The following describes what is requried for a single VM that will act as a validator in a sommelier
testnet.
Compute: 2 CPU RAM: 8 GB Disk: 50GB-100GB Open Ports:
- 26656 (tendermint p2p)
- 26657 (tendermint rpc)
- 9090 (tendermint grpc)
- 1317 (cosmos-sdk api)
- 30303 (geth p2p)
After you spin up your VM with the above specs, install the following dependancies and configure your unit files:
- Install Go
- Install Binaries
- Setup
systemd
unit files (Optional but recommended)
In this step you will generate your keys that will be used for:
- Validating on the Cosmos chain
- Signing for oracle-feeder transactions
- Signing for ETH transactions
- Signing for orchestrator transactions
Then you will:
- Use those keys to sign a
gentx
- Gather addresses from each key and some other information to generate a
merlot/addresses/{name}.json
file
# Initialize config files for both oracle-feeder and sommelier
# NOTE: this also generates ~/.sommelier/config/priv_validator.json that is mission critical
sommelier init moniker --chain-id merlot
oracle-feeder config init
# backup the mnemonics and private keys that you are generating here
# record the public keys that are generated here as well to create your json file
sommelier keys add validator --keyring-backend test
sommelier keys add orchestrator --keyring-backend test
sommelier eth-keys add
oracle-feeder keys add feeder
# generate the gentx file
sommelier add-genesis-account $(sommelier keys show validator -a --keyring-backend test) 10000000000stake
sommelier gentx validator 1000000000stake --chain-id merlot --keyring-backend test
# this outputs a file path, that is where your gentx.json resides
# Next gather the necessary info for your addesses file
sommelier keys show validator --keyring-backend test -a
sommelier keys show orchestrator --keyring-backend test -a
oracle-feeder keys show feeder
sommelier eth-keys show 1
sommelier tendermint show-node-id
Make a PR to this repo with the following files:
This should contain a json blob with the following schema/data:
{
"cosmos-addresses": [
"cosmos18zxhdqsqhx5pl7eyqqgxacwqdxwxx3umj6wvys",
"cosmos12wms6ghmdsewxpvgzfx39tklnmtmzauf3mqr4p",
"cosmos1m38004fjd646gncuqlz08p8al5qt7juvze6a48"
],
"eth-address": "0x004cec59a7c332188602079179bd6d4baa4c6a75",
"node-id": "25f0e83d1f03a8de0956fe858fd8041019d14031",
"node-ip": "35.247.110.115"
}
This should contain the json from your gentx
file.
Before logging out of your machine, now is a great time to prepare configuration files for both oracle-feeder
and sommelier
. Your
Your feeder config file should match the one below:
uniswap-subgraph: http://35.197.17.185:8000/subgraphs/name/davekaj/uniswap
signing-key: feeder
chain-grpc: http://localhost:9090
chain-rpc: http://localhost:26657
chain-id: merlot
gas-prices: 0.025stake
You can test this configuration by running the following:
# test feeder, this should return a JSON blob
oracle-feeder query uniswap-data
To turn on the API, open ~/.sommelier/config/app.toml
in an editor and make the following change to enable the API:
###############################################################################
### API Configuration ###
###############################################################################
[api]
# Enable defines if the API server should be enabled.
enable = true
Now we wait for all testnet participants to submit their files. Once they are submitted we can continue with the network bootstrap process. At this point the batch
and il
contracts can be deployed to Goreli. The resultant hashes should be filled in below:
- Deploy
TestTokenBatchMiddleware
- Deploy script/instructions
- HASH:
"0x439021d5a835C42a7026e71c5a2352602fb41EcE"
- Deploy
TestUniswapLiquidity
- Deploy script/instructions
- HASH:
"0xB757488003d0A31f2761Fd8876C6f2bf4a03f740"
The following changes need to be made to a generated genesis file for sommelier.
-
Add funds to each cosmos address in the
./merlot/addresses/
folder-
sommelier add–genesis-account {address} 1000000000000stake,1000000000000usomm
-
-
Add denom metadata for
usomm
andstake
jq '.app_state.bank.denom_metadata += [{"base": "usomm", display: "usomm", "description": "A non-staking test token", "denom_units": [{"denom": "usomm", "exponent": 6}]}, {"base": "stake", display: "stake", "description": "A staking test token", "denom_units": [{"denom": "stake", "exponent": 6}]}]' ~/.sommelier/config/genesis.json > ~/.sommelier/config/edited-genesis.json mv ~/.sommelier/config/edited-genesis.json ~/.sommelier/config/genesis.json
-
Add contract address for batch contract
jq '.app_state.il.params.batch_contract_address = "0x439021d5a835C42a7026e71c5a2352602fb41EcE"' ~/.sommelier/config/genesis.json > ~/.sommelier/config/edited-genesis.json mv ~/.sommelier/config/edited-genesis.json ~/.sommelier/config/genesis.json
-
Add contract address for liquidity contract
jq '.app_state.il.params.liquidity_contract_address = "0xB757488003d0A31f2761Fd8876C6f2bf4a03f740"' ~/.sommelier/config/genesis.json > ~/.sommelier/config/edited-genesis.json mv ~/.sommelier/config/edited-genesis.json ~/.sommelier/config/genesis.json
-
Add chain id for goreli testnet
jq '.app_state.peggy.params.bridge_chain_id = "5"' ~/.sommelier/config/genesis.json > ~/.sommelier/config/edited-genesis.json mv ~/.sommelier/config/edited-genesis.json ~/.sommelier/config/genesis.json
-
Increase slash window for oracle feeder
jq '.app_state.oracle.params.slash_window = "1000000"' ~/.sommelier/config/genesis.json > ~/.sommelier/config/edited-genesis.json mv ~/.sommelier/config/edited-genesis.json ~/.sommelier/config/genesis.json
Copy all the ./merlot/gentx/
files into ~/.sommelier/config/gentx/
and run the following:
sommelier collect-gentxs
jq -S -c -M '' ~/.sommelier/config/genesis.json | shasum -a 256
# HASH: fe570afc239e4a935e57f1e170bc9cb647fecd332bdddd5c54015b83b6baaa2d
Ensure that your [p2p]persistent_peers
in ~/.sommelier/config/config.toml
contains all the nodes in the ./merlot/addresses/
files. A string will be provided:
persistent_peers = "25f0e83d1f03a8de0956fe858fd8041019d14031@35.247.110.115:26656,a9f8af97e7bae0fe6ac83d4548ff5328fe6ef087@104.131.106.11:26656,61129d45cea573879d4cd300230e40573965bfcd@10.128.0.5:26656,5580b2bdea2519d44e4e13374174fc340880d51f@198.199.91.35:26656,0f8cdce37d2210572cd9df7099d69ab3bc760d13@ 66.36.234.114:26656"
sudo systemctl start sommelier && journalctl -u sommelier -f
At this point the network will begin to come online. The remaining steps are to be completed once the network is online.
sommelier tx oracle delegate-feeder $(oracle-feeder keys show feeder) --from validator --chain-id merlot --keyring-backend test
sudo systemctl start oracle-feeder && journalctl -u oracle-feeder -f
# You should see logging for each cosmos block then a set of transactions every 5th block
# Errors will kill this process and set it into a crash backoff loop
register_delegate_keys
--validator-phrase=""
--ethereum-key=""
--cosmos-phrase=""
--cosmos-rpc="http://localhost:26657"
--fees="stake"
TODO: make this work
sommelier tx peggy set-orchestrator-address \
$(sommelier keys show validator -a --keyring-backend test --bech val) \
$(oracle-feeder key show feeder) \
$(sommelier eth-keys show 1) \
# TODO: The below flags are not present on the sommelier binary currently
--from validator \
--chain-id merlot \
--fees 25000stake \
--keyring-backend test -y
At this point we need to wait for all genesis participants to submit their eth keys then the peggy contract can be deployed.
This step only needs to be performed by one participant and should only be run once all the eth keys have been added
wget https://github.com/althea-net/cosmos-gravity-bridge/releases/download/v0.0.20/contract-deployer
wget https://github.com/althea-net/cosmos-gravity-bridge/releases/download/v0.0.20/Peggy.json
chmod +x contract-deployer
./contract-deployer --cosmos-node="http://localhost:26657" --eth-node="http://localhost:8545" --eth-privkey="{private-key-with-goreli-funds}" --contract=Peggy.json --test-mode=false
This results in a hash which is required for all validators to start their orchestrators.
HASH:
"TBD"
If you are using the systemd
setup described here be sure to sudo systemctl daemon-reload
after editing /etc/systemd/system/orchestrator.service
to include the peggy contract address and your private keys.
sudo systemctl start orchestrator && journalctl -u orchestrator -f
# You should see the orchestrator begin to emit logs