Query blocks, receipts, and transaction counts (8 methods)
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
Block methods provide access to block headers, full blocks, transaction receipts, and metadata. Use these methods to query blockchain state at specific block heights or hashes.
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';const provider = new Provider({ url: 'https://mainnet.infura.io' });const blockNumber = await provider.request(Rpc.Eth.BlockNumberRequest());console.log('Current block:', blockNumber);
eth_getBlockByNumber
Get block by number with full transactions or hashes.Parameters:
Parameter
Type
Description
blockTag
BlockTag
Block to query ('latest', 'earliest', 'pending', or block number)
fullTransactions
boolean
true for full tx objects, false for hashes only
Returns:Block
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';const provider = new Provider({ url: 'https://mainnet.infura.io' });// Get latest block with full transaction objectsconst block = await provider.request(Rpc.Eth.GetBlockByNumberRequest('latest', true));console.log('Block number:', block.number);console.log('Transaction count:', block.transactions.length);
eth_getBlockByHash
Get block by hash with full transactions or hashes.Parameters:
Parameter
Type
Description
blockHash
Hash
Block hash to query
fullTransactions
boolean
true for full tx objects, false for hashes only
Returns:Block
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';import { Keccak256 } from '@tevm/voltaire/Keccak256';const provider = new Provider({ url: 'https://mainnet.infura.io' });const blockHash = Keccak256.from('0x...');const block = await provider.request(Rpc.Eth.GetBlockByHashRequest(blockHash, false));console.log('Block:', block);
eth_getBlockReceipts
Get all transaction receipts for a block.Parameters:
Parameter
Type
Description
blockTag
BlockTag
Block to query
Returns:TransactionReceipt[]
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';const provider = new Provider({ url: 'https://mainnet.infura.io' });const receipts = await provider.request(Rpc.Eth.GetBlockReceiptsRequest('latest'));console.log('Receipts:', receipts.length);receipts.forEach((receipt, i) => { console.log(`TX ${i} status:`, receipt.status);});
eth_getBlockTransactionCountByHash
Get transaction count in a block by hash.Parameters:
Parameter
Type
Description
blockHash
Hash
Block hash to query
Returns:Quantity
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';import { Keccak256 } from '@tevm/voltaire/Keccak256';const provider = new Provider({ url: 'https://mainnet.infura.io' });const blockHash = Keccak256.from('0x...');const count = await provider.request(Rpc.Eth.GetBlockTransactionCountByHashRequest(blockHash));console.log('Transaction count:', count);
eth_getBlockTransactionCountByNumber
Get transaction count in a block by number.Parameters:
Parameter
Type
Description
blockTag
BlockTag
Block to query
Returns:Quantity
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';const provider = new Provider({ url: 'https://mainnet.infura.io' });const count = await provider.request(Rpc.Eth.GetBlockTransactionCountByNumberRequest('latest'));console.log('Transaction count:', count);
eth_getUncleCountByBlockHash
Get uncle count for a block by hash.Parameters:
Parameter
Type
Description
blockHash
Hash
Block hash to query
Returns:Quantity
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';import { Keccak256 } from '@tevm/voltaire/Keccak256';const provider = new Provider({ url: 'https://mainnet.infura.io' });const blockHash = Keccak256.from('0x...');const count = await provider.request(Rpc.Eth.GetUncleCountByBlockHashRequest(blockHash));console.log('Uncle count:', count);
Uncle blocks were removed in Ethereum’s transition to Proof of Stake (The Merge). This method returns 0 for post-merge blocks.
eth_getUncleCountByBlockNumber
Get uncle count for a block by number.Parameters:
Parameter
Type
Description
blockTag
BlockTag
Block to query
Returns:Quantity
Copy
Ask AI
import { Provider } from '@tevm/voltaire/provider';import * as Rpc from '@tevm/voltaire/jsonrpc';const provider = new Provider({ url: 'https://mainnet.infura.io' });const count = await provider.request(Rpc.Eth.GetUncleCountByBlockNumberRequest('latest'));console.log('Uncle count:', count);
Uncle blocks were removed in Ethereum’s transition to Proof of Stake (The Merge). This method returns 0 for post-merge blocks.