Become a Node Operator


Node operator commands are still being stabilized, so they may change. Feel free to try them out and open a pull request to fix anything!

Now that we've set up our Coda node and sent our first transaction, let's turn our attention to the other ways we can interact with the Coda network - namely, participating in consensus, and helping compress data by generating zk-SNARKs. By operating a node that helps secure the network, you can receive coda for your efforts.

Participating in Consensus

The Coda network is secured by Proof-of-Stake consensus. With this model of consensus, you don't need to have complex equipment like in Bitcoin mining. By simply having coda in our wallet, we can choose to either stake it ourselves, or delegate it to another node. Let's first see how to stake coda ourselves:

Staking coda

Since we have some funds in our wallet from the previous step, we can now start the daemon with the -propose-key flag to begin staking coda. Let's stop our current daemon process, and restart it with the following command, passing in the file path for the associated private key (by default, keypairs live in ~/.coda-config/wallets/store). Since we conveniently saved it as an environment variable in the previous step, we can run the following command:

coda daemon \
    -external-port 8302 \
    -discovery-port 8303 \
    -peer /dns4/seed-one.genesis-redux.o1test.net/tcp/10002/ipfs/12D3KooWP7fTKbyiUcYJGajQDpCFo2rDexgTHFJTxCH8jvcL1eAH \
    -peer /dns4/seed-two.genesis-redux.o1test.net/tcp/10002/ipfs/12D3KooWL9ywbiXNfMBqnUKHSB1Q1BaHFNUzppu6JLMVn9TTPFSA \
    -propose-key $CODA_PRIVATE_KEY_FILE


You can provide a list of key files to turn on staking for multiple accounts at the same time

We can always check which accounts we're currently staking with, by using the coda client status command:

coda client status

Coda daemon status

Global number of accounts:  372
Block height:               20
Max observed block length:  20
Local uptime:               1m48s
Ledger Merkle root:         ...
Protocol state hash:        ...
Staged Hash:                ...
Git SHA-1:                  ...
Configuration directory:    ...
Peers:                      5 (...)
User_commands sent:         0
SNARK worker:               None
SNARK work fee:             1
Sync status:                Synced
Block producers running:    1 (...)
Best tip consensus time:    epoch=0, slot=133
Next proposal:              None this epoch… checking at in 5.284h
Consensus time now:         epoch=0, slot=134
Consensus mechanism:        proof_of_stake
Consensus configuration:    

Addresses and ports:        

Libp2p PeerID:              ...

The Block producers running field in the response above returns the number of accounts currently staking, with the associated key.


Keep in mind that if you are staking independently with funds in a account, you'll need to remain connected to the network at all times to succesfully produce blocks. If you need to go offline frequently, it may be better to delegate your stake.

Delegating coda

Delegating coda is an alternative option to staking it directly, with the benefit of not having to remain connected to the network at all times. However, keep in mind that:

  • you will need to pay a small transaction fee to make a delegate change, as this change is issued as a transaction recorded on the blockchain
  • the delegate staking for you may choose to charge you a commission for providing the staking service

First make sure you've unlocked your account:

coda account unlock -public-key $CODA_PUBLIC_KEY

And then run this command to delegate your stake:

coda client delegate-stake \
    -delegate <delegate-public-key> \
    -privkey-path <file> \
    -fee <fee>

The fields in this command:

  • The delegate flag requires the public key of the delegate you've chosen
  • privkey-path is the file path to your private key with the funds that you wish to delegate
  • fee is the transaction fee to record your transaction on the blockchain

Delegating your stake might be useful if you're interested in:

  • Running your own staking node that uses funds from a "cold wallet"
  • Delegating to a "staking pool" which will provide token payouts periodically


There is a waiting period of a day before this change will come into effect to prevent abuse of the network

Compressing data in the Coda network

The Coda protocol is unique in that it doesn't require nodes to maintain the full history of the blockchain like other cryptocurrency protocols. By recursively using cryptographic proofs, the Coda protocol effectively compresses the blockchain to constant size. We call this compression, because it reduces terabytes of data to a few kilobytes.

However, this isn't data encoding or compression in the traditional sense - rather nodes "compress" data in the network by generating cryptographic proofs. Node operators play a crucial role in this process by designating themselves as "snark-workers" that generate zk-SNARKs for transactions that have been added to blocks.

When you start the daemon, set these extra arguments to also start a snark-worker:

coda daemon \
    -external-port 8302 \
    -discovery-port 8303 \
    -peer /dns4/seed-one.genesis-redux.o1test.net/tcp/10002/ipfs/12D3KooWP7fTKbyiUcYJGajQDpCFo2rDexgTHFJTxCH8jvcL1eAH \
    -peer /dns4/seed-two.genesis-redux.o1test.net/tcp/10002/ipfs/12D3KooWL9ywbiXNfMBqnUKHSB1Q1BaHFNUzppu6JLMVn9TTPFSA \
    -run-snark-worker $CODA_PUBLIC_KEY \
    -snark-worker-fee <fee>

As a snark worker, you get to share some of the block reward for each block your compressed transactions make it in to. The block producer is responsible for gathering compressed transactions before including them into a block, and will be incentivized by the protocol to reward snark-workers.

Snark workers can be fairly compute intensive, so if you need to limit their CPU usage, you can specify the number of threads snark workers use. Coda uses the OPENMP library to support parallel CPU processing of SNARKs. Thus each snark worker can be configured with the OMP_NUM_THREADS environment variable to determine how many threads to spawn. It defaults to the number of detected logical cores. The daemon also uses this environment variable when it is proving the blockchain snark. You can run export OMP_NUM_THREAD=4 to set this environmental variable before you begin the daemon.

That about covers the roles and responsibilities as a Code node operator. Since Coda is a permissionless peer-to-peer network, everything is managed and run in a decentralized manner by nodes all over the world. Similarly, the Coda project is also distributed and permissionless to join. The code is all open source, and there is much work to be done, both technical and non-technical. To learn more about how you can get involved with Coda, please check out the Contributing to Coda section.