go1.14+
Gaia是使用Cosmos SDK构建的Cosmos Hub的第一个实现。Hub的作用是促进区块链之间的转移。如果区块链通过IBC连接到Hub,它会自动获得对连接到它的所有其他区块链的访问权限,支持区块链间通信。
目前最新版本为v2.0.10
mkdir cosmos
cd sosmos
git clone -b v2.0.10 https://github.com/cosmos/gaia
cd gaia && make install
检查命令行是否可用
$ gaiacli version --long
name: gaia
server_name: gaiad
client_name: gaiacli
version: 2.0.10
commit: 46bc0060fe7a52abf9e2173d39fc2bfdb59971fb
build_tags: netgo,ledger
go: go version go1.13 linux/amd64
gaiacli是Gaia命令行工具,可以与Gaia全节点进行交互
$ gaiad version --long
name: gaia
server_name: gaiad
client_name: gaiacli
version: 2.0.10
commit: 46bc0060fe7a52abf9e2173d39fc2bfdb59971fb
build_tags: netgo,ledger
go: go version go1.13 linux/amd64
gaiad 是Gaia守护程序,运行gaia应用程序的全节点。
gaiad init 后面跟名称
gaiad init pld_demo_01_moniker
可以在执行上面的命令后编辑~/.gaiad/config/config.toml
文件修改moniker的值
gaiad init执行后生成的文件如下
├── app.toml
├── config.toml
├── genesis.json
├── node_key.json
└── priv_validator_key.json
下载主网创世配置(60M)
curl https://raw.githubusercontent.com/cosmos/launch/master/genesis.json > ~/.gaiad/config/genesis.json
修改seed
vi ~/.gaiad/config/config.toml
找到seeds,添加主网peer节点,逗号分割
seeds = "ba3bacc714817218562f743178228f23678b2873@5.83.160.108:26656,1e63e84945837b026f596ed8ae68708783d04ad4@51.75.145.123:26656,d2d452e7c9c43fa5ef017552688de60a5c0053ee@34.245.217.163:26656"
(同步数据比较耗时间,目前主网高度200多万)
nohup gaiad start > gaia.log 2>&1 &
查看当前状态
gaiacli status
初始化配置,注意设置chain-id
gaiad init pld_demo_02_moniker --chain-id=gaia-13007
下载测试网创世配置(2.3M)
curl https://raw.githubusercontent.com/cosmos/testnets/master/gaia-13k/13007/genesis.json > ~/.gaiad/config/genesis.json
找到seeds,添加主网peer节点,逗号分割
seeds = "055a315b20c847813535d7c2b4cedba5756e3d79@207.180.204.112:26656,444d209bd0f89d7bf18cf389a74872e7082b237e@44.230.205.153:26656,30e46db6f9e6f5f19d1c08785faec03616024759@51.68.102.106:26656,04c28a44dd4eac4961c748bbe5451f7cdd12205c@18.217.97.195:26656"
(同步数据比较耗时间,目前测试网高度200多万)
nohup gaiad start > gaia.log 2>&1 &
查看当前状态
gaiacli status
创建账户,需要输入8位数密码
gaiacli keys add pld-demo
查看账户
$ gaiacli keys list
- name: pld-demo
type: local
address: cosmos1rnvhje672f59x88sxr8f5tj55qwg44r3s79c96
pubkey: cosmospub1addwnpepqdqn86etl4jprlskyftjtek2j2tsnz0an0lxy9lnnff2v8p5jrtmzjvcf9u
mnemonic: ""
threshold: 0
pubkeys: []
账户详情
$ gaiacli q account cosmos1rnvhje672f59x88sxr8f5tj55qwg44r3s79c96 --chain-id gaia-13007
ERROR: {"codespace":"sdk","code":9,"message":"account cosmos1rnvhje672f59x88sxr8f5tj55qwg44r3s79c96 does not exist"}
账户还有在链上有任何交易或数据还未同步完成
去聊天室获取测试币(需要代理)
https://riot.im/app/#/room/#cosmos-faucet:matrix.org
进入后,输入:
show me the money!YOUR ADDRESS
YOUR ADDRESS为你的钱包地址,机器人会自动转币到你的地址
查看验证人公钥(创建验证人需要pubkey)
gaiad tendermint show-validator
创建验证人
gaiacli tx staking create-validator \
--amount=25muon \
--pubkey=cosmosvalconspub1zcjduepq0wkd0ru6mppc0dkxu0yx98vfcptuye7udr8cshf3m62rc596255quyw400 \
--moniker=hongmin \
--chain-id=gaia-13007 \
--sequence=0 \
--commission-rate=0.05 \
--commission-max-rate=0.2 \
--commission-max-change-rate=0.1 \
--min-self-delegation=1 \
--from=cosmos1rnvhje672f59x88sxr8f5tj55qwg44r3s79c96
修改验证人信息(24小时后才可以修改)
gaiacli tx staking edit-validator \
--moniker=“pod” \
--website="https://pld.network" \
--details="To infinity and beyond" \
--chain-id=gaia-13007 \
--from=cosmos1rnvhje672f59x88sxr8f5tj55qwg44r3s79c96\
--commission-rate="0.10"
在区块链浏览器查看地址或交易信息(Gaia-13007测试网络)
https://gaia.bigdipper.live/
gaiad init --chain-id=testing testing
gaiacli keys add validator
gaiad add-genesis-account $(gaiacli keys show validator -a) 1000000000stake,1000000000validatortoken
gaiad gentx --name validator
gaiad collect-gentxs
nohup gaiad start > gaia.log 2>&1 &
删除数据
rm ~/.gaiad/config/addrbook.json ~/.gaiad/config/genesis.json
gaiad unsafe-reset-all
下载最新版本并安装
git clone https://github.com/cosmos/gaia.git
cd gaia
git fetch --all && git checkout master
make install
https://hub.cosmos.network/master/gaia-tutorials/
https://github.com/cosmos/gaia
https://github.com/cosmos/testnets
https://github.com/cosmos/testnets/tree/master/gaia-13k/13007