Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] Test network launch #15

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion network/manifest-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ rm $HOME/.manifest/config/gentx/*.json

# Give yourself 1POASTAKE for the genesis Tx signed
manifestd init "$MONIKER" --chain-id $CHAIN_ID --staking-bond-denom poastake
manifestd add-genesis-account $KEYNAME_ADDR 1000000poastake
manifestd add-genesis-account $KEYNAME_ADDR 1000000poastake --append

# genesis transaction using all above variables
manifestd gentx $KEYNAME 1000000poastake \
Expand Down
11 changes: 9 additions & 2 deletions network/manifest-1/from_scratch.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Takes a default genesis from manifestd and creates a new genesis file.

CHAIN_ID=manifest-1

make install

export HOME_DIR=$(eval echo "${HOME_DIR:-"~/.manifest"}")

rm -rf $HOME_DIR && echo "Removed $HOME_DIR"

manifestd init moniker --chain-id=manifest-1 --default-denom=umfx
manifestd init moniker --chain-id=$CHAIN_ID --default-denom=umfx

update_genesis () {
cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json
Expand Down Expand Up @@ -77,6 +79,11 @@ update_genesis '.app_state["staking"]["params"]["bond_denom"]="poastake"'
update_genesis '.app_state["tokenfactory"]["params"]["denom_creation_fee"]=[]'
update_genesis '.app_state["tokenfactory"]["params"]["denom_creation_gas_consume"]="250000"'

# TODO: gov,multisig
# update_genesis '.app_state["poa"]["params"]["admins"]=["manifest10d07y265gmmuvt4z0w9aw880jnsr700jmq3jzm","MULTISIG-HERE"]'

# add genesis accounts
# TODO:
manifestd genesis add-genesis-account manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct 1umfx --append
manifestd genesis add-genesis-account manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct 1umfx --append

cp ~/.manifest/config/genesis.json ./network/$CHAIN_ID/genesis.json
28 changes: 28 additions & 0 deletions network/obvious-1/POST_GENESIS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Post-Genesis

### Become a validator
* Install the manifest binary
* manifestd init <moniker> --chain-id obvious-1 --default-denom poastake
* Replace your genesis with the public one found in this repo
* Find peers and seeds here.
* Update your minimum-gas-prices in the app.toml
* Start the node and sync up
* Once completed, `manifestd tx poa create-validator path/to/validator.json --from keyname`. This command shows the JSON needed.
```json
{
"pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"oWg2ISpLF405Jcm2vXV+2v4fnjodh6aafuIdeoW+rUw="},
"amount": "1poastake", # ignored
"moniker": "myvalidator",
"identity": "keybase-identity",
"website": "validator's (optional) website",
"security": "validator's (optional) security contact email",
"details": "validator's (optional) details",
"commission-rate": "0.1",
"commission-max-rate": "0.2",
"commission-max-change-rate": "0.01",
"min-self-delegation": "1" # ignored
}
```

Following these instructions, your validator will be put into a queue for the chain admins to accept or reject. Once accepted, you will be a validator on the network.
The chain admin's will set your amount if they accept.
151 changes: 151 additions & 0 deletions network/obvious-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Testnet Genesis

## Cosmos Multisig (testnet)

```sh
CHAIN_ID='obvious-1'

# Add keys for multisig
manifestd keys add chandrastation --pubkey '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9hZjm7++QBixsH4QTQadXPrnhVBDk+MPLE74U0/GoJp"}' # manifest1wxjfftrc0emj5f7ldcvtpj05lxtz3t2npghwsf
manifestd keys add reece-testnet --pubkey '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A57Cxv5vgwE6pAJ9oYtnOdU4ehKixMj6gufF8jBRq4IC"}' # manifest1aucdev30u9505dx9t6q5fkcm70sjg4rh7rn5nf

# Create multisig with those keys and name it
manifestd keys add obvious-1-multisig --multisig reece-testnet,chandrastation --multisig-threshold 1

# - address: manifest1nzpct7tq52rckgnvr55e2m0kmyr0asdrgayq9p
# name: obvious-1-multisig
# pubkey: '{"@type":"/cosmos.crypto.multisig.LegacyAminoPubKey","threshold":1,"public_keys":[{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9hZjm7++QBixsH4QTQadXPrnhVBDk+MPLE74U0/GoJp"},{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A57Cxv5vgwE6pAJ9oYtnOdU4ehKixMj6gufF8jBRq4IC"}]}'
# type: multi

# Generate a Tx
manifestd tx bank send $(manifestd keys show obvious-1-multisig -a) manifest1aucdev30u9505dx9t6q5fkcm70sjg4rh7rn5nf 10000000umfx --generate-only --chain-id=$CHAIN_ID | jq . > tx.json

# both sign
manifestd tx sign --from $(manifestd keys show -a reece-testnet) --multisig $(manifestd keys show -a obvious-1-multisig) tx.json --sign-mode amino-json --chain-id=$CHAIN_ID >> tx-signed-reece.json
# and for chandra station

# combine into a single Tx
manifestd tx multisign --from obvious-1-multisig tx.json obvious-1-multisig tx-signed-reece.json tx-signed-chandra.json --chain-id=$CHAIN_ID > tx_ms.json

# Anyone can Broadcast tx
manifestd tx broadcast tx_ms.json --chain-id=$CHAIN_ID
```


# Post Genesis Validators
If you are a validator joining the network after the initial genesis launch, follow the [post genesis document here](./POST_GENESIS.md).

## Hardware Requirements
**Minimal**
* 4 GB RAM
* 100 GB SSD
* 3.2 x4 GHz CPU

**Recommended**
* 8 GB RAM
* 100 GB NVME SSD
* 4.2 GHz x6 CPU

**Operating System**
* Linux (x86_64) or Linux (amd64) Recommended Arch Linux

### Dependencies
>Prerequisite: go1.21+, git, gcc, make, jq

**Arch Linux:**
```
pacman -S go git gcc make
```

**Ubuntu Linux:**
```
sudo snap install go --classic
sudo apt-get install git gcc make jq
```

## manifestd Installation Steps

```bash
# Clone git repository
git clone https://github.com/liftedinit/manifest-ledger.git
cd manifest-ledger
git checkout v0.0.1-alpha.1

make install # go install ./...
# For ledger support `go install -tags ledger ./...`

manifestd config set client chain-id obvious-1
```

### Generate keys
* `manifestd keys add [key_name]`
* `manifestd keys add [key_name] --recover` to regenerate keys with your BIP39 mnemonic to add ledger key
* `manifestd keys add [key_name] --ledger` to add a ledger key

Copy link
Collaborator Author

@Reecepbcups Reecepbcups Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO:

  • setting config values (chain id, app toml gas prices)
  • note to save priv val key

# Validator setup instructions
## Genesis Tx:
```bash
# Validator variables
KEYNAME='validator' # your keyname
MONIKER='pbcups'
SECURITY_CONTACT="[email protected]"
WEBSITE="https://domain.com"
MAX_RATE='0.20' # 20%
COMMISSION_RATE='0.00' # 0%
MAX_CHANGE='0.01' # 1%
CHAIN_ID='obvious-1'
PROJECT_HOME="${HOME}/.manifest"
KEYNAME_ADDR=$(manifestd keys show $KEYNAME -a)

# Remove old files if they exist
manifestd tendermint unsafe-reset-all
rm $HOME/.manifest/config/genesis.json
rm $HOME/.manifest/config/gentx/*.json

# Give yourself 1POASTAKE for the genesis Tx signed
manifestd init "$MONIKER" --chain-id $CHAIN_ID --default-denom poastake
manifestd genesis add-genesis-account $KEYNAME_ADDR 1000000poastake --append

# genesis transaction using all above variables
manifestd genesis gentx $KEYNAME 1000000poastake \
--home=$PROJECT_HOME \
--chain-id=$CHAIN_ID \
--moniker="$MONIKER" \
--commission-max-change-rate=$MAX_CHANGE \
--commission-max-rate=$MAX_RATE \
--commission-rate=$COMMISSION_RATE \
--security-contact=$SECURITY_CONTACT \
--website=$WEBSITE \
--details=""

# Get that gentx data easily -> your home directory
cat ${PROJECT_HOME}/config/gentx/gentx-*.json

# get your peer
echo $(manifestd tendermint show-node-id)@$(curl -s ifconfig.me):26656
```


maintainer only:
```bash

cd networks/obvious-1

cp genesis.json $HOME/.manifest/config

# iterate through the gentx directory, print the files
# https://github.com/strangelove-ventures/bech32cli
for filename in gentx/*.json; do
addr=`cat $filename | jq -r .body.messages[0].validator_address | xargs -I {} bech32 transform {} manifest`
raw_coin=`cat $filename | jq -r .body.messages[0].value` # { "denom": "poastake", "amount": "1000000" }
coin=$(echo $raw_coin | jq -r '.amount + .denom') # make coin = 1000000poastake
manifestd genesis add-genesis-account $addr $coin --append
done

manifestd genesis collect-gentxs --gentx-dir gentx --home $HOME/.manifest

cp $HOME/.manifest/config/genesis.json live_genesis.json

# curl https://raw.githubusercontent.com/liftedinit/manifest-ledger/reece/test-network-launch/network/obvious-1/live_genesis.json > $HOME/.manifest/config/genesis.json

```
93 changes: 93 additions & 0 deletions network/obvious-1/from_scratch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Takes a default genesis from manifestd and creates a new genesis file.

CHAIN_ID=obvious-1

make install

export HOME_DIR=$(eval echo "${HOME_DIR:-"~/.manifest"}")

rm -rf $HOME_DIR && echo "Removed $HOME_DIR"

manifestd init moniker --chain-id=$CHAIN_ID --default-denom=umfx

update_genesis () {
cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json
}

update_genesis '.consensus["params"]["block"]["max_gas"]="-1"'
update_genesis '.consensus["params"]["abci"]["vote_extensions_enable_height"]="1"'

# auth
update_genesis '.app_state["auth"]["params"]["max_memo_characters"]="512"'

update_genesis '.app_state["bank"]["denom_metadata"]=[
{
"base": "umfx",
"denom_units": [
{
"aliases": [],
"denom": "umfx",
"exponent": 0
},
{
"aliases": [],
"denom": "MFX",
"exponent": 6
}
],
"description": "Denom metadata for MFX (umfx)",
"display": "MFX",
"name": "MFX",
"symbol": "MFX"
}
]'

update_genesis '.app_state["crisis"]["constant_fee"]={"denom": "umfx","amount": "100000000"}'

update_genesis '.app_state["distribution"]["params"]["community_tax"]="0.000000000000000000"'

update_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"umfx","amount":"100000000"}]'
update_genesis '.app_state["gov"]["params"]["max_deposit_period"]="259200s"'
update_genesis '.app_state["gov"]["params"]["voting_period"]="259200s"'
update_genesis '.app_state["gov"]["params"]["expedited_min_deposit"]=[{"denom":"umfx","amount":"250000000"}]'
update_genesis '.app_state["gov"]["params"]["min_deposit_ratio"]="0.100000000000000000"' # 10%
# update_genesis '.app_state["gov"]["params"]["constitution"]=""' # ?

# TODO:
# update_genesis '.app_state["manifest"]["params"]["stake_holders"]=[{"address":"manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct","percentage":100000000}]' # TODO:
update_genesis '.app_state["manifest"]["params"]["inflation"]["automatic_enabled"]=false'
update_genesis '.app_state["manifest"]["params"]["inflation"]["yearly_amount"]="365000000"' # in micro format (1MFX = 10**6)
update_genesis '.app_state["manifest"]["params"]["inflation"]["mint_denom"]="umfx"'

# not used
update_genesis '.app_state["mint"]["minter"]["inflation"]="0.000000000000000000"'
update_genesis '.app_state["mint"]["minter"]["annual_provisions"]="0.000000000000000000"'
update_genesis '.app_state["mint"]["params"]["mint_denom"]="notused"'
update_genesis '.app_state["mint"]["params"]["inflation_rate_change"]="0.000000000000000000"'
update_genesis '.app_state["mint"]["params"]["inflation_max"]="0.000000000000000000"'
update_genesis '.app_state["mint"]["params"]["inflation_min"]="0.000000000000000000"'
update_genesis '.app_state["mint"]["params"]["blocks_per_year"]="6311520"' # default 6s blocks

update_genesis '.app_state["slashing"]["params"]["signed_blocks_window"]="10000"'
update_genesis '.app_state["slashing"]["params"]["min_signed_per_window"]="0.050000000000000000"'
update_genesis '.app_state["slashing"]["params"]["downtime_jail_duration"]="60s"'
update_genesis '.app_state["slashing"]["params"]["slash_fraction_double_sign"]="1.000000000000000000"'
update_genesis '.app_state["slashing"]["params"]["slash_fraction_downtime"]="0.000000000000000000"'

update_genesis '.app_state["staking"]["params"]["bond_denom"]="poastake"'

update_genesis '.app_state["tokenfactory"]["params"]["denom_creation_fee"]=[]'
update_genesis '.app_state["tokenfactory"]["params"]["denom_creation_gas_consume"]="250000"'

# TODO: chalabi / the multisig
# gov, reece-testnet, chandrastation, chandra-reece-multisig
update_genesis '.app_state["poa"]["params"]["admins"]=["manifest10d07y265gmmuvt4z0w9aw880jnsr700jmq3jzm","manifest1aucdev30u9505dx9t6q5fkcm70sjg4rh7rn5nf","manifest1wxjfftrc0emj5f7ldcvtpj05lxtz3t2npghwsf","manifest1nzpct7tq52rckgnvr55e2m0kmyr0asdrgayq9p"]'

# add genesis accounts
# TODO:
manifestd genesis add-genesis-account manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct 1umfx --append
manifestd genesis add-genesis-account manifest1aucdev30u9505dx9t6q5fkcm70sjg4rh7rn5nf 5000000000000umfx --append # reece-testnet (5m UMFX). Is a validator
manifestd genesis add-genesis-account manifest1wxjfftrc0emj5f7ldcvtpj05lxtz3t2npghwsf 5000000000000umfx --append # chandrastation
manifestd genesis add-genesis-account manifest1nzpct7tq52rckgnvr55e2m0kmyr0asdrgayq9p 5000000000000umfx --append # multisig

cp ~/.manifest/config/genesis.json ./network/$CHAIN_ID/genesis.json
Loading
Loading