eth_getBlockByNumber

Returns information about a block by number.

Example

curl https://bsc-<network>.web3api.com/v1/YOUR-API-KEY
-X POST 
-H "Content-Type: application/json" 
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\": [\"0x6F3225\", false],\"id\":1}" 
  1. BLOCK PARAMETER - An int block number in the form of hex, appended with 0x such as 0x6D7FE0, or pre-defined strings latest, earliest, pending.

  2. SHOW TRANSACTION DETAILS FLAG - A boolean parameter. When true, returns the full transaction information of each transaction hash included within the block. When false, only returns transaction hashes within the block.

Web3API's Composer accepts int block numbers, which will be auto-converted to a hex representation before being sent to a node.

Last updated