Skip to content

Commit

Permalink
obvious-1 testnet genesis structure init
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Mar 4, 2024
1 parent 178edf7 commit a50e4ec
Show file tree
Hide file tree
Showing 4 changed files with 602 additions and 0 deletions.
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 manifest-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.
127 changes: 127 additions & 0 deletions network/obvious-1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Testnet Genesis

## Cosmos Multisig (testnet)

```sh
CHAIN_ID='obvious-1'

# Add keys for multisig
manifestd keys add alice-ledger --pubkey <alice-pubkey-here>
manifestd keys add bob-ledger --pubkey <bob-pubkey-here>

# Create multisig with those keys and name it
manifestd keys add alice-bob-multisig --multisig reece-testnet,reece-other --multisig-threshold 1

# Generate a Tx
manifestd tx bank send $(manifestd keys show alice-bob-multisig -a) manifest12wfd44kmcetyg98e7mt7zlp0ul4wnmg9yuuv6l 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 alice-bob-multisig) tx.json --sign-mode amino-json --chain-id=$CHAIN_ID >> tx-signed-alice.json
# and for bob if required

# combine into a single Tx
manifestd tx multisign --from alice-bob-multisig tx.json alice-bob-multisig tx-signed-alice.json tx-signed-bob.json --chain-id=$CHAIN_ID > tx_ms.json

# Anyone can Broadcast tx
manifestd tx broadcast ms/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 VERSION

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

manifestd config set client chain-id manifest-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

# 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='manifest-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 --staking-bond-denom poastake
manifestd add-genesis-account $KEYNAME_ADDR 1000000poastake

# genesis transaction using all above variables
manifestd 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`
```

> Update minimum gas prices
```bash
# nano ${HOME}/.manifest/config/app.toml # minimum-gas-prices -> "0umfx"
sed -i 's/minimum-gas-prices = "0stake"/minimum-gas-prices = "0umfx"/g' ${HOME}/.manifest/config/app.toml
```
91 changes: 91 additions & 0 deletions network/obvious-1/from_scratch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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
update_genesis '.app_state["poa"]["params"]["admins"]=["manifest10d07y265gmmuvt4z0w9aw880jnsr700jmq3jzm","manifest1aucdev30u9505dx9t6q5fkcm70sjg4rh7rn5nf"]'

# 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

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

0 comments on commit a50e4ec

Please sign in to comment.