How modify algorand consensus protocol parameters

Hello,
I was looking into the Algorand GitHub codebase(go-algorand), I saw that all the parameters are in a file called “consensus.go”. My question is if I would like to edit some of those parameters, for example, the MinTxnFee, MaxTxnNoteBytes, and MaxTxnBytesPerBlock for a local private network. Would I need to compile from source code(to generate the “goal”, and other binaries) or is there a way similar to the “config.json” file to change them?

Thanks for the help.

For running local private networks, you can create a file named “consensus.json” which would override the default parameters in consensus.go; please be warned that some permutations of these parameters could place your network in the “untested” territory.

Modifying the above mentioned parameters sounds pretty harmless, nevertheless.

You can use goal protocols > consensus.json to generate the content of that file.

2 Likes

Thanks for your response,

This file would need to be placed inside the data folder correct?

Yes, this file is expected to be found in the data directory. ( it’s completely optional )

Hello, I am trying to use consensus.json to change some of the parameters. And I have a few questions, that I was hoping you had the answer for:

1- This file will need to be inside all the nodes that will be participating in the local network?

2- Also when editing consensus.json I find that there are many versions, with the same variables repeated. Should I just select one of them and change it, and then tell the network to use that version? If so how could I do that?

3- The genesis file also brings a string called:

"proto": "https://github.com/algorandfoundation/specs/tree/ac2255d586c4474d4ebcf3809acccb59b7ef34ff"

Is this going to be overwritten with the consensus.json modifications?

To answer your question:

  • yes, all the nodes on your private local network should have the same consensus.json file.
  • the version that you need to edit needs to be the one matching the protocol specified in the genesis.json file.
  • I would strongly suggest that you will use the consensus version that matches the mainnet. The reason for that is that older consensus protocols doesn’t support all the features available on the latest consensus protocol. The binary itself needs to support all the historical consensus protocols in order to catchup from the genesis block, but it doesn’t mean that when you create a new network you should start with an older consensus protocol.
  • The consensus.json file “overwrite” all the consensus versions that are “baked” into the binary. That allows you to either modify or add new consensus versions ( including adding custom protocol upgrades ).