基于以太坊go-ethereum的DPOS实现(一)源码及测试运行

论坛 期权论坛 区块链     
豆包爹   2018-11-20 23:28   6242   0
            [h1]源码[/h1]GitHub地址 https://github.com/TTCECO/gttc
[h1]目录[/h1]基于以太坊go-ethereum的DPOS实现(一)源码及测试运行
基于以太坊go-ethereum的DPOS实现(二)简要说明
基于以太坊go-ethereum的DPOS实现(三)创世块
基于以太坊go-ethereum的DPOS实现(四)共识接口
基于以太坊go-ethereum的DPOS实现(五)定时出块
[h1]测试运行[/h1][h3]安装环境[/h3]开始之前请先确认已经安装配置好Go语言环境,安装包可以从https://golang.org下载,如果连不Go的官网请自行百度下安装包。gttc现在支持Go版本为 1.9.x、1.10.x 及1.11.x。
  1. $ go versiongo version go1.11 darwin/amd64
复制代码
[h3]下载gttc[/h3]
  1. $ 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代码,放入对应的目录。
[h3]编译[/h3]测试的时候,我们只需要进入cmd/gttc编译这一个文件即可。
  1. $ cd $HOME/go/src/github.com/TTCECO/gttc/cmd/gttc$ go build
复制代码
如果没有任何提示,那恭喜你,编译成功了,你会发现当前目录下多了一个gttc的文件
[h3]运行测试[/h3]
  1. $ ./gttc --testnet
复制代码
如果出现如下提示,则说明已经连上我们部署的ttc测试网络,开始进行同步。
  1. INFO [09-27|11:23:00] Maximum peer count                       ETH=25 LES=0 total=25INFO [09-27|11:23:00] Starting peer-to-peer node               instance=gttc/v0.0.4-unstable/darwin-amd64/go1.11INFO [09-27|11:23:00] Allocated cache and file handles         database=/Users/tataufo/Library/Ethereum/testnet/gttc/chaindata cache=768 handles=128INFO [09-27|11:23:00] Persisted trie from memory database      nodes=54 size=9.96kB time=63.432s gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00BINFO [09-27|11:23:00] Initialised chain configuration          config="{ChainID: 8434 Homestead: 1 EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 4 Constantinople:  Engine: alien}"INFO [09-27|11:23:00] Initialising Ethereum protocol           versions="[63 62]" network=8434INFO [09-27|11:23:01] Loaded most recent local header          number=437847 hash=b41bfe…f68e3f td=437848INFO [09-27|11:23:01] Loaded most recent local full block      number=437847 hash=b41bfe…f68e3f td=437848INFO [09-27|11:23:01] Loaded most recent local fast block      number=437847 hash=b41bfe…f68e3f td=437848INFO [09-27|11:23:01] Loaded local transaction journal         transactions=0 dropped=0INFO [09-27|11:23:01] Regenerated local transaction journal    transactions=0 accounts=0WARN [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@[::]:30303INFO [09-27|11:23:03] RLPx listener up                         self=enode://9a7318a48c4d9b279e96c157db6b4651672dac72bd57fc23736c06c65d60464e43f31e7aec33138304e74d5d089fd952c2c28120a65b501c2e3850b154afb1cc@[::]:30303INFO [09-27|11:23:03] IPC endpoint opened                      url=/Users/tataufo/Library/Ethereum/testnet/gttc.ipcINFO [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.93kBINFO [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.11kBINFO [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.01mBINFO [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.01mBINFO [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
下一节  基于以太坊go-ethereum的DPOS实现(二)简要说明
         
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:187
帖子:6
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP