Skip to content

Commit

Permalink
Merge branch 'ian/pregenesis-tx' (#374)
Browse files Browse the repository at this point in the history
Ian/pregenesis tx
  • Loading branch information
brentstone authored Aug 7, 2024
2 parents b4d5a95 + e787b44 commit 879faf5
Show file tree
Hide file tree
Showing 15 changed files with 334 additions and 271 deletions.
8 changes: 3 additions & 5 deletions packages/docs/pages/networks.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Namada Networks

This page is for Namada networks.

There are two network types:
This section contains information about the current public Namada networks (mainnet and testnet) as well as instructions for creating a new decentralized network or local devnet.

* [Mainnets](./networks/mainnets.mdx) - the main networks
* [Testnets](./networks/testnets.mdx) - the test networks

The mainnet chain-ids are prefixed with `main` and the testnet chain-ids are prefixed with `test`.
* [Setting up a local network](./networks/starting-network/local-network.mdx) - how to set up a local network (useful for development and testing)
* [Setting up a decentralized network](./networks/starting-network/genesis-flow.mdx) - how to launch a decentralized network involving multiple participants
5 changes: 5 additions & 0 deletions packages/docs/pages/networks/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mainnets": "Mainnets",
"testnets": "Testnets",
"starting-network": "Starting a network"
}
File renamed without changes.
12 changes: 12 additions & 0 deletions packages/docs/pages/networks/starting-network/genesis-flow.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Setting up a decentralized Namada network

Setting up a decentralized Namada network requires coordination between two distinct parties:

1. [The network coordinator](./genesis-flow/coordinator.mdx#the-network-coordinator)
2. [The pre-genesis participants](./genesis-flow/participants.mdx#pre-genesis-network-participants)

This process is also called the **genesis ceremony** or the **pre-genesis process**.

The purpose of this process is to establish the initial (genesis) state of the network -- including initial account balances, an initial validator set and an initial stake distribution -- through social consensus.
This is done by generating *pre-genesis transactions* that define established accounts, validator accounts, and bonds. See the [pre-genesis participants](./genesis-flow/participants.mdx#pre-genesis-network-participants)
section for more details on generating pre-genesis transactions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Steps } from 'nextra-theme-docs'

The network coordinator is responsible for:

0. [Setup](#setup)
1. [Collecting pre-genesis public keys](#collecting-pre-genesis-public-keys)
2. [Allocating pre-genesis NAM balances](#allocating-pre-genesis-nam-balances)
3. [Collecting pre-genesis transactions](#collecting-pre-genesis-transactions)
4. [Generating the genesis block](#generating-the-genesis-block)
1. [Setup](#setup)
2. [Collecting pre-genesis public keys](#collecting-pre-genesis-public-keys)
3. [Allocating pre-genesis NAM balances](#allocating-pre-genesis-nam-balances)
4. [Collecting pre-genesis transactions](#collecting-pre-genesis-transactions)
5. [Generating the genesis block](#generating-the-genesis-block)

### Setup

Expand All @@ -26,22 +26,40 @@ Conventionally, the network coordinator hosts a git repository that allows the p

### Allocating pre-genesis NAM balances

Once the participants have [submitted their keys and addresses](./participants.mdx#submitting-keys-and-addresses) the network coordinator must allocate balances to these addresses/public keys. The coordinator will often have prior identity information associated with desired balances, which they will then associate with the public keys and addresses in order to set the correct balances in `balances.toml`. The coordinator must also ensure that the total pre-genesis NAM balances allocated to the pre-genesis network participants is equal to the total NAM supply.
Once the participants have [submitted their keys and addresses](./participants.mdx#submitting-keys-and-addresses), the network coordinator must allocate balances to these addresses/public keys. The coordinator will often have prior identity information associated with desired balances, which they will then associate with the public keys and addresses in order to set the correct balances in `balances.toml`. The coordinator must also ensure that the total pre-genesis NAM balances allocated to the pre-genesis network participants is equal to the total NAM supply.

After this is completed, the network coordinator will publish the `balances.toml` file that contains the pre-genesis NAM balances allocated to the pre-genesis network participants. The `balances.toml` file should be published in the same location as the pre-genesis public keys were submitted.
After this is completed, the network coordinator will publish the `balances.toml` file that contains the pre-genesis NAM balances allocated to the pre-genesis network participants. The `balances.toml` file should be published at the same location to which the pre-genesis public keys were submitted.


### Collecting pre-genesis transactions

Once the participants have [submitted their keys and addresses](./participants.mdx#submitting-keys-and-addresses) the network coordinator must collect the signed pre-genesis transactions from the pre-genesis network participants. The network coordinator must ensure that the total number of pre-genesis transaction files collected is equal to the total number of pre-genesis network participants.
Once the participants have [submitted their keys and addresses](./participants.mdx#submitting-keys-and-addresses), the network coordinator must collect the signed pre-genesis transactions from the pre-genesis network participants.

The network coordinator then aggregates these transaction files into one file and saves it as the `transactions.toml` file to be used in the generation of the genesis block.

The `transactions.toml` file is validated by the network coordinator to ensure that each transaction has been correctly signed by each pre-genesis network participant. The network coordinator must ensure that the `transactions.toml` file is valid before proceeding to the next step.

### Generating the genesis block

Once the network coordinator has collected the pre-genesis public keys, allocated pre-genesis NAM balances, and collected pre-genesis transactions, the network coordinator is ready to generate the genesis block.
Once the network coordinator has collected the pre-genesis public keys, allocated pre-genesis NAM balances, and collected pre-genesis transactions, the network coordinator is ready to generate the genesis block.

The following command can be used to generate a `.tar.gz` archive that packages all genesis files needed to bootstrap any new node which wishes to join the chain.

```
namadac utils init-network \
--genesis-time $GENESIS_TIME \
--wasm-checksums-path $CHECKSUMS_PATH \
--chain-prefix $CHAIN_PREFIX \
--templates-path $TEMPLATES_PATH
```
where:
- `GENESIS_TIME` is a string containing the desired network start time in the format `YYYY-MM-DDTHH:MM:SS.000000000+00:00`. Nodes will not attempt to make blocks before this time.
- `CHECKSUMS_PATH` is the path to the chain's `checksums.json` file
- `CHAIN_PREFIX` is a string of alphanumeric characters that will be used as the first part of the chain-id, chosen by the network coordinator
- `TEMPLATES_PATH` is the path to a directory containing the five `toml` files required to create the genesis block -- `balances.toml`, `transactions.toml`, `tokens.toml`, `paramaters.toml` and `validity-predicates.toml`

After successfully running the command, a file will be generated with the name `$CHAIN_ID.tar.gz` containing the genesis contents. The network coordinator must host this file so that
other nodes can download and apply it to their nodes ahead of the genesis time.


</Steps>
Loading

0 comments on commit 879faf5

Please sign in to comment.