TAC — Methods (3/3)
API reference for TAC. All methods ->
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
The receipt is not available for pending transactions.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(data, 32 bytes): a hash of the transaction.
Returns
-
object: a transaction receipt object, or null when no receipt was found:-
transactionHash(string; data, 32 bytes): a hash of the transaction. -
transactionIndex(string; quantity): the transactions index position in the block. -
blockHash(string; data, 32 bytes): a hash of the block containing the transaction. -
blockNumber(string; quantity): a number of the block containing the transaction. -
from(string; data, 20 bytes): an address of the sender. -
to(string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction. -
cumulativeGasUsed(string; quantity): the total amount of gas used when this transaction was executed in the block. -
effectiveGasPrice(string; quantity): the sum of the base fee and tip paid per unit of gas. -
gasUsed(string; quantity): the amount of gas used by this specific transaction alone. -
contractAddress(string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null. -
logs(array): an array of log objects, which this transaction generated. -
logsBloom(string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs. -
type(string; data): the transaction type,0x00for legacy transactions,0x01for access list types,0x02for dynamic fees. It also returns either of the following:root(string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).status(string; quantity): either 1 (success) or 0 (failure).
-
Request example
curl -X POST https://rpc.ankr.com/tac_turin/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xcace281fc1bc8b74c592ae75ffcc3f9ed183e9870975ad4b54d130874723c50d"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xa8abafe47677b586ef2712bb4c05b97eb8cb6e0dce471938f6990ad75cbda000",
"blockNumber": "0x1fc2ad",
"contractAddress": null,
"cumulativeGasUsed": "0x11505",
"effectiveGasPrice": "0x1",
"from": "0x440e079445aa9586bf99971d5f57bf09e2b9a403",
"gasUsed": "0x11505",
"logs": [
{
"address": "0xd3a8d44b889de02703df8b33c53e93315a33b06f",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000092101c6f576871e4e0a5d7bbc3a2d0a8973aea16"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0x1fc2ad",
"transactionHash": "0xcace281fc1bc8b74c592ae75ffcc3f9ed183e9870975ad4b54d130874723c50d",
"transactionIndex": "0x0",
"blockHash": "0xa8abafe47677b586ef2712bb4c05b97eb8cb6e0dce471938f6990ad75cbda000",
"logIndex": "0x0",
"removed": false
}
],
"logsBloom": "0x00000000000000000000200020000000000000000000000000000000008000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000002000000008000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0xd3a8d44b889de02703df8b33c53e93315a33b06f",
"transactionHash": "0xcace281fc1bc8b74c592ae75ffcc3f9ed183e9870975ad4b54d130874723c50d",
"transactionIndex": "0x0",
"type": "0x2"
}
}
eth_getUncleByBlockHashAndIndex
Returns information about an uncle of a block by hash and uncle index position.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(data, 32 bytes): the hash of a block.<string>(quantity): the uncle's index position.
Returns
<object>: a block object, or null when no block was found:number(string; quantity): the block number; null when it's a pending block.hash(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash(string; data, 32 bytes): the hash of the parent block.nonce(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot(string; data, 32 bytes): the root of the receipts trie of the block.miner(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty(string; quantity): the difficulty for this block.totalDifficulty(string; quantity): the total difficulty of the chain until this block.extraData(string; data): the extra data field of this block.size(string; quantity): the size of this block in bytes.gasLimit(string; quantity): the maximum gas allowed in this block.gasUsed(string; quantity): the total used gas by all transactions in this block.timestamp(string; quantity): the unix timestamp for when the block was collated.transactions(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/tac_turin/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockHashAndIndex",
"params": ["0xa8abafe47677b586ef2712bb4c05b97eb8cb6e0dce471938f6990ad75cbda000", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
eth_getUncleByBlockNumberAndIndex
Returns information about an uncle of a block by number and uncle index position.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(quantity|tag): the hex value of a block number.<string>(quantity): the uncle's index position.
Returns
<object>: a block object, or null when no block was found:number(string; quantity): the block number; null when it's a pending block.hash(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash(string; data, 32 bytes): the hash of the parent block.nonce(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot(string; data, 32 bytes): the root of the receipts trie of the block.miner(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty(string; quantity): the difficulty for this block.totalDifficulty(string; quantity): the total difficulty of the chain until this block.extraData(string; data): the extra data field of this block.size(string; quantity): the size of this block in bytes.gasLimit(string; quantity): the maximum gas allowed in this block.gasUsed(string; quantity): the total used gas by all transactions in this block.timestamp(string; quantity): the unix timestamp for when the block was collated.transactions(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/tac_turin/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": ["0x1FC2AD", "0x0"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": null
}
eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):-
object: the filter options:-
fromBlock(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest: for the last mined block.earliest: for the lowest numbered block available on the client.pending: for not yet mined transactions.
-
toBlock(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest: for the last mined block.earliest: for the lowest numbered block available on the client.pending: for not yet mined transactions.
-
address(array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate. -
topics(array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options. -
blockhash(string; data, 32 bytes; optional; future): with the addition of EIP-234,blockHashwill be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent tofromBlock = toBlock = the blocknumber with hash blockHash. IfblockHashis present in the filter criteria, then neitherfromBlocknortoBlockare allowed.
-
-
Returns
removed(string; tag):truewhen the log was removed, due to a chain reorganization;falseif it's a valid log.logIndex(string; quantity): the log index position in the block; null when it's a pending log.transactionIndex(string; quantity): the transactions index position log was created from; null when it's a pending log.transactionHash(string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.blockHash(string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.blockNumber(string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.address(string; data, 20 bytes): an address from which this log originated.data(string; data): contains one or more 32 bytes non-indexed arguments of the log.topics(array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Request example
curl -X POST https://rpc.ankr.com/tac_turin/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x1FC2AD",
"toBlock": "0x1FC2AE"
}
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0xd3a8d44b889de02703df8b33c53e93315a33b06f",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000092101c6f576871e4e0a5d7bbc3a2d0a8973aea16"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0x1fc2ad",
"transactionHash": "0xcace281fc1bc8b74c592ae75ffcc3f9ed183e9870975ad4b54d130874723c50d",
"transactionIndex": "0x0",
"blockHash": "0xa8abafe47677b586ef2712bb4c05b97eb8cb6e0dce471938f6990ad75cbda000",
"logIndex": "0x0",
"removed": false
},
{
"address": "0xb7615849ab30b5f7050a6dc8de00790bc04616dd",
"topics": [
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff",
"0x16530117695f4cc7aedafb7d3b53b920e74adabab37cbdf6a0bf9af873f9bc5b",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x16530117695f4cc7aedafb7d3b53b920e74adabab37cbdf6a0bf9af873f9bc5b"
],
"data": "0x",
"blockNumber": "0x1fc2ad",
"transactionHash": "0x81ad9fffa1c42f01132aebae506b55f4a3e12c59e53b15a2226012cb39e365d6",
"transactionIndex": "0x1",
"blockHash": "0xa8abafe47677b586ef2712bb4c05b97eb8cb6e0dce471938f6990ad75cbda000",
"logIndex": "0x1",
"removed": false
},
{
"address": "0xb7615849ab30b5f7050a6dc8de00790bc04616dd",
"topics": [
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d",
"0x16530117695f4cc7aedafb7d3b53b920e74adabab37cbdf6a0bf9af873f9bc5b",
"0x000000000000000000000000440e079445aa9586bf99971d5f57bf09e2b9a403",
"0x000000000000000000000000440e079445aa9586bf99971d5f57bf09e2b9a403"
],
"data": "0x",
"blockNumber": "0x1fc2ad",
"transactionHash": "0x81ad9fffa1c42f01132aebae506b55f4a3e12c59e53b15a2226012cb39e365d6",
"transactionIndex": "0x1",
"blockHash": "0xa8abafe47677b586ef2712bb4c05b97eb8cb6e0dce471938f6990ad75cbda000",
"logIndex": "0x2",
"removed": false
}
]
}