|
| 1 | +# How to create a chain configuration for a new rollup |
| 2 | + |
| 3 | +#!/bin/sh |
| 4 | + |
| 5 | +# set variables for the chain |
| 6 | +VALIDATOR_NAME=validator1 |
| 7 | +CHAIN_ID=gm |
| 8 | +KEY_NAME=gm-key |
| 9 | +KEY_2_NAME=gm-key-2 |
| 10 | +KEY_RELAY=gm-relay |
| 11 | +CHAINFLAG="--chain-id ${CHAIN_ID}" |
| 12 | +TOKEN_AMOUNT="10000000000000000000000000stake" |
| 13 | +STAKING_AMOUNT="1000000000stake" |
| 14 | + |
| 15 | +# build and install the gm chain with Rollkit |
| 16 | +go install ./cmd/gmd |
| 17 | + |
| 18 | +# reset any existing genesis/chain data |
| 19 | +gmd tendermint unsafe-reset-all |
| 20 | + |
| 21 | +# initialize the validator with the chain ID you set |
| 22 | +gmd init $VALIDATOR_NAME --chain-id $CHAIN_ID |
| 23 | + |
| 24 | +# add keys for key 1 and key 2 to keyring-backend test |
| 25 | +gmd keys add $KEY_NAME --keyring-backend test |
| 26 | +gmd keys add $KEY_2_NAME --keyring-backend test |
| 27 | +echo "milk verify alley price trust come maple will suit hood clay exotic" | gmd keys add $KEY_RELAY --keyring-backend test --recover |
| 28 | + |
| 29 | +# add these as genesis accounts |
| 30 | +gmd genesis add-genesis-account $KEY_NAME $TOKEN_AMOUNT --keyring-backend test |
| 31 | +gmd genesis add-genesis-account $KEY_2_NAME $TOKEN_AMOUNT --keyring-backend test |
| 32 | +gmd genesis add-genesis-account $KEY_RELAY $TOKEN_AMOUNT --keyring-backend test |
| 33 | + |
| 34 | +# set the staking amounts in the genesis transaction |
| 35 | +gmd genesis gentx $KEY_NAME $STAKING_AMOUNT --chain-id $CHAIN_ID --keyring-backend test |
| 36 | + |
| 37 | +# collect genesis transactions |
| 38 | +gmd genesis collect-gentxs |
| 39 | + |
| 40 | +# copy centralized sequencer address into genesis.json |
| 41 | +# Note: validator and sequencer are used interchangeably here |
| 42 | +ADDRESS=$(jq -r '.address' ~/.gm/config/priv_validator_key.json) |
| 43 | +PUB_KEY=$(jq -r '.pub_key' ~/.gm/config/priv_validator_key.json) |
| 44 | +jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000", "name": "Rollkit Sequencer"}]' ~/.gm/config/genesis.json > temp.json && mv temp.json ~/.gm/config/genesis.json |
| 45 | + |
| 46 | + |
0 commit comments