import cobo_waas2
from cobo_waas2.models.transaction_receipt import TransactionReceipt
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.TransactionsApi(api_client)
chain_id = "ETH"
tx_hash = "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
try:
# Get transaction receipt
api_response = api_instance.get_transaction_receipt(chain_id, tx_hash)
print("The response of TransactionsApi->get_transaction_receipt:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling TransactionsApi->get_transaction_receipt: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.TransactionsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
TransactionsApi apiInstance = new TransactionsApi();
String chainId = "ETH";
String txHash = "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28";
try {
TransactionReceipt result = apiInstance.getTransactionReceipt(chainId, txHash);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#getTransactionReceipt");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
chainId := "ETH"
txHash := "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.TransactionsAPI.GetTransactionReceipt(ctx, chainId, txHash).Execute()
if err != nil {
fmt.Fprintf(
os.Stderr,
"Error when calling `TransactionsAPI.GetTransactionReceipt``: %v\n",
err,
)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetTransactionReceipt`: TransactionReceipt
fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionReceipt`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.TransactionsApi();
const chain_id = "ETH";
const tx_hash =
"0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28";
apiInstance.getTransactionReceipt(chain_id, tx_hash).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"chain_id": "ETH",
"transaction_hash": "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28",
"status": 1,
"block_number": 20123456,
"block_hash": "0xc9ee947f8bb6027c161888bf0d004bec05e7c2beec7e6b187dc512174e438735",
"transaction_index": 42,
"from_address": "0x1234567890abcdef1234567890abcdef12345678",
"gas_used": "21000",
"logs": [
{
"log_index": 5,
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
],
"data": "0x00000000000000000000000000000000000000000000000000000000000f4240",
"block_number": 20123456,
"block_hash": "0xc9ee947f8bb6027c161888bf0d004bec05e7c2beec7e6b187dc512174e438735",
"transaction_hash": "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28",
"transaction_index": 42,
"removed": false
}
],
"logs_truncated": false,
"to_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"contract_address": "0xabcdef1234567890abcdef1234567890abcdef12",
"cumulative_gas_used": "8000000",
"effective_gas_price": "25000000000",
"evm_transaction_type": 2,
"logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}Get transaction receipt
This operation retrieves the receipt of a specified transaction on a specified EVM-compatible chain, which records the execution result of the transaction, including its status, block information, gas consumption, and the event logs emitted during execution.
You need to specify the chain ID and the transaction hash. The chain ID can be retrieved by calling List enabled chains, and the transaction hash can be retrieved by calling Get transaction information.
The receipt is read from a blockchain node in real time and is returned as it is recorded on the chain. The event logs are returned in their raw form and are not filtered, so you need to decode them with the contract ABI yourself.
ETH (Ethereum mainnet) and SETH (Ethereum Sepolia testnet) only. Requests for any other chain are rejected.import cobo_waas2
from cobo_waas2.models.transaction_receipt import TransactionReceipt
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.TransactionsApi(api_client)
chain_id = "ETH"
tx_hash = "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
try:
# Get transaction receipt
api_response = api_instance.get_transaction_receipt(chain_id, tx_hash)
print("The response of TransactionsApi->get_transaction_receipt:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling TransactionsApi->get_transaction_receipt: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.TransactionsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
TransactionsApi apiInstance = new TransactionsApi();
String chainId = "ETH";
String txHash = "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28";
try {
TransactionReceipt result = apiInstance.getTransactionReceipt(chainId, txHash);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#getTransactionReceipt");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
chainId := "ETH"
txHash := "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.TransactionsAPI.GetTransactionReceipt(ctx, chainId, txHash).Execute()
if err != nil {
fmt.Fprintf(
os.Stderr,
"Error when calling `TransactionsAPI.GetTransactionReceipt``: %v\n",
err,
)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetTransactionReceipt`: TransactionReceipt
fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionReceipt`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.TransactionsApi();
const chain_id = "ETH";
const tx_hash =
"0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28";
apiInstance.getTransactionReceipt(chain_id, tx_hash).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
{
"chain_id": "ETH",
"transaction_hash": "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28",
"status": 1,
"block_number": 20123456,
"block_hash": "0xc9ee947f8bb6027c161888bf0d004bec05e7c2beec7e6b187dc512174e438735",
"transaction_index": 42,
"from_address": "0x1234567890abcdef1234567890abcdef12345678",
"gas_used": "21000",
"logs": [
{
"log_index": 5,
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
],
"data": "0x00000000000000000000000000000000000000000000000000000000000f4240",
"block_number": 20123456,
"block_hash": "0xc9ee947f8bb6027c161888bf0d004bec05e7c2beec7e6b187dc512174e438735",
"transaction_hash": "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28",
"transaction_index": 42,
"removed": false
}
],
"logs_truncated": false,
"to_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"contract_address": "0xabcdef1234567890abcdef1234567890abcdef12",
"cumulative_gas_used": "8000000",
"effective_gas_price": "25000000000",
"evm_transaction_type": 2,
"logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}{
"error_code": 123,
"error_message": "<string>",
"error_id": "0b6ddf19083c4bd1a9ca01bec44b24dd"
}import cobo_waas2
from cobo_waas2.models.transaction_receipt import TransactionReceipt
from cobo_waas2.rest import ApiException
from pprint import pprint
# See configuration.py for a list of all supported configurations.
configuration = cobo_waas2.Configuration(
# Replace `<YOUR_PRIVATE_KEY>` with your private key
api_private_key="<YOUR_PRIVATE_KEY>",
# Select the development environment. To use the production environment, change the URL to https://api.cobo.com/v2.
host="https://api.dev.cobo.com/v2",
)
# Enter a context with an instance of the API client
with cobo_waas2.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = cobo_waas2.TransactionsApi(api_client)
chain_id = "ETH"
tx_hash = "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
try:
# Get transaction receipt
api_response = api_instance.get_transaction_receipt(chain_id, tx_hash)
print("The response of TransactionsApi->get_transaction_receipt:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling TransactionsApi->get_transaction_receipt: %s\n" % e)
// Import classes:
import com.cobo.waas2.ApiClient;
import com.cobo.waas2.ApiException;
import com.cobo.waas2.Configuration;
import com.cobo.waas2.Env;
import com.cobo.waas2.api.TransactionsApi;
import com.cobo.waas2.model.*;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Select the development environment. To use the production environment, replace `Env.DEV` with
// `Env.PROD
defaultClient.setEnv(Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
defaultClient.setPrivKey("<YOUR_PRIVATE_KEY>");
TransactionsApi apiInstance = new TransactionsApi();
String chainId = "ETH";
String txHash = "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28";
try {
TransactionReceipt result = apiInstance.getTransactionReceipt(chainId, txHash);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#getTransactionReceipt");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
package main
import (
"context"
"fmt"
coboWaas2 "github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2"
"github.com/CoboGlobal/cobo-waas2-go-sdk/cobo_waas2/crypto"
"os"
)
func main() {
chainId := "ETH"
txHash := "0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
configuration := coboWaas2.NewConfiguration()
// Initialize the API client
apiClient := coboWaas2.NewAPIClient(configuration)
ctx := context.Background()
// Select the development environment. To use the production environment, replace coboWaas2.DevEnv with coboWaas2.ProdEnv
ctx = context.WithValue(ctx, coboWaas2.ContextEnv, coboWaas2.DevEnv)
// Replace `<YOUR_PRIVATE_KEY>` with your private key
ctx = context.WithValue(ctx, coboWaas2.ContextPortalSigner, crypto.Ed25519Signer{
Secret: "<YOUR_PRIVATE_KEY>",
})
resp, r, err := apiClient.TransactionsAPI.GetTransactionReceipt(ctx, chainId, txHash).Execute()
if err != nil {
fmt.Fprintf(
os.Stderr,
"Error when calling `TransactionsAPI.GetTransactionReceipt``: %v\n",
err,
)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetTransactionReceipt`: TransactionReceipt
fmt.Fprintf(os.Stdout, "Response from `TransactionsAPI.GetTransactionReceipt`: %v\n", resp)
}
const CoboWaas2 = require("@cobo/cobo-waas2");
// Initialize the API client
const apiClient = CoboWaas2.ApiClient.instance;
// Select the development environment. To use the production environment, replace `Env.DEV` with `Env.PROD`
apiClient.setEnv(CoboWaas2.Env.DEV);
// Replace `<YOUR_PRIVATE_KEY>` with your private key
apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");
// Call the API
const apiInstance = new CoboWaas2.TransactionsApi();
const chain_id = "ETH";
const tx_hash =
"0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28";
apiInstance.getTransactionReceipt(chain_id, tx_hash).then(
(data) => {
console.log("API called successfully. Returned data: " + data);
},
(error) => {
console.error(error);
},
);
Authorizations
The API key. For more details, refer to API key.
In the API playground, enter your API secret, and your API key will be accordingly calculated.
Path Parameters
The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling List enabled chains.
This operation currently supports the following chains only:
ETH: Ethereum mainnet.SETH: Ethereum Sepolia testnet.
The transaction hash, which is the unique identifier of a transaction on the blockchain. You can retrieve the transaction hash of a transaction by calling Get transaction information.
You need to specify the hash with the 0x prefix.
Response
The information about a transaction receipt.
The information about a transaction receipt, which records the execution result of a transaction that has been included in a block.
All the numeric properties are returned as decimal values instead of the hexadecimal values used by the JSON-RPC interfaces of the chains. The properties that record on-chain amounts are returned as strings to avoid any precision loss.
The chain ID, which is the unique identifier of a blockchain. You can retrieve the IDs of all the chains you can use by calling List enabled chains.
"ETH"
The transaction hash, returned with the 0x prefix.
"0x239861be9a4afe080c359b7fe4a1d035945ec46256b1a0f44d1267c71de8ec28"
The execution result of the transaction.
1: The transaction was executed successfully.0: The transaction failed, for example, because it was reverted by the contract or ran out of gas.
1
The number of the block that contains the transaction.
20123456
The hash of the block that contains the transaction.
"0xc9ee947f8bb6027c161888bf0d004bec05e7c2beec7e6b187dc512174e438735"
The index position of the transaction within the block.
42
The address that sent the transaction.
"0x1234567890abcdef1234567890abcdef12345678"
The number of gas units consumed by the transaction.
"21000"
The event logs emitted during the execution of the transaction, in the order in which they were emitted. The array is empty if the transaction emitted no logs. A maximum of 1,000 logs are returned. If the transaction emitted more logs, only the first 1,000 are returned and logs_truncated is true.
Show child attributes
Show child attributes
Whether the event logs returned in logs were truncated.
true: The transaction emitted more than 1,000 logs and only the first 1,000 are returned.false: All the logs emitted by the transaction are returned.
false
The address that received the transaction. The value is null if the transaction created a contract.
"0xdac17f958d2ee523a2206206994597c13d831ec7"
The address of the contract created by the transaction. The value is null if the transaction did not create a contract.
"0xabcdef1234567890abcdef1234567890abcdef12"
The total number of gas units consumed by all the transactions up to and including this transaction in the block.
"8000000"
The gas price actually paid for each gas unit consumed by the transaction, in the smallest unit of the chain's native token. For example, the value is in wei for Ethereum.
"25000000000"
The transaction envelope type defined by the chain. This property describes the on-chain transaction format, not the Cobo transaction type returned by Get transaction information.
0: A legacy transaction.1: An access list transaction, as defined in EIP-2930.2: A dynamic fee transaction, as defined in EIP-1559.
2
The bloom filter of the event logs emitted during the execution of the transaction, which can be used to quickly check whether the transaction emitted a specific log. The value is a 256-byte hexadecimal string.
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
Was this page helpful?
