# Prepare Where the Node Starts
When you run your chain with
myprojectd start, the software will build from a genesis. This genesis needs to contain:
- The original validators and their stakes.
- The original state values as you see fit. For instance, this can be the original parameters of your world if you are building a metaverse, or the original USD price of your token if you are building a stablecoin.
You are going to build this genesis file progressively. The genesis contains a lot of information, such as minting (opens new window), staking (opens new window), or slashing (opens new window) parameters. You can adjust these parameters (opens new window) if you know what you are doing.
The genesis only needs to be generated once, then it is distributed and copied onto all the network's machines.
# Token name(s)
One of the simpler parameters that you can decide on is the name of the staking token. The name you choose is for the indivisible denomination. For the Cosmos Hub that is
uatom, which is understood as a millionth of an ATOM.
For instance, if you decide that your token is the STONE and that each STONE contains a billion indivisible units, by convention you would name the unit
nstone, as in a nano STONE. The chain only cares about this
nstone unit. The
STONE will be an artifact reserved for human interaction.
Be sure to have enough decimals as there is a hard-coded 10,000,000 number, which is the minimum stake required where creating a validator.
Keeping on-brand, your new chain is named stone-age.
It is customary to append a number to your chain name. Whenever a hard fork happens, you can increment this number for easier identification.
To create a brand new genesis file for your chain, run:
This creates a large genesis file with the default values of the Cosmos SDK. You can start replacing all occurrences of
stake (the default token name) with
nstone in the genesis file.
Correctly identify where this genesis file is located. Most likely it is in
~/.myprojectd/config/genesis.json. If this is not where you want to prepare your genesis file, you can add
--home another/folder to all your commands.
If you are planning on having more denominations than your staking token, this is defined in the next step.
# Genesis accounts
Genesis accounts are accounts that exist in the genesis. They can be there because of a pre-sale of tokens, or of simple allotments, or for any other reason.
Genesis accounts need to be included in the genesis using the command
add-genesis-account. Like any account, genesis accounts have addresses that must be collected.
If these genesis accounts are third parties, make sure in more ways than one that you get the right values, whether by email or other means.
Your addresses have a prefix, which you can define instead of the Cosmos Hub default of
cosmos. Your blockchain may use the prefix
cavedweller for example. This is typically defined in
You can also decide to allocate new tokens to your genesis accounts. There is no limit to the number of genesis accounts or the number of extra tokens in the genesis.
If you introduce another token named
nflint, and Alice has the address
cavedweller1nw793j9xvdzl2uc9ly8fas5tcfwfetercpdfqq, you could make her a genesis account with:
This credits her with 5 STONE and 2 FLINT. It has also given her an
account_number in the genesis.
You can do the same for all your genesis accounts, which includes your validators.
Advanced topics include vesting (opens new window) on these genesis accounts. For information on how to configure them, do:
When you have defined the genesis accounts, it is time to define the genesis validators.
# Validator stakes
The genesis needs to define the starting validators because, at least, a validator needs to propose the first block that comes after the genesis. However, if no validators have been agreed on by consensus, then the first block cannot be produced.
Assume that you have a team of validators that are your starting validators. They are also genesis accounts that you defined previously, so they have tokens. Now you need to:
- Credit each genesis validator the agreed staked token amounts.
- Collect signed transactions from them that identify them as validators.
Each validator needs to generate a transaction locally and send it to you, the party that collects them into the genesis.
To each validator you send:
account_numberthat was given to them when calling
- A confirmation of the number of tokens that you have credited them.
Each validator operator then has to run a
gentx command. This command is not to be run on the server. Instead, it is run on the computer that hosts the cold validator operator app key, using the keyring of your choice. Collect the consensus public key from Tendermint KMS, for instance
If this is Alice, she may run:
This creates a JSON file on the validator's computer, typically in
~/.myprojectd/config/gentx/ with the following form:
Because a validator can be configured with multiple flags, look at:
Each validator then returns to you their transaction file(s).
# Validators aggregation
When a validator returns a signed transaction to you, make sure that it is the one you expect and add the JSON file in the
~/.myprojectd/config/gentx folder along with all the others in your server.
When you have all of the validator responses, you add them all in the genesis like so:
If some validators are not cooperating fast enough, you can do the operation when you have received a reply from enough of them to start a valid network. Late potential validators can always send transactions to the live network to become validators at a later date.
This completes your creation of the genesis. What do you do with it?
All your genesis validators and all other potential node operators need access to this genesis file for them to be technically able to start the network. So put it on a public server. Picking a dedicated GitHub repository for all things production is a good example.
The relevant parties should also come to a consensus that this genesis represents the agreed initial state. Indeed:
- Parties are being granted genesis tokens and one may not accept being omitted.
- Parties are enroling to be validators, so there needs to be agreement on this file.
This is the only block that needs a social consensus on its content. All other blocks will be agreed on technically by the PoS consensus.
In turn, each validator and node operator copies this file on their own machine, in the designated folder, typically
To summarize, this section has explored:
- The contents of the blockchain genesis: the original validators and their stakes, and the original state values defined, such as the minting, staking, and slashing parameters.
- How to name and create a new genesis file.
- The nature and purpose of genesis accounts, and how to add them to the genesis file.
- How to name, define, and allocate tokens to your genesis accounts.
- How to define the genesis validators, credit them with the agreed staked tokens, collect their first signed transactions, and aggregate them.
- How to publish the genesis file so that it can be accessed by all those needing their own copy to be able to start the network.