Links

JSON-RPC

Convenience Libraries

While some developers may opt to interact directly with the JSON-RPC API detailed below, there are also a number of Javascript based convenience libraries designed to make data interaction much easier. Convenience libraries abstract much of the complexity of direct API calls out into simple one-line methods. These methods are also easily portable into decentralized applications and help make backend logic more concise and readable. The primary convenience library used to interact with Quai Network is quais.js.
A postman library containing templates for all of the RPC methods detailed below is also available at the Quai API workspace.

Conventions

Hexadecimal Encoding

When making calls to a node, data can be passed or returned in two types via JSON. These types are quantities and unformatted byte arrays. Both utilize hex encoding for compact representation but have slightly different formatting requirements.

Quantities

When encoding quantities like numbers and integers, use the following format:
  • Encode as a hexadecimal
  • Prefix all data with "0x"
  • Example: 21000 in decimal is "0x5208"

Unformatted Data

To encode unformatted data such as addresses, byte arrays, hashes, etc. - use the folllowing format:
  • Encode as a hexadecimal
  • Prefix with "0x"
  • Two hex digits per byte of data, with an even number of digits only
  • Example: hello is encoded as "0x48656C6C6F"

Default Block Parameter

The default block parameter is an extra parameter that can be passed when querying the state of Quai Network. This parameter allows you to specify a specific block or state of Quai that you would like to receive data from. When not passed in a call, this parameter defaults to the height of the most recent block.
Available options for this parameter are:
  • "earliest" - genesis block
  • "latest" - most recently mined block
  • "pending" - pending state changes
  • integer block number
The default block parameter can be passed to the following methods:

Curl Examples

The below section details using the JSON-RPC API to make curl requests to a Quai Network node. Each example includes a description of the endpoint, parameters, return type, and an illustration of its usage.
You might encounter an error message related to the content type, as the --data option sets it to application/x-www-form-urlencoded. To fix this, include -H "Content-Type: application/json" at the start of the call. Note that the examples do not include the full request headers, flags, and URL/IP & port combination, but only the data for simplicity.
A complete curl request including these additional data would look like:
curl -X POST \
http://127.0.0.1:8512 \
-H 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "quai_syncing",
"params": [],
"id": 1
}'
Depending on the chain you're requesting data from, the port (in the example 8512) the request is being routed to will change.

JSON-RPC API Methods

quai_gasPrice

Returns the gas price.

Input Parameters

No input params are required for this method.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_gasPrice",
"params": [],
"id": 1
}

Returns

gasPrice: Quantity - Current gas price
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"0x3b9aca01" // 1000000001
}

quai_maxPriorityFeePerGas

Returns the max priority fee per unit of gas.

Input Parameters

No input params are required for this method.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_maxPriorityFeePerGas",
"params": [],
"id": 1
}

Returns

priorityFeePerGas: Quantity - Current max priority fee per gas
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"0x3b9aca01" // 1000000001
}

quai_feeHistory

Returns the fee history for a specific range of blocks.

Input Parameters

  • blockCount: Quantity - Integer block count to be queried. Can range from 1 to 1024.
  • blockNumber: Quantity - Latest integer block number to be queried.
  • rewardPercentiles: Array - Array of integer reward percentiles. A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_feeHistory",
"params": ["0x2", "0x8", [2, 4, 6]],
"id": 1
}

Returns

  • oldestBlock: Quantity - Integer block number of the most recent block queried
  • reward: Array - Effective priority fees per gas data points from a single block
  • baseFeePerGas: Array - Base block fees per gas
  • gasUsedRatio: Array - Block gas used ratios. calculated as the ratio of gasUsed and gasLimit
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result": {
"oldestBlock": "0x7",
"reward": [
[
"0x0x4a817c7ee",
"0x0x4a817c7ee",
"0x0x4a817c7ee"
],
[
"0x773593f0",
"0x773593f5",
"0x773593f5"
]
],
"baseFeePerGas": [
"0x12",
"0x10",
"0xe"
],
"gasUsedRatio": [
0.026089875,
0.406803,
]
}
}

quai_syncing

Returns an indicator of whether the client is actively syncing.

Input Parameters

No input params are required for this method.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_syncing",
"params": [],
"id": 1
}

Returns

  • syncing: Boolean - True when syncing, otherwise false
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"false"
}

quai_chainId

Returns the current chain ID.

Input Parameters

No input params are required for this method.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_chainId",
"params": [],
"id": 1
}

Returns

  • chainId: Quantity - Current integer chain ID.
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"0x3" // 3
}

quai_nodeLocation

Returns the current node location or context.

Input Parameters

No input params are required for this method.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_nodeLocation",
"params": [],
"id": 1
}

Returns

  • location: Quantity - Array of integers corresponding indicating node location. The first entry indicates the node's region, the second indicates the zone.
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":["0x1","0x0"] // [1, 0] or Paxos-1
}

quai_blockNumber

Returns the latest block number.

Input Parameters

No input params are required for this method.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_blockNumber",
"params": [],
"id": 1
}

Returns

  • blockNumber: Quantity - Integer number of the most recent block.
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"0x801" // 2049
}

quai_getBalance

Returns the balance of a specified address.

Input Parameters

  • address: Data - 20 bytes, the address being queried.
  • Quantity | Tag - Integer block number or default block parameter.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getBalance",
"params": ["0x421bc7323295c6b7f2f75fc4c854d4fb600e69e8","latest"],
"id": 1
}

Returns

  • balance: Quantity - Integer balance of the address in wei.
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"0x3f28cb71571c7" // 1111111111111111
}

quai_getProof

Returns the Merkle-Proof for a given account and optional storage keys.

Input Parameters

  • address: Data - 20 bytes, the address for which the Merkle-Proof is being returned.
  • storageKeys: Array - String array of storage keys.
  • Quantity | Tag - Integer block number or default block parameter.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getProof",
"params": ["0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842",["0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"],"latest"],
"id": 1
}

Returns

  • address: Data - 20 bytes, the address for the proof
  • accountProof: Array - RLP-serialized MerkleTree-Nodes, starting with the stateRoot-Node, following the path of the SHA3(address) as key
  • balance: Quantity - Balance of the account
  • codeHash: Data - 32 bytes, hash of the code account
  • nonce: Quantity - Nonce of the account
  • storageHash: Data - 32 bytes, the SHA3 hash of the storageRoot
  • storageProof: Array
    • key: Data - Requested storage key
    • value: Quantity - Storage value(s)
    • proof: Array - Array of rlp-serialized MerkleTree-Nodes, starting with the storageHash-Node, following the path of the SHA3 (key) as path.
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result": {
"address": "0x7f0d15c7faae65896648c8273b6d7e43f58fa842",
"accountProof": [
"0xf8518080808080a0c330e7e9f2c4d26b65d6a75253887c5aaf97e0f8d4fca55b9c1b4d258acf69b78080808080808080a0eaa68ff161bff8212a577807d9d5031f7298825a42777c9837dad04d377595d68080",
"0xf870a03380c7b7ae81a58eb98d9c78de4a1fd7fd9535fc953ed2be602daaa41767312ab84df84b808706943fdbce684ba056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a0c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
],
"balance": "0x0",
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"nonce": "0x0",
"storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"storageProof": [
{
"key": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"value": "0x0",
"proof": []
}
]
}
}

quai_getHeaderHashByNumber

Returns the hash of the block header for a specific block number.

Input Parameters

  • blockNumber: Quantity - the integer block number.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getHeaderHashByNumber",
"params": ["0x1"],
"id": 1
}

Returns

  • blockHash: Data - 32 bytes, the hash of the block header.
// Response
{
"jsonrpc":"2.0",
"id":"1",
"result":"0x00000040ba9145742407a455bf07aa33cdd014fd4cd630970906e9f40064d033"
}

quai_getHeaderByHash

Returns the block header given the header hash.

Input Parameters

  • blockHash: Data - 32 bytes, the hash of the block header.

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getHeaderByHash",
"params": ["0x00000040ba9145742407a455bf07aa33cdd014fd4cd630970906e9f40064d033"],
"id": 1
}

Returns

Object - the block header. All arrays within the object are organized by descending context.
  • baseFeePerGas: Quantity - Integer array of base fee per gas
  • difficulty: Quantity - Integer array of difficulty values
  • extRollupRoot: Data - Array of 32 byte hashes of all ETXs emitted since the previous coincident block
  • extTransactionsRoot: Data - Array of 32 byte roots of the external transaction trie of each block
  • extraData: Data- Extra data field of the block, contains a string of bytes
  • gasLimit: Quantity - Integer array of maximum gas value allowed in each block
  • gasUsed: Quantity - Integer array of total gas used by all transactions within each block
  • hash: Data - 32 bytes, the hash of the block header
  • location: Data - RLP encoded node location
  • logsBloom: Data - Array of 256 byte bloom filter for the logs of each block, null when the block is pending
  • manifestHash: Data - Array of 32 byte block manifest hashes of each block
  • miner: Data - Array of 20 byte addresses of whom the mining rewards were paid to
  • nonce: Data - 8 bytes, hash of the generated proof-of-work, null when the block is pending
  • number: Quantity - Integer array of each block number
  • parentHash: Data - Array of 32 byte hashes of the each parent block
  • receiptsRoot: Data - Array of 32 byte receipts trie of each block
  • sha3Uncles: Data - Array of 32 byte SHA3 hashes of the uncles data in each block
  • size: Quantity - Integer size of the block in bytes
  • stateRoot: Data - Array of 32 byte roots of the final state trie of each block
  • timestamp: Quantity - Integer value of unix timestamp of when the block was collated
  • totalDifficulty: Quantity - Integer value of the total difficulty of the network until this block
  • transactionsRoot: Data - Array of 32 byte roots of the transaction trie of each block
// Response
{
"jsonrpc":"2.0",
"id":1,
"result": {
"baseFeePerGas": [
"0x1",
"0x1",
"0x1"
],
"difficulty": [
"0xc8af3f",
"0x140000",
"0x13880"
],
"extRollupRoot": [
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"extTransactionsRoot": [
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"extraData": "0x",
"gasLimit": [
"0xf4240",
"0xf4240",
"0xf4240"
],
"gasUsed": [
"0x0",
"0x0",
"0x0"
],
"hash": "0x0000006580948633a9e4a83d53c42f0b225c3ed86d0d29a8d41cf08ebdfd2167",
"location": "AgI=",
"logsBloom": [
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
],
"manifestHash": [
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x6b833a79c41223cf82c20d97c67c9f85affda4b3883b9b6dceafcac99d67ecd9",
"0x2e9b2d33000d1afcd03ff57aa13aacb0efb210e2e9e1384f410b8ce5663ff707"
],
"miner": [
"0x0000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000"
],
"nonce": "0x6a76520778d4af95",
"number": [
"0x9",
"0x3",
"0x1"
],
"parentHash": [
"0x00000046086151d197b5f323754d85590204c730f0ccf9c4ab240b6730c4aa54",
"0x00000046086151d197b5f323754d85590204c730f0ccf9c4ab240b6730c4aa54",
"0xc063ff8f7b7297e8269e6684f5bcb3dabe06ba60e23034bef2341641bd93b9da"
],
"receiptsRoot": [
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"sha3Uncles": [
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
],
"size": "0x1b0",
"stateRoot": [
"0xfab22b1d882da2e148a3de906bf93a496d5a2965688bd72cfb934d5b44a85576",
"0x62d82b1c37f2dbfb2273bd3429f3f76cf3a75c4dc32938313a5df90d95b3e40b",
"0x15ebf6410672eb37836f6c8bb2cce3023763f465c412c74e6c7d563f4612af9e"
],
"timestamp": "0x63d2b3b0",
"totalDifficulty": "0x67390a8",
"transactionsRoot": [
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
]
}
}

quai_getHeaderByNumber

Returns the block header given the block number.

Input Parameters

  • blockNumber: Quantity - Integer block number

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getHeaderByNumber",
"params": ["0x1"],
"id": 1
}

Returns

quai_getBlockByNumber

Returns the block data for a specific block number.

Input Parameters

  • blockNumber: Quantity - Integer block number
  • full: Boolean - If true, returns the full transaction objects. If false, returns only hashes of the transactions

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getBlockByNumber",
"params": ["0x1",false],
"id": 1
}

Returns

The response for getBlockByNumber is largely the same as the above getHeaderByHash but with the addition of three more parameters. These parameters differentiate block headers from full blocks, they include:
  • extTransactions: Data - Array of 32 byte external transaction hashes
  • subManifest: Data - Array of all 32 byte subordinate block header hashes since the last coincident block
  • transactions: Data - Array 32 byte of internal transaction hashes
// Response{
"jsonrpc":"2.0",
"id":1,
"result":{
"baseFeePerGas":[
"0x1",
"0x1",
"0x1"
],
"difficulty":[
"0xc83203",
"0xc3500",
"0x13880"
],
"extRollupRoot":[
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"extTransactions":[],
"extTransactionsRoot":[
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"extraData":"0x",
"gasLimit":[
"0x989680",
"0x989680",
"0x989680"
],
"gasUsed":[
"0x0",
"0x0",
"0x0"
],
"hash":"0x00000040ba9145742407a455bf07aa33cdd014fd4cd630970906e9f40064d033",
"location":"AQA=",
"logsBloom":[
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
],
"manifestHash":[
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x53c357eaf2dee211de953d37ead49159c0903aaa4525130ba2a307025f297f2a",
"0x53c357eaf2dee211de953d37ead49159c0903aaa4525130ba2a307025f297f2a"
],
"miner":[
"0x0000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000"
],
"nonce":"0x2827df0fe954d0a6",
"number":[
"0x4",
"0x1",
"0x1"
],
"parentHash":[
"0x00000089f657ee62a637fbbe6135b249ba74a021e9b1cf135b4d03c1c3ce6eea",
"0x9db224e069262d1bc7a7fb97a12889daa0e217af386ba8a403e31162855b0da6",
"0x9db224e069262d1bc7a7fb97a12889daa0e217af386ba8a403e31162855b0da6"
],
"receiptsRoot":[
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"sha3Uncles":[
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
],
"size":"0x6b7",
"stateRoot":[
"0x3550f1c8fad40e2df1dc2ec8fa213a3fa40cf1894084ccd5069631e951fe41fe",
"0xb053dc12d73b8f6b31d213a5a1f5020a2a5872abde0946b0d2780bc311fddc4f",
"0x15ebf6410672eb37836f6c8bb2cce3023763f465c412c74e6c7d563f4612af9e"
],
"subManifest":[],
"timestamp":"0x6398d952",
"totalDifficulty":"0x2891f03",
"transactions":[],
"transactionsRoot":[
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
],
"uncles":[]
}
}

quai_getBlockByHash

Returns the block data for a specific block header hash.

Input Parameters

  • blockHash: Data - 32 bytes, the hash of the block header
  • full: Boolean - If true, returns the full transaction objects. If false, returns only hashes of the transactions

Example Request

// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getHeaderByHash",
"params": ["0x00000040ba9145742407a455bf07aa33cdd014fd4cd630970906e9f40064d033", false],
"id": 1
}

Returns

quai_getUncleByBlockNumberAndIndex

Returns the uncle block data for a specific block number and uncle index.

Input Parameters

  • blockNumber: Quantity - Integer block number
  • uncleIndex: Quantity - Integer index of the uncle block
// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getUncleByBlockNumberAndIndex",
"params": ["0x1","0x1"],
"id": 1
}

Returns

See quai_getBlockByNumber. Uncles do not contain individual transactions or external transactions.

quai_getUncleByBlockHashAndIndex

Returns the uncle block data for a specific block header hash and uncle index.

Input Parameters

  • blockHash: Data - 32 bytes, hash of the block header
  • uncleIndex: Quantity - Integer index of the uncle block
// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getUncleByBlockHashAndIndex",
"params": ["0x00000040ba9145742407a455bf07aa33cdd014fd4cd630970906e9f40064d033", "0x1"],
"id": 1
}

Returns

See quai_getBlockByNumber. Uncles do not contain individual transactions or external transactions.

quai_getUncleCountByBlockNumber

Returns the uncle count for a specific block number.

Input Parameters

  • blockNumber: Quantity - Integer block number
// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getUncleCountByBlockNumber",
"params": ["0x1"],
"id": 1
}

Returns

  • uncleCount: Quantity - Integer uncle count for the block
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":"0x2"
}

quai_getUncleCountByBlockHash

Returns the uncle count for a specific block hash.

Input Parameters

  • blockHash: Data - 32 bytes, hash of the block header
// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getUncleCountByBlockHash",
"params": ["0x00000040ba9145742407a455bf07aa33cdd014fd4cd630970906e9f40064d033"],
"id": 1
}

Returns

  • uncleCount: Quantity - Integer uncle count for the block
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":"0x2"
}

quai_getCode

Returns the code stored at the given address.

Input Parameters

  • address: Data - 20 bytes, the address the data is stored at
  • Quantity | Tag - Integer block number or default block parameter
// Request Body
{
"jsonrpc": "2.0",
"method": "quai_getCode",
"params": ["0x421bc7323295c6b7f2f75fc4c854d4fb600e69e8","0x1"],
"id": 1
}

Returns

  • bytecode: Data - Bytecode stored at the address
// Response
{
"jsonrpc":"2.0",
"id":1,
"result":"0x6080604052348015600f57600080fd5b50607e8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063037a417c14602d575b600080fd5b60336049565b6040518082815260200191505060405180910390f35b6000600190509056fea165627a7a72305820e710d7394e9965c17ead6bb53757a23caee28d75a0a02b483638015a49dac6070029"
}