eth_blockNumber - Arc RPC Method
Get the current block height on Arc. Essential for syncing dApps, monitoring transaction confirmations, and blockchain state tracking.
Returns the number of the most recent block on Arc.
Why Arc? Build on Circle's stablecoin-native Layer 1 where USDC is the gas token and BFT consensus gives sub-second deterministic finality with USDC as the native gas token, sub-second irreversible finality, an EWMA-smoothed fee market with a 20 Gwei floor, and EIP-7708 Transfer logs for native value movement.
When to Use This Method
eth_blockNumber is fundamental for payment platforms, stablecoin issuers, exchange and treasury teams, and Solidity developers building on Arc:
- Syncing Applications - Keep your dApp in sync with the latest Arc blockchain state
- Transaction Monitoring - Verify confirmations by comparing block numbers
- Event Filtering - Set the correct block range for querying logs on crossborder settlement, merchant payments, institutional clearing, and USDC-denominated financial applications
- Health Checks - Monitor node connectivity and sync status
Code Examples
Common Use Cases
1. Block Confirmation Counter
Monitor transaction confirmations on Arc:
async function getConfirmations(provider, txHash) {
const tx = await provider.getTransaction(txHash);
if (!tx || !tx.blockNumber) return 0;
const currentBlock = await provider.getBlockNumber();
return currentBlock - tx.blockNumber + 1;
}
// Wait for specific confirmations
async function waitForConfirmations(provider, txHash, confirmations = 6) {
let currentConfirmations = 0;
while (currentConfirmations < confirmations) {
currentConfirmations = await getConfirmations(provider, txHash);
console.log(`Confirmations: ${currentConfirmations}/${confirmations}`);
await new Promise(r => setTimeout(r, 2000));
}
return true;
}2. Event Log Filtering
Query events from recent blocks on Arc:
async function getRecentEvents(provider, contract, eventName, blockRange = 100) {
const currentBlock = await provider.getBlockNumber();
const fromBlock = currentBlock - blockRange;
const filter = contract.filters[eventName]();
const events = await contract.queryFilter(filter, fromBlock, currentBlock);
return events;
}3. Node Health Monitoring
Check if your Arc node is synced:
async function checkNodeHealth(provider) {
try {
const blockNumber = await provider.getBlockNumber();
const block = await provider.getBlock(blockNumber);
const now = Date.now() / 1000;
const blockAge = now - block.timestamp;
if (blockAge > 60) {
console.warn(`Node may be behind. Last block was ${blockAge}s ago`);
return false;
}
console.log(`Node healthy. Latest block: ${blockNumber}`);
return true;
} catch (error) {
console.error('Node unreachable:', error);
return false;
}
}Performance Optimization
Caching Strategy
Cache block numbers to reduce API calls:
class BlockNumberCache {
constructor(ttl = 2000) {
this.cache = null;
this.timestamp = 0;
this.ttl = ttl;
}
async get(provider) {
const now = Date.now();
if (this.cache && (now - this.timestamp) < this.ttl) {
return this.cache;
}
this.cache = await provider.getBlockNumber();
this.timestamp = now;
return this.cache;
}
invalidate() {
this.cache = null;
this.timestamp = 0;
}
}
const blockCache = new BlockNumberCache();Batch Requests
Combine with other calls for efficiency:
const batch = [
{ jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: 1 },
{ jsonrpc: '2.0', method: 'eth_gasPrice', params: [], id: 2 },
{ jsonrpc: '2.0', method: 'eth_chainId', params: [], id: 3 }
];
const response = await fetch('https://api-arc-mainnet.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(batch)
});
const results = await response.json();Finality on Arc
Arc uses Malachite, a Tendermint-style BFT consensus with a Proof-of-Authority validator set. A block is committed only after more than two-thirds of validators pre-commit to it, which makes conflicting blocks impossible and rules out reorganizations entirely.
A transaction is therefore either unconfirmed or final, with no probabilistic middle ground. One confirmation is enough. Once you have a receipt, settlement is irreversible in under a second.
For integrations this means you can drop the machinery that probabilistic chains require: no confirmation-count thresholds, no reorg rollback path, no re-org-aware bookkeeping. Persist the block number and hash for auditability, then act on the receipt.
Error Handling
Common errors and solutions:
| Error Code | Description | Solution |
|---|---|---|
| -32603 | Internal error | Retry with exponential backoff |
| -32005 | Rate limit exceeded | Implement rate limiting client-side |
| -32000 | Execution reverted | Check node sync status |
async function safeGetBlockNumber(provider, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await provider.getBlockNumber();
} catch (error) {
if (error.code === -32005) {
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
} else if (i === maxRetries - 1) {
throw error;
}
}
}
}Related Methods
eth_getBlockByNumber- Get full block details by numbereth_getBlockByHash- Get block details by hasheth_syncing- Check if node is still syncing
Arc RPC Documentation
Connect to Arc through Dwellir's RPC and WebSocket endpoints. Standard Ethereum JSON-RPC with sub-second finality on Circle's USDC-gas Layer 1, Chain ID 5042.
eth_getBlockByNumber
Retrieve complete block data by block number on Arc. Perfect for payment platforms, stablecoin issuers, exchange and treasury teams, and Solidity developers building on Arc building on Circle's stablecoin-native Layer 1 where USDC is the gas token and BFT consensus gives sub-second deterministic finality.