Archive node vs. historical proofsThis guide covers running a full archive node, which serves every historical-state RPC call (such as
eth_getBalance or eth_call) at any block and requires terabytes of storage. Celo also supports a narrower historical proofs feature for serving historical data without keeping full archive state; a dedicated guide for it is forthcoming.Overview
To run an L2 archive node, you need to start the L2 execution client in archive mode. This allows the node to accept RPC requests that require archive data for blocks created after the L2 transition. For historical data from before the L2 transition, you can configure your node to forward those requests to a legacy Celo L1 archive node that contains the historical blockchain state.Instructions
PrerequisitesThese instructions assume you already have
- A migrated full node datadir that has been synced to the migration block. See Migrating an L1 Node if you do not have this.
- A non-migrated Celo L1 archive node datadir. Do not attempt to migrate an archive datadir.
-
Pull the latest version of celo-l2-node-docker-compose and
cdinto the root of the project. -
Configure your
.envfile.Copy default configurations
The celo-l2-node-docker-compose repo contains a<network>.envfile for each Celo network (celo-sepolia,mainnet). Start by copying the default configuration for the appropriate network.Configure sync mode
By default, celo-l2-node-docker-compose will start your node withsnapsync. Whilearchivenodes can technically run withsnapsync, they will only store archive data from the point thatsnapsync completes. This will leave a gap in the archive data after the hardfork, so we recommend running archive nodes withfullsync and a migrated pre-hardfork datadir. To usefullsync, configure.envas follows:Configure node type
To enablearchivemode, configure.envas follows:Configure Historical RPC Service
To handle RPC requests for pre-hardfork state and execution, an L2 archive node proxies to a legacy archive node or “Historical RPC Service”. There are two ways to configure a Historical RPC Service for your archive node:-
Supply a pre-hardfork archive datadir and let celo-l2-node-docker-compose start a legacy archive node. To do this configure
.envas follows:When you start your L2 node, a legacy archive node will also start using the pre-hardfork archive datadir. Your L2 node will be configured to use the legacy archive node as its Historical RPC Service. -
Start the legacy archive node yourself and configure
.envas follows:This will cause any value you set forHISTORICAL_RPC_DATADIR_PATHto be ignored. The tool will not start a legacy archive node when it starts your L2 archive node. If you choose to run your own legacy archive node, you should do so with different flags than before the hardfork, as the node will no longer be syncing blocks or communicating with other nodes. To see how we recommend re-starting a legacy archive node as a Historical RPC Service, see this script.
Configure P2P for external network access
OP_NODE__P2P_ADVERTISE_IP- Specifies the public IP to be shared via discovery so that other nodes can connect to your node. If unset op-node other nodes on the network will not be able to discover and connect to your node.PORT__OP_NODE_P2P- Specifies the port to be shared via discovery so that other nodes can connect to your node. Defaults to 9222.OP_GETH__NAT- Controls how op-geth determines its public IP that is shared via the discovery mechanism. If the public IP is not correctly configured then other nodes on the network will not be able to discover and connect to your node. The default value ofanywill try to automatically determine the public IP, but the most reliable approach is to explicitly set the public IP usingextip:<your-public-ip>. Other acceptable values are(any|none|upnp|pmp|pmp:<IP>|extip:<IP>|stun:<IP:PORT>).PORT__OP_GETH_P2P- Specifies the port to be shared via discovery so that other nodes can connect to your node. Defaults to 30303.
-
Supply a pre-hardfork archive datadir and let celo-l2-node-docker-compose start a legacy archive node. To do this configure
-
Start the node(s).
-
Check the progress of your L2 archive node as it syncs.
This will display and follow the last 50 lines of logs. In a syncing node, you would expect to see
Syncing beacon headers downloaded=...where the downloaded number is increasing and later lines such as"Syncing: chain download in progress","synced":"21.07%"where the percentage is increasing. Once the percentage reaches 100%, the node should be synced. -
Check that node is fully synced.
Once the node is fully synced, you can validate that it’s following the network by fetching the current block number via the RPC API and seeing that it’s increasing as expected.
Note that until fully synced, the RPC API will return 0 for the head block number.
-
Try querying historical state to test archive functionality.