Archive Node

Archive nodes store the entire history of the Sonic chain, including all historical states, transactions, and blocks since the genesis block.

These nodes handle historical data requests, useful for chain explorers or apps that require historical chain information. However, they do not validate transactions or create new blocks, which is the role of validator nodes.

To run an archive node on the Sonic mainnet or Blaze testnet, follow the steps below.

1. Build Sonic Client and Tooling

The minimal configuration for a Sonic archive node is a Linux server with 4 vCPU, 32 GB of RAM, and local SSD storage. We recommend at least 8 vCPU and 64 GB of RAM, but 128GB of RAM is generally preferable for high-demand nodes.

You will need ≈1TB of free local SSD space to achieve good performance and speed. The configuration details depend on your specific use case.

The IOPS throughput and random access latency of the state DB persistent storage determine the performance of Sonic. For a smooth installation and fast response time, we recommend a local NVMe or a local SSD drive.

A remote block device, e.g. AWS Elastic Block Store (EBS), does not provide the required latency and IOPS performance.

The system firewall must allow TCP and UDP connections from/to port 5050.

Building the Sonic binary requires the essential software compilation tools and the Go language version 1.22 or newer to be available. Please refer to your Linux distribution manuals to obtain the development tools installed on your system.

Build Sonic Client

Download the Sonic source code from the following GitHub repository.

git clone https://github.com/Fantom-foundation/Sonic.git

Switch to the most recent Sonic release.

git fetch --tags && git checkout -b v2.0.1 tags/v2.0.1

Build the Sonic binary using the provided configuration.

make all

Transfer the new binaries to the bin folder for system-wide access (optional).

sudo cp build/sonic* /usr/local/bin/

2. Prime Sonic State DB

Download the most recent network archive genesis file for the Sonic mainnet or Blaze testnet.

wget https://genesis.soniclabs.com/sonic-mainnet/genesis/sonic.g

The genesis file will be used to prime your local state database and will allow you to join the network and synchronize with it. Please check the downloaded genesis file using the provided checksum.

wget https://genesis.soniclabs.com/sonic-mainnet/genesis/sonic.g.md5
md5sum --check sonic.g.md5

The expected output is sonic.g: OK.

Prime Sonic Database

Use the sonictool app (created during the building process as build/sonictool) to prime a validated archive state database for the Sonic client. Start the genesis expansion.

GOMEMLIMIT=50GiB sonictool --datadir <datadir> --cache 12000 genesis <genesis path>

The last step of the genesis processing is the state validation. Please double-check that the output log contains the following messages with details about the verified state:

StateDB imported successfully, stateRoot matches module=gossip-store index=1 root="9601e5...c3d639"

3. Synchronize Sonic Node With Network

With the Sonic app created and the database primed in the previous step, you are ready to start the node and synchronize its state with the network.

  • Use the node database path (<datadir>) from the previous step.

  • Use ≈90% of the RAM as the GOMEMLIMIT value.

  • Use ≈12 GiB of the RAM as the --cache value.

Additional starting flags may need to be added to start Web3 RPC and WebSocket interfaces on the node. Add the following flags to enable the Web3 HTTP interface. Adjust your listening IP address, port, CORS, and list of enabled APIs for your specific needs.

--http --http.addr=0.0.0.0 --http.port=18545
--http.corsdomain=* --http.vhosts=*
--http.api=eth,web3,net,ftm,txpool,abft,dag,trace,debug

Add the following flags to enable the WebSockets interface. Adjust your listening IP address, port, origin, and list of enabled APIs for your specific needs.

--ws --ws.addr=0.0.0.0 --ws.port=18546 --ws.origins=*
--ws.api=eth,web3,net,ftm,txpool,abft,dag,trace,debug

Please obtain and explicitly specify the external IP address of your node as a starting flag to help with the inter-node peer-to-peer connectivity.

Now, start your node with the sonicd application.

GOMEMLIMIT=50GiB sonicd --datadir <datadir> --cache 12000 --nat extip:<public external IP address>

Last updated

© 2024 Sonic Labs