Add steps to generate exported state and mainnet genesis file

This commit is contained in:
Nabarun 2025-05-14 19:28:49 +05:30
parent b8924fa7fb
commit 0e8153cb3a
3 changed files with 49 additions and 9 deletions

View File

@ -7,26 +7,64 @@
## Generate mainnet genesis file
<!-- TODO: Add steps to generate genesis file -->
- Fetch the stack in machine where the testnet chain node is running
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Run script to export state from testnet chain
```bash
~/cerc/laconicd-stack/scripts/export-testnet-state.sh <path-to-testnet-deployment>
```
- The file will be generated in `<path-to-testnet-deployment>/export/testnet-state.json`
<!-- TODO: Create playbook to run steps below -->
- If mainnet node will be setup in new machine, fetch the stack again
- Build container image
```bash
# Fetch laconicd repo specified in stack
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull
# Build image
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
```
- Copy the generated exported state from earlier
```bash
cp <path-to-exported-testnet-state> ~/cerc/laconicd-stack/testnet-state.json
```
- Run script to generate genesis file using the exported state
```bash
~/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh ~/cerc/laconicd-stack/testnet-state.json
```
- Genesis file will generated in `output/genesis.json`
## Run node
- Update [run-first-validator-vars.yml](playbooks/first-validator/run-first-validator-vars.yml) with required values:
- Use the mainnet genesis file generated in the previous step
```bash
# Private key of the existing account in hex format (required for gentx)
pvt_key: ""
# Path to the generated mainnet genesis file
# Path to the generated mainnet genesis file generated in the previous step
genesis_file: "<path-to-generated-genesis-file>"
# Optional
cerc_chain_id: "laconic-mainnet"
# Set custom moniker for the node
cerc_moniker: "MainnetNode"
min_gas_price: 0.001
cerc_loglevel: "info"
# Set desired key name
key_name: "validator"
```

View File

@ -43,5 +43,7 @@ jq --arg old "$zero_address" --arg new "$lps_lockup_address" \
'.app_state.bank.balances |= map(if .address == $old then .address = $new else . end)' "$mainnet_genesis_file" > tmp.$$.json \
&& mv tmp.$$.json "$mainnet_genesis_file"
# TODO: Dump JSON for allocations in LPS_LOCKUP_MODULE_ACCOUNT state
# Ensure that resulting genesis file is valid
laconicd genesis validate

View File

@ -2,7 +2,7 @@ version: "1.0"
name: mainnet-laconicd
description: "Laconicd full node"
repos:
- git.vdb.to/cerc-io/laconicd@v0.1.11
- git.vdb.to/cerc-io/laconicd@mainnet
containers:
- cerc/laconicd
pods: