Skip to content

Instantly share code, notes, and snippets.

@nnkken
Last active May 31, 2019 15:30
Show Gist options
  • Select an option

  • Save nnkken/1ef750a64d0a7cc73f3dee01e2e7691c to your computer and use it in GitHub Desktop.

Select an option

Save nnkken/1ef750a64d0a7cc73f3dee01e2e7691c to your computer and use it in GitHub Desktop.
Instruction of joining LikeChain Cosmos Testnet
#!/bin/bash
set -e
COSMOS_BUILD_TAG="v0.34.6"
git clone https://github.com/cosmos/cosmos-sdk
pushd cosmos-sdk
git checkout $COSMOS_BUILD_TAG
make install tools
popd
# verify
gaiad version
gaiacli version
{
"genesis_time": "2019-05-31T08:20:36.700150205Z",
"chain_id": "likechain-cosmos-testnet-1",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
"evidence": {
"max_age": "100000"
},
"validator": {
"pub_key_types": [
"ed25519"
]
}
},
"app_hash": "",
"app_state": {
"accounts": [
{
"address": "cosmos1wxxaxj3xnhypxwjuupzj63spelt3eqv47wwztj",
"coins": [
{
"denom": "nanolike",
"amount": "1000000000000000"
}
],
"sequence_number": "0",
"account_number": "0",
"original_vesting": null,
"delegated_free": null,
"delegated_vesting": null,
"start_time": "0",
"end_time": "0"
},
{
"address": "cosmos1nzdggf8sdp7w30tkl855ncrz9x34e65augxa59",
"coins": [
{
"denom": "nanolike",
"amount": "1000000000000000000000000000"
}
],
"sequence_number": "0",
"account_number": "0",
"original_vesting": null,
"delegated_free": null,
"delegated_vesting": null,
"start_time": "0",
"end_time": "0"
}
],
"auth": {
"collected_fees": null,
"params": {
"max_memo_characters": "256",
"tx_sig_limit": "7",
"tx_size_cost_per_byte": "10",
"sig_verify_cost_ed25519": "590",
"sig_verify_cost_secp256k1": "1000"
}
},
"bank": {
"send_enabled": true
},
"staking": {
"pool": {
"not_bonded_tokens": "1000000000001000000000000000",
"bonded_tokens": "0"
},
"params": {
"unbonding_time": "3600000000000",
"max_validators": 100,
"max_entries": 7,
"bond_denom": "nanolike"
},
"last_total_power": "0",
"last_validator_powers": null,
"validators": null,
"delegations": null,
"unbonding_delegations": null,
"redelegations": null,
"exported": false
},
"mint": {
"minter": {
"inflation": "0.130000000000000000",
"annual_provisions": "0.000000000000000000"
},
"params": {
"mint_denom": "nanolike",
"inflation_rate_change": "0.130000000000000000",
"inflation_max": "0.200000000000000000",
"inflation_min": "0.070000000000000000",
"goal_bonded": "0.670000000000000000",
"blocks_per_year": "6311520"
}
},
"distr": {
"fee_pool": {
"community_pool": null
},
"community_tax": "0.020000000000000000",
"base_proposer_reward": "0.010000000000000000",
"bonus_proposer_reward": "0.040000000000000000",
"withdraw_addr_enabled": true,
"delegator_withdraw_infos": null,
"previous_proposer": "",
"outstanding_rewards": null,
"validator_accumulated_commissions": null,
"validator_historical_rewards": null,
"validator_current_rewards": null,
"delegator_starting_infos": null,
"validator_slash_events": null
},
"gov": {
"starting_proposal_id": "1",
"deposits": null,
"votes": null,
"proposals": null,
"deposit_params": {
"min_deposit": [
{
"denom": "nanolike",
"amount": "100000000000000"
}
],
"max_deposit_period": "172800000000000"
},
"voting_params": {
"voting_period": "172800000000000"
},
"tally_params": {
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto": "0.334000000000000000"
}
},
"crisis": {
"constant_fee": {
"denom": "nanolike",
"amount": "100000000000000"
}
},
"slashing": {
"params": {
"max_evidence_age": "120000000000",
"signed_blocks_window": "100",
"min_signed_per_window": "0.500000000000000000",
"downtime_jail_duration": "600000000000",
"slash_fraction_double_sign": "0.250000000000000000",
"slash_fraction_downtime": "0.010000000000000000"
},
"signing_infos": {},
"missed_blocks": {}
},
"gentxs": [
{
"type": "auth/StdTx",
"value": {
"msg": [
{
"type": "cosmos-sdk/MsgCreateValidator",
"value": {
"description": {
"moniker": "likecoin",
"identity": "",
"website": "",
"details": "LikeCoin Foundation, the first validator"
},
"commission": {
"rate": "0.100000000000000000",
"max_rate": "0.200000000000000000",
"max_change_rate": "0.010000000000000000"
},
"min_self_delegation": "1",
"delegator_address": "cosmos1wxxaxj3xnhypxwjuupzj63spelt3eqv47wwztj",
"validator_address": "cosmosvaloper1wxxaxj3xnhypxwjuupzj63spelt3eqv4m66h8p",
"pubkey": "cosmosvalconspub1zcjduepqyr93h5as922xzyzm3p23kq07nf2tmy7k4fu59pfe8tv0fy273hfqul3y6d",
"value": {
"denom": "nanolike",
"amount": "1000000000000000"
}
}
}
],
"fee": {
"amount": null,
"gas": "200000"
},
"signatures": [
{
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "AgSTdD0tq93tAh9ty71jY6PpRjJFOEhz7FGBBImYt9G3"
},
"signature": "m7ks8gM79qudOf2pTX6v6c+YjeqfbUAo4WrLQWpBKQ8hPGftCInmbiAAsqXIn0foFfbo3dPdiuY7mTj56Zz3VA=="
}
],
"memo": "[email protected]:26656"
}
}
]
}
}

Prerequisite

  • Go 1.12+
  • At least 150 GB storage space (estimated usage: ~15GB/month)

Instruction

Building the software

Run build.sh, or alternatively:

  1. git clone https://github.com/cosmos/cosmos-sdk
  2. cd cosmos-sdk
  3. git checkout v0.34.6
  4. make install tools
  5. verify installation with gaiad version and gaiacli version, check that the version shown is 0.34.6

Running a node

  1. gaiad init --chain-id "likechain-cosmos-testnet-1" YOUR_NODES_NAME
  2. copy genesis.json as ~/.gaiad/config/genesis.json
  3. modify ~/.gaiad/config/config.toml, replace persistent_peers="" with persistent_peers="[email protected]:26656"
  4. run gaiad start

Generating Cosmos account and staking to become a validator

  1. gaiacli keys add validator
  2. follow the instruction to generate a Cosmos account, remember the passphrase and store the mnemonic phrase in a safe place
  3. send us the address generated by the command above, or obtain it by gaiacli keys show validator -a
  4. wait for us to send some coins into this account on the chain
  5. run the following command to stake coins and become a validator:
gaiacli tx staking create-validator \
--amount AMOUNT_IN_nanolike \
--moniker YOUR_NAME \
--pubkey $(gaiad tendermint show-validator) \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.01 \
--details "DESCRIPTION HERE" \
--min-self-delegation 1 \
--from validator \
--chain-id "likechain-cosmos-testnet-1"

Example:

gaiacli tx staking create-validator \
--amount 300000000000000nanolike \
--moniker chung \
--pubkey $(gaiad tendermint show-validator) \
--commission-rate 0.03 \
--commission-max-rate 0.1 \
--commission-max-change-rate 0.01 \
--details "Chung Wu, not Satoshi" \
--min-self-delegation 1 \
--from validator \
--chain-id "likechain-cosmos-testnet-1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment