Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
338966f43f | ||
|
|
6733aa7318 | ||
|
|
48939ffbd7 | ||
|
|
b87609436a | ||
|
|
8a7d184610 | ||
|
|
e3927d4af2 | ||
|
|
1886a9acf0 | ||
|
|
40ac26bd78 | ||
|
|
3d7ba45796 | ||
|
|
3b526fac78 | ||
|
|
1154cfd0bc |
+2
-2
@@ -1,5 +1,5 @@
|
||||
*-deployment
|
||||
*-spec.yml
|
||||
|
||||
# Validator playbook vars
|
||||
playbooks/validator/validator-vars.yml
|
||||
# Playbook vars
|
||||
*-vars.yml
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
# laconicd-stack
|
||||
|
||||
- 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
|
||||
|
||||
@@ -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
@@ -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
|
||||
```
|
||||
@@ -0,0 +1,335 @@
|
||||
# Run First Validator Node
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [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`
|
||||
|
||||
## Setup node
|
||||
|
||||
- Run the following steps in the machine where the mainnet node is to be setup
|
||||
|
||||
- Copy the example variables file if not already done:
|
||||
|
||||
```bash
|
||||
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
|
||||
```
|
||||
|
||||
- Update `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
|
||||
|
||||
```bash
|
||||
# Set custom moniker for the node
|
||||
cerc_moniker: "LaconicMainnetNode"
|
||||
|
||||
# Set desired key name
|
||||
key_name: "laconic-validator"
|
||||
```
|
||||
|
||||
- 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 setup the node:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||
```
|
||||
|
||||
- If TMKMS has been configured 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"
|
||||
```
|
||||
|
||||
## 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:
|
||||
|
||||
```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 [node-addresses.yml](./node-addresses.yml)
|
||||
|
||||
- Submit a PR with this genesis file, staking amount file and node address so that it is available to other validators
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
# Add your node addresses here
|
||||
# Example:
|
||||
# - node-1-id@node-1-host:26656
|
||||
# - node-2-id@node-2-host:26656
|
||||
+2
-10
@@ -1,6 +1,4 @@
|
||||
# playbooks
|
||||
|
||||
## Ansible Installation
|
||||
# Ansible Installation
|
||||
|
||||
- Install [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip)
|
||||
|
||||
@@ -28,7 +26,7 @@
|
||||
|
||||
- Set the `LANG` variable to en_US.UTF-8:
|
||||
|
||||
```
|
||||
```bash
|
||||
LANG="en_US.UTF-8"
|
||||
```
|
||||
|
||||
@@ -42,9 +40,3 @@
|
||||
ansible --version
|
||||
# ansible [core 2.17.2]
|
||||
```
|
||||
|
||||
- Install `sshpass` used for automating SSH password authentication
|
||||
|
||||
```bash
|
||||
sudo apt-get install sshpass
|
||||
```
|
||||
@@ -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
|
||||
@@ -0,0 +1,6 @@
|
||||
cerc_moniker: "LaconicMainnetNode"
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
key_name: "laconic-validator"
|
||||
validator_pub_key: ''
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
- name: Generate Mainnet Genesis File
|
||||
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 --force-rebuild"
|
||||
|
||||
- name: Copy exported testnet state file
|
||||
ansible.builtin.copy:
|
||||
src: "{{ exported_state_path }}"
|
||||
dest: "~/cerc/laconicd-stack/testnet-state.json"
|
||||
remote_src: true # Set to true if exported_state_path is on the target host
|
||||
|
||||
- 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 {{ lps_distribution_path }}"
|
||||
chdir: "{{ lookup('env', 'PWD') }}"
|
||||
always:
|
||||
- name: Clean up temporary genesis directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/cerc/laconicd-stack/playbooks/first-validator/mainnet-genesis"
|
||||
state: absent
|
||||
|
||||
- name: Remove temporary copied state file
|
||||
ansible.builtin.file:
|
||||
path: "~/cerc/laconicd-stack/testnet-state.json"
|
||||
state: absent
|
||||
|
||||
- name: Display genesis file location
|
||||
ansible.builtin.debug:
|
||||
msg: "Mainnet genesis file generated at output/genesis.json"
|
||||
|
||||
- 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
|
||||
@@ -1,13 +0,0 @@
|
||||
cerc_moniker: "TestnetNode"
|
||||
cerc_chain_id: "laconic_9000-1"
|
||||
cerc_peers:
|
||||
min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
# Token denomination (alnt or alps)
|
||||
denom: "alnt"
|
||||
# Validator key name
|
||||
key_name: "validator"
|
||||
# Private key in hex format (required for gentx)
|
||||
pvt_key: ""
|
||||
# Required files
|
||||
genesis_file:
|
||||
@@ -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'
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
# validator
|
||||
|
||||
This directory contains playbooks for setting up and managing a validator on the Laconic chain. There are two main playbooks:
|
||||
|
||||
* `create-validator.yml` - Creates a validator on an already running node
|
||||
* (Coming soon) `setup-validator.yml` - Sets up and runs a validator node
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [Ansible](../README.md#ansible-installation)
|
||||
- [Stack orchestrator](https://git.vdb.to/cerc-io/testnet-ops/src/branch/main/stack-orchestrator-setup)
|
||||
- Private key or mnemonic of validator account from previous testnet
|
||||
- Use <https://wallet.laconic.com>
|
||||
|
||||
## Configuration
|
||||
|
||||
* Set the required environment variables:
|
||||
```bash
|
||||
export DATA_DIRECTORY=/path/to/deployment/parent/directory
|
||||
export DEPLOYMENT_DIR=validator-laconicd-deployment
|
||||
```
|
||||
|
||||
* Copy the example variables file and edit it:
|
||||
```bash
|
||||
cp validator-vars.example.yml validator-vars.yml
|
||||
```
|
||||
|
||||
* Edit `validator-vars.yml` to set your validator parameters:
|
||||
```yaml
|
||||
# Chain configuration
|
||||
cerc_moniker: "YourValidatorName" # Your validator's name
|
||||
cerc_chain_id: "laconic-mainnet" # Chain ID
|
||||
|
||||
# TODO: Add persistent peer addresses
|
||||
cerc_peers: "" # Comma-separated list of peers
|
||||
```
|
||||
|
||||
## Creating a Validator
|
||||
|
||||
To create a validator:
|
||||
|
||||
* Make sure your validator node is running and synced
|
||||
|
||||
<!-- TODO: Add playbook and steps for setting up and running validator node -->
|
||||
* Set key name used for importing validator account
|
||||
```bash
|
||||
export KEY_NAME=<key-name>
|
||||
```
|
||||
|
||||
* Run the create-validator playbook:
|
||||
```bash
|
||||
ansible-playbook playbooks/validator/create-validator.yml
|
||||
```
|
||||
|
||||
## Verification
|
||||
|
||||
After running the playbook, you can verify your validator was created by:
|
||||
|
||||
* Check the validator list:
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
|
||||
```
|
||||
|
||||
* Check your validator's details:
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$DEPLOYMENT_DIR exec laconicd 'laconicd query staking validator $(laconicd keys show validator --bech val -a)'
|
||||
```
|
||||
@@ -1,27 +1,30 @@
|
||||
---
|
||||
- name: Create validator on running chain
|
||||
hosts: localhost
|
||||
vars_files:
|
||||
- validator-vars.yml
|
||||
vars:
|
||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||
deployment_dir: "{{ lookup('env', 'DEPLOYMENT_DIR') }}"
|
||||
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 DEPLOYMENT_DIR env vars are not set
|
||||
- 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 DEPLOYMENT_DIR before running the playbook.
|
||||
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'DEPLOYMENT_DIR') == ''
|
||||
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 neither pvt_key nor mnemonic is set
|
||||
- name: Fail if pvt_key is not set
|
||||
fail:
|
||||
msg: >-
|
||||
Neither private key (pvt_key) nor mnemonic is set in validator-vars.yml.
|
||||
Please set one of them to create the validator.
|
||||
when: not pvt_key and not mnemonic
|
||||
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 "export KEY_NAME={{ key_name }} /scripts/create-validator.sh"
|
||||
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "KEY_NAME={{ key_name }} /scripts/create-validator.sh"
|
||||
|
||||
+17
-26
@@ -1,12 +1,12 @@
|
||||
---
|
||||
- name: Run mainnet validator node
|
||||
- name: Setup mainnet validator node
|
||||
hosts: localhost
|
||||
vars_files:
|
||||
- run-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,8 +20,9 @@
|
||||
fail:
|
||||
msg: >-
|
||||
Required key files are not defined.
|
||||
Please set genesis_file in run-first-validator-vars.yml.
|
||||
when: not genesis_file
|
||||
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
|
||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
|
||||
@@ -32,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: |
|
||||
@@ -52,11 +53,9 @@
|
||||
content: |
|
||||
CERC_MONIKER: "{{ cerc_moniker }}"
|
||||
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
||||
CERC_PEERS: "{{ cerc_peers}}"
|
||||
CERC_PEERS: "{{ cerc_peers }}"
|
||||
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
||||
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
||||
DENOM: "{{ denom }}"
|
||||
KEY_NAME: "{{ key_name }}"
|
||||
mode: '0777'
|
||||
|
||||
- name: Ensure tmp directory exists inside laconicd-data
|
||||
@@ -65,31 +64,23 @@
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy staking amount file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ staking_amount_file }}"
|
||||
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: "{{ genesis_file }}"
|
||||
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 run-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 -it \
|
||||
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 "DENOM={{ denom }}" \
|
||||
-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'
|
||||
@@ -1,6 +1,7 @@
|
||||
# Chain configuration
|
||||
cerc_moniker:
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
cerc_peers: # Comma-separated list of peers
|
||||
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: ""
|
||||
|
||||
@@ -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 .app_state.onboarding > "$testnet_state_file"
|
||||
| jq | gzip > "$testnet_state_file"
|
||||
|
||||
echo "Exported state from testnet to $testnet_state_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()
|
||||
Executable
+57
@@ -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"
|
||||
@@ -5,37 +5,71 @@ 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
|
||||
|
||||
# Create a temporary target directory
|
||||
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
|
||||
|
||||
# --------
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
echo "Initializing a new empty chain with chain-id $CHAIN_ID..."
|
||||
docker run \
|
||||
-v ./$MAINNET_GENESIS_DIR:/root/.laconicd \
|
||||
-v $script_dir:/scripts \
|
||||
-e "CHAIN_ID=$CHAIN_ID" \
|
||||
cerc/laconicd:local bash -c "/scripts/init-mainnet.sh"
|
||||
|
||||
# --------
|
||||
|
||||
# Install required bech32 dependency
|
||||
# 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
|
||||
|
||||
echo "Carrying over state from testnet state to mainnet genesis..."
|
||||
"$venv_dir/bin/python" "$script_dir/transfer-state.py"
|
||||
|
||||
# Clean up venv
|
||||
rm -rf "$venv_dir"
|
||||
|
||||
# --------
|
||||
|
||||
# Run a script with cerc/laconicd:local to generate the genesis file
|
||||
# with onboarding module state and given allocations
|
||||
docker run -it \
|
||||
echo "Performing alps allocations..."
|
||||
docker run \
|
||||
-v ./$MAINNET_GENESIS_DIR:/root/.laconicd \
|
||||
-v ./scripts:/scripts \
|
||||
-v $script_dir:/scripts \
|
||||
-e "CHAIN_ID=$CHAIN_ID" \
|
||||
-e "EARLY_SUPPORTS_ACC_ADDRESS=$EARLY_SUPPORTS_ACC_ADDRESS" \
|
||||
-e "LPS_LOCKUP_ACC_ADDRESS=$LPS_LOCKUP_ACC_ADDRESS" \
|
||||
cerc/laconicd:local bash -c "/scripts/genesis.sh"
|
||||
|
||||
# Copy over the genesis file to output folder
|
||||
OUTPUT_DIR=output
|
||||
mkdir -p $OUTPUT_DIR
|
||||
cp ./$MAINNET_GENESIS_DIR/config/genesis.json $OUTPUT_DIR/genesis.json
|
||||
|
||||
echo "Genesis file for mainnet written to $OUTPUT_DIR/genesis.json"
|
||||
@@ -43,4 +77,4 @@ echo "Genesis file for mainnet written to $OUTPUT_DIR/genesis.json"
|
||||
# --------
|
||||
|
||||
# Clean up
|
||||
echo "Please remove the temporary data directory: sudo rm -rf $MAINNET_GENESIS_DIR"
|
||||
rm -rf $MAINNET_GENESIS_DIR
|
||||
|
||||
+25
-26
@@ -6,48 +6,47 @@ set -u
|
||||
|
||||
# Note: Needs to be run in a docker container with image cerc/laconicd:local
|
||||
|
||||
CHAINID=${CHAINID:-"laconic-mainnet"}
|
||||
MONIKER=${MONIKER:-"mainnet-node"}
|
||||
KEYRING="test"
|
||||
NODE_HOME="/root/.laconicd"
|
||||
|
||||
EARLY_SUPPORTS_ACC_ADDRESS=${EARLY_SUPPORTS_ACC_ADDRESS}
|
||||
LPS_LOCKUP_ACC_ADDRESS=${LPS_LOCKUP_ACC_ADDRESS}
|
||||
|
||||
if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ] || [ -z "$LPS_LOCKUP_ACC_ADDRESS" ]; then
|
||||
echo "EARLY_SUPPORTS_ACC_ADDRESS or LPS_LOCKUP_ACC_ADDRESS not provided, exiting..."
|
||||
if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ]; then
|
||||
echo "EARLY_SUPPORTS_ACC_ADDRESS not provided, exiting..."
|
||||
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="lps"
|
||||
|
||||
testnet_state_file="$NODE_HOME/testnet-state.json"
|
||||
distribution_file="$NODE_HOME/distribution.json"
|
||||
mainnet_genesis_file="$NODE_HOME/config/genesis.json"
|
||||
|
||||
laconicd config set client chain-id $CHAINID
|
||||
laconicd init $MONIKER --chain-id $CHAINID --default-denom alnt
|
||||
|
||||
# Import required state
|
||||
jq --slurpfile nested $testnet_state_file '.app_state.auth = $nested[0].app_state' "$mainnet_genesis_file" > tmp.$$.json && mv tmp.$$.json "$mainnet_genesis_file"
|
||||
jq --slurpfile nested $testnet_state_file '.consensus.auth = $nested[0].consensus' "$mainnet_genesis_file" > tmp.$$.json && mv tmp.$$.json "$mainnet_genesis_file"
|
||||
|
||||
# Update any module params if required here
|
||||
update_genesis() {
|
||||
jq "$1" $NODE_HOME/config/genesis.json > $NODE_HOME/config/tmp_genesis.json &&
|
||||
mv $NODE_HOME/config/tmp_genesis.json $NODE_HOME/config/genesis.json
|
||||
}
|
||||
|
||||
# Perform alps allocations
|
||||
laconicd genesis add-genesis-account $ADDRESS $EARLY_SUPPORTS$DENOM --keyring-backend $KEYRING
|
||||
# Set distribution community tax to 1 for disabling staking rewards and redirect them to the community pool
|
||||
update_genesis '.app_state["distribution"]["params"]["community_tax"]="1.000000000000000000"'
|
||||
|
||||
# Use zero address to add an account for lps_lockup
|
||||
zero_address="laconic1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklcls0"
|
||||
laconicd genesis add-genesis-account $zero_address $EARLY_SUPPORTS$DENOM --keyring-backend $KEYRING --module-name $LPS_LOCKUP_MODULE_ACCOUNT
|
||||
# Increase threshold in gov proposals for making it difficult to spend community pool funds
|
||||
echo "Setting high threshold for accepting governance proposal"
|
||||
update_genesis '.app_state["gov"]["params"]["quorum"]="1.000000000000000000"'
|
||||
# Set expedited threshold to 100%
|
||||
update_genesis '.app_state["gov"]["params"]["expedited_threshold"]="1.000000000000000000"'
|
||||
# Set normal threshold to 99% since it needs to be lesser than expedited threshold
|
||||
update_genesis '.app_state["gov"]["params"]["threshold"]="0.990000000000000000"'
|
||||
|
||||
# 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"
|
||||
# Perform lps allocations
|
||||
laconicd genesis add-genesis-account $EARLY_SUPPORTS_ACC_ADDRESS $EARLY_SUPPORTS_ALLOC$LPS_DENOM --keyring-backend $KEYRING --append
|
||||
laconicd genesis add-genesis-lockup-account lps_lockup $distribution_file $LOCKUP_ALLOC$LPS_DENOM
|
||||
|
||||
# Ensure that resulting genesis file is valid
|
||||
laconicd genesis validate
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# Note: Needs to be run in a docker container with image cerc/laconicd:local
|
||||
|
||||
CHAIN_ID=${CHAIN_ID:-"laconic-mainnet"}
|
||||
MONIKER=${MONIKER:-"mainnet-node"}
|
||||
NODE_HOME="/root/.laconicd"
|
||||
|
||||
laconicd config set client chain-id $CHAIN_ID
|
||||
laconicd init $MONIKER --chain-id $CHAIN_ID --default-denom alnt
|
||||
|
||||
# Allow all permissions to process further
|
||||
chmod -R 777 $NODE_HOME/data $NODE_HOME/config
|
||||
@@ -0,0 +1,172 @@
|
||||
import json
|
||||
|
||||
from decimal import Decimal
|
||||
from collections import defaultdict
|
||||
from bech32 import bech32_decode, bech32_encode, convertbits
|
||||
|
||||
#------
|
||||
|
||||
# Helper methods
|
||||
|
||||
def valoper_to_account_address(valoper_addr: str, new_prefix = "laconic") -> str:
|
||||
hrp, data = bech32_decode(valoper_addr)
|
||||
if hrp is None or data is None:
|
||||
raise ValueError("Invalid bech32 address")
|
||||
|
||||
# Convert back from 5-bit to 8-bit
|
||||
decoded = convertbits(data, 5, 8, False)
|
||||
if decoded is None:
|
||||
raise ValueError("Failed to convert bits")
|
||||
|
||||
# Re-encode with new prefix
|
||||
converted_data = convertbits(decoded, 8, 5, True)
|
||||
return bech32_encode(new_prefix, converted_data)
|
||||
|
||||
def get_min_delegation_share(state):
|
||||
validators = state["app_state"]["staking"]["validators"]
|
||||
delegations = state["app_state"]["staking"]["delegations"]
|
||||
|
||||
shares_list = []
|
||||
|
||||
for val in validators:
|
||||
valoper_addr = val["operator_address"]
|
||||
orig_delegator_addr = valoper_to_account_address(valoper_addr)
|
||||
|
||||
# Find delegations where the delegator is the original delegator and delegated to their validator
|
||||
for delegation in delegations:
|
||||
if (delegation["delegator_address"] == orig_delegator_addr and
|
||||
delegation["validator_address"] == valoper_addr):
|
||||
shares = int(Decimal(delegation["shares"]))
|
||||
shares_list.append(shares)
|
||||
|
||||
break
|
||||
|
||||
# Find minimum
|
||||
return min(shares_list)
|
||||
|
||||
#------
|
||||
|
||||
# Read testnet and mainnet states
|
||||
|
||||
mainnet_genesis_dir="mainnet-genesis"
|
||||
testnet_state_file=f"{mainnet_genesis_dir}/testnet-state.json"
|
||||
mainnet_genesis_file=f"{mainnet_genesis_dir}/config/genesis.json"
|
||||
staking_amount_file=f"output/staking-amount.json"
|
||||
|
||||
with open(testnet_state_file) as f:
|
||||
testnet_state = json.load(f)
|
||||
|
||||
with open(mainnet_genesis_file) as f:
|
||||
mainnet_state = json.load(f)
|
||||
|
||||
#------
|
||||
|
||||
# Import required module state
|
||||
mainnet_state["app_state"]["auth"] = testnet_state["app_state"]["auth"]
|
||||
mainnet_state["app_state"]["bond"] = testnet_state["app_state"]["bond"]
|
||||
mainnet_state["app_state"]["bank"] = testnet_state["app_state"]["bank"]
|
||||
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
|
||||
|
||||
# Build map of address -> extra balance to add (as integers)
|
||||
deltas = {}
|
||||
for delegation in testnet_state["app_state"]["staking"]["delegations"]:
|
||||
addr = delegation["delegator_address"]
|
||||
amount = int(Decimal(delegation["shares"]))
|
||||
deltas[addr] = deltas.get(addr, 0) + amount
|
||||
|
||||
# Now apply the deltas to existing balances
|
||||
supply_increment = 0
|
||||
for balance in mainnet_state["app_state"]["bank"]["balances"]:
|
||||
addr = balance["address"]
|
||||
if addr in deltas:
|
||||
for coin in balance["coins"]:
|
||||
if coin["denom"] == "alnt":
|
||||
coin["amount"] = str(int(coin["amount"]) + deltas[addr])
|
||||
supply_increment += deltas[addr]
|
||||
break
|
||||
del deltas[addr]
|
||||
|
||||
# Increase the total supply
|
||||
for coin in mainnet_state["app_state"]["bank"]["supply"]:
|
||||
if coin["denom"] == "alnt":
|
||||
coin["amount"] = str(int(coin["amount"]) + supply_increment)
|
||||
|
||||
#------
|
||||
|
||||
# Remove non-required module accounts
|
||||
|
||||
# Addresses to remove
|
||||
addresses_to_remove = {
|
||||
"bonded_tokens_pool",
|
||||
"not_bonded_tokens_pool",
|
||||
"distribution"
|
||||
}
|
||||
|
||||
# Remove from auth.accounts and get their addresses
|
||||
removed_addresses = set()
|
||||
new_accounts = []
|
||||
for account in mainnet_state["app_state"]["auth"]["accounts"]:
|
||||
account_type = account.get("@type", "")
|
||||
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
|
||||
|
||||
# Remove from bank.balances and tally removed amounts
|
||||
new_balances = []
|
||||
removed_amounts = defaultdict(int)
|
||||
|
||||
for bal in mainnet_state["app_state"]["bank"]["balances"]:
|
||||
if bal["address"] in removed_addresses:
|
||||
# Skip this account
|
||||
for coin in bal["coins"]:
|
||||
denom = coin["denom"]
|
||||
amount = int(coin["amount"])
|
||||
removed_amounts[denom] += amount
|
||||
|
||||
continue
|
||||
|
||||
new_balances.append(bal)
|
||||
|
||||
mainnet_state["app_state"]["bank"]["balances"] = new_balances
|
||||
|
||||
# Reduce from bank supply
|
||||
new_supply = []
|
||||
for coin in mainnet_state["app_state"]["bank"]["supply"]:
|
||||
denom = coin["denom"]
|
||||
amount = int(coin["amount"])
|
||||
amount -= removed_amounts.get(denom, 0)
|
||||
new_supply.append({
|
||||
"denom": denom,
|
||||
"amount": str(amount)
|
||||
})
|
||||
|
||||
mainnet_state["app_state"]["bank"]["supply"] = new_supply
|
||||
|
||||
#------
|
||||
|
||||
# Find minimum delegation share for common staking amount
|
||||
|
||||
min_delegation_share = get_min_delegation_share(testnet_state)
|
||||
with open(staking_amount_file, "w") as f:
|
||||
json.dump({"common_staking_amount": min_delegation_share}, f, indent=2)
|
||||
print(f"Staking amount written to {staking_amount_file}")
|
||||
|
||||
# Write back modified state
|
||||
with open(mainnet_genesis_file, "w") as f:
|
||||
json.dump(mainnet_state, f, indent=2)
|
||||
@@ -9,12 +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"
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
# Early supports: 12960 * 10^18 alps (10% of 129600 * 10^18 alps)
|
||||
EARLY_SUPPORTS="12960000000000000000000"
|
||||
|
||||
DENOM=alps
|
||||
|
||||
input_genesis_file=$INPUT_GENESIS_FILE
|
||||
if [ ! -f ${input_genesis_file} ]; then
|
||||
echo "Genesis file not provided, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$RECIPIENT_ADDRESS" ]; then
|
||||
echo "Recipient address not provided, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
update_genesis() {
|
||||
jq "$1" ${input_genesis_file} > ${input_genesis_file}.tmp &&
|
||||
mv ${input_genesis_file}.tmp ${input_genesis_file}
|
||||
}
|
||||
|
||||
# Add new account to auth.accounts
|
||||
update_genesis '.app_state["auth"]["accounts"] += [{"@type": "/cosmos.auth.v1beta1.BaseAccount", "address": "'$RECIPIENT_ADDRESS'", "pub_key": null, "account_number": "0", "sequence": "0"}]'
|
||||
|
||||
# Add balance for the new account
|
||||
update_genesis '.app_state["bank"]["balances"] += [{"address": "'$RECIPIENT_ADDRESS'", "coins": [{"denom": "'$DENOM'", "amount": "'$EARLY_SUPPORTS'"}]}]'
|
||||
|
||||
# Get current supply
|
||||
CURRENT_SUPPLY=$(jq -r '.app_state["bank"]["supply"][0]["amount"]' ${input_genesis_file})
|
||||
|
||||
# Calculate new supply
|
||||
NEW_SUPPLY=$((CURRENT_SUPPLY + EARLY_SUPPORTS))
|
||||
|
||||
# Update total supply
|
||||
update_genesis '.app_state["bank"]["supply"][0]["amount"] = "'$NEW_SUPPLY'"'
|
||||
|
||||
echo "Genesis file updated with new account ${RECIPIENT_ADDRESS} and allocated ${EARLY_SUPPORTS} ${DENOM}"
|
||||
@@ -4,6 +4,8 @@ set -e
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||
# TODO: Set to OS keyring backend
|
||||
KEYRING="test"
|
||||
|
||||
if [ -f "$genesis_file_path" ]; then
|
||||
echo "Genesis file already created, exiting..."
|
||||
@@ -20,8 +22,8 @@ if [ -z "$KEY_NAME" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DENOM" ]; then
|
||||
echo "DENOM environment variable not set, exiting..."
|
||||
if [ -z "$VALIDATOR_PUB_KEY" ]; then
|
||||
echo "VALIDATOR_PUB_KEY environment variable not set, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -31,34 +33,52 @@ if [ ! -f ${input_genesis_file} ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
# Strip leading and trailing quotes ("") if they exist
|
||||
export MONIKER=$(echo "$CERC_MONIKER" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
||||
export CHAIN_ID=$(echo "$CERC_CHAIN_ID" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
||||
export DENOM=$(echo "$DENOM" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
||||
|
||||
# Init
|
||||
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
|
||||
|
||||
# Import private key passed via PVT_KEY
|
||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY"
|
||||
# Import private key
|
||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY" --keyring-backend $KEYRING
|
||||
|
||||
account_address=$(laconicd keys list | awk -v key_name="$KEY_NAME" '
|
||||
$1 == "name:" && $2 == key_name {found=1}
|
||||
found && $1 == "- address:" {print $3; exit}
|
||||
')
|
||||
# Get account address corresponding to the imported key
|
||||
account_address=$(laconicd keys show "$KEY_NAME" --keyring-backend "$KEYRING" | grep 'address:' | awk -F': ' '{print $2}' | xargs)
|
||||
|
||||
stake_amount=$(jq -r --arg address "$account_address" --arg denom "$DENOM" '.app_state.bank.balances[] | select(.address == $address) | .coins[] | select(.denom == $denom) | .amount' $genesis_file_path)
|
||||
if [ -z "$account_address" ]; then
|
||||
echo "Failed to get account address for key name $KEY_NAME, exiting..."
|
||||
laconicd keys list --keyring-backend $KEYRING
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set staking amount
|
||||
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
|
||||
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
|
||||
|
||||
Regular → Executable
+39
-9
@@ -3,18 +3,48 @@ set -e
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
# Create validator with fixed parameters
|
||||
laconicd tx staking create-validator \
|
||||
--amount 900000000$DENOM \
|
||||
--pubkey $(laconicd tendermint show-validator) \
|
||||
--moniker "$CERC_MONIKER" \
|
||||
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" \
|
||||
--commission-rate 0.0 \
|
||||
--commission-max-rate 0.0 \
|
||||
--commission-max-change-rate 0.0 \
|
||||
--min-self-delegation 1 \
|
||||
--gas auto \
|
||||
--gas-adjustment 1.5 \
|
||||
--gas-prices $MIN_GAS_PRICE$DENOM \
|
||||
--from $KEY_NAME \
|
||||
--keyring-backend $KEYRING \
|
||||
--yes
|
||||
|
||||
@@ -15,38 +15,50 @@ 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
|
||||
/scripts/setup-laconicd.sh
|
||||
|
||||
# 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
|
||||
|
||||
# Use provided config files
|
||||
cp $input_genesis_file $NODE_HOME/config/genesis.json
|
||||
else
|
||||
echo "Node data dir $NODE_HOME/data already exists, skipping initialization..."
|
||||
fi
|
||||
# Use provided config files
|
||||
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
|
||||
|
||||
# Enable telemetry (prometheus metrics: http://localhost:1317/metrics?format=prometheus)
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' 's/enabled = false/enabled = true/g' $NODE_HOME/config/app.toml
|
||||
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $NODE_HOME/config/app.toml
|
||||
sed -i '' 's/prometheus = false/prometheus = true/g' $NODE_HOME/config/config.toml
|
||||
else
|
||||
sed -i 's/enabled = false/enabled = true/g' $NODE_HOME/config/app.toml
|
||||
sed -i 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $NODE_HOME/config/app.toml
|
||||
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
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
# mainnet-laconicd
|
||||
|
||||
Instructions for running validator nodes
|
||||
|
||||
@@ -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 # TODO: Use a release
|
||||
containers:
|
||||
- cerc/laconicd
|
||||
pods:
|
||||
|
||||
Reference in New Issue
Block a user