Compare commits
17 Commits
main
...
ng-create-
Author | SHA1 | Date | |
---|---|---|---|
1df3ab2500 | |||
|
1de4a3dc3e | ||
b3ebd32499 | |||
|
daad25a049 | ||
|
13c95e61c5 | ||
d284d4c321 | |||
|
67405d3809 | ||
74e5f470e2 | |||
|
d769c6e055 | ||
|
f181e67045 | ||
afd2082f6e | |||
|
404951bda7 | ||
|
31a560bb15 | ||
|
08847a3912 | ||
|
44219c801c | ||
|
ad22b6350b | ||
|
0c25f9daff |
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,8 +1,5 @@
|
|||||||
*-deployment
|
*-deployment
|
||||||
*-spec.yml
|
*-spec.yml
|
||||||
|
|
||||||
# Playbook vars
|
# Validator playbook vars
|
||||||
*-vars.yml
|
playbooks/validator/validator-vars.yml
|
||||||
|
|
||||||
# Playbooks inventories
|
|
||||||
hosts.ini
|
|
||||||
|
26
README.md
26
README.md
@ -1,27 +1 @@
|
|||||||
# laconicd-stack
|
# laconicd-stack
|
||||||
|
|
||||||
- This stack is used for running nodes to launch Laconic mainnet chain
|
|
||||||
|
|
||||||
- It allows you to export SAPO testnet state and start mainnet nodes
|
|
||||||
|
|
||||||
## Mainnet OPS
|
|
||||||
|
|
||||||
- To launch Laconic mainnet, follow these steps:
|
|
||||||
|
|
||||||
- **Export Testnet State and Prepare Token Distribution:** Begin by exporting SAPO testnet state and preparing requirements for mainnet chain as detailed in [export-testnet.md](docs/export-testnet.md)
|
|
||||||
|
|
||||||
- **Run the First Validator Node:** Set up and run the bootstrap validator node as detailed in [run-first-validator.md](docs/run-first-validator.md)
|
|
||||||
|
|
||||||
- **Deploy Cosmos Multisig App:** Integrate and run the Cosmos Multisig app using the playbook available at [cosmos-multisig-app playbook](./playbooks/cosmos-multisig-app/README.md)
|
|
||||||
|
|
||||||
- To migrate existing deployments from SAPO testnet to mainnet, refer to [update-deployments.md](docs/update-deployments.md)
|
|
||||||
|
|
||||||
## Join Mainnet
|
|
||||||
|
|
||||||
- **Run A Validator Node:** Follow steps in [run-validator.md](docs/run-validator.md) to run a mainnet validator node
|
|
||||||
|
|
||||||
- **Update Service Provider:** Follow steps in [update-service-provider.md](docs/update-service-provider.md) to migrate your service provider from SAPO testnet to mainnet
|
|
||||||
|
|
||||||
## Multisig App
|
|
||||||
|
|
||||||
- Usage guide is available at [multisig-usage.md](./playbooks/cosmos-multisig-app/multisig-usage.md)
|
|
||||||
|
Binary file not shown.
@ -1,49 +0,0 @@
|
|||||||
{
|
|
||||||
"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": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"coinDenom": "ALPS",
|
|
||||||
"coinMinimalDenom": "alps",
|
|
||||||
"coinDecimals": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"feeCurrencies": [
|
|
||||||
{
|
|
||||||
"coinDenom": "ALNT",
|
|
||||||
"coinMinimalDenom": "alnt",
|
|
||||||
"coinDecimals": 0,
|
|
||||||
"gasPriceStep": {
|
|
||||||
"low": 0.001,
|
|
||||||
"average": 0.001,
|
|
||||||
"high": 0.002
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"stakeCurrency": {
|
|
||||||
"coinDenom": "ALNT",
|
|
||||||
"coinMinimalDenom": "alnt",
|
|
||||||
"coinDecimals": 0
|
|
||||||
},
|
|
||||||
"features": [
|
|
||||||
"stargate"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"common_staking_amount": 900000000
|
|
||||||
}
|
|
505
docs/demo.md
505
docs/demo.md
@ -1,505 +0,0 @@
|
|||||||
# 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 `zstd` using `sudo apt install zstd` (Linux) or `brew install zstd` (macOS)
|
|
||||||
- testnet-state.zst ([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.zst` file from prerequisites
|
|
||||||
|
|
||||||
- Fetch stack:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --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
|
|
||||||
|
|
||||||
```
|
|
||||||
zstd -dc $CWD/testnet-state.zst > $CWD/testnet-state.json
|
|
||||||
|
|
||||||
# Remove zst folder
|
|
||||||
rm -rf testnet-state.zst
|
|
||||||
```
|
|
||||||
|
|
||||||
- Set envs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export EXPORTED_STATE_PATH=$CWD/testnet-state.json
|
|
||||||
export LPS_DISTRIBUTION_PATH=~/cerc/laconicd-stack/data/distribution.json
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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"
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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"
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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:8090"
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
@ -1,21 +0,0 @@
|
|||||||
# Domains / Port Mappings
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Machine running the mainnet node should have following domain port mappings
|
|
||||||
https://laconicd-mainnet.laconic.com -> 26657
|
|
||||||
https://laconicd-mainnet.laconic.com/api -> 9473/api
|
|
||||||
https://laconicd-mainnet.laconic.com/console -> 9473/console
|
|
||||||
https://laconicd-mainnet.laconic.com/graphql -> 9473/graphql
|
|
||||||
|
|
||||||
Open p2p port:
|
|
||||||
26656
|
|
||||||
|
|
||||||
Open port for TMKMS:
|
|
||||||
26659
|
|
||||||
|
|
||||||
# Console app deployment already exists, point new domain to following port
|
|
||||||
https://console-mainnet.laconic.com -> 4001
|
|
||||||
|
|
||||||
# Cosmos Multisig App
|
|
||||||
https://multisig.laconic.com -> 7000
|
|
||||||
```
|
|
@ -1,82 +0,0 @@
|
|||||||
# Export Testnet
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Machine where the SAPO testnet validator node is already running
|
|
||||||
|
|
||||||
- Install `zstd` using `sudo apt install zstd` (Linux) or `brew install zstd` (macOS)
|
|
||||||
|
|
||||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
|
||||||
|
|
||||||
- laconicd-stack
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
## Export testnet state
|
|
||||||
|
|
||||||
- Run the following steps in machine where the testnet node is already running (machine 1)
|
|
||||||
|
|
||||||
- Export the testnet deployment directory as environment variable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export TESTNET_DEPLOYMENT_DIR=<absolute/path/to/testnet/deployment>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Get your private key from testnet deployment (should be available if steps for joining SAPO testnet was followed previously):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $TESTNET_DEPLOYMENT_DIR exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe --keyring-backend test"
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: Store this key securely as it is needed in later steps for signing bootstrap validator node gentx
|
|
||||||
|
|
||||||
- Stop the node for SAPO testnet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $TESTNET_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run script to export state from testnet chain:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
~/cerc/laconicd-stack/scripts/export-testnet-state.sh $TESTNET_DEPLOYMENT_DIR
|
|
||||||
```
|
|
||||||
|
|
||||||
- The compressed zst file will be generated at `$TESTNET_DEPLOYMENT_DIR/export/testnet-state.zst`
|
|
||||||
|
|
||||||
- The generated state file will be used in later steps for creating genesis.json file for mainnet
|
|
||||||
|
|
||||||
## Prepare LPS distribution JSON
|
|
||||||
|
|
||||||
- The following steps can be performed in any machine
|
|
||||||
|
|
||||||
- Fetch laconicd-stack
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
- Set envs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# File path where LPS distribution JSON file will be created
|
|
||||||
export LPS_DISTRIBUTION_PATH=<absolute/path/to/distribution.json>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Generate lockup distribution JSON file with LPS distribution Google spreadsheet URL or downloaded CSV file path
|
|
||||||
|
|
||||||
```bash
|
|
||||||
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-csv-file-path>" -o $LPS_DISTRIBUTION_PATH
|
|
||||||
```
|
|
||||||
|
|
||||||
- This will generate the JSON file at `$LPS_DISTRIBUTION_PATH` which will be later required when creating genesis file
|
|
||||||
|
|
||||||
## Requirements for Mainnet Genesis
|
|
||||||
|
|
||||||
- Exported testnet state
|
|
||||||
- LPS distribution JSON
|
|
||||||
- Account address for early supports
|
|
||||||
- This account will be allocated 20% of total LPS tokens
|
|
||||||
- Private key of account which will sign gentx for the bootstrap validator node
|
|
@ -1,450 +0,0 @@
|
|||||||
# Run First Validator Node
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- Machine 1: Where the TMKMS service is to be setup
|
|
||||||
|
|
||||||
- Machine 2: Where the mainnet first validator node is to be setup
|
|
||||||
|
|
||||||
- Check [domain port mappings](./domain-port-mappings.md) to ensure that required domains are pointing to correct ports
|
|
||||||
|
|
||||||
- Machine 3: Where the genesis file is to be generated
|
|
||||||
|
|
||||||
- Install `zstd` using `sudo apt install zstd` (Linux) or `brew install zstd` (macOS)
|
|
||||||
|
|
||||||
- [LSP distribution JSON](./export-testnet.md#prepare-lps-distribution-json)
|
|
||||||
|
|
||||||
- [Exported testnet state](./export-testnet.md#export-testnet-state)
|
|
||||||
|
|
||||||
- Following tools are required in all machines:
|
|
||||||
|
|
||||||
- [ansible](../playbooks/README.md#ansible-installation)
|
|
||||||
|
|
||||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
|
||||||
|
|
||||||
- laconicd-stack
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build laconicd to generate genesis file
|
|
||||||
|
|
||||||
- Run the following steps in a secure machine (machine 3) separate from the one where the node is to be setup (machine 2)
|
|
||||||
|
|
||||||
- Run playbook to build laconicd container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/build-laconicd.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup bootstrap node deployment
|
|
||||||
|
|
||||||
- Run the following steps in the machine where the mainnet node is to be setup (machine 2)
|
|
||||||
|
|
||||||
- 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"
|
|
||||||
|
|
||||||
# Enable TMKMS
|
|
||||||
tmkms_enabled: true
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
export MAINNET_DEPLOYMENT_DIR=mainnet-laconicd-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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 $DATA_DIRECTORY/$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](#generate-mainnet-genesis-file)
|
|
||||||
|
|
||||||
- Copy over the `priv_validator_key.json` located at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json` to the machine where the TMKMS service is to be setup (machine 1)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Example command to transfer file from machine 2 to machine 1 (run on machine 2)
|
|
||||||
scp -C $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json <user>@<machine-ip-address>:<absolute-path-to-desired-destination-directory>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup TMKMS deployment
|
|
||||||
|
|
||||||
- For integrating TMKMS with laconicd, follow steps below in the machine where the TMKMS service is to be setup (machine 1)
|
|
||||||
|
|
||||||
- Export the data directory and TMKMS deployment directory as environment variables:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Parent directory where the deployment directory will live
|
|
||||||
export DATA_DIRECTORY=
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to setup the TMKMS service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Generate mainnet genesis file
|
|
||||||
|
|
||||||
- Run the following steps in machine where [the genesis file is to be generated (machine 3)](#build-laconicd-to-generate-genesis-file)
|
|
||||||
|
|
||||||
- Set envs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# File path where exported testnet state JSON file will be created
|
|
||||||
export EXPORTED_STATE_PATH=<absolute/path/to/testnet-state.json>
|
|
||||||
|
|
||||||
# File path where LPS distribution JSON file will be created
|
|
||||||
export LPS_DISTRIBUTION_PATH=<absolute/path/to/distribution.json>
|
|
||||||
|
|
||||||
# Parent directory where the deployment directory will be setup (required for generating genesis)
|
|
||||||
export DATA_DIRECTORY=
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: Steps for creating LPS distribution JSON are in [export-testnet.md](./export-testnet.md#prepare-lps-distribution-json)
|
|
||||||
|
|
||||||
- Copy over the compressed `testnet-state.zst` file (from [export-testnet.md](./export-testnet.md#export-testnet-state)):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Example command to transfer testnet state file
|
|
||||||
scp -C <user>@<machine-ip-address>:<absolute-path-to-testnet-deployment>/export/testnet-state.zst <absolute-path-to-compressed-file>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Extract the testnet-state JSON file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
zstd -dc <absolute-path-to-compressed-file>/testnet-state.zst > $EXPORTED_STATE_PATH
|
|
||||||
|
|
||||||
# Remove zst folder
|
|
||||||
rm -rf <absolute-path-to-compressed-file>/testnet-state.zst
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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:
|
|
||||||
|
|
||||||
NOTE: Use the public key exported in [previous steps](#setup-node)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Make sure to wrap it with single quotes ('')
|
|
||||||
validator_pub_key: '<public-key-of-your-node>'
|
|
||||||
```
|
|
||||||
|
|
||||||
- Change to the deployments directory
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd $DATA_DIRECTORY
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run playbook for generating mainnet genesis file with gentx:
|
|
||||||
|
|
||||||
```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"
|
|
||||||
```
|
|
||||||
|
|
||||||
- When prompted for private key, use key of the existing account that was exported in [export-testnet.md](./export-testnet.md#export-testnet-state)
|
|
||||||
|
|
||||||
- Private key should be of the account which will create the first validator bootstrap node
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: Staking amount will be used by the playbooks to send create validator txs
|
|
||||||
|
|
||||||
|
|
||||||
## Start Mainnet
|
|
||||||
|
|
||||||
### Start TMKMS
|
|
||||||
|
|
||||||
- Run these steps in the machine where [the TMKMS service is setup (machine 1)](#setup-tmkms-deployment)
|
|
||||||
|
|
||||||
- Copy the example variables file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp ~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.example.yml ~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml` with required values:
|
|
||||||
|
|
||||||
NOTE: Use the `priv_validator_key.json` file copied from the node setup machine (Machine 2) in [previous step](#setup-bootstrap-node-deployment)
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Absolute path to the node's private validator key file
|
|
||||||
priv_validator_key_file_path: "</path/to/priv_validator_key.json>"
|
|
||||||
|
|
||||||
# Set the IP address of the machine where the laconicd node is setup
|
|
||||||
node_ip: "laconicd-mainnet.laconic.com"
|
|
||||||
|
|
||||||
# Set the port of the laconicd node
|
|
||||||
node_port: "26659"
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to run the TMKMS:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Check logs to ensure that TMKMS is running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment logs tmkms -f
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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://<node-ip>: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
|
|
||||||
|
|
||||||
### Start laconicd node
|
|
||||||
|
|
||||||
- Run the following steps in the machine where [the mainnet node is setup (machine 2)](#setup-bootstrap-node-deployment)
|
|
||||||
|
|
||||||
- Remove the validator key from node deployment as it is no longer required:
|
|
||||||
|
|
||||||
NOTE: Store it safely offline in case of an emergency
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rm -rf $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy the genesis file generated in [Generate mainnet genesis file section](#generate-mainnet-genesis-file) from machine 3 to the machine 2 mainnet deployment tmp directory:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Example command to transfer file from machine 3 to machine 2 (run on machine 3)
|
|
||||||
scp -C $DATA_DIRECTORY/output/genesis.json <user>@<machine-ip-address>:<absolute-path-to-deployments-directory>/mainnet-laconicd-deployment/data/laconicd-data/tmp/
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: The node takes a long time to start generating blocks `~30 seconds`
|
|
||||||
|
|
||||||
- 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` account balance:
|
|
||||||
|
|
||||||
```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"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Publish required artifacts
|
|
||||||
|
|
||||||
- Run the following steps in machine where the genesis file and staking amount files were generated (machine 3)
|
|
||||||
|
|
||||||
- Copy the genesis file to [config](./config) folder:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp $DATA_DIRECTORY/output/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy the staking amount file to [config](./config) folder:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp $DATA_DIRECTORY/output/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.json
|
|
||||||
```
|
|
||||||
|
|
||||||
- Check git status of the stack repo
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd ~/cerc/laconicd-stack
|
|
||||||
git status
|
|
||||||
```
|
|
||||||
|
|
||||||
The following files should show up with changes:
|
|
||||||
- config/mainnet-genesis.json
|
|
||||||
- config/staking-amount.json
|
|
||||||
|
|
||||||
- Create a PR (to this repo and to https://github.com/LaconicNetwork/mainnet/) with the genesis file and staking amount file so that it is available to other validators
|
|
||||||
|
|
||||||
- Run the following steps in machine where the mainnet node is running (machine 2)
|
|
||||||
|
|
||||||
- Get your node's address by running the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@laconicd-mainnet.laconic.com:26656'
|
|
||||||
```
|
|
||||||
|
|
||||||
- Add your node's address to [node-addresses.yml](../node-addresses.yml)
|
|
||||||
|
|
||||||
- Update the file `~/cerc/laconicd-stack/node-addresses.yml` in machine where genesis file is generated (machine 3)
|
|
||||||
|
|
||||||
- Check git status of the stack repo
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd ~/cerc/laconicd-stack
|
|
||||||
git status
|
|
||||||
```
|
|
||||||
|
|
||||||
The `node-addresses.yml` file should show up with changes
|
|
||||||
|
|
||||||
- Submit a PR with the node address so that it is available to other validators
|
|
||||||
|
|
||||||
## Update config
|
|
||||||
|
|
||||||
- Run following steps to update the config for TMKMS and node
|
|
||||||
|
|
||||||
### TMKMS
|
|
||||||
|
|
||||||
- Run these steps in the machine where the TMKMS service is setup (machine 1)
|
|
||||||
|
|
||||||
- Stop the TMKMS deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$TMKMS_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml` with required values
|
|
||||||
|
|
||||||
- Run ansible playbook to run the TMKMS:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Node
|
|
||||||
|
|
||||||
- Run these steps in the machine where the mainnet node is setup (machine 2)
|
|
||||||
|
|
||||||
- Stop the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env` with required values
|
|
||||||
|
|
||||||
- Start the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Rebuild Images
|
|
||||||
|
|
||||||
- Follow these steps to rebuild the images for TMKMS and node in case of any code changes
|
|
||||||
|
|
||||||
### TMKMS
|
|
||||||
|
|
||||||
- Run these steps in the machine where the TMKMS service is setup (machine 1)
|
|
||||||
|
|
||||||
- Stop the TMKMS deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to rebuild the TMKMS image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Start the TMKMS deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Node
|
|
||||||
|
|
||||||
- Run these steps in the machine where the mainnet node is setup (machine 2)
|
|
||||||
|
|
||||||
- Stop the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to rebuild the node image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Start the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
|
|
||||||
```
|
|
@ -1,378 +0,0 @@
|
|||||||
# Run Validator Node
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) is required in all machines listed below
|
|
||||||
|
|
||||||
- To fetch laconicd-stack:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
- Machine 1: Where your SAPO testnet node is already running
|
|
||||||
|
|
||||||
- Machine 2: Where the mainnet validator node is to be setup
|
|
||||||
|
|
||||||
- laconicd-stack
|
|
||||||
|
|
||||||
- [ansible](playbooks/README.md#ansible-installation)
|
|
||||||
|
|
||||||
- Install `zstd` using `sudo apt install zstd` (Linux) or `brew install zstd` (macOS)
|
|
||||||
|
|
||||||
- Machine 3: Where the create-validator transaction is to be signed
|
|
||||||
|
|
||||||
- laconicd-stack
|
|
||||||
|
|
||||||
- [ansible](playbooks/README.md#ansible-installation)
|
|
||||||
|
|
||||||
- Machine 4: Where the TMKMS service is to be setup (Optional)
|
|
||||||
|
|
||||||
- laconicd-stack
|
|
||||||
|
|
||||||
- [ansible](playbooks/README.md#ansible-installation)
|
|
||||||
|
|
||||||
## Stop SAPO testnet node
|
|
||||||
|
|
||||||
- Run the following steps in machine where your SAPO testnet validator node is already running (machine 1)
|
|
||||||
|
|
||||||
- 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](#create-validator). It should be the private key of the account that was used to create validator in SAPO testnet.
|
|
||||||
|
|
||||||
- Stop the node for SAPO testnet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir <testnet-deployment-dir> stop
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build laconicd to create validator
|
|
||||||
|
|
||||||
- Run the following steps in a secure machine (machine 3) separate from the one where the node is to be setup (machine 2)
|
|
||||||
|
|
||||||
- Run playbook to build laconicd container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/build-laconicd.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup TMKMS (Optional)
|
|
||||||
|
|
||||||
- For integrating TMKMS with laconicd, follow steps below in the machine where the TMKMS service is to be setup (machine 4)
|
|
||||||
|
|
||||||
- Export the data directory as environment variable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Parent directory where the deployment directory will live
|
|
||||||
export DATA_DIRECTORY=
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to setup the TMKMS service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup laconicd Node
|
|
||||||
|
|
||||||
- Run the following steps in the machine where the validator node is to be setup for mainnet (machine 2)
|
|
||||||
|
|
||||||
- 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"
|
|
||||||
|
|
||||||
# Enable TMKMS (Set to true or false)
|
|
||||||
# NOTE: Enabling TMKMS is optional and can be set to `true` if you are following the optional steps to setup TMKMS
|
|
||||||
tmkms_enabled:
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
export MAINNET_DEPLOYMENT_DIR=mainnet-validator-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
- To get path to the deployment
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR
|
|
||||||
```
|
|
||||||
|
|
||||||
## Start Deployments
|
|
||||||
|
|
||||||
### Start TMKMS (Optional)
|
|
||||||
|
|
||||||
- Run the following steps in the machine where [the TMKMS service is setup (Machine 4)](#setup-tmkms)
|
|
||||||
|
|
||||||
- Copy over the `priv_validator_key.json` from the machine where [mainnet laconicd node was setup](#setup-laconicd-node) (machine 2) to a suitable place in the TMKMS machine (path to file needs to be specified in playbook vars in next step)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Example command to transfer file from machine 2 (run on machine 2)
|
|
||||||
scp -C <user>@<machine-2-ip-address>:<path_to_laconicd_deployment_dir>/data/laconicd-data/config/priv_validator_key.json <absolute-path-to-desired-destination-directory>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy the example variables file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp ~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.example.yml ~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml` with required values:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Absolute path to the node's private validator key file
|
|
||||||
# Use the priv_validator_key.json file copied from the node setup machine (Machine 2) in previous step
|
|
||||||
priv_validator_key_file_path: "<absolute/path/to/priv_validator_key.json>"
|
|
||||||
|
|
||||||
# Set the IP address of the machine where the laconicd node is setup
|
|
||||||
node_ip: "<NODE_PUBLIC_IP_ADDRESS>"
|
|
||||||
|
|
||||||
# Set the port of the laconicd node
|
|
||||||
node_port: "26659"
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to run the TMKMS:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Check logs to ensure that TMKMS is running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment logs tmkms -f
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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@<node-ip>: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
|
|
||||||
|
|
||||||
### Start laconicd Node
|
|
||||||
|
|
||||||
- Run the following steps in the machine where [the laconicd node is setup (machine 2)](#setup-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
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: The node takes a long time to start syncing blocks `~30 seconds`
|
|
||||||
|
|
||||||
- Get the public key of your node:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd tendermint show-validator"
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: This public key is required in next step to create validator
|
|
||||||
|
|
||||||
- Check sync status of node:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check sync status
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd status | jq .sync_info"
|
|
||||||
|
|
||||||
# `catching_up: false` indicates that node is completely synced
|
|
||||||
```
|
|
||||||
|
|
||||||
## Create Validator
|
|
||||||
|
|
||||||
- Run these steps in a machine from where [the create-validator transaction is to be signed (machine 3)](#build-laconicd-to-create-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:
|
|
||||||
|
|
||||||
NOTE: Use the public key exported in [previous step](#start-laconicd-node)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Set the public IP address of the machine where your node is running
|
|
||||||
# NOTE: An https URL can also be used
|
|
||||||
node_url: "tcp://NODE_PUBLIC_IP_ADDRESS:26657"
|
|
||||||
|
|
||||||
# Make sure to wrap it with single quotes ('')
|
|
||||||
validator_pub_key: '<public-key-of-your-node>'
|
|
||||||
|
|
||||||
# Same moniker as set during setup of laconicd node
|
|
||||||
cerc_moniker: "<your-moniker>"
|
|
||||||
```
|
|
||||||
|
|
||||||
- Set a directory path required by the playbook to create validator (used temporarily):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export DATA_DIRECTORY=<data-directory>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to create a validator in the running chain:
|
|
||||||
|
|
||||||
NOTE: Make sure that your node has completed syncing before running the playbook
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Input private key of the existing account that was exported in [previous steps](#stop-sapo-testnet-node) when prompted
|
|
||||||
|
|
||||||
- Run the following commands in the machine where the validator node is running (machine 2)
|
|
||||||
|
|
||||||
- Check the validator list:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
|
|
||||||
```
|
|
||||||
|
|
||||||
- (Optional) If TMKMS is configured and running, remove the validator key from node deployment:
|
|
||||||
|
|
||||||
NOTE: Store it safely offline in case of an emergency
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rm -rf $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
|
|
||||||
```
|
|
||||||
|
|
||||||
## Register Your Node
|
|
||||||
|
|
||||||
- Run the following steps in the machine where the mainnet node is setup (machine 2)
|
|
||||||
|
|
||||||
- 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 [node-addresses.yml](../node-addresses.yml) file
|
|
||||||
|
|
||||||
- Submit a PR to add your node address to the [laconicd-stack repository](https://git.vdb.to/cerc-io/laconicd-stack)
|
|
||||||
|
|
||||||
## Update config
|
|
||||||
|
|
||||||
- Run following steps to update the config for TMKMS and node
|
|
||||||
|
|
||||||
### TMKMS
|
|
||||||
|
|
||||||
- Run these steps in the machine where the TMKMS service is setup (machine 4)
|
|
||||||
|
|
||||||
- Stop the TMKMS deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml` with required values
|
|
||||||
|
|
||||||
- Run ansible playbook to run the TMKMS:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Node
|
|
||||||
|
|
||||||
- Run these steps in the machine where the mainnet node is setup (machine 2)
|
|
||||||
|
|
||||||
- Stop the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env` with required values
|
|
||||||
|
|
||||||
- Start the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Rebuild Images
|
|
||||||
|
|
||||||
- Follow these steps to rebuild the images for TMKMS and node in case of any code changes
|
|
||||||
|
|
||||||
### TMKMS
|
|
||||||
|
|
||||||
- Run these steps in the machine where the TMKMS service is setup (machine 4)
|
|
||||||
|
|
||||||
- Stop the TMKMS deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/tmkms-deployment stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to rebuild the TMKMS image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Start the TMKMS deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/run-tmkms.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Node
|
|
||||||
|
|
||||||
- Run these steps in the machine where the mainnet node is setup (machine 2)
|
|
||||||
|
|
||||||
- Stop the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to rebuild the node image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
BUILD_ONLY=true ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- Start the node deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
|
|
||||||
```
|
|
@ -1,394 +0,0 @@
|
|||||||
# Update Deployments
|
|
||||||
|
|
||||||
Instructions to reset / update the deployments
|
|
||||||
|
|
||||||
## Login
|
|
||||||
|
|
||||||
* Log in as `dev` user on the deployments VM
|
|
||||||
|
|
||||||
* All the deployments are placed in the `/srv` directory:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /srv
|
|
||||||
```
|
|
||||||
|
|
||||||
## laconic-wallet-web
|
|
||||||
|
|
||||||
* Deployment dir: `/srv/wallet/laconic-wallet-web-deployment`
|
|
||||||
|
|
||||||
* If code has changed, fetch and build with updated source code:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# testnet-onboarding-app source
|
|
||||||
cd ~/cerc/laconic-wallet-web
|
|
||||||
|
|
||||||
# Fetch from remote
|
|
||||||
git fetch
|
|
||||||
|
|
||||||
# Checkout to the latest tag (https://git.vdb.to/LaconicNetwork/laconic-wallet-web/tags)
|
|
||||||
git checkout <tag>
|
|
||||||
|
|
||||||
# Rebuild the containers
|
|
||||||
cd /srv/wallet
|
|
||||||
|
|
||||||
laconic-so --stack ~/cerc/laconic-wallet-web/stack/stack-orchestrator/stack/laconic-wallet-web build-containers --force-rebuild
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update the configuration `laconic-wallet-web-deployment/config.env`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# URL for the deploy app so that wallet can work with it
|
|
||||||
CERC_ALLOWED_URLS=https://deploy.laconic.com,https://store.laconic.com
|
|
||||||
```
|
|
||||||
|
|
||||||
* Restart the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir laconic-wallet-web-deployment stop
|
|
||||||
|
|
||||||
laconic-so deployment --dir laconic-wallet-web-deployment start
|
|
||||||
|
|
||||||
# Follow logs for laconic-wallet-web container, wait for the build to finish
|
|
||||||
laconic-so deployment --dir laconic-wallet-web-deployment logs laconic-wallet-web -f
|
|
||||||
```
|
|
||||||
|
|
||||||
* The web wallet can now be viewed at <https://wallet.laconic.com>
|
|
||||||
|
|
||||||
## laconic-console
|
|
||||||
|
|
||||||
* Deployment dir: `/srv/console/laconic-console-testnet2-deployment`
|
|
||||||
|
|
||||||
* Set deployment directory in a variable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
CONSOLE_DEPLOYMENT=/srv/console/laconic-console-testnet2-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update the configuration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nano $CONSOLE_DEPLOYMENT/config.env
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Laconicd (hosted) GQL endpoint
|
|
||||||
LACONIC_HOSTED_ENDPOINT=https://laconicd-mainnet.laconic.com
|
|
||||||
|
|
||||||
# laconicd chain id
|
|
||||||
CERC_LACONICD_CHAIN_ID=laconic-mainnet
|
|
||||||
```
|
|
||||||
|
|
||||||
* Restart the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $CONSOLE_DEPLOYMENT stop
|
|
||||||
|
|
||||||
laconic-so deployment --dir $CONSOLE_DEPLOYMENT start
|
|
||||||
|
|
||||||
# Follow logs for console container
|
|
||||||
laconic-so deployment --dir $CONSOLE_DEPLOYMENT logs console -f
|
|
||||||
```
|
|
||||||
|
|
||||||
* The laconic console can now be viewed at <https://console-mainnet.laconic.com>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Laconic Shopify
|
|
||||||
|
|
||||||
* Deployment dir: `/srv/shopify/laconic-shopify-deployment`
|
|
||||||
|
|
||||||
* If code has changed, fetch and build with updated source code:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify setup-repositories --git-ssh --pull
|
|
||||||
|
|
||||||
# rebuild containers
|
|
||||||
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-shopify build-containers --force-rebuild
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update the configuration if required in `laconic-shopify-deployment/config.env`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# laconicd RPC endpoint
|
|
||||||
CERC_LACONICD_RPC_ENDPOINT=https://laconicd-mainnet.laconic.com
|
|
||||||
|
|
||||||
# laconicd chain id
|
|
||||||
CERC_LACONICD_CHAIN_ID=laconic-mainnet
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update the code for shopify app in [theme/sections/main-product.liquid](https://git.vdb.to/cerc-io/shopify/pulls/13/files#diff-971bd0e0a616c3feaecf3205ac98a23296a5a0d7) to use the correct chain ID
|
|
||||||
|
|
||||||
```bash
|
|
||||||
...
|
|
||||||
<script>
|
|
||||||
// Function to send a message to the iframe to get or create wallet account
|
|
||||||
function requestWalletAddress(iframe) {
|
|
||||||
const message = {
|
|
||||||
type: 'REQUEST_CREATE_OR_GET_ACCOUNTS',
|
|
||||||
# Replace `laconic-testnet-2` with `laconic-mainnet`
|
|
||||||
chainId: 'laconic-testnet-2',
|
|
||||||
};
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
* Restart the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /srv/shopify
|
|
||||||
|
|
||||||
laconic-so deployment --dir laconic-shopify-deployment stop
|
|
||||||
|
|
||||||
laconic-so deployment --dir laconic-shopify-deployment start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Webapp Deployer
|
|
||||||
|
|
||||||
* Deployment dir: `/srv/service-provider/webapp-deployer` and `/srv/service-provider/webapp-ui`
|
|
||||||
|
|
||||||
* Set deployment directory in a variable:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SP_DEPLOYMENT=/srv/service-provider/webapp-deployer
|
|
||||||
SP_UI_DEPLOYMENT=/srv/service-provider/webapp-ui
|
|
||||||
```
|
|
||||||
|
|
||||||
* Stop the deployments:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $SP_DEPLOYMENT stop
|
|
||||||
laconic-so deployment --dir $SP_UI_DEPLOYMENT stop
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update the laconic registry config with new endpoints:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nano $SP_DEPLOYMENT/data/config/laconic.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
services:
|
|
||||||
registry:
|
|
||||||
rpcEndpoint: "https://laconicd-mainnet.laconic.com"
|
|
||||||
gqlEndpoint: "https://laconicd-mainnet.laconic.com/api"
|
|
||||||
userKey: "<userKey>"
|
|
||||||
bondId: "<bondId>"
|
|
||||||
chainId: laconic-mainnet
|
|
||||||
gasPrice: 0.001alnt
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: Existing `userKey` and `bondId` can be used since they are carried over from SAPO testnet to mainnet
|
|
||||||
|
|
||||||
* Update any deployer config (`webapp-deployer/config.env`) if required
|
|
||||||
|
|
||||||
* Start the webapp deployer:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $SP_DEPLOYMENT start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Get the webapp-deployer pod id:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir webapp-deployer ps
|
|
||||||
|
|
||||||
# Expected output
|
|
||||||
# Running containers:
|
|
||||||
# id: default/laconic-096fed46af974a47-deployment-644db859c7-snbq6, name: laconic-096fed46af974a47-deployment-644db859c7-snbq6, ports: 10.42.2.11:9555->9555
|
|
||||||
|
|
||||||
# Set pod id
|
|
||||||
export POD_ID=
|
|
||||||
|
|
||||||
# Example:
|
|
||||||
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
|
|
||||||
```
|
|
||||||
|
|
||||||
* Copy over GPG keys files to the webapp-deployer container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubie ctx default
|
|
||||||
|
|
||||||
# Copy the GPG key files to the pod
|
|
||||||
kubectl cp <path-to-your-gpg-private-key> $POD_ID:/app
|
|
||||||
kubectl cp <path-to-your-gpg-public-key> $POD_ID:/app
|
|
||||||
|
|
||||||
# Required everytime you stop and start the deployer
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Deployer
|
|
||||||
kubectl logs -f $POD_ID
|
|
||||||
|
|
||||||
# Deployer auction handler
|
|
||||||
kubectl logs -f $POD_ID -c cerc-webapp-auction-handler
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update deployer UI config:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nano $SP_UI_DEPLOYMENT/config.env
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# URL of the laconic console
|
|
||||||
LACONIC_HOSTED_CONFIG_app_console_link=https://console-mainnet.laconic.com
|
|
||||||
```
|
|
||||||
|
|
||||||
* Start the webapp UI:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $SP_UI_DEPLOYMENT start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check logs
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $SP_UI_DEPLOYMENT logs webapp
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deploy Backend
|
|
||||||
|
|
||||||
* Deployment dir: `/srv/deploy-backend/laconic-backend-deployment`
|
|
||||||
|
|
||||||
* Stop the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir laconic-backend-deployment stop
|
|
||||||
```
|
|
||||||
|
|
||||||
* If code has changed, fetch and build with updated source code:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend setup-repositories --pull
|
|
||||||
|
|
||||||
# rebuild containers
|
|
||||||
laconic-so --stack ~/cerc/snowballtools-base-api-stack/stack-orchestrator/stacks/snowballtools-base-backend build-containers --force-rebuild
|
|
||||||
```
|
|
||||||
|
|
||||||
* Push updated images to the container registry:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /srv/deploy-backend
|
|
||||||
|
|
||||||
# login to container registry
|
|
||||||
CONTAINER_REGISTRY_URL=container-registry.apps.vaasl.io
|
|
||||||
# For credentials: "cat /srv/service-provider/webapp-deployer/config.env | grep IMAGE_REGISTRY"
|
|
||||||
CONTAINER_REGISTRY_USERNAME=
|
|
||||||
CONTAINER_REGISTRY_PASSWORD=
|
|
||||||
|
|
||||||
docker login $CONTAINER_REGISTRY_URL --username $CONTAINER_REGISTRY_USERNAME --password $CONTAINER_REGISTRY_PASSWORD
|
|
||||||
|
|
||||||
# Push backend images
|
|
||||||
laconic-so deployment --dir laconic-backend-deployment push-images
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update the configuration if required in `laconic-backend-deployment/configmaps/config/prod.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
...
|
|
||||||
[registryConfig]
|
|
||||||
fetchDeploymentRecordDelay = 5000
|
|
||||||
checkAuctionStatusDelay = 5000
|
|
||||||
restEndpoint = "https://laconicd-mainnet.laconic.com"
|
|
||||||
gqlEndpoint = "https://laconicd-mainnet.laconic.com/api"
|
|
||||||
chainId = "laconic-mainnet"
|
|
||||||
privateKey = "<private-key>"
|
|
||||||
bondId = "<bond-id>"
|
|
||||||
authority = "laconic-deploy"
|
|
||||||
[registryConfig.fee]
|
|
||||||
gasPrice = "0.001alnt"
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
* Restart the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir laconic-backend-deployment start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir laconic-backend-deployment logs snowballtools-base-backend
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deploy Frontend
|
|
||||||
|
|
||||||
* Source repo: <https://git.vdb.to/cerc-io/snowballtools-base>
|
|
||||||
|
|
||||||
* Merge the following PRs in order to deploy frontend app with mainnet configuration
|
|
||||||
|
|
||||||
* <https://git.vdb.to/cerc-io/snowballtools-base/pulls/59>
|
|
||||||
|
|
||||||
* <https://git.vdb.to/cerc-io/snowballtools-base/pulls/58>
|
|
||||||
|
|
||||||
NOTE: Follow steps below if CI deployment doesn't work (cancel CI before following steps below)
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
* Node.js
|
|
||||||
|
|
||||||
* Yarn
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
|
|
||||||
* On your local machine, clone the `snowballtools-base` repo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone git@git.vdb.to:cerc-io/snowballtools-base.git
|
|
||||||
```
|
|
||||||
|
|
||||||
* Install dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd snowballtools-base
|
|
||||||
yarn install
|
|
||||||
```
|
|
||||||
|
|
||||||
* In the deployer package, create required env:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd packages/deployer
|
|
||||||
cp .env.example .env
|
|
||||||
```
|
|
||||||
|
|
||||||
Set the required variables:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
REGISTRY_BOND_ID=<bond-id>
|
|
||||||
DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io
|
|
||||||
AUTHORITY=laconic-deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: The bond id should be set to the `laconic-deploy` authority
|
|
||||||
|
|
||||||
* Update required laconic config. You can use the same `userKey` and `bondId` used for deploying backend:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Replace <user-pk> and <bond-id>
|
|
||||||
cat <<EOF > config.yml
|
|
||||||
services:
|
|
||||||
registry:
|
|
||||||
rpcEndpoint: https://laconicd-mainnet.laconic.com
|
|
||||||
gqlEndpoint: https://laconicd-mainnet.laconic.com/api
|
|
||||||
userKey: <user-pk>
|
|
||||||
bondId: <bond-id>
|
|
||||||
chainId: laconic-mainnet
|
|
||||||
gasPrice: 0.001alnt
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: The `userKey` account should own the authority `laconic-deploy`
|
|
||||||
|
|
||||||
### Run
|
|
||||||
|
|
||||||
* Run frontend deployment script:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./deploy-frontend.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Follow deployment logs on the [deployer UI](https://webapp-deployer-ui.apps.vaasl.io/)
|
|
||||||
|
|
||||||
* On a successful deployment, the frontend can be viewed at <https://deploy.laconic.com>
|
|
@ -1,178 +0,0 @@
|
|||||||
# Update Service Provider
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
A Laconic mainnet node (see [run-validator.md](./run-validator.md))
|
|
||||||
|
|
||||||
## Stop services
|
|
||||||
|
|
||||||
* Stop laconic-console deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# In directory where laconic-console deployment was created
|
|
||||||
laconic-so deployment --dir laconic-console-deployment stop
|
|
||||||
```
|
|
||||||
|
|
||||||
* Stop webapp deployer:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# In directory where webapp-deployer deployment was created
|
|
||||||
laconic-so deployment --dir webapp-deployer stop
|
|
||||||
laconic-so deployment --dir webapp-ui stop
|
|
||||||
```
|
|
||||||
|
|
||||||
## Update laconic console
|
|
||||||
|
|
||||||
* Update the console config (`laconic-console-deployment/config.env`) if required:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# CLI configuration
|
|
||||||
|
|
||||||
# laconicd RPC endpoint (can be pointed to your node)
|
|
||||||
CERC_LACONICD_RPC_ENDPOINT=https://laconicd-mainnet.laconic.com
|
|
||||||
|
|
||||||
# laconicd GQL endpoint (can be pointed to your node)
|
|
||||||
CERC_LACONICD_GQL_ENDPOINT=https://laconicd-mainnet.laconic.com/api
|
|
||||||
|
|
||||||
CERC_LACONICD_CHAIN_ID=laconic-mainnet
|
|
||||||
|
|
||||||
# Console configuration
|
|
||||||
|
|
||||||
# Laconicd (hosted) GQL endpoint (can be pointed to your node)
|
|
||||||
LACONIC_HOSTED_ENDPOINT=https://laconicd-mainnet.laconic.com
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update any other config values as required
|
|
||||||
|
|
||||||
* Start the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir laconic-console-deployment start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Use the cli service for any registry CLI operations:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Example
|
|
||||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry status"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Check authority and deployer record
|
|
||||||
|
|
||||||
* The state has been carried over from SAPO testnet to the mainnet, if you had authority and records on the SAPO testnet, they should be present on mainnet as well
|
|
||||||
|
|
||||||
* Check authority:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# In directory where laconic-console deployment was created
|
|
||||||
AUTHORITY=<your-authority>
|
|
||||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry authority whois $AUTHORITY"
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check deployer record:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
PAYMENT_ADDRESS=<your-deployers-payment-address>
|
|
||||||
laconic-so deployment --dir laconic-console-deployment exec cli "laconic registry record list --all --type WebappDeployer --paymentAddress $PAYMENT_ADDRESS"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Update webapp deployer
|
|
||||||
|
|
||||||
* Update deployer laconic registry config (`webapp-deployer/data/config/laconic.yml`) with new endpoints:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
services:
|
|
||||||
registry:
|
|
||||||
rpcEndpoint: "<your-mainnet-rpc-endpoint>" # Eg. https://laconicd-mainnet.laconic.com
|
|
||||||
gqlEndpoint: "<your-mainnet-gql-endpoint>" # Eg. https://laconicd-mainnet.laconic.com/api
|
|
||||||
userKey: "<userKey>"
|
|
||||||
bondId: "<bondId"
|
|
||||||
chainId: laconic-mainnet
|
|
||||||
gasPrice: 0.001alnt
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: Existing `userKey` and `bondId` can be used since they are carried over from SAPO testnet to mainnet
|
|
||||||
|
|
||||||
* Update deployer config (`webapp-deployer/config.env`) if required:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Update the deployer LRN if it has changed
|
|
||||||
export LRN=
|
|
||||||
|
|
||||||
# Min payment to require for performing deployments
|
|
||||||
export MIN_REQUIRED_PAYMENT=9500
|
|
||||||
|
|
||||||
# Handle deployment auction requests
|
|
||||||
export HANDLE_AUCTION_REQUESTS=true
|
|
||||||
|
|
||||||
# Amount that the deployer will bid on deployment auctions
|
|
||||||
export AUCTION_BID_AMOUNT=9500
|
|
||||||
```
|
|
||||||
|
|
||||||
* Start the webapp deployer:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir webapp-deployer start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Get the webapp-deployer pod id:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir webapp-deployer ps
|
|
||||||
|
|
||||||
# Expected output
|
|
||||||
# Running containers:
|
|
||||||
# id: default/laconic-096fed46af974a47-deployment-644db859c7-snbq6, name: laconic-096fed46af974a47-deployment-644db859c7-snbq6, ports: 10.42.2.11:9555->9555
|
|
||||||
|
|
||||||
# Set pod id
|
|
||||||
export POD_ID=
|
|
||||||
|
|
||||||
# Example:
|
|
||||||
# export POD_ID=laconic-096fed46af974a47-deployment-644db859c7-snbq6
|
|
||||||
```
|
|
||||||
|
|
||||||
* Copy over GPG keys files to the webapp-deployer container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubie ctx default
|
|
||||||
|
|
||||||
# Copy the GPG key files to the pod
|
|
||||||
kubectl cp <path-to-your-gpg-private-key> $POD_ID:/app
|
|
||||||
kubectl cp <path-to-your-gpg-public-key> $POD_ID:/app
|
|
||||||
|
|
||||||
# Required everytime you stop and start the deployer
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Deployer
|
|
||||||
kubectl logs -f $POD_ID
|
|
||||||
|
|
||||||
# Deployer auction handler
|
|
||||||
kubectl logs -f $POD_ID -c cerc-webapp-auction-handler
|
|
||||||
```
|
|
||||||
|
|
||||||
* Update deployer UI config (`webapp-ui/config.env`) if required:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# URL of the webapp deployer backend API
|
|
||||||
# eg: https://webapp-deployer-api.pwa.laconic.com
|
|
||||||
LACONIC_HOSTED_CONFIG_app_api_url=
|
|
||||||
|
|
||||||
# URL of the laconic console
|
|
||||||
# eg: https://console-mainnet.laconic.com/console?...
|
|
||||||
LACONIC_HOSTED_CONFIG_app_console_link=
|
|
||||||
```
|
|
||||||
|
|
||||||
* Start the webapp UI:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir webapp-ui start
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check logs
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir webapp-ui logs webapp
|
|
||||||
```
|
|
@ -1,7 +0,0 @@
|
|||||||
# Add your node addresses here
|
|
||||||
# Example:
|
|
||||||
# - node-1-id@node-1-host:26656
|
|
||||||
# - node-2-id@node-2-host:26656
|
|
||||||
|
|
||||||
- f89c3216cd763c8c984810058f11189ca7f3e365@bootstrap-mainnet.laconic.com:26656
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
|||||||
# Ansible Installation
|
# playbooks
|
||||||
|
|
||||||
|
## Ansible Installation
|
||||||
|
|
||||||
- Install [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip)
|
- Install [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip)
|
||||||
|
|
||||||
@ -26,7 +28,7 @@
|
|||||||
|
|
||||||
- Set the `LANG` variable to en_US.UTF-8:
|
- Set the `LANG` variable to en_US.UTF-8:
|
||||||
|
|
||||||
```bash
|
```
|
||||||
LANG="en_US.UTF-8"
|
LANG="en_US.UTF-8"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -40,3 +42,9 @@
|
|||||||
ansible --version
|
ansible --version
|
||||||
# ansible [core 2.17.2]
|
# ansible [core 2.17.2]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Install `sshpass` used for automating SSH password authentication
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install sshpass
|
||||||
|
```
|
@ -1,141 +0,0 @@
|
|||||||
# Cosmos Multisig App Setup
|
|
||||||
|
|
||||||
This playbook sets up the Cosmos Multisig application for managing multisig wallets on the Laconic chain.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- [Mainnet node RPC and REST API endpoints](../../docs/run-first-validator.md)
|
|
||||||
- [ansible](../README.md#ansible-installation)
|
|
||||||
- If running playbook to setup deployment on remote machine, the following need to be installed in remote:
|
|
||||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
|
||||||
- Check [domain port mappings](./domain-port-mappings.md) to ensure that required domain is pointing to correct port
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
- Fetch the stack:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --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 `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml` with your node configuration:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
next_public_node_addresses: '["https://laconicd-mainnet.laconic.com"]'
|
|
||||||
node_rest_endpoint: "https://api.laconicd-mainnet.laconic.com"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup Steps
|
|
||||||
|
|
||||||
- Set common environment variables:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Parent directory where the deployment directory will live
|
|
||||||
export DATA_DIRECTORY=<absolute/path/to/deployments/directory>
|
|
||||||
|
|
||||||
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy the inventory file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp ~/cerc/laconicd-stack/playbooks/hosts.ini.example ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini
|
|
||||||
```
|
|
||||||
|
|
||||||
### Local Setup
|
|
||||||
|
|
||||||
- Setup and start the multisig app:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local
|
|
||||||
```
|
|
||||||
|
|
||||||
- Access the app at <https://multisig.laconic.com/laconic-mainnet>
|
|
||||||
|
|
||||||
### Remote Setup
|
|
||||||
|
|
||||||
- Create and configure hosts.ini:
|
|
||||||
|
|
||||||
- Edit `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini` and update the remote host details:
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[remote]
|
|
||||||
# Replace with your actual remote host details
|
|
||||||
remote_host ansible_host=your.remote.host ansible_user=your_remote_user ansible_ssh_common_args='-o ForwardAgent=yes'
|
|
||||||
```
|
|
||||||
|
|
||||||
- Verify SSH connection using Ansible ping:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible all -m ping -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini --limit remote_host
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run the playbook targeting the remote host:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit remote_host
|
|
||||||
```
|
|
||||||
|
|
||||||
- Access the app at <https://multisig.laconic.com/laconic-mainnet>
|
|
||||||
|
|
||||||
## Check Status
|
|
||||||
|
|
||||||
- Check app logs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR logs -f cosmos-multisig-ui
|
|
||||||
```
|
|
||||||
|
|
||||||
## Update
|
|
||||||
|
|
||||||
- Set environment variables for the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Parent directory where the deployment directory will live
|
|
||||||
export DATA_DIRECTORY=<absolute/path/to/deployments/directory>
|
|
||||||
|
|
||||||
export MULTISIG_DEPLOYMENT_DIR=cosmos-multisig-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
- Stop the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MULTISIG_DEPLOYMENT_DIR stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Update `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-vars.yml` with required values
|
|
||||||
|
|
||||||
- Run ansible playbook to deploy again:
|
|
||||||
|
|
||||||
- For local host
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit local
|
|
||||||
```
|
|
||||||
|
|
||||||
- For remote host (check that remote is configured properly in `~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini`)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ansible-playbook -v -i ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/hosts.ini ~/cerc/laconicd-stack/playbooks/cosmos-multisig-app/cosmos-multisig-app-start.yml --limit remote_host
|
|
||||||
```
|
|
||||||
|
|
||||||
## 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
|
|
||||||
```
|
|
@ -1,117 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Setup and deploy the cosmos multisig app
|
|
||||||
hosts: multihosts
|
|
||||||
|
|
||||||
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"
|
|
||||||
remote_spec_template: "{{data_directory}}/cosmos-multisig-app-spec-template.yml.j2"
|
|
||||||
network_json: "../../config/network.json"
|
|
||||||
remote_network_json: "{{data_directory}}/network.json"
|
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Include setup tasks
|
|
||||||
ansible.builtin.import_tasks: ../setup.yml
|
|
||||||
|
|
||||||
- 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.3 --pull
|
|
||||||
|
|
||||||
- name: Build container image
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui build-containers {{ build_args }}
|
|
||||||
|
|
||||||
- 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: Copy spec template to remote server
|
|
||||||
copy:
|
|
||||||
src: "{{ spec_template }}"
|
|
||||||
dest: "{{ remote_spec_template }}"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Replace network section in spec_output
|
|
||||||
shell: >
|
|
||||||
{{ yq_path }} eval '(.network) = load("{{ remote_spec_template }}").network' -i {{ spec_output }}
|
|
||||||
|
|
||||||
- name: Check if deployment directory exists
|
|
||||||
stat:
|
|
||||||
path: "{{data_directory}}/{{ multisig_deployment_dir }}"
|
|
||||||
register: deployment_dir_stat
|
|
||||||
|
|
||||||
- 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 }}
|
|
||||||
when: not deployment_dir_stat.stat.exists
|
|
||||||
|
|
||||||
- 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"
|
|
||||||
NEXT_PUBLIC_REGISTRY_ENABLED_CHAINS={{ next_public_registry_enabled_chains }}
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Copy network.json to remote server
|
|
||||||
copy:
|
|
||||||
src: "{{ network_json }}"
|
|
||||||
dest: "{{ remote_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 }}" \
|
|
||||||
--arg chainId "{{ next_public_chain_id }}" --arg chainName "{{ next_public_chain_display_name }}" \
|
|
||||||
'.rpc = $rpc | .rest = $rest | .chainId = $chainId | .chainName = $chainName' "{{ remote_network_json }}" > "{{ remote_network_json }}.tmp" && \
|
|
||||||
mv "{{ remote_network_json }}.tmp" "{{ remote_network_json }}"
|
|
||||||
args:
|
|
||||||
executable: /bin/bash
|
|
||||||
|
|
||||||
- name: Copy modified network JSON to deployment config directory
|
|
||||||
copy:
|
|
||||||
src: "{{ remote_network_json }}"
|
|
||||||
dest: "{{data_directory}}/{{ multisig_deployment_dir }}/config/cosmos-multisig-ui/network.json"
|
|
||||||
remote_src: true
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Clean up temporary files
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: absent
|
|
||||||
with_items:
|
|
||||||
- "{{ remote_spec_template }}"
|
|
||||||
- "{{ remote_network_json }}"
|
|
||||||
|
|
||||||
- name: Start the deployment
|
|
||||||
shell: |
|
|
||||||
laconic-so deployment --dir {{data_directory}}/{{ multisig_deployment_dir }} start
|
|
@ -1,50 +0,0 @@
|
|||||||
# Set to true if the application supports multiple chains
|
|
||||||
next_public_multichain: true
|
|
||||||
|
|
||||||
# Array of enabled chain names for the registry
|
|
||||||
next_public_registry_enabled_chains: '["cosmoshub","sei"]'
|
|
||||||
|
|
||||||
# The name of the blockchain registry
|
|
||||||
next_public_registry_name: "laconic-mainnet"
|
|
||||||
|
|
||||||
# URL or path to the blockchain's logo
|
|
||||||
next_public_logo: ""
|
|
||||||
|
|
||||||
# The chain ID for the blockchain network
|
|
||||||
next_public_chain_id: "laconic-mainnet"
|
|
||||||
|
|
||||||
# Display name for the blockchain network
|
|
||||||
next_public_chain_display_name: "Laconic Mainnet"
|
|
||||||
|
|
||||||
# Comma-separated list of node addresses for the application to connect to
|
|
||||||
next_public_node_addresses: '[]'
|
|
||||||
|
|
||||||
# The REST endpoint for the node
|
|
||||||
node_rest_endpoint: ""
|
|
||||||
|
|
||||||
# The base denomination of the native token
|
|
||||||
next_public_denom: "alnt"
|
|
||||||
|
|
||||||
# The display denomination of the native token
|
|
||||||
next_public_display_denom: "ALNT"
|
|
||||||
|
|
||||||
# The exponent for the display denomination
|
|
||||||
next_public_display_denom_exponent: 0
|
|
||||||
|
|
||||||
# JSON array of asset definitions, including denom units, base, name, display, and symbol
|
|
||||||
next_public_assets: '[{"denom_units":[{"denom":"alnt","exponent":0}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"},{"denom_units":[{"denom":"alps","exponent":0}],"base":"alps","name":"Laconic Prepaid Service","display":"ALPS","symbol":"alps"}]'
|
|
||||||
|
|
||||||
# Default gas price for transactions
|
|
||||||
next_public_gas_price: "0.001alnt"
|
|
||||||
|
|
||||||
# The address prefix for the blockchain
|
|
||||||
next_public_address_prefix: "laconic"
|
|
||||||
|
|
||||||
# Set to true if HTTP is enabled for the application
|
|
||||||
next_public_is_http_enabled: false
|
|
||||||
|
|
||||||
# Set to true to use host network mode for the Docker container
|
|
||||||
use_host_network: ""
|
|
||||||
|
|
||||||
# Domain for Dgraph service
|
|
||||||
dgraph_domain: ""
|
|
@ -1,61 +0,0 @@
|
|||||||
# Multisig Usage
|
|
||||||
|
|
||||||
## Create a Multisig
|
|
||||||
|
|
||||||
- On opening the app, a prompt will be shown to add Laconic Mainnet network to you Keplr wallet. Click on `Approve`
|
|
||||||
|
|
||||||
- Go to home and click on `I don't have a multisig`
|
|
||||||
|
|
||||||
- Add the addresses of accounts which have performed at least one tx on chain
|
|
||||||
|
|
||||||
- Set the threshold as required (if threshold is set to N out of N members then all the validators have to sign the tx)
|
|
||||||
|
|
||||||
- Click on `Submit` and `Create multisig`
|
|
||||||
|
|
||||||
## Import Accounts in Keplr
|
|
||||||
|
|
||||||
- Add the 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 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 Mainnet` and select it, then click on `Save`
|
|
||||||
|
|
||||||
- Other accounts can be added in a similar manner
|
|
||||||
|
|
||||||
- Send funds 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 for `Laconic Mainnet`, choose the token you wish to send and select the network
|
|
||||||
|
|
||||||
- Select `Send` and paste the multisig address and set desired amount
|
|
||||||
|
|
||||||
- Click on `Next` and approve the transaction
|
|
||||||
|
|
||||||
## Send Transaction From Multisig Address
|
|
||||||
|
|
||||||
- In the multisig app, 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, amount to be transfered and memo (optional)
|
|
||||||
|
|
||||||
- You can either select `alnt` or `alps` as denom
|
|
||||||
|
|
||||||
- Click on create transaction
|
|
||||||
|
|
||||||
- Under Choose wallet to sign, click on `Connect Keplr`
|
|
||||||
|
|
||||||
- After connecting the wallet, click on `Sign transaction` and approve the transaction
|
|
||||||
|
|
||||||
- Repeat the above steps for other members of the multisig to sign the transaction
|
|
||||||
|
|
||||||
- Once the transaction is signed by required number of validators (as set in the threshold), click on `Broadcast Transaction`
|
|
@ -1,6 +0,0 @@
|
|||||||
network:
|
|
||||||
ports:
|
|
||||||
cosmos-multisig-ui:
|
|
||||||
- 7000:7000
|
|
||||||
alpha:
|
|
||||||
- 8090:8080
|
|
@ -1,23 +0,0 @@
|
|||||||
|
|
||||||
# The public key of the validator node. This is required for generating the genesis file
|
|
||||||
# It should be wrapped in single quotes
|
|
||||||
validator_pub_key: ''
|
|
||||||
|
|
||||||
# Custom moniker for the validator node
|
|
||||||
cerc_moniker: "LaconicMainnetNode"
|
|
||||||
|
|
||||||
# The chain ID for the blockchain network
|
|
||||||
cerc_chain_id: "laconic-mainnet"
|
|
||||||
|
|
||||||
# Set to true to enable TMKMS (Tendermint Key Management System) for this node
|
|
||||||
# If true, the node will use an external TMKMS for signing validator operations
|
|
||||||
tmkms_enabled:
|
|
||||||
|
|
||||||
# Minimum gas price for transactions, in ALNT (e.g., 0.001alnt)
|
|
||||||
min_gas_price: 0.001
|
|
||||||
|
|
||||||
# Log level for the laconicd node (e.g., "info", "debug", "error")
|
|
||||||
cerc_loglevel: "info"
|
|
||||||
|
|
||||||
# Desired key name for the validator account
|
|
||||||
key_name: "laconic-validator"
|
|
@ -1,115 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Generate Mainnet Genesis File
|
|
||||||
hosts: localhost
|
|
||||||
vars_files:
|
|
||||||
- first-validator-vars.yml
|
|
||||||
vars:
|
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
|
||||||
gentx_genesis_dir: "{{data_directory}}/generate-gentx-genesis"
|
|
||||||
spec_file: "{{data_directory}}/laconicd-spec.yml"
|
|
||||||
connection: local
|
|
||||||
tasks:
|
|
||||||
- name: Fail if DATA_DIRECTORY env vars are not set
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
Required environment variables are not set.
|
|
||||||
Please export both DATA_DIRECTORY before running the playbook.
|
|
||||||
when: lookup('env', 'DATA_DIRECTORY') == ''
|
|
||||||
|
|
||||||
- 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 {{ exported_state_path }} {{ 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: 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 data directory
|
|
||||||
file:
|
|
||||||
path: "{{ gentx_genesis_dir }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Ensure tmp directory exists inside gentx genesis directory
|
|
||||||
file:
|
|
||||||
path: "{{gentx_genesis_dir}}/tmp"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Ensure output directory exists inside gentx genesis directory
|
|
||||||
file:
|
|
||||||
path: "{{gentx_genesis_dir}}/output"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Copy staking amount file to gentx genesis tmp directory
|
|
||||||
copy:
|
|
||||||
src: "{{ lookup('env', 'PWD') }}/output/staking-amount.json"
|
|
||||||
dest: "{{gentx_genesis_dir}}/tmp/staking-amount.json"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Copy genesis file to gentx genesis tmp directory
|
|
||||||
copy:
|
|
||||||
src: "{{ lookup('env', 'PWD') }}/output/genesis.json"
|
|
||||||
dest: "{{gentx_genesis_dir}}/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
|
|
||||||
command:
|
|
||||||
argv:
|
|
||||||
- docker
|
|
||||||
- run
|
|
||||||
- -i
|
|
||||||
- -v
|
|
||||||
- "{{ gentx_genesis_dir }}:/root/generate-gentx-genesis"
|
|
||||||
- -v
|
|
||||||
- "~/cerc/laconicd-stack/stack-orchestrator/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 }}"
|
|
||||||
- cerc/laconicd:local
|
|
||||||
- bash
|
|
||||||
- -c
|
|
||||||
- "/scripts/create-and-collect-gentx.sh"
|
|
||||||
|
|
||||||
- name: Update genesis file in output
|
|
||||||
copy:
|
|
||||||
src: "{{gentx_genesis_dir}}/output/genesis.json"
|
|
||||||
dest: "{{ lookup('env', 'PWD') }}/output/genesis.json"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Clear tmp directory
|
|
||||||
file:
|
|
||||||
path: "{{gentx_genesis_dir}}/tmp"
|
|
||||||
state: absent
|
|
13
playbooks/first-validator/run-first-validator-vars.yml
Normal file
13
playbooks/first-validator/run-first-validator-vars.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
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:
|
@ -2,74 +2,94 @@
|
|||||||
- name: Run mainnet validator node
|
- name: Run mainnet validator node
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
vars_files:
|
vars_files:
|
||||||
- first-validator-vars.yml
|
- run-first-validator-vars.yml
|
||||||
vars:
|
vars:
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||||
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
||||||
spec_file: "{{data_directory}}/laconicd-spec.yml"
|
spec_file: "{{data_directory}}/laconicd-spec.yml"
|
||||||
spec_template: "./templates/specs/spec-template.yml.j2"
|
spec_template: "./templates/specs/spec-template.yml.j2"
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
|
||||||
BUILD_ONLY: "{{ lookup('env', 'BUILD_ONLY') | default(false) | bool }}"
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Include setup tasks
|
|
||||||
ansible.builtin.import_tasks: ../setup.yml
|
|
||||||
|
|
||||||
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
Required environment variables are not set.
|
Required environment variables are not set.
|
||||||
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
|
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
|
||||||
when: not BUILD_ONLY and (lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == '')
|
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 in run-first-validator-vars.yml.
|
||||||
|
when: not genesis_file
|
||||||
|
- name: Fetch laconicd stack
|
||||||
|
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
|
||||||
- name: Setup required repositories
|
- name: Setup required repositories
|
||||||
shell: >
|
shell: >
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
|
||||||
setup-repositories --pull
|
setup-repositories --git-ssh --pull
|
||||||
|
|
||||||
- name: Build container images
|
- name: Build container images
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
|
||||||
|
|
||||||
- name: Create deployment spec file
|
- name: Create deployment spec file
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: |
|
shell: |
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
||||||
|
|
||||||
- name: Replace network section in spec_file
|
- name: Replace network section in spec_file
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: >
|
shell: >
|
||||||
{{ yq_path }} eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
yq eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
||||||
|
|
||||||
- name: Create deployment from spec file
|
- name: Create deployment from spec file
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: |
|
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 }}
|
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
|
- name: Create config.env
|
||||||
when: not BUILD_ONLY
|
|
||||||
copy:
|
copy:
|
||||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
|
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
|
||||||
content: |
|
content: |
|
||||||
CERC_MONIKER: "{{ cerc_moniker }}"
|
CERC_MONIKER: "{{ cerc_moniker }}"
|
||||||
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
||||||
|
CERC_PEERS: "{{ cerc_peers}}"
|
||||||
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
||||||
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
||||||
TMKMS_ENABLED: "{{ tmkms_enabled }}"
|
DENOM: "{{ denom }}"
|
||||||
|
KEY_NAME: "{{ key_name }}"
|
||||||
mode: '0777'
|
mode: '0777'
|
||||||
|
|
||||||
- name: Initialize laconicd node
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
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 "CERC_MONIKER={{ cerc_moniker }}" \
|
|
||||||
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
|
||||||
cerc/laconicd:local bash -c "/scripts/setup-laconicd.sh"
|
|
||||||
|
|
||||||
- name: Ensure tmp directory exists inside laconicd-data
|
- name: Ensure tmp directory exists inside laconicd-data
|
||||||
when: not BUILD_ONLY
|
|
||||||
file:
|
file:
|
||||||
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
|
|
||||||
|
- 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
|
||||||
|
shell: |
|
||||||
|
docker run -it \
|
||||||
|
-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
|
@ -2,7 +2,6 @@ network:
|
|||||||
ports:
|
ports:
|
||||||
laconicd:
|
laconicd:
|
||||||
- '6060:6060'
|
- '6060:6060'
|
||||||
- '26659:26659'
|
|
||||||
- '26657:26657'
|
- '26657:26657'
|
||||||
- '26656:26656'
|
- '26656:26656'
|
||||||
- '9473:9473'
|
- '9473:9473'
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
[local]
|
|
||||||
localhost ansible_connection=local
|
|
||||||
|
|
||||||
[remote]
|
|
||||||
# Replace these values with your actual remote host details
|
|
||||||
remote_host ansible_host=your.remote.host ansible_user=your_remote_user ansible_ssh_common_args='-o ForwardAgent=yes'
|
|
||||||
|
|
||||||
[multihosts:children]
|
|
||||||
local
|
|
||||||
remote
|
|
@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
# Setup tasks for all playbooks
|
|
||||||
- name: Create tools directory in user's home
|
|
||||||
file:
|
|
||||||
path: "{{ ansible_env.HOME }}/.laconic-tools"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Check if yq exists
|
|
||||||
stat:
|
|
||||||
path: "{{ ansible_env.HOME }}/.laconic-tools/yq"
|
|
||||||
register: yq_file
|
|
||||||
|
|
||||||
- name: Detect OS and architecture
|
|
||||||
set_fact:
|
|
||||||
yq_os: "{{ 'darwin' if ansible_system == 'Darwin' else 'linux' }}"
|
|
||||||
yq_arch: "{{ ansible_architecture | regex_replace('x86_64', 'amd64') | regex_replace('aarch64', 'arm64') }}"
|
|
||||||
|
|
||||||
- name: Download yq to user's tools directory
|
|
||||||
shell: |
|
|
||||||
curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_{{ yq_os }}_{{ yq_arch }} -o {{ ansible_env.HOME }}/.laconic-tools/yq
|
|
||||||
chmod +x {{ ansible_env.HOME }}/.laconic-tools/yq
|
|
||||||
when: not yq_file.stat.exists
|
|
||||||
args:
|
|
||||||
creates: "{{ ansible_env.HOME }}/.laconic-tools/yq"
|
|
||||||
|
|
||||||
- name: Set yq path variable
|
|
||||||
set_fact:
|
|
||||||
yq_path: "{{ ansible_env.HOME }}/.laconic-tools/yq"
|
|
@ -1,53 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Run TMKMS stack
|
|
||||||
hosts: localhost
|
|
||||||
vars_files:
|
|
||||||
- tmkms-vars.yml
|
|
||||||
vars:
|
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
|
||||||
tmkms_deployment_dir: "{{ lookup('env', 'TMKMS_DEPLOYMENT_DIR') | default('tmkms-deployment', true) }}"
|
|
||||||
tasks:
|
|
||||||
- name: Fail if DATA_DIRECTORY env var is not set
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
Required environment variable DATA_DIRECTORY is not set.
|
|
||||||
Please export DATA_DIRECTORY before running the playbook.
|
|
||||||
when: lookup('env', 'DATA_DIRECTORY') == ''
|
|
||||||
|
|
||||||
- name: Ensure tmp directory exists inside tmkms-data volume
|
|
||||||
file:
|
|
||||||
path: "{{data_directory}}/{{ tmkms_deployment_dir }}/data/tmkms-data/tmp"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Check if priv_validator_key_file_path exists
|
|
||||||
stat:
|
|
||||||
path: "{{ priv_validator_key_file_path }}"
|
|
||||||
register: priv_key_file
|
|
||||||
|
|
||||||
- name: Copy private validator key to tmkms deployment tmp directory
|
|
||||||
copy:
|
|
||||||
src: "{{ priv_validator_key_file_path }}"
|
|
||||||
dest: "{{data_directory}}/{{ tmkms_deployment_dir }}/data/tmkms-data/tmp/priv_validator_key.json"
|
|
||||||
mode: '0644'
|
|
||||||
when: priv_key_file.stat.exists
|
|
||||||
|
|
||||||
- name: Create config.env for tmkms deployment
|
|
||||||
copy:
|
|
||||||
dest: "{{data_directory}}/{{ tmkms_deployment_dir }}/config.env"
|
|
||||||
content: |
|
|
||||||
CHAIN_ID: "{{ chain_id }}"
|
|
||||||
NODE_IP: "{{ node_ip }}"
|
|
||||||
NODE_PORT: "{{ node_port }}"
|
|
||||||
KEY_PREFIX: "{{ key_prefix }}"
|
|
||||||
mode: '0777'
|
|
||||||
|
|
||||||
- name: Start tmkms deployment
|
|
||||||
shell: |
|
|
||||||
laconic-so deployment --dir {{data_directory}}/{{ tmkms_deployment_dir }} start
|
|
||||||
|
|
||||||
- name: Remove input private validator key file
|
|
||||||
file:
|
|
||||||
path: "{{ priv_validator_key_file_path }}"
|
|
||||||
state: absent
|
|
||||||
when: priv_key_file.stat.exists
|
|
@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Setup TMKMS stack
|
|
||||||
hosts: localhost
|
|
||||||
vars:
|
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
|
||||||
tmkms_deployment_dir: "{{ lookup('env', 'TMKMS_DEPLOYMENT_DIR') | default('tmkms-deployment', true) }}"
|
|
||||||
tmkms_spec_file: "{{data_directory}}/tmkms-spec.yml"
|
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
|
||||||
BUILD_ONLY: "{{ lookup('env', 'BUILD_ONLY') | default(false) | bool }}"
|
|
||||||
tasks:
|
|
||||||
- name: Fail if DATA_DIRECTORY env var is not set
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
Required environment variable DATA_DIRECTORY is not set.
|
|
||||||
Please export DATA_DIRECTORY before running the playbook.
|
|
||||||
when: not BUILD_ONLY and lookup('env', 'DATA_DIRECTORY') == ''
|
|
||||||
|
|
||||||
- name: Fetch tmkms stack
|
|
||||||
shell: |
|
|
||||||
laconic-so fetch-stack git.vdb.to/LaconicNetwork/tmkms-stack --pull
|
|
||||||
|
|
||||||
- name: Build tmkms container images
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms build-containers {{ build_args }}
|
|
||||||
|
|
||||||
- name: Create tmkms deployment spec file
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms deploy init --output {{ tmkms_spec_file }}
|
|
||||||
|
|
||||||
- name: Create tmkms deployment from spec file
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/tmkms-stack/stack-orchestrator/stacks/tmkms deploy create --spec-file {{ tmkms_spec_file }} --deployment-dir {{data_directory}}/{{ tmkms_deployment_dir }}
|
|
@ -1,16 +0,0 @@
|
|||||||
# Absolute path to the node's private validator key file (e.g., /path/to/priv_validator_key.json).
|
|
||||||
# This file is copied into the TMKMS deployment
|
|
||||||
priv_validator_key_file_path: ""
|
|
||||||
|
|
||||||
# The IP address of the machine where the laconicd node is set up
|
|
||||||
# TMKMS will connect to this IP address
|
|
||||||
node_ip: ""
|
|
||||||
|
|
||||||
# The port of the laconicd node that TMKMS will connect to
|
|
||||||
node_port: "26659"
|
|
||||||
|
|
||||||
# The key prefix used for account and consensus public keys in the blockchain
|
|
||||||
key_prefix: "laconic"
|
|
||||||
|
|
||||||
# The chain ID for the blockchain network
|
|
||||||
chain_id: "laconic-mainnet"
|
|
67
playbooks/validator/README.md
Normal file
67
playbooks/validator/README.md
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# 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,15 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Build Laconicd
|
|
||||||
hosts: localhost
|
|
||||||
connection: local
|
|
||||||
vars:
|
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
|
||||||
tasks:
|
|
||||||
- name: Setup required repositories
|
|
||||||
shell: >
|
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
|
|
||||||
setup-repositories --pull
|
|
||||||
|
|
||||||
- name: Build container images
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
|
|
@ -5,74 +5,23 @@
|
|||||||
- validator-vars.yml
|
- validator-vars.yml
|
||||||
vars:
|
vars:
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||||
create_validator_dir: "{{data_directory}}/create-validator"
|
deployment_dir: "{{ lookup('env', 'DEPLOYMENT_DIR') }}"
|
||||||
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
|
key_name: "{{ lookup('env', 'KEY_NAME') }}"
|
||||||
tasks:
|
tasks:
|
||||||
- name: Fail if DATA_DIRECTORY env var is not set
|
- name: Fail if DATA_DIRECTORY or DEPLOYMENT_DIR env vars are not set
|
||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
Required environment variables are not set.
|
Required environment variables are not set.
|
||||||
Please export DATA_DIRECTORY before running the playbook.
|
Please export both DATA_DIRECTORY and DEPLOYMENT_DIR before running the playbook.
|
||||||
when: lookup('env', 'DATA_DIRECTORY') == ''
|
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'DEPLOYMENT_DIR') == ''
|
||||||
|
|
||||||
- name: Fail if required key files are not defined
|
- name: Fail if neither pvt_key nor mnemonic is set
|
||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
Required key files are not defined.
|
Neither private key (pvt_key) nor mnemonic is set in validator-vars.yml.
|
||||||
Please set staking_amount_file in validator-vars.yml.
|
Please set one of them to create the validator.
|
||||||
when: not staking_amount_file
|
when: not pvt_key and not mnemonic
|
||||||
|
|
||||||
- name: Ensure tmp directory exists inside laconicd-data
|
|
||||||
file:
|
|
||||||
path: "{{create_validator_dir}}/tmp"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Copy staking amount file to laconicd-data tmp directory
|
|
||||||
copy:
|
|
||||||
src: "{{ staking_amount_file }}"
|
|
||||||
dest: "{{create_validator_dir}}/tmp/staking-amount.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 create-validator script
|
- name: Run create-validator script
|
||||||
command:
|
shell: |
|
||||||
argv:
|
laconic-so deployment --dir {{data_directory}}/{{deployment_dir}} exec laconicd "export KEY_NAME={{ key_name }} /scripts/create-validator.sh"
|
||||||
- docker
|
|
||||||
- run
|
|
||||||
- -i
|
|
||||||
- -v
|
|
||||||
- "{{create_validator_dir}}:/root/create-validator"
|
|
||||||
- -v
|
|
||||||
- "{{ ansible_env.HOME }}/cerc/laconicd-stack/stack-orchestrator/config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh"
|
|
||||||
- -e
|
|
||||||
- "KEY_NAME={{ key_name }}"
|
|
||||||
- -e
|
|
||||||
- "NODE_URL={{ node_url }}"
|
|
||||||
- -e
|
|
||||||
- "CERC_MONIKER={{ cerc_moniker }}"
|
|
||||||
- -e
|
|
||||||
- "CERC_CHAIN_ID={{ cerc_chain_id }}"
|
|
||||||
- -e
|
|
||||||
- "MIN_GAS_PRICE={{ min_gas_price }}"
|
|
||||||
- -e
|
|
||||||
- "VALIDATOR_PUB_KEY={{ validator_pub_key }}"
|
|
||||||
- -e
|
|
||||||
- "PVT_KEY={{ private_key_input.user_input }}"
|
|
||||||
- --network=host
|
|
||||||
- cerc/laconicd:local
|
|
||||||
- sh
|
|
||||||
- -c
|
|
||||||
- "/scripts/create-validator.sh"
|
|
||||||
|
@ -1,113 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Setup mainnet validator node
|
|
||||||
hosts: localhost
|
|
||||||
vars_files:
|
|
||||||
- validator-vars.yml
|
|
||||||
vars:
|
|
||||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
|
||||||
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
|
||||||
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
|
|
||||||
spec_template: "./templates/specs/spec-template.yml.j2"
|
|
||||||
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
|
|
||||||
BUILD_ONLY: "{{ lookup('env', 'BUILD_ONLY') | default(false) | bool }}"
|
|
||||||
tasks:
|
|
||||||
- name: Include setup tasks
|
|
||||||
ansible.builtin.import_tasks: ../setup.yml
|
|
||||||
|
|
||||||
- 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: not BUILD_ONLY and (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 validator-vars.yml.
|
|
||||||
when: not BUILD_ONLY and (not genesis_file or not staking_amount_file)
|
|
||||||
|
|
||||||
- name: Setup required repositories
|
|
||||||
shell: >
|
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
|
|
||||||
setup-repositories --pull
|
|
||||||
|
|
||||||
- name: Build container images
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
|
|
||||||
|
|
||||||
- name: Create deployment spec file
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: |
|
|
||||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
|
||||||
|
|
||||||
- name: Replace network section in spec_file
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
shell: >
|
|
||||||
{{ yq_path }} eval '(.network) = load("{{ spec_template }}").network' -i {{ spec_file }}
|
|
||||||
|
|
||||||
- name: Create deployment from spec file
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
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
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
copy:
|
|
||||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
|
|
||||||
content: |
|
|
||||||
CERC_MONIKER: "{{ cerc_moniker }}"
|
|
||||||
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
|
||||||
CERC_PEERS: "{{ cerc_peers }}"
|
|
||||||
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
|
||||||
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
|
||||||
TMKMS_ENABLED: "{{ tmkms_enabled }}"
|
|
||||||
mode: '0777'
|
|
||||||
|
|
||||||
- name: Ensure tmp directory exists inside laconicd-data
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
file:
|
|
||||||
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
|
|
||||||
- name: Copy compressed genesis file to laconicd-data tmp directory
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
copy:
|
|
||||||
src: "{{ genesis_file }}"
|
|
||||||
dest: "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json.zst"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Decompress genesis file in tmp directory
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
ansible.builtin.command:
|
|
||||||
argv:
|
|
||||||
- zstd
|
|
||||||
- -d
|
|
||||||
- "-f"
|
|
||||||
- "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json.zst"
|
|
||||||
- "-o"
|
|
||||||
- "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
|
||||||
args:
|
|
||||||
creates: "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
|
||||||
|
|
||||||
- name: Initialize laconicd node
|
|
||||||
when: not BUILD_ONLY
|
|
||||||
command:
|
|
||||||
argv:
|
|
||||||
- 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
|
|
||||||
- "CERC_MONIKER={{ cerc_moniker }}"
|
|
||||||
- -e
|
|
||||||
- "CERC_CHAIN_ID={{ cerc_chain_id }}"
|
|
||||||
- cerc/laconicd:local
|
|
||||||
- bash
|
|
||||||
- -c
|
|
||||||
- "/scripts/setup-laconicd.sh"
|
|
@ -1,10 +0,0 @@
|
|||||||
network:
|
|
||||||
ports:
|
|
||||||
laconicd:
|
|
||||||
- '6060:6060'
|
|
||||||
- '26659:26659'
|
|
||||||
- '26657:26657'
|
|
||||||
- '26656:26656'
|
|
||||||
- '9473:9473'
|
|
||||||
- '9090:9090'
|
|
||||||
- '1317:1317'
|
|
@ -1,35 +1,6 @@
|
|||||||
# The URL of the laconicd node's RPC endpoint (e.g., "tcp://NODE_PUBLIC_IP_ADDRESS:26657" or "https://<your-node-url>")
|
# Chain configuration
|
||||||
node_url: ""
|
cerc_moniker:
|
||||||
|
|
||||||
# The public key of the validator node. This is required for creating the validator on chain
|
|
||||||
# It should be wrapped in single quotes
|
|
||||||
validator_pub_key: ''
|
|
||||||
|
|
||||||
# Custom moniker for the validator node
|
|
||||||
cerc_moniker: ""
|
|
||||||
|
|
||||||
# Comma-separated list of persistent peers for the laconicd node
|
|
||||||
# You can find available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml
|
|
||||||
cerc_peers: ""
|
|
||||||
|
|
||||||
# Set to true to enable TMKMS (Tendermint Key Management System) for this node
|
|
||||||
# If true, the node will use an external TMKMS for signing validator operations
|
|
||||||
tmkms_enabled:
|
|
||||||
|
|
||||||
# The chain ID for the blockchain network
|
|
||||||
cerc_chain_id: "laconic-mainnet"
|
cerc_chain_id: "laconic-mainnet"
|
||||||
|
cerc_peers: # Comma-separated list of peers
|
||||||
# Minimum gas price for transactions, in ALNT (e.g., 0.001alnt)
|
|
||||||
min_gas_price: 0.001
|
min_gas_price: 0.001
|
||||||
|
|
||||||
# Log level for the laconicd node (e.g., "info", "debug", "error")
|
|
||||||
cerc_loglevel: "info"
|
cerc_loglevel: "info"
|
||||||
|
|
||||||
# Absolute path to the mainnet genesis.json file
|
|
||||||
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json.zst"
|
|
||||||
|
|
||||||
# Absolute path to the staking-amount.json file
|
|
||||||
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
|
|
||||||
|
|
||||||
# Desired key name for the validator account
|
|
||||||
key_name: "laconic-validator"
|
|
||||||
|
@ -19,10 +19,10 @@ OUTPUT_DIR=${TESTNET_DEPLOYMENT_DIR}/export
|
|||||||
mkdir -p $OUTPUT_DIR
|
mkdir -p $OUTPUT_DIR
|
||||||
|
|
||||||
# Export state from testnet chain
|
# Export state from testnet chain
|
||||||
testnet_state_file="$OUTPUT_DIR/testnet-state.zst"
|
testnet_state_file="$OUTPUT_DIR/testnet-state.json"
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
|
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
|
||||||
cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
|
cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
|
||||||
| jq | zstd > "$testnet_state_file"
|
| jq .app_state.onboarding > "$testnet_state_file"
|
||||||
|
|
||||||
echo "Exported state from testnet to $testnet_state_file"
|
echo "Exported state from testnet to $testnet_state_file"
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
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
|
|
||||||
key = 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 = {
|
|
||||||
'laconic_address': row[LACONIC_ADDRESS_COLUMN] if not pd.isna(row[LACONIC_ADDRESS_COLUMN]) else None,
|
|
||||||
'placeholder': placeholder,
|
|
||||||
'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
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append(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()
|
|
@ -1,54 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Default values
|
|
||||||
INPUT=""
|
|
||||||
OUTPUT_FILE="./distribution.json"
|
|
||||||
|
|
||||||
# Parse command line arguments
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case $1 in
|
|
||||||
-i|--input)
|
|
||||||
INPUT="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-o|--output)
|
|
||||||
OUTPUT_FILE="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown option: $1"
|
|
||||||
echo "Usage: $0 -i|--input <input_url_or_path> [-o|--output <output_file_path>]"
|
|
||||||
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> [-o|--output <output_file_path>]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
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_FILE"
|
|
||||||
|
|
||||||
# Clean up venv
|
|
||||||
echo "Cleaning up..."
|
|
||||||
rm -rf "$venv_dir"
|
|
@ -5,71 +5,37 @@ set -e
|
|||||||
set -u
|
set -u
|
||||||
|
|
||||||
# Check args
|
# Check args
|
||||||
if [ "$#" -ne 2 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "Usage: $0 <testnet-state-json-file-path> <lps-distribution-json-file-path>"
|
echo "Usage: $0 <testnet-state-json-file-path>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TESTNET_STATE_FILE="$1"
|
TESTNET_STATE_FILE="$1"
|
||||||
LPS_DISTRIBUTION_FILE="$2"
|
|
||||||
MAINNET_GENESIS_DIR=mainnet-genesis
|
MAINNET_GENESIS_DIR=mainnet-genesis
|
||||||
OUTPUT_DIR=output
|
|
||||||
|
|
||||||
if ! jq empty $LPS_DISTRIBUTION_FILE >/dev/null 2>&1; then
|
# Create a temporary target directory
|
||||||
echo "$LPS_DISTRIBUTION_FILE is not a valid JSON"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a required target directories
|
|
||||||
mkdir -p $MAINNET_GENESIS_DIR
|
mkdir -p $MAINNET_GENESIS_DIR
|
||||||
mkdir -p $OUTPUT_DIR
|
|
||||||
|
|
||||||
# --------
|
# --------
|
||||||
|
|
||||||
# Copy testnet state file and distribution to required dir
|
# Copy testnet state file to required dir
|
||||||
cp $TESTNET_STATE_FILE $MAINNET_GENESIS_DIR/testnet-state.json
|
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
|
# Run a script with cerc/laconicd:local to generate the genesis file
|
||||||
# with onboarding module state and given allocations
|
# with onboarding module state and given allocations
|
||||||
echo "Performing alps allocations..."
|
docker run -it \
|
||||||
docker run \
|
|
||||||
-v ./$MAINNET_GENESIS_DIR:/root/.laconicd \
|
-v ./$MAINNET_GENESIS_DIR:/root/.laconicd \
|
||||||
-v $script_dir:/scripts \
|
-v ./scripts:/scripts \
|
||||||
-e "CHAIN_ID=$CHAIN_ID" \
|
-e "CHAIN_ID=$CHAIN_ID" \
|
||||||
-e "EARLY_SUPPORTS_ACC_ADDRESS=$EARLY_SUPPORTS_ACC_ADDRESS" \
|
-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"
|
cerc/laconicd:local bash -c "/scripts/genesis.sh"
|
||||||
|
|
||||||
# Copy over the genesis file to output folder
|
# 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
|
cp ./$MAINNET_GENESIS_DIR/config/genesis.json $OUTPUT_DIR/genesis.json
|
||||||
|
|
||||||
echo "Genesis file for mainnet written to $OUTPUT_DIR/genesis.json"
|
echo "Genesis file for mainnet written to $OUTPUT_DIR/genesis.json"
|
||||||
@ -77,4 +43,4 @@ echo "Genesis file for mainnet written to $OUTPUT_DIR/genesis.json"
|
|||||||
# --------
|
# --------
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -rf $MAINNET_GENESIS_DIR
|
echo "Please remove the temporary data directory: sudo rm -rf $MAINNET_GENESIS_DIR"
|
||||||
|
@ -6,56 +6,48 @@ set -u
|
|||||||
|
|
||||||
# Note: Needs to be run in a docker container with image cerc/laconicd:local
|
# Note: Needs to be run in a docker container with image cerc/laconicd:local
|
||||||
|
|
||||||
KEYRING="test"
|
CHAINID=${CHAINID:-"laconic-mainnet"}
|
||||||
|
MONIKER=${MONIKER:-"mainnet-node"}
|
||||||
NODE_HOME="/root/.laconicd"
|
NODE_HOME="/root/.laconicd"
|
||||||
|
|
||||||
EARLY_SUPPORTS_ACC_ADDRESS=${EARLY_SUPPORTS_ACC_ADDRESS}
|
EARLY_SUPPORTS_ACC_ADDRESS=${EARLY_SUPPORTS_ACC_ADDRESS}
|
||||||
|
LPS_LOCKUP_ACC_ADDRESS=${LPS_LOCKUP_ACC_ADDRESS}
|
||||||
|
|
||||||
# Skipping early supports account allocation
|
if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ] || [ -z "$LPS_LOCKUP_ACC_ADDRESS" ]; then
|
||||||
# if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ]; then
|
echo "EARLY_SUPPORTS_ACC_ADDRESS or LPS_LOCKUP_ACC_ADDRESS not provided, exiting..."
|
||||||
# echo "EARLY_SUPPORTS_ACC_ADDRESS not provided, exiting..."
|
exit 1
|
||||||
# exit 1
|
fi
|
||||||
# fi
|
|
||||||
|
|
||||||
# lps allocations
|
|
||||||
# Total supply: 129600 lps
|
|
||||||
|
|
||||||
# Old plan, will allocate 100% to lockup module instead
|
|
||||||
# EARLY_SUPPORTS_ALLOC="25920" # Early supports: 25920 lps (20% of total supply)
|
|
||||||
# LOCKUP_ALLOC="103680" # Lockup: 103680 lps (80% of total supply)
|
|
||||||
|
|
||||||
|
|
||||||
LOCKUP_ALLOC="129600" # Lockup: 129600 lps (100% of total supply)
|
|
||||||
|
|
||||||
|
# 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_LOCKUP_MODULE_ACCOUNT="lps_lockup"
|
LPS_LOCKUP_MODULE_ACCOUNT="lps_lockup"
|
||||||
LPS_DENOM="lps"
|
|
||||||
|
|
||||||
testnet_state_file="$NODE_HOME/testnet-state.json"
|
testnet_state_file="$NODE_HOME/testnet-state.json"
|
||||||
distribution_file="$NODE_HOME/distribution.json"
|
|
||||||
mainnet_genesis_file="$NODE_HOME/config/genesis.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 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
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set distribution community tax to 1 for disabling staking rewards and redirect them to the community pool
|
# Perform alps allocations
|
||||||
update_genesis '.app_state["distribution"]["params"]["community_tax"]="1.000000000000000000"'
|
laconicd genesis add-genesis-account $ADDRESS $EARLY_SUPPORTS$DENOM --keyring-backend $KEYRING
|
||||||
|
|
||||||
# Increase threshold in gov proposals for making it difficult to spend community pool funds
|
# Use zero address to add an account for lps_lockup
|
||||||
echo "Setting high threshold for accepting governance proposal"
|
zero_address="laconic1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklcls0"
|
||||||
update_genesis '.app_state["gov"]["params"]["quorum"]="1.000000000000000000"'
|
laconicd genesis add-genesis-account $zero_address $EARLY_SUPPORTS$DENOM --keyring-backend $KEYRING --module-name $LPS_LOCKUP_MODULE_ACCOUNT
|
||||||
# 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"'
|
|
||||||
|
|
||||||
# Skipping early supports account allocation
|
# Update the lps_lockup address in bank module state
|
||||||
# laconicd genesis add-genesis-account $EARLY_SUPPORTS_ACC_ADDRESS $EARLY_SUPPORTS_ALLOC$LPS_DENOM --keyring-backend $KEYRING --append
|
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" \
|
||||||
# Perform lps allocations
|
'.app_state.bank.balances |= map(if .address == $old then .address = $new else . end)' "$mainnet_genesis_file" > tmp.$$.json \
|
||||||
laconicd genesis add-genesis-lockup-account lps_lockup $distribution_file $LOCKUP_ALLOC$LPS_DENOM
|
&& mv tmp.$$.json "$mainnet_genesis_file"
|
||||||
|
|
||||||
# Ensure that resulting genesis file is valid
|
# Ensure that resulting genesis file is valid
|
||||||
laconicd genesis validate
|
laconicd genesis validate
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
#!/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
|
|
@ -1,172 +0,0 @@
|
|||||||
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,15 +9,12 @@ services:
|
|||||||
CERC_PEERS: ${CERC_PEERS}
|
CERC_PEERS: ${CERC_PEERS}
|
||||||
MIN_GAS_PRICE: ${MIN_GAS_PRICE:-0.001}
|
MIN_GAS_PRICE: ${MIN_GAS_PRICE:-0.001}
|
||||||
CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info}
|
CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info}
|
||||||
TMKMS_ENABLED: ${TMKMS_ENABLED:-false}
|
|
||||||
volumes:
|
volumes:
|
||||||
- laconicd-data:/root/.laconicd
|
- laconicd-data:/root/.laconicd
|
||||||
- ../config/mainnet-laconicd/run-laconicd.sh:/opt/run-laconicd.sh
|
- ../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
|
- ../config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh
|
||||||
ports:
|
ports:
|
||||||
- "6060"
|
- "6060"
|
||||||
- "26659"
|
|
||||||
- "26657"
|
- "26657"
|
||||||
- "26656"
|
- "26656"
|
||||||
- "9473"
|
- "9473"
|
||||||
|
45
stack-orchestrator/config/mainnet-laconicd/allocate-lps.sh
Executable file
45
stack-orchestrator/config/mainnet-laconicd/allocate-lps.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/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}"
|
@ -3,9 +3,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
NODE_HOME=/root/.laconicd
|
NODE_HOME=/root/.laconicd
|
||||||
GENTX_DIR=/root/generate-gentx-genesis
|
|
||||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||||
KEYRING="test"
|
|
||||||
|
|
||||||
if [ -f "$genesis_file_path" ]; then
|
if [ -f "$genesis_file_path" ]; then
|
||||||
echo "Genesis file already created, exiting..."
|
echo "Genesis file already created, exiting..."
|
||||||
@ -22,62 +20,45 @@ if [ -z "$KEY_NAME" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$VALIDATOR_PUB_KEY" ]; then
|
if [ -z "$DENOM" ]; then
|
||||||
echo "VALIDATOR_PUB_KEY environment variable not set, exiting..."
|
echo "DENOM environment variable not set, exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
input_genesis_file=$GENTX_DIR/tmp/genesis.json
|
input_genesis_file=$NODE_HOME/tmp/genesis.json
|
||||||
if [ ! -f ${input_genesis_file} ]; then
|
if [ ! -f ${input_genesis_file} ]; then
|
||||||
echo "Genesis file not provided, exiting..."
|
echo "Genesis file not provided, exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
staking_amount_file="$GENTX_DIR/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
|
# Strip leading and trailing quotes ("") if they exist
|
||||||
export MONIKER=$(echo "$CERC_MONIKER" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
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 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
|
# Init
|
||||||
laconicd config set client chain-id $CHAIN_ID --home $NODE_HOME
|
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
|
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
|
# Copy over provided genesis config
|
||||||
cp $input_genesis_file $genesis_file_path
|
cp $input_genesis_file $genesis_file_path
|
||||||
|
|
||||||
# Import private key
|
# Import private key passed via PVT_KEY
|
||||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY" --keyring-backend $KEYRING
|
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY"
|
||||||
|
|
||||||
# Get account address corresponding to the imported key
|
account_address=$(laconicd keys list | awk -v key_name="$KEY_NAME" '
|
||||||
account_address=$(laconicd keys show "$KEY_NAME" --keyring-backend "$KEYRING" | grep 'address:' | awk -F': ' '{print $2}' | xargs)
|
$1 == "name:" && $2 == key_name {found=1}
|
||||||
|
found && $1 == "- address:" {print $3; exit}
|
||||||
|
')
|
||||||
|
|
||||||
if [ -z "$account_address" ]; then
|
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)
|
||||||
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
|
# Create gentx with staked amount equal to allocated balance
|
||||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING --pubkey "$VALIDATOR_PUB_KEY"
|
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID
|
||||||
|
|
||||||
# Collect the gentx and validate
|
# Collect the gentx and validate
|
||||||
laconicd genesis collect-gentxs
|
laconicd genesis collect-gentxs
|
||||||
laconicd genesis validate
|
laconicd genesis validate
|
||||||
|
|
||||||
chmod 777 $genesis_file_path
|
# Update the input genesis file
|
||||||
|
cp $genesis_file_path $input_genesis_file
|
||||||
cp $genesis_file_path $GENTX_DIR/output
|
|
||||||
|
66
stack-orchestrator/config/mainnet-laconicd/create-validator.sh
Executable file → Normal file
66
stack-orchestrator/config/mainnet-laconicd/create-validator.sh
Executable file → Normal file
@ -3,66 +3,18 @@ set -e
|
|||||||
|
|
||||||
DENOM=alnt
|
DENOM=alnt
|
||||||
|
|
||||||
CREATE_VALIDATOR_DIR=/root/create-validator
|
# Create validator with fixed parameters
|
||||||
KEYRING="test"
|
laconicd tx staking create-validator \
|
||||||
|
--amount 900000000$DENOM \
|
||||||
staking_amount_file="$CREATE_VALIDATOR_DIR/tmp/staking-amount.json"
|
--pubkey $(laconicd tendermint show-validator) \
|
||||||
if [ ! -f "$staking_amount_file" ]; then
|
--moniker "$CERC_MONIKER" \
|
||||||
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
|
|
||||||
|
|
||||||
if [ -z "$NODE_URL" ]; then
|
|
||||||
echo "NODE_URL environment variable not set, exiting..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$VALIDATOR_PUB_KEY" ]; then
|
|
||||||
echo "VALIDATOR_PUB_KEY environment variable not set, exiting..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$PVT_KEY" ]; then
|
|
||||||
echo "PVT_KEY environment variable not set, exiting..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY" --keyring-backend test
|
|
||||||
|
|
||||||
# Set staking amount
|
|
||||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
|
||||||
|
|
||||||
# Create validator.json file
|
|
||||||
validator_json="$CREATE_VALIDATOR_DIR/tmp/validator.json"
|
|
||||||
cat > "$validator_json" << EOF
|
|
||||||
{
|
|
||||||
"pubkey": $VALIDATOR_PUB_KEY,
|
|
||||||
"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" \
|
--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 auto \
|
||||||
--gas-adjustment 1.5 \
|
--gas-adjustment 1.5 \
|
||||||
--gas-prices $MIN_GAS_PRICE$DENOM \
|
--gas-prices $MIN_GAS_PRICE$DENOM \
|
||||||
--from $KEY_NAME \
|
--from $KEY_NAME \
|
||||||
--keyring-backend $KEYRING \
|
|
||||||
--node $NODE_URL \
|
|
||||||
--yes
|
--yes
|
||||||
|
@ -15,50 +15,38 @@ if [ ! -f ${input_genesis_file} ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Env:"
|
echo "Env:"
|
||||||
|
echo "Moniker: $CERC_MONIKER"
|
||||||
|
echo "Chain Id: $CERC_CHAIN_ID"
|
||||||
echo "Persistent peers: $CERC_PEERS"
|
echo "Persistent peers: $CERC_PEERS"
|
||||||
echo "Min gas price: $MIN_GAS_PRICE"
|
echo "Min gas price: $MIN_GAS_PRICE"
|
||||||
echo "Log level: $CERC_LOGLEVEL"
|
echo "Log level: $CERC_LOGLEVEL"
|
||||||
echo "TMKMS enabled: $TMKMS_ENABLED"
|
|
||||||
|
|
||||||
/scripts/setup-laconicd.sh
|
# Set chain id in config
|
||||||
|
laconicd config set client chain-id $CERC_CHAIN_ID --home $NODE_HOME
|
||||||
|
|
||||||
# Use provided config files
|
# Check if node data dir already exists
|
||||||
cp $input_genesis_file $NODE_HOME/config/genesis.json
|
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
|
||||||
|
|
||||||
# Enable cors
|
# Enable cors
|
||||||
sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $NODE_HOME/config/config.toml
|
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
|
# Update config with persistent peers
|
||||||
sed -i "s/^persistent_peers *=.*/persistent_peers = \"$CERC_PEERS\"/g" $NODE_HOME/config/config.toml
|
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..."
|
echo "Starting laconicd node..."
|
||||||
laconicd start \
|
laconicd start \
|
||||||
--api.enable \
|
--api.enable \
|
||||||
--minimum-gas-prices=${MIN_GAS_PRICE}alnt \
|
--minimum-gas-prices=${MIN_GAS_PRICE}alnt \
|
||||||
--rpc.laddr="tcp://0.0.0.0:26657" \
|
--rpc.laddr="tcp://0.0.0.0:26657" \
|
||||||
--api.address="tcp://0.0.0.0:1317" \
|
|
||||||
--gql-playground --gql-server \
|
--gql-playground --gql-server \
|
||||||
--log_level $CERC_LOGLEVEL \
|
--log_level $CERC_LOGLEVEL \
|
||||||
--home $NODE_HOME
|
--home $NODE_HOME
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
#!/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 +1,3 @@
|
|||||||
# mainnet-laconicd
|
# mainnet-laconicd
|
||||||
|
|
||||||
|
Instructions for running validator nodes
|
||||||
|
@ -2,7 +2,7 @@ version: "1.0"
|
|||||||
name: mainnet-laconicd
|
name: mainnet-laconicd
|
||||||
description: "Laconicd full node"
|
description: "Laconicd full node"
|
||||||
repos:
|
repos:
|
||||||
- git.vdb.to/cerc-io/laconicd@v1.0.1
|
- git.vdb.to/cerc-io/laconicd@v0.1.11
|
||||||
containers:
|
containers:
|
||||||
- cerc/laconicd
|
- cerc/laconicd
|
||||||
pods:
|
pods:
|
||||||
|
Loading…
Reference in New Issue
Block a user