eth_*
namespace
Standard Ethereum JSON-RPC calls supported by anvil-zksync.
Unless marked ✗, behavior matches the same call on an actual ZK chain endpoint.
curl -X POST http://localhost:8011 \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
Method index
Accounts & keys
Method | ✓ / ✗ | Purpose |
---|---|---|
eth_accounts | ✓ | List dev accounts |
eth_coinbase | ✗ | Coinbase address |
eth_getTransactionCount | ✓ | Nonce for address |
Blocks & chain
Method | ✓ / ✗ | Purpose |
---|---|---|
eth_blockNumber | ✓ | Latest block height |
eth_chainId | ✓ | Configured chain ID (260 default) |
eth_getBlockByNumber | ✓ | Block by number |
eth_getBlockByHash | ✓ | Block by hash |
eth_getUncleByBlockNumberAndIndex | ✗ | Uncle data |
eth_getUncleCountByBlockHash | ✗ | Uncle count |
Transactions
Method | ✓ / ✗ | Purpose |
---|---|---|
eth_sendRawTransaction | ✓ | Broadcast signed tx |
eth_sendTransaction | ✓ | Broadcast unsigned tx (dev wallets) |
eth_getTransactionByHash | ✓ | Tx by hash |
eth_getTransactionReceipt | ✓ | Tx receipt |
eth_estimateGas | ✓ | Gas estimate |
eth_call | ✓ | Stateless call |
eth_sign | ✗ | Sign message |
eth_signTypedData | ✗ | Sign typed data |
Logs & filters
Method | ✓ / ✗ | Purpose |
---|---|---|
eth_getLogs | ✓ | Logs by filter object |
eth_newFilter | ✓ | Create log filter |
eth_getFilterChanges | ✓ | Poll filter |
eth_uninstallFilter | ✓ | Remove filter |
eth_subscribe | ✗ | Open websocket subscription |
Gas & fees
Method | ✓ / ✗ | Purpose |
---|---|---|
eth_gasPrice | ✓ | Current gas price (hardcoded 50_000_000 ) |
eth_feeHistory | ✓ | Historical fee data (stubbed) |
eth_maxPriorityFeePerGas | ✗ | EIP-1559 priority fee |
Misc & sync
Method | ✓ / ✗ | Purpose |
---|---|---|
eth_syncing | ✓ | Always false (instant sync) |
eth_protocolVersion | ✓ | Protocol version |
eth_hashrate | ✗ | Miner hashrate |
Method reference
We keep this section lightweight — for full parameter and return definitions see the official Ethereum JSON-RPC spec ↗︎.
eth_accounts
Returns a list of addresses owned by the local node (e.g. dev accounts).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_accounts","params":[]}'
eth_getTransactionCount
Returns the nonce (transaction count) for an address.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getTransactionCount",
"params":["0x6fC1E2F6c7381BF9b7205F3a14e0ccabe9d9a8F8", "latest"]
}'
Replace the address with one from
eth_accounts
if you’re running dev mode.
eth_blockNumber
Returns the latest block height.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'
eth_chainId
Returns the chain ID of the node (default: 260
/ 0x104
).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'
eth_getBlockByNumber
Returns block details by block number.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getBlockByNumber",
"params":["latest", true]
}'
true
returns full transaction objects;false
returns only tx hashes.
eth_getBlockByHash
Returns block details by hash.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getBlockByHash",
"params":["0xabc123...blockHash...", true]
}'
Replace the hash with a real block hash from your node (e.g. via
eth_getLogs
or block explorer).
eth_sendRawTransaction
Broadcasts a raw signed transaction.
Use this with pre-signed transactions (e.g. from Foundry or viem).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_sendRawTransaction",
"params":["0x02f8..."] // replace with actual signed tx
}'
--no-mining
, the transaction is mined immediately.
eth_sendTransaction
Broadcasts an unsigned transaction using dev accounts (in local mode only).
Automatically signs and sends the tx.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_sendTransaction",
"params":[{
"from": "0x6fC1E2F6c7381BF9b7205F3a14e0ccabe9d9a8F8",
"to": "0x0000000000000000000000000000000000000000",
"value": "0x2386F26FC10000" // 0.01 ETH
}]
}'
eth_getTransactionByHash
Returns a transaction by its hash.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getTransactionByHash",
"params":["0x...transactionHash..."]
}'
eth_getTransactionReceipt
Returns the receipt for a transaction hash (after it has been mined).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getTransactionReceipt",
"params":["0x...transactionHash..."]
}'
eth_estimateGas
Estimates how much gas a transaction will consume.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_estimateGas",
"params":[{
"from": "0x6fC1E2F6c7381BF9b7205F3a14e0ccabe9d9a8F8",
"to": "0x0000000000000000000000000000000000000000",
"data": "0x"
}]
}'
eth_call
Simulates a read-only call to a contract (does not submit a tx).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_call",
"params":[{
"from": "0x6fC1E2F6c7381BF9b7205F3a14e0ccabe9d9a8F8",
"to": "0x0000000000000000000000000000000000000000",
"data": "0x..."
}, "latest"]
}'
Replace
data
with the ABI-encoded call data for the method you wish to simulate.
eth_getLogs
Returns logs matching the specified filter object.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getLogs",
"params":[{
"fromBlock": "0x0",
"toBlock": "latest",
"address": "0x0000000000000000000000000000000000000000",
"topics": []
}]
}'
eth_newFilter
Creates a new log filter on the node and returns its ID.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_newFilter",
"params":[{
"fromBlock": "0x0",
"toBlock": "latest",
"address": "0x0000000000000000000000000000000000000000",
"topics": []
}]
}'
eth_getFilterChanges
Polls the filter for new changes (e.g. logs or block hashes since last call).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_getFilterChanges",
"params":["0x1"]
}'
Replace
0x1
with the filter ID returned byeth_newFilter
.
eth_uninstallFilter
Removes a previously created filter.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_uninstallFilter",
"params":["0x1"]
}'
After removal, the filter ID becomes invalid and cannot be polled.
eth_gasPrice
Returns the current gas price.
In anvil-zksync
, this is hardcoded to 50_000_000
gwei (0x2FAF080
).
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_gasPrice","params":[]}'
eth_feeHistory
Returns a stubbed gas fee history.
Parameters include block count, reference block, and optional reward percentiles.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{
"jsonrpc":"2.0","id":1,
"method":"eth_feeHistory",
"params":["0x5", "latest", [25, 50, 75]]
}'
eth_syncing
Returns false
— the node is always considered fully synced.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_syncing","params":[]}'
eth_protocolVersion
Returns the Ethereum protocol version as a hex string.
curl -s -X POST http://localhost:8011 \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_protocolVersion","params":[]}'
Unimplemented stubs
The following methods currently return Method not found
:
eth_getCompilers
eth_sign
eth_subscribe
eth_hashrate
eth_maxPriorityFeePerGas
eth_coinbase
eth_signTypedData
eth_getUncleByBlockNumberAndIndex
eth_getUncleCountByBlockHash
eth_getUncleByBlockHashAndIndex
eth_getUncleCountByBlockNumber
eth_getUncleByBlockNumberAndIndex