Author SHA1 Message Date
Shreerang Kale 338966f43f Update scripts and playbooks to sign gentx on a separate machine 2025-06-09 12:51:53 +05:30
ishavenikarandIshaVenikar 6733aa7318 Add steps to compress testnet state JSON file (#11)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #11
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-06-04 11:25:23 +00:00
ishavenikarandIshaVenikar 48939ffbd7 Create lockup module JSON from LPS distribution excel file (#10)
Part of https://www.notion.so/Lockup-LPS-tokens-into-a-module-account-1f2a6b22d472802cbb35e8ce052d22ca?pvs=23

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #10
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-06-04 10:55:10 +00:00
ishavenikarandIshaVenikar b87609436a Update dgraph URL env value in demo steps (#9)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #9
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-06-02 11:36:23 +00:00
ishavenikarandIshaVenikar 8a7d184610 Update port for multisig app (#8)
Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #8
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-05-30 06:32:11 +00:00
ishavenikarandIshaVenikar e3927d4af2 Update chain registry name in vars file (#7)
Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #7
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-05-29 05:06:54 +00:00
ishavenikarandIshaVenikar 1886a9acf0 Add playbook to setup cosmos multisig app (#6)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
Reviewed-on: #6
Co-authored-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
Co-committed-by: ishavenikar <ishavenikar@noreply.git.vdb.to>
2025-05-28 13:36:34 +00:00
nabarun 40ac26bd78 Add steps to configure TMKMS in node deployments (#4)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

- TMKMS config is for `softsign` backend provider

Reviewed-on: #4
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2025-05-20 13:55:15 +00:00
3d7ba45796 Add playbook to send create-validator tx for subsequent nodes (#3)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e of cerc-io/laconicd#66
- Use calculated staking amount for running validator nodes

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Reviewed-on: #3
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
2025-05-16 09:54:09 +00:00
shreerangandShreerang Kale 3b526fac78 Add playbook to run subsequent validator nodes (#2)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Reviewed-on: #2
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
2025-05-16 05:08:33 +00:00
30 changed files with 1731 additions and 138 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
*-spec.yml
# Playbook vars
playbooks/first-validator/first-validator-vars.yml
*-vars.yml
+3 -1
View File
@@ -1,3 +1,5 @@
# laconicd-stack
- Follow [run-first-validator.md](./docs/run-first-validator.md) to run the first validator node
- Follow [run-first-validator.md](docs/run-first-validator.md) to run the first validator node
- Follow [cosmos-multisig-app playbook](./playbooks/cosmos-multisig-app/README.md) to run the Cosmos Multisig app
- Follow [run-validator.md](docs/run-validator.md) to run subsequent validator nodes
+45
View File
@@ -0,0 +1,45 @@
{
"chainId": "laconic-mainnet",
"chainName": "Laconic Mainnet",
"rpc": "",
"rest": "",
"bip44": {
"coinType": 118
},
"bech32Config": {
"bech32PrefixAccAddr": "laconic",
"bech32PrefixAccPub": "laconipub",
"bech32PrefixValAddr": "laconicvaloper",
"bech32PrefixValPub": "laconicvaloperpub",
"bech32PrefixConsAddr": "laconicvalcons",
"bech32PrefixConsPub": "laconicvalconspub"
},
"currencies": [
{
"coinDenom": "ALNT",
"coinMinimalDenom": "alnt",
"coinDecimals": 18
}
],
"feeCurrencies": [
{
"coinDenom": "ALNT",
"coinMinimalDenom": "alnt",
"coinDecimals": 18,
"gasPriceStep": {
"low": 0.01,
"average": 0.01,
"high": 0.02
}
}
],
"stakeCurrency": {
"coinDenom": "ALNT",
"coinMinimalDenom": "alnt",
"coinDecimals": 18
},
"features": [
"stargate",
"ibc-transfer"
]
}
+513
View File
@@ -0,0 +1,513 @@
# demo
## Prerequisites
- [ansible](playbooks/README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
- [tmkms](https://github.com/iqlusioninc/tmkms?tab=readme-ov-file#installation)
- Install with `softsign` feature
```bash
cargo install tmkms --features=softsign --version=0.14.0
```
- Install `gzip` using `sudo apt install gzip`
- testnet-state.gz ([exported testnet state](./run-first-validator.md#export-testnet-state))
- LPS distribution Google spreadsheet URL or CSV file path
## Steps
- In current working directory demo, keep exported `testnet-state.gz` file from prerequisites
- Fetch stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Generate LPS lockup distribution JSON file
```bash
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-file-path>" -d "~/cerc/laconicd-stack/data"
```
- This will generate the `distribution.json` file
- Export current working directory
```bash
export CWD=$(pwd)
```
- Extract the testnet-state JSON file
```
gzip -dc $CWD/testnet-state.gz > $CWD/testnet-state.json
# Remove zip folder
rm -rf testnet-state.gz
```
- Set envs:
```bash
export EXPORTED_STATE_PATH=$CWD/testnet-state.json
export LPS_DISTRIBUTION_PATH=~/cerc/laconicd-stack/data/distribution.json
# Test address that does not exist on testnet chain
export EARLY_SUPPORTS_ACC_ADDR=laconic1gwytamfk3m5n0gsawh5vpwxkwd3vapmvzpp6nz
```
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
```
- Run playbook to use exported state for generating mainnet genesis:
```bash
ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
```
- Genesis file will be generated in output directory along with a file specifying the staking amount
```bash
# List files in output directory - genesis.json and staking-amount.json
ls -l output
```
- Set env for key of account with balance in testnet:
```bash
export FIRST_ACCOUNT_KEY=<KEY_OF_ACCOUNT_WITH_BALANCE_IN_TESTNET>
```
- Create and populate first-validator-vars.yml:
```bash
cat > ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml << EOL
# Use a private key of an existing account with balance in testnet
pvt_key: $FIRST_ACCOUNT_KEY
# Path to the generated mainnet genesis file
# Use the absolute path of generated output directory in the previous steps
genesis_file: "$CWD/output/genesis.json"
# Path to staking-amount.json generated in previous steps
staking_amount_file: "$CWD/output/staking-amount.json"
# Set custom moniker for the node
cerc_moniker: "LaconicMainnet"
# Set desired key name
key_name: "laconic-validator"
cerc_chain_id: "laconic-mainnet"
min_gas_price: 0.001
cerc_loglevel: "info"
key_name: "laconic-validator"
EOL
```
- Export the data directory and mainnet deployment directory as environment variables:
```bash
# Parent directory where the deployment directory will live
export DATA_DIRECTORY=$CWD
# Set mainnet deployment directory
export MAINNET_DEPLOYMENT_DIR=mainnet-laconicd-deployment
```
- Run ansible playbook to submit gentx and setup the node:
```bash
ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
```
- Create tmks config directory for first validator node
```bash
tmkms init ./tmkms-first-node
```
- Update the TMKMS configuration file `./tmkms-first-node/tmkms.toml`:
```bash
cat > ./tmkms-first-node/tmkms.toml << EOL
[[chain]]
id = "laconic-mainnet"
key_format = { type = "cosmos-json", account_key_prefix = "laconicpub", consensus_key_prefix = "laconicvalconspub" }
state_file = "$CWD/tmkms-first-node/state/priv_validator_state.json"
[[validator]]
chain_id = "laconic-mainnet"
addr = "tcp://localhost:26659"
secret_key = "$CWD/tmkms-first-node/secrets/kms-identity.key"
protocol_version = "v0.34"
reconnect = true
[[providers.softsign]]
key_type = "consensus"
path = "$CWD/tmkms-first-node/secrets/priv_validator_key"
chain_ids = ["laconic-mainnet"]
EOL
```
- Import the private validator key into tmkms:
```bash
tmkms softsign import $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json $CWD/tmkms-first-node/secrets/priv_validator_key
```
- Start TMKMS:
```bash
tmkms start --config $CWD/tmkms-first-node/tmkms.toml
```
- Expected example output:
```bash
INFO tmkms::commands::start: tmkms 0.14.0 starting up...
INFO tmkms::keyring: [keyring:softsign] added consensus Ed25519 key: {"@type":"/cosmos.crypto.ed25519.PubKey","key":"T24No1A1FmetNRVCOSg2G2XAKWh97oBXuELdAD6DFgw="}
INFO tmkms::connection::tcp: KMS node ID: 7f5fd8dae8953e964e7e56edd4700f597ea0d45c
ERROR tmkms::client: [laconic-mainnet@tcp://localhost:26659] I/O error: Connection refused (os error 111)
```
NOTE: The errors dissapear once the laconicd node starts
- Note the pubkey logged at start for comparing later with validator pubkey on chain
- In a new terminal export envs
```bash
export CWD=$(pwd)
export DATA_DIRECTORY=$CWD
export MAINNET_DEPLOYMENT_DIR=mainnet-laconicd-deployment
# Test address that does not exist on testnet chain
export EARLY_SUPPORTS_ACC_ADDR=laconic1gwytamfk3m5n0gsawh5vpwxkwd3vapmvzpp6nz
```
- Enable TMKMS in the laconicd node configuration:
```bash
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
```
- Remove the validator key from node deployment as it is no longer required
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
```
- Run the first validator node
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
- Check logs to ensure that node is running:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
```
- The chain will start running after some time.
- Verify that validator and TMKMS pubkeys match
- Get validator pubkey on chain
```bash
# Check consensus_pubkey in output
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators -o json | jq .validators'
```
- Compare it with the pubkey noted from logs in TMKMS
- Check bonds list to confirm that testnet state was transferred properly:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bond list'
```
- Check `alps` and `alnt` tokens total supply:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bank total-supply'
```
- Query the `lps_lockup` account and view distribution:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup'
```
- Query the `lps_lockup` and early supports accounts balances:
```bash
lockup_account_address=$(laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup -o json | jq -r .account.value.base_account.address')
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $lockup_account_address"
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $EARLY_SUPPORTS_ACC_ADDR"
```
- Copy the genesis file to [config](./config) folder:
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
```
- Copy the staking amount file to [config](./config) folder:
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.json
```
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml
```
- Check first validator node address using:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@host.docker.internal:26656'
```
- Update `cerc_peers` in `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml`:
```bash
cerc_moniker: "LaconicMainnetNode-2"
cerc_peers: "<node-id>@host.docker.internal:26656"
```
- Export the data directory and mainnet deployment directory as environment variables:
```bash
# Parent directory where the deployment directory will live
export DATA_DIRECTORY=$CWD
# Set mainnet deployment directory
export MAINNET_DEPLOYMENT_DIR=mainnet-validator-deployment
```
- Update port mappings in `~/cerc/laconicd-stack/playbooks/validator/templates/specs/spec-template.yml.j2` to avoid port conflicts with first validator node:
```bash
network:
ports:
laconicd:
- '3060:6060'
- '36659:26659'
- '36657:26657'
- '36656:26656'
- '3473:9473'
- '3090:9090'
- '3317:1317'
```
- Run ansible playbook to set up your validator node deployment:
```bash
ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml
```
- Create tmks config directory for second validator node
```bash
tmkms init ./tmkms-second-node
```
- Update the TMKMS configuration file `./tmkms-second-node/tmkms.toml`:
```bash
cat > ./tmkms-second-node/tmkms.toml << EOL
[[chain]]
id = "laconic-mainnet"
key_format = { type = "cosmos-json", account_key_prefix = "laconicpub", consensus_key_prefix = "laconicvalconspub" }
state_file = "$CWD/tmkms-second-node/state/priv_validator_state.json"
[[validator]]
chain_id = "laconic-mainnet"
addr = "tcp://localhost:36659"
secret_key = "$CWD/tmkms-second-node/secrets/kms-identity.key"
protocol_version = "v0.34"
reconnect = true
[[providers.softsign]]
key_type = "consensus"
path = "$CWD/tmkms-second-node/secrets/priv_validator_key"
chain_ids = ["laconic-mainnet"]
EOL
```
- Import the private validator key into tmkms:
```bash
tmkms softsign import $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json $CWD/tmkms-second-node/secrets/priv_validator_key
```
- Start TMKMS:
```bash
tmkms start --config $CWD/tmkms-second-node/tmkms.toml
```
- In a new terminal export envs
```bash
export CWD=$(pwd)
export DATA_DIRECTORY=$CWD
export MAINNET_DEPLOYMENT_DIR=mainnet-validator-deployment
```
- Enable TMKMS in the laconicd node configuration:
```bash
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
```
- Start the node:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
- Check logs to ensure that node is running:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
```
- Export required env vars for creating validator:
```bash
# private key of another existing account with balance
export PVT_KEY=<private-key-in-hex-format>
# desired key name
export KEY_NAME=validator-2
```
- Run ansible playbook to create validator on running chain:
```bash
ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
```
- Check the validator list:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
```
- Remove the validator key from node deployment as it is no longer required
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
```
- Copy the example variables file for cosmos-multisig app playbook:
```bash
cp ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml
```
- Update env values in `cosmos-multisig-vars.yml` with your node RPC URL
```bash
next_public_node_addresses: '["http://localhost:26657"]'
node_rest_endpoint: 'http://localhost:1317'
next_public_is_http_enabled: true
# Set network mode to host so that browser app and backend can use the same node localhost RPC URL
use_host_network: "host"
# Set local host URL for dgraph server
dgraph_domain: "http://localhost:8080"
```
- Set envs:
```bash
# Set multisig app deployment directory
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
```
- Run playbook to setup cosmos multisig app
```bash
ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml
```
- Check logs to ensure that the app is running:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f
```
- The app will be running on <http://localhost:7000/laconic>
### Create a multisig with both the validator accounts
- On opening the app, a prompt will be shown to add laconic network to you Keplr wallet. Click on `Approve`
- Go to home and click on `I don't have a multisig`
- Add the addresses of your validators as member 1 and member 2
- Set the threshold to 2 out of 2 members (Both the validators should sign the TX to broadcast it)
- Click on `Submit` and `Create multisig`
### Create and sign transaction
- Add accounts in Keplr wallet for signing the transaction
- Open Keplr wallet and click on the user icon in the top right corner
- Click on `Add wallet`, then select `Import an existing wallet` and go to `Use recovery phrase or private key`
- Select the `Private key` tab and then paste the private key of the validator account and click on import
- Set a name for the wallet (used when connecting wallet to app for signing transaction) and click on next
- Search for `Laconic network` and select it, then click on `Save`
- Follow the above steps for the second validator account
- Send fund to the generated multisig address using Keplr
- Open Keplr wallet and select the account from which you wish to transfer the funds to the multisig address
- Search and `laconic` and select the network. Select `Send` and paste the multisig address and set amount to `0.000000000001` (1000000alnt)
- Go to `home`, paste your multisig address and click on `Use this multisig`
- You will see the multisig members and holdings for the address
- Click on `Create new transaction` and then click on `Bank Send` under `Add New Msg`
- Enter the recipient address ( Eg: `laconic1n4wa366kh0zxndwyq3kkse9ulz9jv9xukx3hy4`), amount to be transfered and memo (optional)
- Click on create transaction
- Go back to the multisig info page and scroll down to the `Transactions` section
- Click on `Verify identity` and connect the app to your validator account in the Keplr wallet
- After approving the connection, you will see the list of transactions created by your multisig
- Click on your transaction and under `Choose wallet to sign`, click on connect Keplr
- After connecting the wallet, click on `Sign transaction` and approve the transaction
- Go back to multisig info page, switch to the second validator account in Keplr wallet and repeat the same process to sign the transaction with the second validator account
- Once the transaction is signed by both the validators, click on `Broadcast Transaction`
- Confirm funds transfer by checking balance of recipient address
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances laconic1n4wa366kh0zxndwyq3kkse9ulz9jv9xukx3hy4"
```
## Cleanup
- Remove deployments and other config files
```bash
rm -rf *-spec.yml *-deployment tmkms-* output
```
+277 -62
View File
@@ -4,56 +4,15 @@
- [ansible](playbooks/README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
- LPS distribution Google spreadsheet URL or CSV file path
- Install `gzip` using `sudo apt install gzip`
## Generate mainnet genesis file
## Setup node
- Fetch the stack in machine where the testnet chain node is running
- Run the following steps in the machine where the mainnet node is to be setup
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Copy the example variables file if not already done:
- 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`
- If mainnet node will be setup in new machine, fetch the stack again
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Copy over the exported `testnet-state.json` file to target machine
- Set envs
```bash
export EXPORTED_STATE_PATH=<absolute-path-to-exported-testnet-state-json>
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
```
- Run playbook to use exported state for generating mainnet genesis
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
```
- Genesis file will be generated in output directory along with a file specifying the staking amount
```bash
# List files in output directory - genesis.json and staking-amount.json
ls -l output
```
## Run node
<!-- TODO: Add steps to get private key of validator account from laconic testnet -->
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
```
@@ -61,16 +20,6 @@
- Update `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
```bash
# Private key of the existing account in hex format (required for gentx)
pvt_key: ""
# Path to the generated mainnet genesis file
# Use the absolute path of generated output directory in the previous steps
genesis_file: "<absolute-path-to-generated-output-dir>/genesis.json"
# Path to staking-amount.json generated in previous steps
staking_amount_file: "<absolute-path-to-generated-output-dir>/staking-amount.json"
# Set custom moniker for the node
cerc_moniker: "LaconicMainnetNode"
@@ -89,10 +38,232 @@
export MAINNET_DEPLOYMENT_DIR=
```
- Run ansible playbook to submit the gentx and run the node:
- Run ansible playbook to setup the node:
```bash
ansible-playbook -i localhost, -c local playbooks/first-validator/run-first-validator.yml
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
```
- Get the public key of your node:
```bash
docker run -it \
-v ./$MAINNET_DEPLOYMENT_DIR/data/laconicd-data:/root/.laconicd \
cerc/laconicd:local bash -c "laconicd tendermint show-validator"
```
NOTE: This public key is required in next step to generate the genesis file
### Setup TMKMS (Optional but Recommended)
<!-- Reference: https://docs.osmosis.zone/osmosis-core/keys/tmkms/#setup-tmkms -->
- For integrating existing TMKMS with laconicd, follow steps below in the machine where TMKMS is setup
- Set `$TMKMS_HOME` to the directory path containing TMKMS config files
```bash
# Contents of tmkms config directory
ls -l $TMKMS_HOME
drwxrwxr-x 2 ... schema
drwx------ 2 ... secrets
drwxrwxr-x 2 ... state
-rw-rw-r-- 1 ... tmkms.toml
```
- Update the TMKMS configuration file `$TMKMS_HOME/tmkms.toml`:
```toml
[[chain]]
id = "laconic-mainnet"
key_format = { type = "cosmos-json", account_key_prefix = "laconicpub", consensus_key_prefix = "laconicvalconspub" }
# Replace <TMKMS_HOME> with absolute path to tmkms config directory
state_file = "<TMKMS_HOME>/state/priv_validator_state.json"
[[validator]]
chain_id = "laconic-mainnet"
# Replace <NODE_IP> with actual IP address of the laconicd node
addr = "tcp://<NODE_IP>:26659"
# Replace <TMKMS_HOME> with absolute path to tmkms config directory
secret_key = "<TMKMS_HOME>/secrets/kms-identity.key"
protocol_version = "v0.34"
reconnect = true
[[providers.softsign]]
key_type = "consensus"
# Replace <TMKMS_HOME> with absolute path to tmkms config directory
path = "<TMKMS_HOME>/secrets/priv_validator_key"
chain_ids = ["laconic-mainnet"]
```
- Copy your validator key to TMKMS:
- The validator key in laconicd node deployment is present at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json`
- Place the validator key file in TMKMS config directory at `$TMKMS_HOME/secrets/`
- Import the private validator key into tmkms:
```bash
tmkms softsign import $TMKMS_HOME/secrets/priv_validator_key.json $TMKMS_HOME/secrets/priv_validator_key
```
- Remove the JSON key file
```bash
rm $TMKMS_HOME/secrets/priv_validator_key.json
```
- Start TMKMS:
```bash
tmkms start --config $TMKMS_HOME/tmkms.toml
```
- Expected example output:
```bash
INFO tmkms::commands::start: tmkms 0.14.0 starting up...
INFO tmkms::keyring: [keyring:softsign] added consensus Ed25519 key: {"@type":"/cosmos.crypto.ed25519.PubKey","key":"T24No1A1FmetNRVCOSg2G2XAKWh97oBXuELdAD6DFgw="}
INFO tmkms::connection::tcp: KMS node ID: 7f5fd8dae8953e964e7e56edd4700f597ea0d45c
ERROR tmkms::client: [laconic-mainnet@tcp://localhost:26659] I/O error: Connection refused (os error 111)
```
NOTE: The errors dissapear once the laconicd node starts
- Note the pubkey logged at start for comparing later with validator pubkey on chain
- Enable TMKMS in the laconicd node configuration:
```bash
# Set TMKMS_ENABLED to true in the node's config.env
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
```
- Remove the validator key from node deployment as it is no longer required
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
```
NOTE: Store it safely offline in case of an emergency
## Export testnet state
- Run the following steps in machine where the testnet node is running
- Get your private key from testnet deployment:
```bash
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
```
NOTE: Store this key securely as it is needed in later steps
- Stop the node for SAPO testnet:
```bash
laconic-so deployment --dir <testnet-deployment-dir> stop
```
- 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 <absolute-path-to-testnet-deployment>
```
- The compressed gzip will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.gz`
## Generate mainnet genesis file
- Run the following steps in secure machine separate from the one where the node is setup
- Fetch the stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Copy over compressed `testnet-state.gz` file
- Extract the testnet-state JSON file:
```bash
gzip -dc <path-to-compressed-file>/testnet-state.gz > testnet-state.json
# Remove zip folder
rm -rf <path-to-compressed-file>/testnet-state.gz
```
- Generate LPS lockup distribution JSON file
```bash
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-file-path>" -d "<destination-folder-for-json-file>"
```
- This will generate the `distribution.json` file
- Set envs:
```bash
export EXPORTED_STATE_PATH=<absolute-path-to-exported-testnet-state-json>
export LPS_DISTRIBUTION_PATH=<absolute-path-to-distribution-json>
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
# Parent directory where the deployment directory will live
export DATA_DIRECTORY=
# Set mainnet deployment directory
# for eg: mainnet-laconicd-deployment
export MAINNET_DEPLOYMENT_DIR=
```
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
```
- Edit `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
```bash
# Use the public key exported in previous step (make sure to wrap it with single quotes [''])
validator_pub_key: '<public-key-of-your-node>'
```
- Run playbook to use exported state for generating mainnet genesis:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
```
- Input private key of the existing account that was exported in previous steps when prompted
- Genesis file will be generated in output directory along with a file specifying the staking amount
```bash
# List files in output directory - genesis.json and staking-amount.json
ls -l output
```
## Run node
- Copy the genesis file to the mainnet deployment tmp directory:
```bash
cp <absolute-path-to-genesis-json> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/genesis.json
```
- Command to run node:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
- Check logs to ensure that node is running:
@@ -101,12 +272,56 @@
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
```
## Publish Genesis File and Node Address
- If TMKMS has been configured verify that validator and TMKMS pubkeys match:
- Copy the genesis file to [genesis](./genesis) folder:
- Get validator pubkey on chain
```bash
# Check consensus_pubkey in output
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators -o json | jq .validators'
```
- Compare it with the pubkey noted from logs in TMKMS
- Check bonds list to confirm that testnet state was transferred properly:
```bash
sudo cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ./genesis/mainnet-genesis.json
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bond list'
```
- Check `alps` and `alnt` tokens total supply:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bank total-supply'
```
- Query the `lps_lockup` account and view distribution:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup'
```
- Query the `lps_lockup` and early supports accounts balances:
```bash
lockup_account_address=$(laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup -o json | jq -r .account.value.base_account.address')
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $lockup_account_address"
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $EARLY_SUPPORTS_ACC_ADDR"
```
## Publish required artifacts
- Copy the genesis file to [config](./config) folder:
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
```
- Copy the staking amount file to [config](./config) folder:
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.json
```
- Get your node's address:
@@ -117,4 +332,4 @@
- Add your node's address to [node-addresses.yml](./node-addresses.yml)
- Submit a PR with this genesis file and node address so that it is available to other validators
- Submit a PR with this genesis file, staking amount file and node address so that it is available to other validators
+192
View File
@@ -0,0 +1,192 @@
# Run Validator Node
## Prerequisites
- [ansible](playbooks/README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
## Setup Node
- Get your private key from testnet deployment:
```bash
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
```
NOTE: Store this key securely as it is needed in later steps
- Stop the node for SAPO testnet:
```bash
laconic-so deployment --dir <testnet-deployment-dir> stop
```
- Fetch the stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator.
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml
```
- Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values:
```bash
# Set custom moniker for the node
cerc_moniker: "<your-moniker>"
# Set persistent peers (comma-separated list of node IDs and addresses)
# You can find the list of available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml
cerc_peers: "<node-id>@<node-host>:26656,<node-id>@<node-host>:26656"
```
- Export the data directory and mainnet deployment directory as environment variables:
```bash
# Parent directory where the deployment directory will live
export DATA_DIRECTORY=
# Set mainnet deployment directory
# for eg: mainnet-laconicd-deployment
export MAINNET_DEPLOYMENT_DIR=
```
- Run ansible playbook to set up your validator node deployment:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml
```
### Setup TMKMS (Optional but Recommended)
<!-- Reference: https://docs.osmosis.zone/osmosis-core/keys/tmkms/#setup-tmkms -->
- For integrating existing TMKMS with laconicd, follow steps below in the machine where TMKMS is setup
- Set `$TMKMS_HOME` to the directory path containing TMKMS config files
```bash
# Contents of tmkms config directory
ls -l $TMKMS_HOME
drwxrwxr-x 2 ... schema
drwx------ 2 ... secrets
drwxrwxr-x 2 ... state
-rw-rw-r-- 1 ... tmkms.toml
```
- Update the TMKMS configuration file `$TMKMS_HOME/tmkms.toml`:
```toml
[[chain]]
id = "laconic-mainnet"
key_format = { type = "cosmos-json", account_key_prefix = "laconicpub", consensus_key_prefix = "laconicvalconspub" }
# Replace <TMKMS_HOME> with absolute path to tmkms config directory
state_file = "<TMKMS_HOME>/state/priv_validator_state.json"
[[validator]]
chain_id = "laconic-mainnet"
# Replace <NODE_IP> with actual IP address of the laconicd node
addr = "tcp://<NODE_IP>:26659"
# Replace <TMKMS_HOME> with absolute path to tmkms config directory
secret_key = "<TMKMS_HOME>/secrets/kms-identity.key"
protocol_version = "v0.34"
reconnect = true
[[providers.softsign]]
key_type = "consensus"
# Replace <TMKMS_HOME> with absolute path to tmkms config directory
path = "<TMKMS_HOME>/secrets/priv_validator_key"
chain_ids = ["laconic-mainnet"]
```
- Copy your validator key to TMKMS:
- The validator key in laconicd node deployment is present at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json`
- Place the validator key file in TMKMS config directory at `$TMKMS_HOME/secrets/`
- Import the private validator key into tmkms:
```bash
tmkms softsign import $TMKMS_HOME/secrets/priv_validator_key.json $TMKMS_HOME/secrets/priv_validator_key
```
- Remove the JSON key file
```bash
rm $TMKMS_HOME/secrets/priv_validator_key.json
```
- Start TMKMS:
```bash
tmkms start --config $TMKMS_HOME/tmkms.toml
```
- Enable TMKMS in the laconicd node configuration:
```bash
# Set TMKMS_ENABLED to true in the node's config.env
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
```
## Start Node
- Start the laconicd node:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
- Check logs to ensure that node is running:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
```
## Create Validator
- Export required env vars:
```bash
# Use the private key of the existing account that was exported in previous steps
export PVT_KEY=<private-key-in-hex-format>
# desired key name
export KEY_NAME=<key-name>
export DATA_DIRECTORY=<data-directory>
export MAINNET_DEPLOYMENT_DIR=<mainnet-deployment-dir>
```
- Run ansible playbook to create validator on running chain:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
```
- Check the validator list:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
```
- If TMKMS has been configured, remove the validator key from node deployment as it is no longer required:
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
```
NOTE: Store it safely offline in case of an emergency
## Register Your Node
- Get your node's address:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@YOUR_PUBLIC_IP_ADDRESS:26656'
```
- Add your node's address to the `~/cerc/laconicd-stack/node-addresses.yml` file
- Submit a PR to add your node address to the repository
+68
View File
@@ -0,0 +1,68 @@
# Cosmos Multisig App Setup
This playbook sets up the Cosmos Multisig application for managing multisig wallets on the Laconic chain.
## Prerequisites
- [ansible](../README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
- [Running Laconic validator node](../../docs/run-validator.md)
- Keplr wallet extension installed in browser
## Configuration
* Fetch the stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
* Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.example.yml ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml
```
* Update `cosmos-multisig-vars.yml` with your node configuration:
```yaml
# TODO: Update with example domains mapped to ports
next_public_node_addresses:
node_rest_endpoint:
```
## Setup Steps
* Set environment variables:
```bash
export CWD=$(pwd)
export DATA_DIRECTORY=$CWD
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
export NETWORK_JSON_PATH=~/cerc/laconicd-stack/config/network.json
```
* Setup and start the multisig app:
```bash
ansible-playbook -v -i localhost, -c local ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml
```
* Access the app at <http://localhost:7000/laconic>
## Check Status
* Check app logs:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f
```
## Clean up
- To stop the deployment:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop
```
- To stop and delete all data:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop --delete-volumes
sudo rm -rf $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR
```
@@ -0,0 +1,85 @@
---
- name: Setup and deploy the cosmos multisig app
hosts: localhost
vars_files:
- cosmos-multisig-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
multisig_deployment_dir: "{{ lookup('env', 'MULTISIG_DEPLOYMENT_DIR') }}"
spec_output: "{{data_directory}}/cosmos-multisig-ui-spec.yml"
spec_template: "./templates/specs/cosmos-multisig-app-spec-template.yml.j2"
network_json: "../../config/network.json"
temp_network_json: "{{data_directory}}/temp_network.json"
tasks:
- name: Fail if DATA_DIRECTORY env var is not set
fail:
msg: "Environment variable DATA_DIRECTORY is not set. Please export it before running the playbook."
when: lookup('env', 'DATA_DIRECTORY') == ''
- name: Clone cosmos-multisig-ui repo
shell: |
laconic-so fetch-stack git.vdb.to/cerc-io/cosmos-multisig-ui@v0.1.2 --git-ssh --pull
- name: Build container image
shell: |
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui build-containers
- name: Create deployment spec file
shell: |
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output {{ spec_output }}
- name: Replace network section in spec_output
shell: >
yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_output }}
- name: Create deployment from spec file
shell: |
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file {{ spec_output }} --deployment-dir {{data_directory}}/{{ multisig_deployment_dir }}
- name: Create config.env in deployment dir
copy:
dest: "{{data_directory}}/{{ multisig_deployment_dir }}/config.env"
content: |
NEXT_PUBLIC_MULTICHAIN={{ next_public_multichain }}
NEXT_PUBLIC_REGISTRY_NAME={{ next_public_registry_name }}
NEXT_PUBLIC_LOGO={{ next_public_logo }}
NEXT_PUBLIC_CHAIN_ID={{ next_public_chain_id }}
NEXT_PUBLIC_CHAIN_DISPLAY_NAME={{ next_public_chain_display_name }}
NEXT_PUBLIC_NODE_ADDRESSES={{ next_public_node_addresses }}
NODE_REST_ENDPOINT={{ node_rest_endpoint }}
NEXT_PUBLIC_DENOM={{ next_public_denom }}
NEXT_PUBLIC_DISPLAY_DENOM={{ next_public_display_denom }}
NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT={{ next_public_display_denom_exponent }}
NEXT_PUBLIC_ASSETS={{ next_public_assets }}
NEXT_PUBLIC_GAS_PRICE={{ next_public_gas_price }}
NEXT_PUBLIC_ADDRESS_PREFIX={{ next_public_address_prefix }}
NEXT_PUBLIC_IS_HTTP_ENABLED={{ next_public_is_http_enabled }}
USE_HOST_NETWORK={{ use_host_network }}
DGRAPH_DOMAIN={{ dgraph_domain }}
CHAIN_CONFIG_PATH="{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
mode: '0644'
- name: Update network.json with environment endpoints
shell: |
RPC_VALUE=$(echo '{{ next_public_node_addresses }}' | jq -r '.[0]')
echo "Using RPC value: $RPC_VALUE"
jq --arg rpc "$RPC_VALUE" --arg rest "{{ node_rest_endpoint }}" \
'.rpc = $rpc | .rest = $rest' "{{ network_json }}" > "{{ temp_network_json }}"
args:
executable: /bin/bash
- name: Copy modified network JSON to deployment config directory
copy:
src: "{{ temp_network_json }}"
dest: "{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
mode: '0644'
- name: Clean up temporary network.json
file:
path: "{{ temp_network_json }}"
state: absent
- name: Start the deployment
shell: |
laconic-so deployment --dir {{data_directory}}/{{ multisig_deployment_dir }} start
@@ -0,0 +1,16 @@
next_public_multichain: false
next_public_registry_name: "laconic"
next_public_logo: ""
next_public_chain_id: "laconic-mainnet"
next_public_chain_display_name: "Laconic Mainnet"
next_public_node_addresses: ""
node_rest_endpoint: ""
next_public_denom: "alnt"
next_public_display_denom: "ALNT"
next_public_display_denom_exponent: 18
next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]'
next_public_gas_price: "0.01alnt"
next_public_address_prefix: "laconic"
next_public_is_http_enabled: false
use_host_network: ""
dgraph_domain: ""
@@ -0,0 +1,6 @@
network:
ports:
cosmos-multisig-ui:
- 7000:7000
alpha:
- 8080:8080
@@ -2,7 +2,5 @@ cerc_moniker: "LaconicMainnetNode"
cerc_chain_id: "laconic-mainnet"
min_gas_price: 0.001
cerc_loglevel: "info"
key_name: "validator"
pvt_key: ""
genesis_file:
staking_amount_file:
key_name: "laconic-validator"
validator_pub_key: ''
+76 -2
View File
@@ -3,15 +3,27 @@
hosts: localhost
vars_files:
- first-validator-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
spec_file: "{{data_directory}}/laconicd-spec.yml"
connection: local
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
msg: >-
Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fetch repositories
ansible.builtin.shell:
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
# TODO: Add a flag to control force rebuild
- name: Build containers
ansible.builtin.shell:
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers"
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild"
- name: Copy exported testnet state file
ansible.builtin.copy:
@@ -22,7 +34,7 @@
- block:
- name: Run script to generate genesis file
ansible.builtin.shell:
cmd: "CHAIN_ID={{ cerc_chain_id }} EARLY_SUPPORTS_ACC_ADDRESS={{ early_supports_acc_address }} {{ ansible_env.HOME }}/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh {{ ansible_env.HOME }}/cerc/laconicd-stack/testnet-state.json"
cmd: "CHAIN_ID={{ cerc_chain_id }} EARLY_SUPPORTS_ACC_ADDRESS={{ early_supports_acc_address }} {{ ansible_env.HOME }}/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh {{ ansible_env.HOME }}/cerc/laconicd-stack/testnet-state.json {{ lps_distribution_path }}"
chdir: "{{ lookup('env', 'PWD') }}"
always:
- name: Clean up temporary genesis directory
@@ -42,3 +54,65 @@
- name: Display staking-amount file location
ansible.builtin.debug:
msg: "Staking amount written to output/staking-amount.json"
- name: Create deployment spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
- name: Create deployment from spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
- name: Ensure tmp directory exists inside laconicd-data
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
state: directory
mode: '0755'
- name: Copy staking amount file to laconicd-data tmp directory
copy:
src: "{{ lookup('env', 'PWD') }}/output/staking-amount.json"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
mode: '0644'
- name: Copy genesis file to laconicd-data tmp directory
copy:
src: "{{ lookup('env', 'PWD') }}/output/genesis.json"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
mode: '0644'
- name: Prompt for validator private key
vars:
private_key_prompt: "Please enter your validator private key: "
pause:
prompt: "{{ private_key_prompt }}"
echo: no
register: private_key_input
- name: Fail if private key is not provided
fail:
msg: "Private key is required for creating the gentx."
when: private_key_input.user_input | default('') | trim == ''
- name: Run script to create and collect gentx
shell: |
docker run -i \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
-e "PVT_KEY={{ private_key_input.user_input }}" \
-e "KEY_NAME={{ key_name }}" \
-e "CERC_MONIKER={{ cerc_moniker }}" \
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
-e "VALIDATOR_PUB_KEY={{ validator_pub_key | to_json }}" \
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
- name: Update genesis file in output
copy:
src: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/config/genesis.json"
dest: "{{ lookup('env', 'PWD') }}/output/genesis.json"
mode: '0644'
- name: Clear tmp directory
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
state: absent
@@ -0,0 +1,58 @@
---
- name: Run mainnet validator node
hosts: localhost
vars_files:
- first-validator-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
spec_file: "{{data_directory}}/laconicd-spec.yml"
spec_template: "./templates/specs/spec-template.yml.j2"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
msg: >-
Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fail if required key files are not defined
fail:
msg: >-
Required key files are not defined.
Please set genesis_file and staking_amount_file in first-validator-vars.yml.
when: not genesis_file or not staking_amount_file
- name: Fetch laconicd stack
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
- name: Setup required repositories
shell: >
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
setup-repositories --git-ssh --pull
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild
- name: Create deployment spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
- name: Replace network section in spec_file
shell: >
yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
- name: Create deployment from spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
- name: Create config.env
copy:
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
content: |
CERC_MONIKER: "{{ cerc_moniker }}"
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
MIN_GAS_PRICE: "{{ min_gas_price }}"
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
mode: '0777'
@@ -2,6 +2,7 @@ network:
ports:
laconicd:
- '6060:6060'
- '26659:26659'
- '26657:26657'
- '26656:26656'
- '9473:9473'
+30
View File
@@ -0,0 +1,30 @@
---
- name: Create validator on running chain
hosts: localhost
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
key_name: "{{ lookup('env', 'KEY_NAME') }}"
pvt_key: "{{ lookup('env', 'PVT_KEY') }}"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
msg: >-
Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fail if pvt_key is not set
fail:
msg: >-
Neither private key (pvt_key) is set.
Please export PVT_KEY.
when: not pvt_key
- name: Import private key in laconicd
shell: |
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "laconicd keys import-hex {{ key_name }} {{ pvt_key }} --keyring-backend test"
- name: Run create-validator script
shell: |
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "KEY_NAME={{ key_name }} /scripts/create-validator.sh"
@@ -1,12 +1,12 @@
---
- name: Run mainnet validator node
- name: Setup mainnet validator node
hosts: localhost
vars_files:
- first-validator-vars.yml
- validator-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
spec_file: "{{data_directory}}/laconicd-spec.yml"
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
spec_template: "./templates/specs/spec-template.yml.j2"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
@@ -20,7 +20,7 @@
fail:
msg: >-
Required key files are not defined.
Please set genesis_file and staking_amount_file in first-validator-vars.yml.
Please set genesis_file and staking_amount_file in validator-vars.yml.
when: not genesis_file or not staking_amount_file
- name: Fetch laconicd stack
@@ -33,7 +33,7 @@
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild
- name: Create deployment spec file
shell: |
@@ -53,9 +53,9 @@
content: |
CERC_MONIKER: "{{ cerc_moniker }}"
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
CERC_PEERS: "{{ cerc_peers }}"
MIN_GAS_PRICE: "{{ min_gas_price }}"
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
KEY_NAME: "{{ key_name }}"
mode: '0777'
- name: Ensure tmp directory exists inside laconicd-data
@@ -76,24 +76,11 @@
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
mode: '0644'
- name: Fail if pvt_key is not set
fail:
msg: >-
Private key (pvt_key) is not set in first-validator-vars.yml.
This is required for creating the gentx.
when: not pvt_key
- name: Run script to create and collect gentx
- name: Initialize laconicd node
shell: |
docker run -i \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
-e "PVT_KEY={{ pvt_key }}" \
-e "KEY_NAME={{ key_name }}" \
-e "CERC_MONIKER={{ cerc_moniker }}" \
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
- name: Run validator node
shell: |
laconic-so deployment --dir {{data_directory}}/{{ mainnet_deployment_dir }} start
cerc/laconicd:local bash -c "/scripts/setup-laconicd.sh"
@@ -0,0 +1,10 @@
network:
ports:
laconicd:
- '6060:6060'
- '26659:26659'
- '26657:26657'
- '26656:26656'
- '9473:9473'
- '9090:9090'
- '1317:1317'
@@ -0,0 +1,7 @@
cerc_chain_id: "laconic-mainnet"
min_gas_price: 0.001
cerc_loglevel: "info"
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
cerc_moniker: ""
cerc_peers: ""
+2 -2
View File
@@ -19,10 +19,10 @@ OUTPUT_DIR=${TESTNET_DEPLOYMENT_DIR}/export
mkdir -p $OUTPUT_DIR
# Export state from testnet chain
testnet_state_file="$OUTPUT_DIR/testnet-state.json"
testnet_state_file="$OUTPUT_DIR/testnet-state.gz"
docker run -it \
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
| jq > "$testnet_state_file"
| jq | gzip > "$testnet_state_file"
echo "Exported state from testnet to $testnet_state_file"
+128
View File
@@ -0,0 +1,128 @@
import sys
import requests
import pandas as pd
import json
import re
import argparse
import urllib.parse
from bech32 import bech32_decode
# Column names in the input CSV
PLACEHOLDER_COLUMN = 'Placeholder'
LACONIC_ADDRESS_COLUMN = 'Laconic Address'
TOTAL_LPS_ALLOCATION_COLUMN = 'Total LPS Allocation'
LOCK_MONTHS_COLUMN = 'Lock (months)'
VEST_MONTHS_COLUMN = 'Vest (months)'
# Required columns in the input CSV
REQUIRED_COLUMNS = [
PLACEHOLDER_COLUMN,
LACONIC_ADDRESS_COLUMN,
TOTAL_LPS_ALLOCATION_COLUMN,
LOCK_MONTHS_COLUMN,
VEST_MONTHS_COLUMN
]
def to_number(val):
"""
Convert a value to a number, handling empty values and invalid inputs.
Returns None for empty or invalid values.
"""
if pd.isna(val) or str(val).strip() == '':
return None
try:
return float(val)
except (ValueError, TypeError):
return None
def get_csv_download_url(google_sheet_url):
"""
Convert a full Google Sheets URL to a CSV export URL using the `gid` in the query string.
"""
# Extract the sheet ID
match = re.search(r'/d/([a-zA-Z0-9-_]+)', google_sheet_url)
if not match:
raise ValueError('Invalid Google Sheets URL')
sheet_id = match.group(1)
# Extract gid from query params
gid_match = re.search(r'[?&]gid=([0-9]+)', google_sheet_url)
if not gid_match:
raise ValueError('Missing gid in Google Sheets URL')
gid = gid_match.group(1)
# Build export URL
return f'https://docs.google.com/spreadsheets/d/{sheet_id}/export?format=csv&gid={gid}'
def download_csv(url, output_path):
"""
Download the CSV file from the given URL.
"""
response = requests.get(url)
if response.status_code != 200:
raise Exception(f'Failed to download file: {response.status_code}')
with open(output_path, 'wb') as f:
f.write(response.content)
def convert_csv_to_json(csv_path, json_path):
"""
Read the CSV file, extract columns, and save as JSON.
"""
df = pd.read_csv(csv_path)
for col in REQUIRED_COLUMNS:
if col not in df.columns:
raise Exception(f'Missing required column: {col}')
result = {}
for _, row in df.iterrows():
placeholder = str(row[PLACEHOLDER_COLUMN]) if not pd.isna(row[PLACEHOLDER_COLUMN]) else ''
laconic_address = str(row[LACONIC_ADDRESS_COLUMN]) if not pd.isna(row[LACONIC_ADDRESS_COLUMN]) else ''
# Use laconic_address as key if placeholder is missing or empty
key = placeholder if placeholder and placeholder.lower() != 'nan' else laconic_address
# Skip the row if both 'Placeholder' and 'Laconic Address' are missing or invalid
if not key or key.lower() == 'nan':
continue
# If key is the laconic address, validate that it's a valid bech32 address
if key == laconic_address:
hrp, data = bech32_decode(laconic_address)
if hrp is None or data is None or not hrp.startswith("laconic"):
print(f"Skipping invalid Laconic address: {laconic_address}")
continue
entry = {
'total_lps_allocation': to_number(row[TOTAL_LPS_ALLOCATION_COLUMN]),
'lock_months': row[LOCK_MONTHS_COLUMN] if not pd.isna(row[LOCK_MONTHS_COLUMN]) else None,
'vest_months': row[VEST_MONTHS_COLUMN] if not pd.isna(row[VEST_MONTHS_COLUMN]) else None,
'laconic_address': row[LACONIC_ADDRESS_COLUMN] if not pd.isna(row[LACONIC_ADDRESS_COLUMN]) else None
}
result[key] = entry
with open(json_path, 'w') as f:
json.dump(result, f, indent=2)
def main():
parser = argparse.ArgumentParser(description='Generate LPS distribution JSON from CSV or Google Sheet')
parser.add_argument('--input', '-i', required=True, help='Input: Google Sheet URL or local CSV file path')
parser.add_argument('--output', '-o', default='distribution.json', help='Output JSON file path (default: distribution.json)')
args = parser.parse_args()
if args.input.startswith('https://'):
csv_url = get_csv_download_url(args.input)
csv_path = 'sheet.csv'
print(f'Downloading CSV file from: {csv_url}')
download_csv(csv_url, csv_path)
else:
csv_path = args.input
print(f'Using CSV file at path: {csv_path}')
print('Converting CSV to JSON...')
convert_csv_to_json(csv_path, args.output)
print(f'JSON saved to {args.output}')
if __name__ == '__main__':
main()
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
set -e
# Default values
INPUT=""
OUTPUT_DIR="."
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-i|--input)
INPUT="$2"
shift 2
;;
-d|--dir)
OUTPUT_DIR="$2"
shift 2
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 -i|--input <input_url_or_path> [-d|--dir <output_directory>]"
exit 1
;;
esac
done
# Check if input is provided
if [ -z "$INPUT" ]; then
echo "Error: Input URL or path is required"
echo "Usage: $0 -i|--input <input_url_or_path> [-d|--dir <output_directory>]"
exit 1
fi
# Create output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
venv_dir="$PWD/venv-lps-lock"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Create venv if it doesn't exist
if [ ! -d "$venv_dir" ]; then
python3 -m venv "$venv_dir"
fi
# Activate venv and install dependencies
"$venv_dir/bin/pip" install --upgrade pip
"$venv_dir/bin/pip" install requests pandas openpyxl bech32
echo "Running LPS lock generation script..."
"$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" \
--input "$INPUT" \
--output "$OUTPUT_DIR/distribution.json"
# Clean up venv
echo "Cleaning up..."
rm -rf "$venv_dir"
+20 -7
View File
@@ -5,23 +5,30 @@ set -e
set -u
# Check args
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <testnet-state-json-file-path>"
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <testnet-state-json-file-path> <lps-distribution-json-file-path>"
exit 1
fi
TESTNET_STATE_FILE="$1"
LPS_DISTRIBUTION_FILE="$2"
MAINNET_GENESIS_DIR=mainnet-genesis
OUTPUT_DIR=output
if ! jq empty $LPS_DISTRIBUTION_FILE >/dev/null 2>&1; then
echo "$LPS_DISTRIBUTION_FILE is not a valid JSON"
exit 1
fi
# Create a required target directories
mkdir -p $MAINNET_GENESIS_DIR
mkdir -p $OUTPUT_DIR
# --------
# Copy testnet state file to required dir
# Copy testnet state file and distribution to required dir
cp $TESTNET_STATE_FILE $MAINNET_GENESIS_DIR/testnet-state.json
cp $LPS_DISTRIBUTION_FILE $MAINNET_GENESIS_DIR/distribution.json
# --------
@@ -37,12 +44,18 @@ docker run \
# --------
# Install required bech32 dependency
# TODO: Avoid installing bech32 system-wide
python3 -m pip install bech32 --break-system-packages
# Define and create venv if not exists
venv_dir="$PWD/venv"
if [ ! -d "$venv_dir" ]; then
python3 -m venv "$venv_dir"
"$venv_dir/bin/pip" install bech32
fi
# Carry over state from testnet to mainnet
echo "Carrying over state from testnet state to mainnet genesis..."
python3 $script_dir/transfer-state.py
"$venv_dir/bin/python" "$script_dir/transfer-state.py"
# Clean up venv
rm -rf "$venv_dir"
# --------
+8 -20
View File
@@ -16,14 +16,15 @@ if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ]; then
exit 1
fi
# alps allocations
# Total supply: 129600 * 10^18 alps
EARLY_SUPPORTS_ALLOC="12960000000000000000000" # Early supports: 12960 * 10^18 alps (10% of total supply)
LOCKUP_ALLOC="116640000000000000000000" # Lockup: 116640 * 10^18 alps (90% of total supply)
# lps allocations
# Total supply: 129600 lps
EARLY_SUPPORTS_ALLOC="25920" # Early supports: 25920 lps (20% of total supply)
LOCKUP_ALLOC="103680" # Lockup: 103680 lps (80% of total supply)
LPS_LOCKUP_MODULE_ACCOUNT="lps_lockup"
LPS_DENOM="alps"
LPS_DENOM="lps"
testnet_state_file="$NODE_HOME/testnet-state.json"
distribution_file="$NODE_HOME/distribution.json"
mainnet_genesis_file="$NODE_HOME/config/genesis.json"
# Update any module params if required here
@@ -43,22 +44,9 @@ update_genesis '.app_state["gov"]["params"]["expedited_threshold"]="1.0000000000
# Set normal threshold to 99% since it needs to be lesser than expedited threshold
update_genesis '.app_state["gov"]["params"]["threshold"]="0.990000000000000000"'
# Perform alps allocations
# Perform lps allocations
laconicd genesis add-genesis-account $EARLY_SUPPORTS_ACC_ADDRESS $EARLY_SUPPORTS_ALLOC$LPS_DENOM --keyring-backend $KEYRING --append
# Use zero address to add an account for lps_lockup
zero_address="laconic1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklcls0"
laconicd genesis add-genesis-account $zero_address $LOCKUP_ALLOC$LPS_DENOM --keyring-backend $KEYRING --module-name $LPS_LOCKUP_MODULE_ACCOUNT
# Update the lps_lockup address in bank module state
lps_lockup_address=$(jq -r '.app_state.auth.accounts[] | select(.name == "lps_lockup") | .base_account.address' $HOME/.laconicd/config/genesis.json)
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"
jq '(.app_state.auth.accounts[] | select(.name == "lps_lockup") | .permissions) = []' "$mainnet_genesis_file" > tmp.$$.json \
&& mv tmp.$$.json "$mainnet_genesis_file"
# TODO: Dump JSON for allocations in LPS_LOCKUP_MODULE_ACCOUNT state
laconicd genesis add-genesis-lockup-account lps_lockup $distribution_file $LOCKUP_ALLOC$LPS_DENOM
# Ensure that resulting genesis file is valid
laconicd genesis validate
+7
View File
@@ -69,6 +69,10 @@ mainnet_state["app_state"]["registry"] = testnet_state["app_state"]["registry"]
mainnet_state["app_state"]["slashing"]["params"] = testnet_state["app_state"]["slashing"]["params"]
mainnet_state["consensus"]["params"] = testnet_state["consensus"]["params"]
# Update authority auction durations from 3600s to 60s
mainnet_state["app_state"]["registry"]["params"]["authority_auction_commits_duration"] = "60s"
mainnet_state["app_state"]["registry"]["params"]["authority_auction_reveals_duration"] = "60s"
#------
# Allocate back delegation stakes
@@ -116,6 +120,9 @@ for account in mainnet_state["app_state"]["auth"]["accounts"]:
if "ModuleAccount" in account_type and account.get("name") in addresses_to_remove:
removed_addresses.add(account["base_account"]["address"])
continue
if "ModuleAccount" not in account_type:
account["sequence"] = "0"
new_accounts.append(account)
mainnet_state["app_state"]["auth"]["accounts"] = new_accounts
@@ -9,11 +9,15 @@ services:
CERC_PEERS: ${CERC_PEERS}
MIN_GAS_PRICE: ${MIN_GAS_PRICE:-0.001}
CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info}
TMKMS_ENABLED: ${TMKMS_ENABLED:-false}
volumes:
- laconicd-data:/root/.laconicd
- ../config/mainnet-laconicd/run-laconicd.sh:/opt/run-laconicd.sh
- ../config/mainnet-laconicd/setup-laconicd.sh:/scripts/setup-laconicd.sh
- ../config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh
ports:
- "6060"
- "26659"
- "26657"
- "26656"
- "9473"
@@ -22,6 +22,11 @@ if [ -z "$KEY_NAME" ]; then
exit 1
fi
if [ -z "$VALIDATOR_PUB_KEY" ]; then
echo "VALIDATOR_PUB_KEY environment variable not set, exiting..."
exit 1
fi
input_genesis_file=$NODE_HOME/tmp/genesis.json
if [ ! -f ${input_genesis_file} ]; then
echo "Genesis file not provided, exiting..."
@@ -45,6 +50,9 @@ laconicd config set client chain-id $CHAIN_ID --home $NODE_HOME
laconicd config set client keyring-backend $KEYRING
laconicd init $MONIKER --chain-id=$CHAIN_ID --home $NODE_HOME
# Make config directory accessible without root permissions in docker host
chmod -R 777 $NODE_HOME/config
# Copy over provided genesis config
cp $input_genesis_file $genesis_file_path
@@ -61,14 +69,16 @@ if [ -z "$account_address" ]; then
fi
# Set staking amount
stake_amount=$(jq -r '.amount' "$staking_amount_file")
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
# Create gentx with staked amount equal to allocated balance
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING --pubkey "$VALIDATOR_PUB_KEY"
# Collect the gentx and validate
laconicd genesis collect-gentxs
laconicd genesis validate
# Update the input genesis file
cp $genesis_file_path $input_genesis_file
chmod 777 $genesis_file_path
# Clear tmp directory
rm -rf $NODE_HOME/tmp
@@ -0,0 +1,50 @@
#!/bin/bash
set -e
DENOM=alnt
NODE_HOME=/root/.laconicd
KEYRING="test"
staking_amount_file="$NODE_HOME/tmp/staking-amount.json"
if [ ! -f "$staking_amount_file" ]; then
echo "staking-amount.json file not provided, exiting..."
exit 1
fi
if [-z "$KEY_NAME" ]; then
echo "KEY_NAME environment variable not set, exiting..."
exit 1
fi
if [ -z "$CERC_MONIKER" ]; then
echo "CERC_MONIKER environment variable not set, exiting..."
exit 1
fi
# Set staking amount
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
# Create validator.json file
validator_json="$NODE_HOME/tmp/validator.json"
cat > "$validator_json" << EOF
{
"pubkey": $(laconicd tendermint show-validator),
"amount": "${stake_amount}${DENOM}",
"moniker": "${CERC_MONIKER}",
"commission-rate": "0.0",
"commission-max-rate": "0.0",
"commission-max-change-rate": "0.0",
"min-self-delegation": "1"
}
EOF
# Create validator using the JSON file
laconicd tx staking create-validator "$validator_json" \
--chain-id "$CERC_CHAIN_ID" \
--gas auto \
--gas-adjustment 1.5 \
--gas-prices $MIN_GAS_PRICE$DENOM \
--from $KEY_NAME \
--keyring-backend $KEYRING \
--yes
@@ -15,23 +15,12 @@ if [ ! -f ${input_genesis_file} ]; then
fi
echo "Env:"
echo "Moniker: $CERC_MONIKER"
echo "Chain Id: $CERC_CHAIN_ID"
echo "Persistent peers: $CERC_PEERS"
echo "Min gas price: $MIN_GAS_PRICE"
echo "Log level: $CERC_LOGLEVEL"
echo "TMKMS enabled: $TMKMS_ENABLED"
# Set chain id in config
laconicd config set client chain-id $CERC_CHAIN_ID --home $NODE_HOME
# Check if node data dir already exists
if [ -z "$(ls -A "$NODE_HOME/data")" ]; then
# Init node
echo "Initializing a new laconicd node with moniker $CERC_MONIKER and chain id $CERC_CHAIN_ID"
laconicd init $CERC_MONIKER --chain-id=$CERC_CHAIN_ID --home $NODE_HOME
else
echo "Node data dir $NODE_HOME/data already exists, skipping initialization..."
fi
/scripts/setup-laconicd.sh
# Use provided config files
cp $input_genesis_file $NODE_HOME/config/genesis.json
@@ -39,6 +28,17 @@ cp $input_genesis_file $NODE_HOME/config/genesis.json
# Enable cors
sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $NODE_HOME/config/config.toml
if [[ "${TMKMS_ENABLED,,}" == "true" ]]; then
# Configure private validator for external tmkms
sed -i "s/^priv_validator_laddr *=.*/priv_validator_laddr = \"tcp:\/\/0.0.0.0:26659\"/" $NODE_HOME/config/config.toml
# Comment out validator key files when using external TMKMS
sed -i 's/^priv_validator_key_file =/# priv_validator_key_file =/' $NODE_HOME/config/config.toml
sed -i 's/^priv_validator_state_file =/# priv_validator_state_file =/' $NODE_HOME/config/config.toml
else
echo "Warning: TMKMS disabled, node will run with local validator keys"
fi
# Update config with persistent peers
sed -i "s/^persistent_peers *=.*/persistent_peers = \"$CERC_PEERS\"/g" $NODE_HOME/config/config.toml
@@ -53,12 +53,12 @@ else
sed -i 's/prometheus = false/prometheus = true/g' $NODE_HOME/config/config.toml
fi
echo "Starting laconicd node..."
laconicd start \
--api.enable \
--minimum-gas-prices=${MIN_GAS_PRICE}alnt \
--rpc.laddr="tcp://0.0.0.0:26657" \
--api.address="tcp://0.0.0.0:1317" \
--gql-playground --gql-server \
--log_level $CERC_LOGLEVEL \
--home $NODE_HOME
@@ -0,0 +1,29 @@
#!/bin/bash
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
set -x
fi
set -e
NODE_HOME=/root/.laconicd
echo "Env:"
echo "Moniker: $CERC_MONIKER"
echo "Chain Id: $CERC_CHAIN_ID"
# Set chain id in config
laconicd config set client chain-id $CERC_CHAIN_ID --home $NODE_HOME
# Check if node data dir already exists
if [ -z "$(ls -A "$NODE_HOME/data")" ]; then
# Init node
echo "Initializing a new laconicd node with moniker $CERC_MONIKER and chain id $CERC_CHAIN_ID"
laconicd init $CERC_MONIKER --chain-id=$CERC_CHAIN_ID --home $NODE_HOME
# Make config directory accessible without root permissions in docker host
chmod -R 777 $NODE_HOME/config
else
echo "Node data dir $NODE_HOME/data already exists, skipping initialization..."
fi