By Wesley Graham, Infrastructure Engineer

Looking to join the Canto network? This technical post details solutions for deploying a mainnet staging validator.

Note: this post relates to Canto v6.0.0. All of this is subject to change. Refer to https://docs.canto.io/ for the latest state of Canto.

Canto Logo

Background

Canto is a permissionless general-purpose blockchain running the Ethereum Virtual Machine (EVM). Its primary differentiator is that the protocol’s native DeFi infrastructure (DEX, Lending, and Stablecoin) is permanently set to 0% fees, and deployed without the ability to implement fees in the future. Participating in Canto covers some exciting technical ground, including:

  • Free Public Infrastructure: Canto has a native DEX, Lending Market, and Stablecoin that permanently take 0% fees.
  • Contract Secured Revenue: Developers are able to get a share of fees generated from usage with their applications. This is meant to incentivize further development on Canto.
  • Liquidity Incentives: A portion of the initial token supply has been held by the DAO in reserves to incentivize liquidity in the protocol.

Account Setup

Canto’s official documentation can be found at docs.canto.io and is the best place to start learning about the protocol. Their tutorial requires very few dependencies that should already be found on most developer machines. Simply cloning their Github repository & running make install constitutes our setup.

# Clone repo & install
git clone --recursive https://github.com/Canto-Network/Canto.git
cd Canto
git checkout v6.0.0
make install

Once you are installed, you can generate a new keyring using the command:

cantod keys add cantoTest

- name: cantoTest
  type: local
  address: canto1cgz2cghrw7awntprlyzfyhqxrw89ns4dvgjnhr
  pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AlosAqUd1nMaLg7cKCk+bXPpZRjwILDSsZrKMRz8Qiwj"}'
  mnemonic: ""

Note: Don’t forget about this address, it’s useful later!

This generates a local keyring that is not yet registered on-chain.

Funding Your Account

An account in Canto is created the first time it receives funds. At time of writing, acquiring CANTO is not very straightforward.

Using decentralized exchanges like app.crescent.network, you can acquire CANTO by swapping ATOM for bCRE, and bCRE for CANTO. This gives you CANTO in its “Cosmos Hub” representation. The last stage of canto acquisition involves bridging this “Cosmos Hub” canto to the Canto EVM execution layer. This can be done by “bridging in” using canto’s official bridge: https://canto.io/bridge.

Once you have completed the above steps you will have CANTO in its native execution environment - Canto’s EVM execution layer. You can then run the following command to send tokens to your newly created address:

cantod tx bank send <fromAddress> canto1cgz2cghrw7awntprlyzfyhqxrw89ns4dvgjnhr 1000000acanto --chain-id canto_7700-1

Note: we use the recipient address from “Account Setup”.

acanto is a smaller unit of account of canto (similar to gwei and ETH): 1acanto = 0.000000001 canto

Canto’s network-specific chain id is “canto_7700-1”

Running a Node

Following the official docs to run a full node is fast (<30 minutes). In particular, steps 3-6 of the linked document above are essential to get your node running.

# Initialize the node & retrieve latest 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

Initialize your environment

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

Add polkachu seeds & set minimum gas price. The polkachu seed was retrieved from [this link](https://polkachu.com/seeds/canto). Polkachu was selected as a trusted seed due to their reputation in the Cosmos ecosystem & high uptimes.

# 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

The Canto EVM uses a modified EIP-1559 gas model without priority fees. The minimum base fee is 1000 acanto and self-adjusts based on how full blocks are.

# Start canto node
cantod start --trace --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable

“info” log levels are used for increased visibility into the node’s sync status.

“json-rpc.api”: Canto supports most of the standard web3 JSON-RPC APIs to connect with existing Ethereum-compatible web3 tooling over HTTP.

“api.enable”: enables the node to serve api requests.

A unique feature in launching Canto nodes is that Canto highly recommends the use of state snapshots. In fact, you cannot initially sync from genesis due to cantod being unable to parse genesis.json fields added during the ETH Merge in September 2022.

Specifically, utilizing a snapshot (which we again fetched from polkachu) will allow you to sync your nodes. Once caught up to chainhead, you can configure your own daily backups, which backup your state (/opt/canto/home/data) and wasm data (/opt/canto/home/wasm).

Once your node starts, you can check on health & sync status by hitting the node’s /status endpoint

curl localhost:26657/status

{"jsonrpc":"2.0","id":-1,"result":{"node_info":...,"id":"<id>","listen_addr":"...","network":"canto_7700-1","version":...,"channels":"...","moniker":...,"other":...,"sync_info":...,"validator_info":..,"voting_power":"0"}}}

Sync status can be inferred from the sync_info.catching_up response field.

Launching a Staging Validator

Once your node is up and running, you can turn your efforts towards readying your validator.

pubkey=$(cantod tendermint show-validator)

cantod tx staking create-validator \
--amount=1000000000000000000acanto \
--pubkey=$pubkey \
--moniker="Canto-Demo-1" \
--details="just a validator hanging out and signing blocks" \
--chain-id="canto_7700-1" \
--commission-rate="0.05" \
--commission-max-rate="1.0" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--from <yourAccount> \
--fees 30000000000000000acanto

Note: before you create a validator, ensure that your node is synced to chainhead, and the validator operator address is properly funded with at least 30 CANTO

The above command generates a validator and stakes a small amount of tokens. Additional tokens are likely necessary to enter into the active validator set. Running a small validator on mainnet (staging) allows testing all aspects of Canto validator operations before launching an official mainnet validator - including setting up monitors, alerts, permissions, and more.

Next Steps

Once your staging validator is launched, you can test the acceptance of delegations. In order to delegate, again use cantod:

cantod tx staking delegate <validatorAddress> 5000000acanto --fees 10000acanto --from <fromAccount> --gas 300000

Also consider configuring Authz support for Canto. Authz allows Canto addresses (grantees) to submit transactions on behalf of other addresses (granters) - so long as transactions are of some predetermined type. Authz can be utilized to minimize the exposure & usage of cold delegator keys, and automate common operations such as governance participation and claiming/restaking rewards.

Helpful Resources

We hope that you found this getting started guide helpful. As you explore more of the Canto project, here are some resources we found particularly useful:

If you are interested in growing and challenging your skillset, we have several positions available right now and would be happy to chat: unit410.com/jobs.