cosmos测试网络结点搭建完整流程

第一步:下载golang并安装,配置环境变量

wget https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz

tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz

vim ~/.profile

export PATH=$PATH:/usr/local/go/bin

第二步:下载gaia代码并安装,配置环境变量

git clone https://github.com/cosmos/gaia

cd gaia

git checkout v2.0.6

make install

#如果系统没有安装make和gcc,用下面两条命令安装

apt install make

apt install gcc

 

第三步:Initialize the gaia directories and create the local genesis file with the correct chain-id

gaiad init cosmostest --chain-id=gaia-13007

{"app_message":{"accounts":[],"auth":{"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"bank":{"send_enabled":true},"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"distribution":{"base_proposer_reward":"0.010000000000000000","bonus_proposer_reward":"0.040000000000000000","community_tax":"0.020000000000000000","delegator_starting_infos":[],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[]},"outstanding_rewards":[],"previous_proposer":"","validator_accumulated_commissions":[],"validator_current_rewards":[],"validator_historical_rewards":[],"validator_slash_events":[],"withdraw_addr_enabled":true},"genutil":{"gentxs":null},"gov":{"deposit_params":{"max_deposit_period":"172800000000000","min_deposit":[{"amount":"10000000","denom":"stake"}]},"deposits":null,"proposals":null,"starting_proposal_id":"1","tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto":"0.334000000000000000"},"votes":null,"voting_params":{"voting_period":"172800000000000"}},"mint":{"minter":{"annual_provisions":"0.000000000000000000","inflation":"0.130000000000000000"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"params":null,"slashing":{"missed_blocks":{},"params":{"downtime_jail_duration":"600000000000","max_evidence_age":"120000000000","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":{}},"staking":{"delegations":null,"exported":false,"last_total_power":"0","last_validator_powers":null,"params":{"bond_denom":"stake","max_entries":7,"max_validators":100,"unbonding_time":"1814400000000000"},"redelegations":null,"unbonding_delegations":null,"validators":null},"supply":{"supply":[]}},"chain_id":"gaia-13007","gentxs_dir":"","moniker":"hashfin","node_id":"0098a90b6cc05adb50467e8d659424d5a8c954aa"}

 

第四步:替换:~/.gaiad/config/genesis.json
https://github.com/cosmos/testnets/blob/master/gaia-13k/13007/genesis.json

 

第五步:Create a local key pair in the Keybase

gaiacli keys add cosmoskey

Enter a passphrase to encrypt your key to disk:11111111

Repeat the passphrase:11111111



- name: cosmoskey

type: local

address: cosmos1mmqnry7vdvggdd87a4rg087rqytzwfqd5sft7n

pubkey: cosmospub1addwnpepqv5uu7ewup3aw4drdlx83n4sqyfvh7v86295f0urvm7qsn3jed0t7cd7c8k

mnemonic: ""

threshold: 0

pubkeys: []



**Important** write this mnemonic phrase in a safe place.

It is the only way to recover your account if you ever forget your password.



better safe jewel barely estate cinnamon limb debris portion kit explain anchor camp announce glove dynamic taste dragon gate ivory quick dream project giggle

第六步:Add your account to your local genesis file with a given amount and the key you just created.

gaiad add-genesis-account $(gaiacli keys show cosmostest -a) 50000000000umuon

 

第七步:Create the gentx

gaiad gentx --amount 50000000000umuon \ --commission-rate=0.01 \ --commission-max-rate=0.02 \ --commission-max-change-rate=0.01 \ --pubkey $(gaiad tendermint show-validator) \ --name=cosmostest


Genesis transaction written to "/root/.gaiad/config/gentx/gentx-0098a90b6cc05adb50467e8d659424d5a8c954aa.json"

 

第八步:配置文件~/.gaiad/config/config.toml添加seeds

[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656

 

第九步:启动gaiad,开始同步数据

nohup gaiad start &

tail -f nohup.out

 

刚开始会显示网络连接错误,等一会就好了

I[2020-02-15|00:39:38.043] starting ABCI with Tendermint module=main

E[2020-02-15|10:42:46.607] Not stopping ConsensusState -- have not been started yet module=consensus impl=ConsensusState
I[2020-02-15|10:42:46.607] exiting... module=main
I[2020-02-15|10:46:06.640] starting ABCI with Tendermint module=main
E[2020-02-15|10:46:07.482] Stopping peer for error module=p2p peer="Peer{MConn{51.68.102.106:26656} 30e46db6f9e6f5f19d1c08785faec03616024759 out}" err=EOF
E[2020-02-15|10:46:38.309] Stopping peer for error module=p2p peer="Peer{MConn{51.68.102.106:26656} 30e46db6f9e6f5f19d1c08785faec03616024759 out}" err=EOF
E[2020-02-15|10:47:08.245] Stopping peer for error module=p2p peer="Peer{MConn{207.180.204.112:26656} 055a315b20c847813535d7c2b4cedba5756e3d79 out}" err=EOF
E[2020-02-15|10:47:37.686] Error dialing seed module=p2p err="auth failure: conn.ID (2a1ddf5a0e44c24a914b00e6c00955d4fbe440d6) dialed ID (444d209bd0f89d7bf18cf389a74872e7082b237e) mismatch" [email protected]:26656

 

你可能感兴趣的:(学习区块链)