# Debug and trace APIs

You can deploy an elastic Avalanche archive node with debug and trace APIs enabled as an AvalancheGo client, which is the Go language implementation of an Avalanche node. Avalanche offers an identical API interface to Geth's API (opens new window), but with a limited set of services that include debug_trace*.

For a full list of the Geth debug API methods, see the Debug namespace (opens new window) section of the Geth documentation.

You can deploy dedicated Avalanche nodes starting from the Business plan.

# Usage examples

You can debug and trace transactions on the Avalanche C-Chain by replaying them in the Ethereum Virtual Machine to get the execution details in the exact same way as they happened on the chain.

Note that to debug and trace transactions, you need to have historical states on the node. Avalanche full nodes keep historical states for the immediately previous 32 blocks. Avalanche archive nodes keep historical states for the entire chain.

# debug_traceBlockByNumber

Trace all transactions included in a block with debug_traceBlockByNumber (opens new window):

curl -H "Content-Type: application/json" -d '{"id": 1, "method": "debug_traceBlockByNumber", "params": ["BLOCK_NUMBER", {"tracer": "callTracer"}]}' ENDPOINT

where

  • BLOCK_NUMBER — the number of the block in hex to get the traces of included transactions.
  • ENDPOINT — your node HTTPS endpoint.

See View node access and credentials.

For example, trace all smart contract interactions in block 20922538 on the C-Chain:

curl -H "Content-Type: application/json" -d '{"id": 1, "method": "debug_traceBlockByNumber", "params": ["0x13F40AA", {"tracer": "callTracer"}]}' https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531dext/bc/C/rpc