Skip to main content

RPC Endpoints

NodeTrace provides access to Ethereum Archive nodes through standard JSON-RPC endpoints. All standard Ethereum methods are supported.

Base URL

https://eth.nodetrace.xyz/rpc

Request Format

All requests must be POST requests with a JSON body following the JSON-RPC 2.0 specification:

{
"jsonrpc": "2.0",
"method": "method_name",
"params": [...],
"id": 1
}

Supported Methods

Reading Blockchain Data

  • eth_blockNumber - Get latest block number
  • eth_getBlockByHash - Get block by hash
  • eth_getBlockByNumber - Get block by number
  • eth_getTransactionByHash - Get transaction details
  • eth_getTransactionReceipt - Get transaction receipt
  • eth_getBalance - Get account balance
  • eth_getCode - Get contract code
  • eth_getStorageAt - Get storage value
  • eth_call - Execute a call without creating a transaction
  • eth_estimateGas - Estimate gas for a transaction
  • eth_gasPrice - Get current gas price
  • eth_getLogs - Get event logs

Network Information

  • eth_chainId - Get chain ID (1 for mainnet)
  • eth_protocolVersion - Get protocol version
  • eth_syncing - Get sync status

Debug Methods (Archive Node Features)

  • debug_traceTransaction - Trace transaction execution
  • debug_traceCall - Trace a call
  • debug_traceBlockByNumber - Trace all transactions in a block
  • debug_traceBlockByHash - Trace all transactions in a block

Additional Methods

All standard Ethereum JSON-RPC methods are supported. For a complete list, see the Ethereum JSON-RPC Specification.

Archive Node Specific Features

As an Archive node provider, NodeTrace allows you to query historical blockchain data at any block height. This is particularly useful for:

Historical Balance Queries

Get the balance of an account at any point in history:

# Balance at block 1,000,000
curl -X POST https://eth.nodetrace.xyz/rpc/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"eth_getBalance",
"params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "0xf4240"],
"id":1
}'

Historical Contract State

Query contract state at any block:

# Get storage at specific block
curl -X POST https://eth.nodetrace.xyz/rpc/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"eth_getStorageAt",
"params":["0x...", "0x0", "0xf4240"],
"id":1
}'

Error Responses

NodeTrace returns standard JSON-RPC error responses:

{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "Invalid params"
}
}

Common error codes:

  • -32700: Parse error
  • -32600: Invalid request
  • -32601: Method not found
  • -32602: Invalid params
  • -32603: Internal error
  • -32000: Server error (includes rate limiting)

Web3 Library Examples

Web3.js

const Web3 = require('web3');

// Using API key in URL path
const web3 = new Web3(
new Web3.providers.HttpProvider('https://eth.nodetrace.xyz/rpc/YOUR_API_KEY')
);

// Get latest block number
const blockNumber = await web3.eth.getBlockNumber();
console.log('Latest block:', blockNumber);

Ethers.js

const { ethers } = require('ethers');

// Using API key in URL path
const provider = new ethers.JsonRpcProvider(
'https://eth.nodetrace.xyz/rpc/YOUR_API_KEY'
);

// Get latest block number
const blockNumber = await provider.getBlockNumber();
console.log('Latest block:', blockNumber);

Viem

import { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';

// Using API key in URL path
const client = createPublicClient({
chain: mainnet,
transport: http('https://eth.nodetrace.xyz/rpc/YOUR_API_KEY'),
});

// Get latest block number
const blockNumber = await client.getBlockNumber();
console.log('Latest block:', blockNumber);

Best Practices

  1. Batch Requests: Combine multiple calls into a single request to reduce API calls
  2. Cache Responses: Cache immutable data like historical blocks and transactions
  3. Handle Rate Limits: Implement exponential backoff when hitting rate limits
  4. Use Appropriate Block Parameters: Use specific block numbers instead of "latest" when possible for better caching

Need Help?