安装go
$ wget https://golang.google.cn/dl/go1.15.6.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz
/etc/profile ubuntu全局
~/.zshrc mac
$ vim ~/.profile ubuntu
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:/usr/local/go/bin:$GOBIN
export GO111MODULE=on
$ source ~/.profile
$ go version
国内服务器go代理
export GOPROXY=https://mirrors.aliyun.com/goproxy/
- win10终端使用系统代理
set HTTP_PROXY=http://127.0.0.1:7890
Cosmos节点数据修剪
pruning = "custom"
# These are applied if and only if the pruning strategy is custom.
pruning-keep-recent = "100"
pruning-interval = "10"
pruning-keep-every = "2000"
Cosmos查看升级情况
https://github.com/quokkastake/tmtop
tmtop --provider-rpc-host http://provider-sentry-02.rs-testnet.polypore.xyz:26657 --rpc-host https://rpc-palvus.pion-1.ntrn.tech
Cosmos下载快照
SYNC_RPC_1=https://rpc.provider-state-sync-01.rs-testnet.polypore.xyz:443
SYNC_RPC_2=https://rpc.provider-state-sync-02.rs-testnet.polypore.xyz:443
SYNC_RPC_SERVERS="$SYNC_RPC_1,$SYNC_RPC_2"
CURRENT_BLOCK=$(curl -s $SYNC_RPC_1/block | jq -r '.result.block.header.height')
TRUST_HEIGHT=$[$CURRENT_BLOCK-1000]
TRUST_BLOCK=$(curl -s $SYNC_RPC_1/block\?height\=$TRUST_HEIGHT)
TRUST_HASH=$(echo $TRUST_BLOCK | jq -r '.result.block_id.hash')
sed -i -e '/enable =/ s/= .*/= true/' $NODE_HOME/config/config.toml
sed -i -e '/trust_period =/ s/= .*/= "8h0m0s"/' $NODE_HOME/config/config.toml
sed -i -e "/trust_height =/ s/= .*/= $TRUST_HEIGHT/" $NODE_HOME/config/config.toml
sed -i -e "/trust_hash =/ s/= .*/= \"$TRUST_HASH\"/" $NODE_HOME/config/config.toml
sed -i -e "/rpc_servers =/ s^= .*^= \"$SYNC_RPC_SERVERS\"^" $NODE_HOME/config/config.toml
使用state sync
- 修改
config.toml
[statesync]
enable = true # whether enable stat_sync; set true
rpc_servers = "34.82.96.8:26657,34.77.68.145:26657" # RPC server address which the node connects to
trust_height = # Set to the block height of the latest snapshot
trust_hash = "" #Set to the hash corresponding to the latest snapshot block height (trust height), which can be checked via https://irishub.iobscan.io/#/block/<trust_height>.
trust_period = "168h0m0s"
discovery_time = "15s"
temp_dir = ""
- 查询快照区块高度和
hash
curl -s http://foo.net:26657/block | jq -r '.result.block.header.height + "\n" + .result.block_id.hash'
Goland常用快捷键
工作中Goland常用快捷键(windows环境下)
(1)返回上次光标所在位置
Ctrl+window+Alt +左箭头或右箭头
(2)跳转到interface实现
ctrl + alt + 鼠标左键
(3)查看函数被调用
Alt + F7
(4)下载依赖包
Alt + Shift + Enter
Mac技巧
(1)设置终端
iTerm2 + zsh + oh-my-zsh
(2)设置终端速度
搜索keyboard 将按键重复和重复前延迟调整到最快
(3)goland 设置
command + ,
docker 指定文件存储位置
- DockerFile
volumes:
- ./config:/opt/taraxa_data/conf
- /data/data:/opt/taraxa_data/data
- 主机位置:docker位置