eth_getBlockByNumber
Returns information about a block given its block number. This method uses 80 credits from your daily balance.
Parameters
block parameter: [Required] A hexadecimal block number, or one of the string tagslatest,earliest,pending,safe, orfinalized. See the default block parameter.show transaction details flag: [Required] If set totrue, returns the full transaction objects. Iffalsereturns only the hashes of the transactions.
Returns
A block object, or null when no block was found. The returned block object 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. Hash of the block.Nullwhen the returned block is the pending block.logsBloom: 256 bytes. The bloom filter for the logs of the block.Nullwhen the returned block is the pending block.miner: 20 bytes. Address of the beneficiary to whom the mining rewards were given.nonce: 8 bytes. Hash of the generated proof-of-work.Nullwhen the returned block is the pending block.number: Block number.Nullwhen the returned block is the pending block.parentHash: 32 bytes. Hash of the parent block.receiptsRoot: 32 bytes. The root of the receipts trie of the block. Also see Tries in Ethereum.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: The 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
Replace <YOUR-API-KEY> with an API key from your MetaMask Developer dashboard.
Request
- curl
 - WSS
 
curl https://zksync-mainnet.infura.io/v3/<YOUR-API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x5BAD55", false], "id": 1}'
wscat -c wss://zksync-mainnet.infura.io/ws/v3/<YOUR-API-KEY> -x '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x5BAD55", false], "id": 1}'