cosmos-sdk

Error in setting up genesis transactions -- what am I doing wrong?


I'm trying to go through the "Running a node" tutorial here: https://github.com/cosmos/cosmos-sdk/blob/master/docs/run-node/run-node.md

I seem to have some issue though, the genesis transactions don't manage to set up a validator, so the validator set is empty and the app stops. Am I missing something?

I'm running script.sh and getting error message in error.log

simd version: goz-phase-1-1119-g8572a84eb

script.sh

#!/bin/bash
set -eu

PATH=build:$PATH

MONIKER=foobar

simd init $MONIKER --chain-id my-test-chain

simd keys add my_validator --keyring-backend test

# Put the generated address in a variable for later use.
MY_VALIDATOR_ADDRESS=$(simd keys show my_validator -a --keyring-backend test)

simd add-genesis-account $MY_VALIDATOR_ADDRESS 100000000stake

# Create a gentx.
simd gentx my_validator 100000stake --chain-id my-test-chain --keyring-backend test

# Add the gentx to the genesis file.
simd collect-gentxs

simd start

error.log:

5:09PM INF starting ABCI with Tendermint
5:09PM INF Starting multiAppConn service impl={"Logger":{}} module=proxy
5:09PM INF Starting localClient service connection=query impl="marshaling error: json: unsupported type: abcicli.Callback" module=abci-client
5:09PM INF Starting localClient service connection=snapshot impl="marshaling error: json: unsupported type: abcicli.Callback" module=abci-client
5:09PM INF Starting localClient service connection=mempool impl="marshaling error: json: unsupported type: abcicli.Callback" module=abci-client
5:09PM INF Starting localClient service connection=consensus impl="marshaling error: json: unsupported type: abcicli.Callback" module=abci-client
5:09PM INF Starting EventBus service impl={"Logger":{}} module=events
5:09PM INF Starting PubSub service impl={"Logger":{}} module=pubsub
5:09PM INF Starting IndexerService service impl={"Logger":{}} module=txindex
5:09PM INF ABCI Handshake App Info hash= height=0 module=consensus protocol-version=0 software-version=
5:09PM INF ABCI Replay Blocks appHeight=0 module=consensus stateHeight=0 storeHeight=0
5:09PM INF asserting crisis invariants inv=0/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=1/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=2/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=3/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=4/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=5/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=6/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=7/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=8/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=9/11 module=x/crisis
5:09PM INF asserting crisis invariants inv=10/11 module=x/crisis
5:09PM INF asserted all invariants duration=0.844065 height=0 module=x/crisis
5:09PM INF created new capability module=ibc name=ports/transfer
5:09PM INF port binded module=x/ibc/port port=transfer
5:09PM INF claimed capability capability=1 module=transfer name=ports/transfer
Error: error during handshake: error on replay: validator set is nil in genesis and still empty after InitChain
Usage:
  simd start [flags]

Flags:
      --abci string                                     specify abci transport (socket | grpc) (default "socket")
... [other usage info]

Solution

  • I tried it myself and saw the same error but was able to fix it by increasing the amount of stake in the simd gentx command to 100000000stake. It works now as follows:

    #!/bin/bash
    set -eu
    
    PATH=build:$PATH
    
    MONIKER=foobar
    
    simd init $MONIKER --chain-id my-test-chain
    
    simd keys add my_validator --keyring-backend test
    
    # Put the generated address in a variable for later use.
    MY_VALIDATOR_ADDRESS=$(simd keys show my_validator -a --keyring-backend test)
    
    simd add-genesis-account $MY_VALIDATOR_ADDRESS 100000000stake
    
    # Create a gentx.
    simd gentx my_validator 100000000stake --chain-id my-test-chain --keyring-backend test
    
    # Add the gentx to the genesis file.
    simd collect-gentxs
    
    # simd start
    

    Where did you get the script.sh file from? I didn't see it inside of https://github.com/cosmos/cosmos-sdk/blob/master/docs/run-node/run-node.md