For compatibility with Parity, please prefix all hex strings with " 0x ".
eth_blockNumber
Returns the number of most recent block
https://api.xaiscan.io/api
?module=proxy
&action=eth_blockNumber
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Sample response
{
"jsonrpc":"2.0",
"result":"0x169ca7b",
"id":83
}
eth_getBlockByNumber
Returns information about a block by block number.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getBlockByNumber
&tag=0x52B06
&boolean=true
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the block number, in hex eg. 0xC36B3C |
| the boolean value to show full transaction objects. when true , returns full transaction objects and their information, when false only returns a list of transactions. |
Sample response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"baseFeePerGas": "0x5f5e100",
"difficulty": "0x1",
"extraData": "0xc5f837f1244a4cc6874451614d385aa0dca89737da6db614622efe8939ee72c1",
"gasLimit": "0x4000000000000",
"gasUsed": "0x11f00",
"hash": "0xc278e7b6134a7f206cbf70f90b8610855e9652a1374aa238cdf9a79fb80f279e",
"l1BlockNumber": "0x1243fa8",
"logsBloom": "0x00000000000000000000000400000000000000000000000000000000040000100000000000000000000000000000000000000000000000000000000000000000000000000000000040000008000000000000000000000000000000000000000000000000020000000100200000000a00004000000000000000020010000000000000000004000000000000000000000000000000000000000000000000000000000400000000000000000000000000080000000000000000000000000000000000000002000000000000040000000002000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xa4b000000000000000000073657175656e636572",
"mixHash": "0x00000000000001740000000001243fa8000000000000000b0000000000000000",
"nonce": "0x0000000000001062",
"number": "0x52b06",
"parentHash": "0x3d96d6632e79709fa411d0e21af8c6402640dd16f2a4cc08e74362b0fb04e8a7",
"receiptsRoot": "0x0e2484689904ffaaea9ce23c64c2eb7c9754c8defeb1b988169be7cb032e8628",
"sendCount": "0x174",
"sendRoot": "0xc5f837f1244a4cc6874451614d385aa0dca89737da6db614622efe8939ee72c1",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x355",
"stateRoot": "0xe535d9d5ad9315b09e2ff42e6912d2c699cf53e36697e2582afd0226407f01b0",
"timestamp": "0x65bf1d5a",
"totalDifficulty": "0x52b07",
"transactions": [
{
"blockHash": "0xc278e7b6134a7f206cbf70f90b8610855e9652a1374aa238cdf9a79fb80f279e",
"blockNumber": "0x52b06",
"from": "0x00000000000000000000000000000000000a4b05",
"gas": "0x0",
"gasPrice": "0x0",
"hash": "0x8257bae2ce936c0c1df8383490dee74289cdf78f0b1588f46456e3b939eaa224",
"input": "0x6bf6a42d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001243fa80000000000000000000000000000000000000000000000000000000000052b060000000000000000000000000000000000000000000000000000000000000001",
"nonce": "0x0",
"to": "0x00000000000000000000000000000000000a4b05",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x6a",
"chainId": "0xa1337",
"v": "0x0",
"r": "0x0",
"s": "0x0"
},
{
"blockHash": "0xc278e7b6134a7f206cbf70f90b8610855e9652a1374aa238cdf9a79fb80f279e",
"blockNumber": "0x52b06",
"from": "0xdd26b1fd3019e7079edc0cacd2879de2b1d5dcba",
"gas": "0x12558",
"gasPrice": "0x5f5e100",
"maxFeePerGas": "0x5f5e100",
"maxPriorityFeePerGas": "0x5f5e100",
"hash": "0xaf30ae1485d8be7eafce6efeebf6ea8a0c1d40da4cbddd24703e548847941afb",
"input": "0xe4ba15180000000000000000000000000000000000000000000000000000000000000e10",
"nonce": "0x158",
"to": "0x391cc20b5eb47a776bc59f7af7743bf26ef91df6",
"transactionIndex": "0x1",
"value": "0x0",
"type": "0x2",
"accessList": [],
"chainId": "0xa1337",
"v": "0x0",
"r": "0x1965bc6d92b9de59568d33e572eed6a4db89674576bc20d3ded9f781a0c01345",
"s": "0x5f90080a0e342fd38375e28017ce5449e9a820a1a91820b60681eac6845b021f",
"yParity": "0x0"
}
],
"transactionsRoot": "0x93ad5f0cbddc13f679b5015b4527a4b4cd335a630ae1ef7e5fdb06e2ba66e559",
"uncles": []
}
}
eth_getBlockTransactionCountByNumber
Returns the number of transactions in a block.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getBlockTransactionCountByNumber
&tag=0x52B06
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the block number, in hex eg. 0x10FB78 |
Sample response
{
"jsonrpc":"2.0",
"result":"0x2",
"id":1
}
eth_getTransactionByHash
Returns the information about a transaction requested by transaction hash.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getTransactionByHash
&txhash=0xfde1a894f0532396a7aa5d9b3d2e9b4a96b68138c3ea614733068c2e61705438
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the hash of the transaction |
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x4cbbbd9cda2bbb16922bc0bb45db8f15825cb5790723a625a2480c23b3c92ae3",
"blockNumber": "0x1c0356",
"from": "0x81acc319a1a50c0faebd6882643a0cc8b6da5a18",
"gas": "0x903e",
"gasPrice": "0x5f5e1000",
"maxFeePerGas": "0x608f3d00",
"maxPriorityFeePerGas": "0x59682f00",
"hash": "0xfde1a894f0532396a7aa5d9b3d2e9b4a96b68138c3ea614733068c2e61705438",
"input": "0x2e1a7d4d000000000000000000000000000000000000000000000005f68af3b348318000",
"nonce": "0x64",
"to": "0x36be1fd6ff2a6beb34b500a04f89103a524516d8",
"transactionIndex": "0x1",
"value": "0x0",
"type": "0x2",
"accessList": [],
"chainId": "0xa1337",
"v": "0x1",
"r": "0x79c22f9b21f4cebfbf5e7c2f2d709c2db274ca97633779f97bb0be8d52698117",
"s": "0xd43e2a21036f9b84e96e192c99f70e3f8a348dee2889ff816396f1e5f4b74a9",
"yParity": "0x1"
}
}
eth_getTransactionByBlockNumberAndIndex
Returns information about a transaction by block number and transaction index position.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getTransactionByBlockNumberAndIndex
&tag=0x5858
&index=0x0
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the block number, in hex eg. 0x10FB78 |
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x7cb032627eb591b79ee12583ba48c246a411ed24ed40f9a46db15f9b5899c2f9",
"blockNumber": "0x5858",
"from": "0x00000000000000000000000000000000000a4b05",
"gas": "0x0",
"gasPrice": "0x0",
"hash": "0x19480fbad6a7617090a90cb6b807e22ed0adc79eef873afbd8ebeef480c7ad47",
"input": "0x6bf6a42d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000122324b00000000000000000000000000000000000000000000000000000000000058580000000000000000000000000000000000000000000000000000000000000001",
"nonce": "0x0",
"to": "0x00000000000000000000000000000000000a4b05",
"transactionIndex": "0x0",
"value": "0x0",
"type": "0x6a",
"chainId": "0xa1337",
"v": "0x0",
"r": "0x0",
"s": "0x0"
}
}
eth_getTransactionCount
Returns the number of transactions performed by an address.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getTransactionCount
&address=0x81ACC319a1A50C0FaeBd6882643A0CC8b6Da5A18
&tag=latest
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the address to get transaction count |
| the string pre-defined block parameter, either earliest , pending or latest |
Sample Response
{
"jsonrpc":"2.0",
"result":"0x217",
"id":1
}
eth_sendRawTransaction
Submits a pre-signed transaction for broadcast to the Xai network.
https://api.xaiscan.io/api
?module=proxy
&action=eth_sendRawTransaction
&hex=0x02f874030185012a05f200852e90edd00082520894eeee7341f206302f2216e39d715b96d8c6901a1c880de0b6b3a764000080c001a0bf61ea5419c7856be4ea2221b721b849d50fec738d10a714e7aaa809d9ad8838a01e59353aa8e567cc0661fb58b047361998df234df6593bf424839bc5ea214a2c
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the signed raw transaction data to broadcast. |
💡 Tip: Send a POST request if your hex string is particularly long.
🖋️ For more information on creating a signed raw transaction, visit this page.
Sample Response
{
"id":1,
"jsonrpc": "2.0",
"result": "0x84c81fc1e23474e13be0114f94f99b43696830f33292fd1d642f37e87e95acd6"
}
⛏️ Note: The result
represents the transaction hash of the submitted raw transaction.
Use eth_getTransactionReceipt to retrieve full details.
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getTransactionReceipt
&txhash=0xfde1a894f0532396a7aa5d9b3d2e9b4a96b68138c3ea614733068c2e61705438
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the hash of the transaction |
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x4cbbbd9cda2bbb16922bc0bb45db8f15825cb5790723a625a2480c23b3c92ae3",
"blockNumber": "0x1c0356",
"contractAddress": null,
"cumulativeGasUsed": "0x8c4f",
"effectiveGasPrice": "0x5f5e100",
"from": "0x81acc319a1a50c0faebd6882643a0cc8b6da5a18",
"gasUsed": "0x8c4f",
"gasUsedForL1": "0x283",
"l1BlockNumber": "0x1268a3a",
"logs": [
{
"address": "0x36be1fd6ff2a6beb34b500a04f89103a524516d8",
"topics": [
"0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
"0x00000000000000000000000081acc319a1a50c0faebd6882643a0cc8b6da5a18"
],
"data": "0x000000000000000000000000000000000000000000000005f68af3b348318000",
"blockNumber": "0x1c0356",
"transactionHash": "0xfde1a894f0532396a7aa5d9b3d2e9b4a96b68138c3ea614733068c2e61705438",
"transactionIndex": "0x1",
"blockHash": "0x4cbbbd9cda2bbb16922bc0bb45db8f15825cb5790723a625a2480c23b3c92ae3",
"logIndex": "0x0",
"removed": false
}
],
"logsBloom": "0x00008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000080000002000000000000000000000000000000000000000000000000000000000000000000000000002008000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x36be1fd6ff2a6beb34b500a04f89103a524516d8",
"transactionHash": "0xfde1a894f0532396a7aa5d9b3d2e9b4a96b68138c3ea614733068c2e61705438",
"transactionIndex": "0x1",
"type": "0x2"
}
}
eth_call
Executes a new message call immediately without creating a transaction on the block chain.
https://api.xaiscan.io/api
?module=proxy
&action=eth_call
&to=0xfab2b4b677a4e104759d378ea25504862150256e
&data=0x
&tag=latest
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the address to interact with |
| the hash of the method signature and encoded parameters |
| the string pre-defined block parameter, either earliest , pending or latest |
⛽ Note: The gas
parameter is capped at 2x the current block gas limit.
Sample Response
{
"jsonrpc":"2.0",
"result":"0x",
"id":1
}
eth_getCode
Returns code at a given address.
https://api.xaiscan.io/api
?module=proxy
&action=eth_getCode
&address=0x8DF2CDec3ec9a8A65998c866422c152D3dA52fB2
&tag=latest
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the address to get code |
| the string pre-defined block parameter, either earliest , pending or latest |
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033"
}
eth_getStorageAt
Returns the value from a storage position at a given address.
This endpoint is still experimental and may have potential issues
https://api.xaiscan.io/api
?module=proxy
&action=eth_getStorageAt
&address=0x8DF2CDec3ec9a8A65998c866422c152D3dA52fB2
&position=0x0
&tag=latest
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the string representing the address to get code |
| the hex code of the position in storage, eg 0x0 |
| the string pre-defined block parameter, either earliest , pending or latest |
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
eth_gasPrice
Returns the current price per gas in wei.
https://api.xaiscan.io/api
?module=proxy
&action=eth_gasPrice
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Sample Response
{
"jsonrpc": "2.0",
"id": 73,
"result": "0x5f5e100"
}
📖 Tip: The result
is returned in wei.
Easily convert Ethereum units using our unit converter.
eth_estimateGas
Makes a call or transaction, which won't be added to the blockchain and returns the used gas.
https://api.xaiscan.io/api
?module=proxy
&action=eth_estimateGas
&data=0x
&to=0xe84d601e5d945031129a83e5602be0cc7f182cf3
&value=0x1
&gasPrice=0x51da038cc
&gas=0x186A0
&apikey=YourApiKeyToken
Try this endpoint in your browser 🔗
Query Parameters
Parameter | Description |
---|
| the hash of the method signature and encoded parameters |
| the string representing the address to interact with |
| the value sent in this transaction, in hex eg. 0xff22 |
| the amount of gas provided for the transaction, in hex eg. 0x5f5e0ff |
| the gas price paid for each unit of gas, in wei post EIP-1559, the gasPrice has to be higher than the block's baseFeePerGas |
⛽ Note: The gas
parameter is capped at 2x the current block gas limit.
Sample Response
{
"jsonrpc":"2.0",
"result":"0x5208",
"id":1
}
Last updated