theta.GetTransaction

This API returns the transaction being queried in json format.

Parameters

Object NameRequiredTypeDetail
hashβœ…Stringthe transaction hash
"params":[
    {
        "hash":"0xb64148befc19d39cbfee2dbdb1d7cb3991f4653a2acf4f9f4e4a3eddafa27c98"
    }
]

Result

Result Fields

KeyTypeDetail
block_hashStringhash of the block that contains the transaction
block_heightStringheight of the block that contains the transaction
statusStringstatus of the transaction
hashStringthe hash of the transaction itself
typeIntegertype of the transaction (see the Transaction Types note below)
transactionObjectthe details of the transaction
receiptObjectsmart contract Tx execution result
blance_changesObjectaccount balance changes due to smart contract Tx execution

Transaction Types

0: coinbase transaction, for validator/guardian reward
1: slash transaction, for slashing malicious actors
2: send transaction, for sending tokens among accounts
3: reserve fund transaction, for off-chain micropayment
4: release fund transaction, for off-chain micropayment
5: service payment transaction, for off-chain micropayment
6: split rule transaction, for the "split rule" special smart contract
7: smart contract transaction, for general purpose smart contract
8: deposit stake transaction, for depositing stake to validators/guardians
9: withdraw stake transaction, for withdrawing stake from validators/guardians

Example 1

In this example, the transaction being queried is a "send transaction" (i.e., type 2, see the # Transaction Types. . In this transaction, address 0xebdf7c1599c170ad23e31219ef9b13959664376c sent 0 Theta and 1908 TFuel tokens to address 0xb3542c07860f1527f7d460a61e5a3ff57db40872, which cost 300000000000000000 TFuelWei transaction fee

Request

curl <your-endpoint> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"theta.GetTransaction","params":[{"hash":"0xb64148befc19d39cbfee2dbdb1d7cb3991f4653a2acf4f9f4e4a3eddafa27c98"}],"id":1}'

Return

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "block_hash": "0xaec5347e64d835f5393720ae973fa51936085beefd92af3a643969f15601269d",
        "block_height": "19348370",
        "status": "finalized",
        "hash": "0xb64148befc19d39cbfee2dbdb1d7cb3991f4653a2acf4f9f4e4a3eddafa27c98",
        "type": 2,
        "transaction": {
            "fee": {
                "thetawei": "0",
                "tfuelwei": "300000000000000000"
            },
            "inputs": [
                {
                    "address": "0xebdf7c1599c170ad23e31219ef9b13959664376c",
                    "coins": {
                        "thetawei": "0",
                        "tfuelwei": "1908300000000000000000"
                    },
                    "sequence": "272",
                    "signature": "0xb69f2b806acbd9af8e909da98c28a9241d145379645418f41cc4f7a6d0beda6b6a2ab8cb82d9de18510b722e795421299eb686a80757d4cca472db4b96a6fe3e00"
                }
            ],
            "outputs": [
                {
                    "address": "0xb3542c07860f1527f7d460a61e5a3ff57db40872",
                    "coins": {
                        "thetawei": "0",
                        "tfuelwei": "1908000000000000000000"
                    }
                }
            ]
        },
        "receipt": null,
        "blance_changes": null
    }
}

Example 2

Smart contract transactions can be used to send TFuel. For example, if you use Metamask to send TFuel following the steps here, the TFuel is sent through a smart contract transaction. In the transaction details, transaction.from.coins.tfuelwei specifies the amount of TFuel (in Wei) sent to the receiver address (see below for more details). Similar to ETH, some of the smart contract transactions just interact with a smart contract. They may not send any TFUEL to the contract. This is a smart contract transaction that did not send any TFuel. On the other hand, this is a smart contract transaction with a non-zero TFuel value. In this example, the transaction sends 991.98 TFUEL to the receiver address 0x8366537d56cf2b86ca90e9dbc89450207a29f6e3.

The following example show how to query the details of a "smart contract transaction" (i.e., type 7, see the # Transaction Types). This type of transaction is similar to the Ethereum transaction:

  • transaction.from.address is the sender address of the transaction
  • transaction.to.address is the receiver address of the transaction. It can be a regular wallet, or a smart contract address
  • transaction.from.coins.tfuelwei is the amount of TFuel (in unit wei, i.e. 10e-18 TFuel) send to the receiver address. This corresponds to the value field of an Ethereum transaction. In the example below, the sender is sending 250000000000000000000 TFuelWei (i.e. 250 TFuel) to the receiver address.
  • transaction.gas_limit and transaction.gas_price are the the gas limit and gas price of the transaction, similar to the corresponding fields of an Ethereum transaction.
  • transaction.data is an optional field to include arbitrary data, similar to the data field of an Ethereum transaction.
  • receipt is the receipt generated by the transaction, including the event logs, similar to the Ethereum transaction receipt.

πŸ“˜

Note : You can also use theta.GetBlock to retrieve all the transactions in a block. The transaction details in the theta.GetBlock response should also contain the above fields.

Request

curl <your-endpoint> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"theta.GetTransaction","params":[{"hash":"0x68aecdfb86df40b04a01f0f8389a02eeee43655a0c14ca93e868a02b808363ed"}],"id":1}'

Return

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "block_hash": "0x4eab38cde1d1b4dbb94cc45780a483922ca794def74fe0201b1ecdf991fa88ac",
        "block_height": "19337878",
        "status": "finalized",
        "hash": "0x68aecdfb86df40b04a01f0f8389a02eeee43655a0c14ca93e868a02b808363ed",
        "type": 7,
        "transaction": {
            "from": {
                "address": "0x8118469627d11fd5ef66a17d3fb9bcb82da63e98",
                "coins": {
                    "thetawei": "0",
                    "tfuelwei": "991979775386423600000"
                },
                "sequence": "73",
                "signature": "0x157d7b29a8d0dd30920506e354ca4fa2c4c7750bc028b74bfa113a1af3bf0aaf5c357aa5a7b15bf8617fdbd744d283256b652c652d0842bac5f7b3f8c1de888300"
            },
            "to": {
                "address": "0x8366537d56cf2b86ca90e9dbc89450207a29f6e3",
                "coins": {
                    "thetawei": "0",
                    "tfuelwei": "0"
                }
            },
            "gas_limit": "249738",
            "gas_price": "4000000000000",
            "data": "f/NqtQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIzPp1w3j4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAACBGEaWJ9Ef1e9moX0/uby4LaY+mAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYaAd1SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAABNwIsV6g4QuWxBrsIvq5NLoVyYPgAAAAAAAAAAAAAAALl8JNAUyr24dE8ZihaRhJfv/Dbl"
        },
        "receipt": {
            "TxHash": "0x68aecdfb86df40b04a01f0f8389a02eeee43655a0c14ca93e868a02b808363ed",
            "Logs": [
                {
                    "address": "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e",
                    "topics": [
                        "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
                        "0x0000000000000000000000008366537d56cf2b86ca90e9dbc89450207a29f6e3"
                    ],
                    "data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1xnwd+tePI4A="
                },
                {
                    "address": "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e",
                    "topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x0000000000000000000000008366537d56cf2b86ca90e9dbc89450207a29f6e3",
                        "0x000000000000000000000000503d52c7c484aeb09fe23eaf9a4a428c00203efc"
                    ],
                    "data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1xnwd+tePI4A="
                },
                {
                    "address": "0xb97c24d014cabdb8744f198a16918497effc36e5",
                    "topics": [
                        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                        "0x000000000000000000000000503d52c7c484aeb09fe23eaf9a4a428c00203efc",
                        "0x0000000000000000000000008118469627d11fd5ef66a17d3fb9bcb82da63e98"
                    ],
                    "data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjYT2f8vwIGE="
                },
                {
                    "address": "0x503d52c7c484aeb09fe23eaf9a4a428c00203efc",
                    "topics": [
                        "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1"
                    ],
                    "data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAoi+3OPWfyTD/UUAAAAAAAAAAAAAAAAAAAAAAAAAAAAABq/fYVmN8ggy8Q=="
                },
                {
                    "address": "0x503d52c7c484aeb09fe23eaf9a4a428c00203efc",
                    "topics": [
                        "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822",
                        "0x0000000000000000000000008366537d56cf2b86ca90e9dbc89450207a29f6e3",
                        "0x0000000000000000000000008118469627d11fd5ef66a17d3fb9bcb82da63e98"
                    ],
                    "data": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1xnwd+tePI4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjYT2f8vwIGE="
                }
            ],
            "EvmRet": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANcZ8HfrXjyOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjYT2f8vwIGE=",
            "ContractAddress": "0x8366537d56cf2b86ca90e9dbc89450207a29f6e3",
            "GasUsed": 166492,
            "EvmErr": ""
        },
        "blance_changes": {
            "TxHash": "0x68aecdfb86df40b04a01f0f8389a02eeee43655a0c14ca93e868a02b808363ed",
            "BalanceChanges": [
                {
                    "address": "0x8118469627d11fd5ef66a17d3fb9bcb82da63e98",
                    "token_type": 1,
                    "is_negative": true,
                    "delta": 991979775386423600000
                },
                {
                    "address": "0x8366537d56cf2b86ca90e9dbc89450207a29f6e3",
                    "token_type": 1,
                    "is_negative": false,
                    "delta": 991979775386423600000
                },
                {
                    "address": "0x8366537d56cf2b86ca90e9dbc89450207a29f6e3",
                    "token_type": 1,
                    "is_negative": true,
                    "delta": 991979775386423600000
                },
                {
                    "address": "0x4dc08b15ea0e10b96c41aec22fab934ba15c983e",
                    "token_type": 1,
                    "is_negative": false,
                    "delta": 991979775386423600000
                }
            ],
            "EvmRet": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANcZ8HfrXjyOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjYT2f8vwIGE=",
            "ContractAddress": "0x8366537d56cf2b86ca90e9dbc89450207a29f6e3",
            "GasUsed": 166492,
            "EvmErr": ""
        }
    }
}
Language
Click Try It! to start a request and see the response here!