Xai
Xai API is available on Web3 API platform (opens in a new tab).
Xai operates as an Arbitrum Orbit chain, harnessing Anytrust technology to achieve maximum speed and minimal costs. Unlike most Orbit chains that are "self-managed," Xai benefits from direct technical support courtesy of Offchain Labs. This support is not available to other orbit chains and is a crucial component of Xai as a strategic gaming initiative within the Arbitrum ecosystem.
In order for your Web3 application to interact with Xai — either by reading blockchain data or sending transactions to the network — it must connect to a Xai node. Developers interact with the blockchain using the methods provided by the API.
The API interaction follows the JSON-RPC (opens in a new tab) which is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in other message-passing environments. It uses JSON (RFC 4627) as data format.
Methods supported
web3_clientVersion
— returns the current client version.web3_sha3
— returns Keccak-256 (not the standardized SHA3-256) of the given data.net_version
— returns the current network ID.eth_syncing
— returns data on the sync status or false.eth_gasPrice
— returns the current price per gas in wei.eth_accounts
— returns a list of addresses owned by client.eth_blockNumber
— returns the number of most recent block.eth_getBalance
— returns the balance of the account specified by address.eth_getStorageAt
— returns the value from a storage position at an address specified.eth_getTransactionCount
— returns the number of transactions sent from an address.eth_getBlockTransactionCountByHash
— returns the number of transactions in a block specified by block hash.eth_getBlockTransactionCountByNumber
— returns the number of transactions in the block specified by number.eth_getUncleCountByBlockHash
— returns the number of uncles in a block specified by block hash.eth_getUncleCountByBlockNumber
— returns the number of uncles in a block specified by block number.eth_getCode
— returns code at an address specified.eth_sendRawTransaction
— creates a new message call transaction or a contract creation for signed transactions.eth_call
— executes a new message call immediately without creating a transaction on the blockchain.eth_estimateGas
— generates and returns an estimate of how much gas is necessary to allow the transaction to complete.eth_getBlockByHash
— returns information for the block specified by block hash.eth_getBlockByNumber
— returns information for the block specified by block number.eth_getTransactionByHash
— returns information on a transaction specified by transaction hash.eth_getTransactionByBlockHashAndIndex
— returns information on a transaction specified by block hash and transaction index position.eth_getTransactionByBlockNumberAndIndex
— returns information on a transaction by block number and transaction index position.eth_getTransactionReceipt
— returns the receipt of a transaction by transaction hash.eth_getUncleByBlockHashAndIndex
— returns information about an uncle of a block by hash and uncle index position.eth_getUncleByBlockNumberAndIndex
— returns information about an uncle of a block by number and uncle index position.eth_getLogs
— returns logs matching the parameters specified.
web3_clientVersion
Returns the current client version.
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): None.
Returns
<string>
: the current client version.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "nitro/v2.3.3-6a1c1a7/linux-amd64/go1.20.14",
"id": 1
}
web3_sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
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): the data to convert into a SHA3 hash.
Returns
<string>
(data): the SHA3 result of the given string.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "web3_sha3",
"params": ["0x68656c6c6f20776f726c64"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}
net_version
Returns the current network ID.
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): None.
Returns
<string>
: the current network ID.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "660279"
}
eth_syncing
Returns an object with data about the sync status or false.
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): None.
Returns
<object>
|<boolean>
: an object with sync status data orfalse
, when not syncing:startingBlock
(quantity): the block at which the import started (will only be reset, after the sync reached its head).currentBlock
(quantity): the current block, same aseth_blockNumber
.highestBlock
(quantity): the estimated highest block.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}'
Response example (syncing)
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"startingBlock": "0x384",
"currentBlock": "0x386",
"highestBlock": "0x454"
}
}
Response example (not syncing)
{
"jsonrpc": "2.0",
"id": 1,
"result": false
}
eth_gasPrice
Returns the current price per gas in wei.
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): None.
Returns
<string>
(quantity): the current gas price in wei.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5f5e100"
}
eth_accounts
Returns a list of addresses owned by client.
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): None.
Returns
<array>
(string; data, 20 bytes): addresses owned by the client.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": []
}
eth_blockNumber
Returns the number of most recent block.
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): None.
Returns
<string>
(quantity): the current block number the client is on.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5f20f3"
}
eth_getBalance
Returns the balance of the account specified by address.
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, 20 bytes): an address to check for balance.<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the current balance in wei.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x261a7acefed3b8e6f3f81d08bf60d1a0c853c3f6", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xab588c5740"
}
eth_getStorageAt
Returns the value from a storage position at an address specified.
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, 20 bytes): an address of the storage (hex encoded). -
<string>
(quantity): a slot position in the storage (hex encoded unsigned integer). -
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(data): the value at this storage position.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": ["0x2f318C334780961FB129D2a6c30D0763d9a5C970", "0x0", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
eth_getTransactionCount
Returns the number of transactions sent from an address.
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, 20 bytes): an address. -
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(quantity): the number of transactions send from this address.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0xA4b000000000000000000073657175656e636572", "0x400058"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
eth_getBlockTransactionCountByHash
Returns the number of transactions in a block specified by block hash.
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 block hash.
Returns
<string>
(quantity): the number of transactions in this block.
Request example:
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0xcf4d0158f20872ec5851fbe1676019f7d630d25ed7a09f9b020b98bd6ab20186"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x2"
}
eth_getBlockTransactionCountByNumber
Returns the number of transactions in the block specified by number.
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): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the number of transactions in this block.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x400058"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x2"
}
eth_getUncleCountByBlockHash
Returns the number of uncles in a block specified by block hash.
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 block hash.
Returns
<string>
(quantity): the number of uncles in this block.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleCountByBlockHash",
"params": ["0xcf4d0158f20872ec5851fbe1676019f7d630d25ed7a09f9b020b98bd6ab20186"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
eth_getUncleCountByBlockNumber
Returns the number of uncles in a block specified by block number.
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): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the number of uncles in this block.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleCountByBlockNumber",
"params": ["0x400058"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0"
}
eth_getCode
Returns code at a given address.
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, 20 bytes): an address to get the code from.<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(data): the code from the given address.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0x2f318C334780961FB129D2a6c30D0763d9a5C970", "0x400058"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}
eth_sendRawTransaction
Creates new message call transaction or a contract creation for signed 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): the signed transaction data.
Returns
<string>
(data, 32 bytes): the transaction hash, or the zero hash if the transaction is not yet available.
Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["signed_transaction_data"],
"id": 1
}'
eth_call
Executes a new message call immediately without creating a transaction on the blockchain.
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>
(hex encoded): the transaction object:from
(string; data, 20 bytes; optional): the address the transaction is sent from.to
(string; data, 20 bytes): the address the transaction is directed to.gas
(string; quantity; optional): the gas provided for the transaction execution.eth_call
consumes zero gas, but this parameter may be needed by some executions.gasPrice
(string; quantity; optional): the gas price willing to be paid by the sender in wei.value
(string; quantity; optional): the value sent with this transaction, in wei.data
(string; data; optional): the hash of the method signature and encoded parameters.
-
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(hex encoded bytes): the return value of executed contract.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970",
"data": "0x70a082310000000000000000000000007cB57B5A97eAbe94205C07890BE4c1D51F80F8a5"
}, "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}
eth_estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
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>
(hex encoded): the transaction object:from
(string; data, 20 bytes; optional): the address the transaction is sent from.to
(string; data, 20 bytes; optional): the address the transaction is directed to.gas
(string; quantity; optional): the gas provided for the transaction execution.eth_call
consumes zero gas, but this parameter may be needed by some executions.gasPrice
(string; quantity; optional): the gas price willing to be paid by the sender in wei.value
(string; quantity; optional): the value sent with this transaction, in wei.data
(string; data; optional): the hash of the method signature and encoded parameters.
-
<string>
(quantity|tag; optional): either a HEX value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(quantity): the amount of gas used.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [
{
"from": null,
"to": "0x6b175474e89094c44da98b954eedeac495271d0f",
"data": "0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"
},
"latest"
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x53c9"
}
eth_getBlockByHash
Returns information for the block specified by block hash.
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 block hash.<boolean>
: iftrue
it returns the full transaction objects, iffalse
— only the hashes of the transactions.
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/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0xcf4d0158f20872ec5851fbe1676019f7d630d25ed7a09f9b020b98bd6ab20186", false],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"baseFeePerGas": "0x5f5e100",
"difficulty": "0x1",
"extraData": "0xaa55d4025e441de59a39d7d3d2dac5fd5ac8938cbcb07f24339796db5682a8e1",
"gasLimit": "0x4000000000000",
"gasUsed": "0xd0a6",
"hash": "0xcf4d0158f20872ec5851fbe1676019f7d630d25ed7a09f9b020b98bd6ab20186",
"l1BlockNumber": "0x12b29aa",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000080000000000000000000100000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xa4b000000000000000000073657175656e636572",
"mixHash": "0x000000000000038600000000012b29aa000000000000000b0000000000000000",
"nonce": "0x00000000000039a4",
"number": "0x3ff718",
"parentHash": "0xc640a3a8b946f08965e7c125aec457cd7e2905527f5b59819e249b96e753d874",
"receiptsRoot": "0xeb2f05e73fa4889bf6e2e753f574e10d7fc71e606be490cbf7a545b85105c9f1",
"sendCount": "0x386",
"sendRoot": "0xaa55d4025e441de59a39d7d3d2dac5fd5ac8938cbcb07f24339796db5682a8e1",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x44d",
"stateRoot": "0x1580f815e9aa77771024bf93cc3db9439033220c86e8fa3aed354c6063d68ee1",
"timestamp": "0x6612f583",
"totalDifficulty": "0x3ff719",
"transactions": [
"0x0a351df10b5e28c21a5f78946530d2bac586fece6def1b294a2e35f17f0244b4",
"0xaa0026df8df2b26fe27ceb40fa69311b7fed829f587bbd4076a7897336a19d9d"
],
"transactionsRoot": "0x7e1457eafc48baccccf063835c9df250cd9e215b89718d669eb70374406c1585",
"uncles": []
}
}
eth_getBlockByNumber
Returns information for the block specified by block number.
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): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<boolean>
: iftrue
it returns the full transaction objects, iffalse
— only the hashes of the transactions.
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/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["0x400058", false],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"baseFeePerGas": "0x5f5e100",
"difficulty": "0x1",
"extraData": "0xaa55d4025e441de59a39d7d3d2dac5fd5ac8938cbcb07f24339796db5682a8e1",
"gasLimit": "0x4000000000000",
"gasUsed": "0xd0a4",
"hash": "0x5378dc646fd7bdb48b9032252b1206e0112815356a1b7287bfbbe8e78c860c11",
"l1BlockNumber": "0x12b2a82",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000080000000000000000000100000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xa4b000000000000000000073657175656e636572",
"mixHash": "0x000000000000038600000000012b2a82000000000000000b0000000000000000",
"nonce": "0x00000000000039a7",
"number": "0x400058",
"parentHash": "0x702dc9f21f76d1bd96929dea907edd4768de77113d1838d7acb7521a499a125e",
"receiptsRoot": "0x94c3c053e7e7f1f0888957d9c9a7c4236962a1f4c5c2a8440aea7204d8fe010e",
"sendCount": "0x386",
"sendRoot": "0xaa55d4025e441de59a39d7d3d2dac5fd5ac8938cbcb07f24339796db5682a8e1",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x44d",
"stateRoot": "0xa07443c552f914c72817d4a130916ba3aa4d3791299420748b92ffd32c026565",
"timestamp": "0x6612ffd4",
"totalDifficulty": "0x400059",
"transactions": [
"0x14280c773783b86df783663b640fd83d257fd63ac9e991b9739feb8c33055609",
"0xeaf34ebcca662f529bcdcee3e4f4f6cd91a3d471b88f9dab0818a3e5d0599256"
],
"transactionsRoot": "0x78417b25cdf0f498f759bb4eeaf5cc8b2f28aab02daa2d2cfe973852db813290",
"uncles": []
}
}
eth_getTransactionByHash
Returns information on a transaction specified by transaction hash.
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 transaction hash.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0xa98bf9be2a7f8f88ee46f738d3f27f5f50cde686322616c461e9300cc909ad22"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x4633726357538ef4d0840a589e7dc7207702e65f7ebd855a7ce0fbb332693bb5",
"blockNumber": "0x5f2338",
"from": "0x3bdcdb2610d2f2d4f8e7bf71c830cb8493216e6b",
"gas": "0x26370",
"gasPrice": "0x5f5e100",
"maxFeePerGas": "0xbebc200",
"maxPriorityFeePerGas": "0x0",
"hash": "0xa98bf9be2a7f8f88ee46f738d3f27f5f50cde686322616c461e9300cc909ad22",
"input": "0x3804df03000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000cc42023103307866663063636633393561343862643363366139396639346135346330666234383039336431623934033078383835363866326162326239356338653538653162383539626365623736323563653663613831663663653535346431313735363936393432386330383062373363363262316636356434353639373338613036623735353038616632306263373030336330343938323930323538613633353166316137656533346535313331620340667c3530307c35303003313731353836383730333637330000000000000000000000000000000000000000",
"nonce": "0x255c0b",
"to": "0xf7cd914bd083ba44025300911be54b2db670f41d",
"transactionIndex": "0x1",
"value": "0x2540be400",
"type": "0x2",
"accessList": [],
"chainId": "0xa1337",
"v": "0x0",
"r": "0x64b1459cef2b064f66f739ae05dc4976e3e391216932b9bcfe9781c141e1c2e6",
"s": "0x6289d05793846a80ede6eaa17403b6309610bb8432df587b25db96d21f76fa8e",
"yParity": "0x0"
}
}
eth_getTransactionByBlockHashAndIndex
Returns information on a transaction specified by block hash and transaction 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): a block hash.<string>
(quantity): a transaction index position.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": ["0xcf4d0158f20872ec5851fbe1676019f7d630d25ed7a09f9b020b98bd6ab20186", "0x0"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xcf4d0158f20872ec5851fbe1676019f7d630d25ed7a09f9b020b98bd6ab20186",
"blockNumber": "0x3ff718",
"from": "0x00000000000000000000000000000000000a4b05",
"gas": "0x0",
"gasPrice": "0x0",
"hash": "0x0a351df10b5e28c21a5f78946530d2bac586fece6def1b294a2e35f17f0244b4",
"input": "0x6bf6a42d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012b29aa00000000000000000000000000000000000000000000000000000000003ff7180000000000000000000000000000000000000000000000000000000000000002",
"nonce": "0x0",
"to": "0x00000000000000000000000000000000000a4b05",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x6a",
"chainId": "0xa1337",
"v": "0x0",
"r": "0x0",
"s": "0x0"
}
}
eth_getTransactionByBlockNumberAndIndex
Returns information on a transaction by block number and transaction 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): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<string>
(quantity): the transaction index position.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": ["0x400058", "0x0"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x5378dc646fd7bdb48b9032252b1206e0112815356a1b7287bfbbe8e78c860c11",
"blockNumber": "0x400058",
"from": "0x00000000000000000000000000000000000a4b05",
"gas": "0x0",
"gasPrice": "0x0",
"hash": "0x14280c773783b86df783663b640fd83d257fd63ac9e991b9739feb8c33055609",
"input": "0x6bf6a42d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012b2a8200000000000000000000000000000000000000000000000000000000004000580000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0",
"to": "0x00000000000000000000000000000000000a4b05",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x6a",
"chainId": "0xa1337",
"v": "0x0",
"r": "0x0",
"s": "0x0"
}
}
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,0x00
for legacy transactions,0x01
for access list types,0x02
for 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/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xa98bf9be2a7f8f88ee46f738d3f27f5f50cde686322616c461e9300cc909ad22"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x4633726357538ef4d0840a589e7dc7207702e65f7ebd855a7ce0fbb332693bb5",
"blockNumber": "0x5f2338",
"contractAddress": null,
"cumulativeGasUsed": "0x7b3c",
"effectiveGasPrice": "0x5f5e100",
"from": "0x3bdcdb2610d2f2d4f8e7bf71c830cb8493216e6b",
"gasUsed": "0x7b3c",
"gasUsedForL1": "0x24",
"l1BlockNumber": "0x12f6427",
"logs": [
{
"address": "0xf7cd914bd083ba44025300911be54b2db670f41d",
"topics": [
"0xffa7cf79b6173c04d5ec2b41bce25acc6e48f9cf86349011288bab7da23fc517",
"0x0000000000000000000000003bdcdb2610d2f2d4f8e7bf71c830cb8493216e6b"
],
"data": "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000002540be40000000000000000000000000000000000000000000000000000000000000000cc42023103307866663063636633393561343862643363366139396639346135346330666234383039336431623934033078383835363866326162326239356338653538653162383539626365623736323563653663613831663663653535346431313735363936393432386330383062373363363262316636356434353639373338613036623735353038616632306263373030336330343938323930323538613633353166316137656533346535313331620340667c3530307c35303003313731353836383730333637330000000000000000000000000000000000000000",
"blockNumber": "0x5f2338",
"transactionHash": "0xa98bf9be2a7f8f88ee46f738d3f27f5f50cde686322616c461e9300cc909ad22",
"transactionIndex": "0x1",
"blockHash": "0x4633726357538ef4d0840a589e7dc7207702e65f7ebd855a7ce0fbb332693bb5",
"logIndex": "0x0",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000002000100000000000000000000000000000000000000000000000000800000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000040000000000080000000000000000000000000000000000000",
"status": "0x1",
"to": "0xf7cd914bd083ba44025300911be54b2db670f41d",
"transactionHash": "0xa98bf9be2a7f8f88ee46f738d3f27f5f50cde686322616c461e9300cc909ad22",
"transactionIndex": "0x1",
"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/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockHashAndIndex",
"params": ["0x2549ca537e118d5e4adf5192143a5794d9eb5d697d1c908ec19a40b7c2ef15e9", "0x0"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"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): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<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/xai \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getUncleByBlockNumberAndIndex",
"params": ["latest", "0x0"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"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. -
-
-