源码
GitHub地址 https://github.com/TTCECO/gttc
测试运行
安装环境
开始之前请先确认已经安装配置好Go语言环境,安装包可以从https://golang.org下载,如果连不Go的官网请自行百度下安装包。gttc现在支持Go版本为 1.9.x、1.10.x 及1.11.x。
$ go version
go version go1.11 darwin/amd64
下载gttc
$ go get github.com/TTCECO/gttc
$ cd $HOME/go/src/github.com/TTCECO/gttc
# 如果安装Go时,自己指定了GOPATH,则
$ cd $GOPATH/src/github.com/TTCECO/gttc
国内用go get会比较慢,也可以直接git clone代码,放入对应的目录。
编译
测试的时候,我们只需要进入cmd/gttc编译这一个文件即可。
$ cd $HOME/go/src/github.com/TTCECO/gttc/cmd/gttc
$ go build
如果没有任何提示,那恭喜你,编译成功了,你会发现当前目录下多了一个gttc的文件
运行测试
$ ./gttc --testnet
如果出现如下提示,则说明已经连上我们部署的ttc测试网络,开始进行同步。
INFO [09-27|11:23:00] Maximum peer count ETH=25 LES=0 total=25
INFO [09-27|11:23:00] Starting peer-to-peer node instance=gttc/v0.0.4-unstable/darwin-amd64/go1.11
INFO [09-27|11:23:00] Allocated cache and file handles database=/Users/tataufo/Library/Ethereum/testnet/gttc/chaindata cache=768 handles=128
INFO [09-27|11:23:00] Persisted trie from memory database nodes=54 size=9.96kB time=63.432µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [09-27|11:23:00] Initialised chain configuration config="{ChainID: 8434 Homestead: 1 EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 4 Constantinople: <nil> Engine: alien}"
INFO [09-27|11:23:00] Initialising Ethereum protocol versions="[63 62]" network=8434
INFO [09-27|11:23:01] Loaded most recent local header number=437847 hash=b41bfe…f68e3f td=437848
INFO [09-27|11:23:01] Loaded most recent local full block number=437847 hash=b41bfe…f68e3f td=437848
INFO [09-27|11:23:01] Loaded most recent local fast block number=437847 hash=b41bfe…f68e3f td=437848
INFO [09-27|11:23:01] Loaded local transaction journal transactions=0 dropped=0
INFO [09-27|11:23:01] Regenerated local transaction journal transactions=0 accounts=0
WARN [09-27|11:23:01] Blockchain not empty, fast sync disabled
INFO [09-27|11:23:01] Starting P2P networking
INFO [09-27|11:23:03] UDP listener up self=enode://9a7318a48c4d9b279e96c157db6b4651672dac72bd57fc23736c06c65d60464e43f31e7aec33138304e74d5d089fd952c2c28120a65b501c2e3850b154afb1cc@[::]:30303
INFO [09-27|11:23:03] RLPx listener up self=enode://9a7318a48c4d9b279e96c157db6b4651672dac72bd57fc23736c06c65d60464e43f31e7aec33138304e74d5d089fd952c2c28120a65b501c2e3850b154afb1cc@[::]:30303
INFO [09-27|11:23:03] IPC endpoint opened url=/Users/tataufo/Library/Ethereum/testnet/gttc.ipc
INFO [09-27|11:23:07] Block synchronisation started
INFO [09-27|11:23:08] Imported new chain segment blocks=6 txs=212 mgas=4.827 elapsed=72.939ms mgasps=66.176 number=437853 hash=cdfc63…9e4ecd cache=50.93kB
INFO [09-27|11:23:09] Imported new chain segment blocks=6 txs=216 mgas=4.918 elapsed=80.791ms mgasps=60.872 number=437859 hash=56ee8c…7dc15d cache=97.11kB
INFO [09-27|11:23:11] Imported new chain segment blocks=156 txs=5625 mgas=128.070 elapsed=1.953s mgasps=65.544 number=438015 hash=714503…70370a cache=1.01mB
INFO [09-27|11:23:19] Imported new chain segment blocks=631 txs=22721 mgas=517.312 elapsed=8.005s mgasps=64.623 number=438646 hash=0bbc83…aa69da cache=1.01mB
INFO [09-27|11:23:24] Imported new chain segment blocks=412 txs=14818 mgas=337.376 elapsed=5.203s mgasps=64.832 num
如果有兴趣部署自己的测试链,可以参见docs/HOWTO_RUNNING_TEST_ON_PRIVATE_NETWORK.md。
有疑问加站长微信联系(非本文作者)