LogoLogo
  • Introduction
  • Radius testnet access
  • Quickstart
    • Command line
    • Go
    • JavaScript
    • Postman
    • Python
    • Rust
    • TypeScript
  • How to
    • Create a Private Key
    • Get testnet ETH tokens
    • Deploy a smart contract
  • Concepts
    • Ethereum transaction types
  • Tutorials
  • Radius SDKs
  • API Reference
    • eth_blockNumber
    • eth_call
    • eth_chainId
    • eth_createAccessList
    • eth_estimateGas
    • eth_feeHistory
    • eth_gasPrice
    • eth_getBalance
    • eth_getBlock
    • eth_getBlockByHash
    • eth_getBlockByNumber
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getCode
    • eth_getLogs
    • eth_getStorageAt
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex
    • eth_getTransactionByHash
    • eth_getTransactionCount
    • eth_getTransactionReceipt
    • eth_sendRawTransaction
    • eth_sendTransaction
    • net_version
    • web3_clientVersion
    • web3_sha3
    • web3_getTransactionCount
  • Release Notes
  • Whitepaper
  • Radius Discord
Powered by GitBook
On this page
  • Parameters
  • Returns
  • Example

Was this helpful?

Edit on GitHub
  1. API Reference

eth_getBlockByNumber

Returns information about the specified block.

Parameters

  • block number: (string) [Required] A string representing the number of a block.

  • transaction details flag: (boolean) [Required] If set to true, returns the full transaction objects, if false returns only the hashes of the transactions.

Returns

A block object matching the hash in the request, or null when no block was found. The matched block contains the following keys and their values:

  • difficulty: A hexadecimal of the difficulty for this block.

  • extraData: The "extra data" field of this block.

  • gasLimit: Maximum gas allowed in this block.

  • gasUsed: Total used gas by all transactions in this block.

  • hash: 32 bytes. The hash of the block. Null when the returned block is the pending block.

  • logsBloom: 256 bytes. The bloom filter for the logs of the block. Null when the returned block is the pending block.

  • miner: 20 bytes. The address of the beneficiary to whom the mining rewards were given.

  • nonce: 8 bytes. The hash of the generated proof-of-work. Null when the returned block is the pending block.

  • number: The block number. Null when the returned block is the pending block.

  • parentHash: 32 bytes. The hash of the parent block.

  • receiptsRoot: 32 bytes. The root of the receipts trie of the block.

  • sha3Uncles: 32 bytes. The SHA3 of the uncles data in the block.

  • size: A hexadecimal of the size of this block in bytes.

  • stateRoot: 32 bytes. The root of the final state trie of the block.

  • timestamp: Unix timestamp for when the block was collated.

  • totalDifficulty: A hexadecimal of the total difficulty of the chain until this block.

  • transactions: [Array] An array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.

  • transactionsRoot: 32 bytes. The root of the transaction trie of the block.

  • uncles: [Array] An Array of uncle hashes.

Example

Request

curl https://rpc.testnet.tryradi.us/<YOUR-RPC-ENDPOINT> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "1738267480915",
    true
  ],
  "id": 1
}
'

Response

{
  "jsonrpc": "2.0",
  "result": {
    "hash": "0x00000000000000000000000000000000000000000000000000000194b8d0d353",
    "blockHash": "0x00000000000000000000000000000000000000000000000000000194b8d0d353",
    "parentHash": "0x00000000000000000000000000000000000000000000000000000194b8d0d352",
    "number": "0x194b8d0d353",
    "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0x0000000000000000000000000000000000000000",
    "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x0",
    "gasLimit": "0x0000000000000000",
    "gasUsed": "0x0000000000000000",
    "timestamp": "0x0000000000000000",
    "totalDifficulty": "0x0000000000000000",
    "transactionHashes": [],
    "uncles": [],
    "extraData": [],
    "prevrandao": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "withdrawalsroot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "baseFeePerGas": "0x0000000000000000",
    "blobGasUsed": "0x0000000000000000",
    "blobGasPrice": "0x0000000000000000",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000"
  },
  "id": 1
}

This method does not work as expected using cast, but we are looking into it.

Request

cast rpc eth_getBlockByNumber \
  "1738267480915" \
  true \
  --rpc-url https://rpc.testnet.tryradi.us/<YOUR-RPC-ENDPOINT>

Response

Error: server returned an error response: error code -32602: Invalid params, data: "invalid type: integer `1738267480915`, expected a string at line 1 column 13"
Previouseth_getBlockByHashNexteth_getBlockTransactionCountByHash

Last updated 4 months ago

Was this helpful?

Workaround: Use curl or instead.

eth_getBlockByHash