Etherlink — eth
API reference for Etherlink. 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/etherlink_mainnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xf9cc7eca8ec48421df80657bd1bf2c856161a965cacfc23a68e2a9a9fb8545b8"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"transactionHash": "0xf9cc7eca8ec48421df80657bd1bf2c856161a965cacfc23a68e2a9a9fb8545b8",
"transactionIndex": "0x1",
"blockHash": "0x74075370eba6036bef4f0e02f7dd6d3a59adefe26d0c218c1f8960f6a89fd1de",
"blockNumber": "0x143e555",
"from": "0x97f6e5458e83a4dc31020056213d44d0abeff46d",
"to": "0x1f8e735f424b7a49a885571a2fa104e8c13c26c7",
"cumulativeGasUsed": "0x64a9d8",
"effectiveGasPrice": "0x3b9aca00",
"gasUsed": "0x225535",
"logs": [
{
"address": "0x2c03058c8afc06713be23e58d2febc8337dbfe6a",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000097f6e5458e83a4dc31020056213d44d0abeff46d",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
"data": "0x00000000000000000000000000000000000000000000000000000000001e8480",
"blockNumber": "0x143e555",
"transactionHash": "0xf9cc7eca8ec48421df80657bd1bf2c856161a965cacfc23a68e2a9a9fb8545b8",
"transactionIndex": "0x1",
"blockHash": "0x74075370eba6036bef4f0e02f7dd6d3a59adefe26d0c218c1f8960f6a89fd1de",
"logIndex": "0x2",
"removed": false
},
{
"address": "0xcb566e3b6934fa77258d68ea18e931fa75e1aaaa",
"topics": [
"0xdf21c415b78ed2552cc9971249e32a053abce6087a0ae0fbf3f78db5174a3493"
],
"data": "0x00000000000000000000000000000000000000000000000058fdd3accbe2ac2b",
"blockNumber": "0x143e555",
"transactionHash": "0xf9cc7eca8ec48421df80657bd1bf2c856161a965cacfc23a68e2a9a9fb8545b8",
"transactionIndex": "0x1",
"blockHash": "0x74075370eba6036bef4f0e02f7dd6d3a59adefe26d0c218c1f8960f6a89fd1de",
"logIndex": "0x3",
"removed": false
}
],
"logsBloom": "0x00000000000000000000200000000000000040000000000008000000000800000000000000000000000002000000000000000000000000040000000000000000004000000000000000000008000000002000000000800000000000000000000000040000020000004000000000000800020040000000000000000010000000000000000040000000000000000000000000000200280000000000100000000000000000000000020000000000000100000200000000000000000000000000000400003042000008000000008000000000000000000008000001000000000020001000000000000000400000000100020000000000000000000000000000000000",
"type": "0x2",
"status": "0x1",
"contractAddress": null
},
"id": 1
}
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/etherlink_mainnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockHashAndIndex",
"params": ["0x74075370eba6036bef4f0e02f7dd6d3a59adefe26d0c218c1f8960f6a89fd1de", "0x1"],
"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/etherlink_mainnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": ["0x143E555", "0x1"],
"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/etherlink_mainnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x143E555",
"toBlock": "0x143E556"
}
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": [
{
"address": "0x79052ab3c166d4899a1e0dd033ac3b379af0b1fd",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000003ef3d8ba38ebe18db133cec108f4d14ce00dd9ae",
"0x0000000000000000000000007fe17f2f2e3837b94eaa1f4835acbe499403f4cf"
],
"data": "0x000000000000000000000000000000000000000000000000016345785d8a0000",
"blockNumber": "0x143e555",
"transactionHash": "0x5cf0a322447e1f5b1fea4d973ab33fd7feee65e6ad3d251dbc4b458ed286a7ef",
"transactionIndex": "0x0",
"blockHash": "0x74075370eba6036bef4f0e02f7dd6d3a59adefe26d0c218c1f8960f6a89fd1de",
"logIndex": "0x0",
"removed": false
},
{
"address": "0x3ef3d8ba38ebe18db133cec108f4d14ce00dd9ae",
"topics": [
"0xf7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd3992683",
"0x0000000000000000000000007fe17f2f2e3837b94eaa1f4835acbe499403f4cf",
"0x00000000000000000000000079052ab3c166d4899a1e0dd033ac3b379af0b1fd"
],
"data": "0x000000000000000000000000000000000000000000000000016345785d8a0000",
"blockNumber": "0x143e555",
"transactionHash": "0x5cf0a322447e1f5b1fea4d973ab33fd7feee65e6ad3d251dbc4b458ed286a7ef",
"transactionIndex": "0x0",
"blockHash": "0x74075370eba6036bef4f0e02f7dd6d3a59adefe26d0c218c1f8960f6a89fd1de",
"logIndex": "0x1",
"removed": false
}
],
"id": 1
}