Archive Node

Syncing and operating a Canto archive node is a time-consuming process. For convenience, consider provisioning a dedicated archive node with Ansybl.

You may wish to archive the entire history of the Canto blockchain in order to index it with a Graph node or to roll your own block explorer. This means spinning up an archive node.

Complete step-by-step instructions for launching an archive node are provided below. If you're already comfortable installing and upgrading cantod, see step four for archive-specific config details.

As of block 2,500,000, the full archive state of Canto uses approximately 600GB of storage.

1. Install Dependencies

Install dependencies (Ubuntu):

sudo snap install go --classic
sudo apt-get install git
sudo apt-get install gcc
sudo apt-get install make

2. Install cantod

Clone the official repo and install the v1.0.0 binary:

git clone https://github.com/Canto-Network/Canto.git
cd Canto
git checkout v1.0.0
make install
sudo mv $HOME/go/bin/cantod /usr/bin/

3. Initialize cantod

Initialize the node and download the genesis file:

cantod init <MONIKER> --chain-id canto_7700-1
cd ~/.cantod/config
rm genesis.json
wget https://github.com/Canto-Network/Canto/raw/genesis/Networks/Mainnet/genesis.json

4. Edit Config

As when setting up a validating node, you'll need to set a seed peer (or persistent peers) as well as minimum gas prices:

# Add seed peer to config.toml
sed -i 's/seeds = ""/seeds = "[email protected]:15556"/g' $HOME/.cantod/config/config.toml

# Set minimum gas price in app.toml
sed -i 's/minimum-gas-prices = "0acanto"/minimum-gas-prices = "0.0001acanto"/g' $HOME/.cantod/config/app.toml

For an archive node specifically, the most important config setting is the pruning setting, which should be set to nothing:

# Set pruning in app.toml
sed -i 's/pruning = "default"/pruning = "nothing"/g' $HOME/.cantod/config/app.toml

5. Create systemd Service

Create the systemd service file:

sudo nano /etc/systemd/system/cantod.service

Copy and paste the following configuration and save:

[Unit]
Description=Canto Node
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/
ExecStart=/usr/bin/cantod start --trace --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200

[Install]
WantedBy=multi-user.target

6. Start the Node

# Reload service files
sudo systemctl daemon-reload

# Create the symlink
sudo systemctl enable cantod.service

# Start the node
sudo systemctl start cantod

# Show logs
journalctl -u cantod -f

If your node has issues connecting to the seed peer, you can manually download an address book.

7. Update Binary

State breaking software upgrades took place at blocks:

  • 218225 (v2.0.0)

  • 1231500 (v3.0.0)

  • 1274863 (v4.0.0)

  • 2669495 (v5.0.0)

  • 5144100 (v6.0.0)

  • 6055770 (v7.0.0)

Important: v2.0.0 may cause AppHash errors at blocks that contained governance proposals (e.g. 804212). To avoid this, build from the thomas/archive-patch branch instead.

Upon reaching these blocks while syncing an archive node, the node will halt and throw an error every time it restarts until you update the binary. To do so, follow these steps:

# Stop cantod
sudo systemctl stop cantod

# Delete old binary from path and install new binary (run in /Canto/ folder)
git checkout thomas/archive-patch # Replace "thomas/archive-patch" with v3/4/5.0.0 as needed
sudo rm /usr/bin/cantod
make install
sudo mv $HOME/go/bin/cantod /usr/bin/

# Restart
sudo systemctl start cantod

For future binary upgrades, you will need to git pull to fetch the updated binary before you attempt to install it.

Last updated