支持的操作系统:Linux
,MacOS
依赖和工具:Oracle JDK 1.8
,git
推荐配置
- CPU:16核
- 内存:32G
- SSD:1.5T以上
- 带宽:100M
如果是超级代表搭建产块的全节点,建议配置是 CPU:32核, 内存:64G
1、波场节点介绍
- 波场网络的节点主要分为两类:超级节点,全节点
①、超级节点
- 包含全网全部区块数据,并负责共识出块
②、全节点
- 包含全网全部区块数据
2、编译源码
- 获取java-tron源码
$ git clone https://github.com/tronprotocol/java-tron.git
$ git checkout -t origin/master
- 编译
$ cd java-tron
$ ./gradlew clean build -x test
image.png
编译完成之后,FullNode.jar会生成在 java-tron/build/libs/FullNode.jar
。
3、运行节点
a.) 节点需要的jar及配置文件
获取主网全节点配置文件:main_net_config.conf,其它网络节点配置文件在这里。
1.FullNode.jar(项目路径/java-tron/build/libs/FullNode.jar)
2.main_net_config.conf(/项目路径/java-tron/build/libs/main_net_config.conf) //习惯性放在同级目录
b.) 运行超级节点
目标:创建超级节点,并开始创建区块
创建节点目录superNode并拷贝相关FullNode.jar包及配置文件(见a项)
# mkdir -p /项目路径/superNode
# cp /项目路径/java-tron/build/libs/FullNode.jar /项目路径/superNode
# cp /项目路径/java-tron/build/libs/main_net_config.conf /项目路径/superNode
创建你的tron账号
可通过https://tronscan.org/ 去创建你的个人账号,并保存创建的私钥及地址信息
修改配置文件
- 配置文件:/项目路径/superNode/main_net_config.conf* 修改genesis.block.witnesses为你个人的tron地址
witnesses = [
{
address: 27PsvT28qhmUM1GHMVVJeyRskhB2pfzA1En,
url= "http://tron.com",
voteCount = 10000
}
]* 修改seed.node.ip.list 为服务器的IP:PORT
seed.node = {
ip.list = [
"123.207.xx.xxx:18888"
]
}* 第一个超级节点,则需要修改needSyncCheck =false
block = {
needSyncCheck = false# first node : false, other : true
maintenanceTimeInterval = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms)
}* 可修改p2pversion 为你自己定制的版本,建议不修改该值
启动超级节点
cd /项目路径/superNode
java -jar FullNode.jar -p 个人地址的私钥 --witness -c /项目路径/superNode/main_net_config.conf
验证节点启动状态:
节点启动后,FullNode.jar的同级目录上将生成 logs 和 output-directory 两个文件夹
logs : 节点日志文件
output-directory : 节点数据存储目录
查看日志,确定节点是否正常启动,并在出块
超级节点启动,并创建创世块:
15:49:34.973 INFO [main] [o.t.c.d.Manager](Manager.java:305) create genesis block
15:49:34.975 INFO [main] [o.t.c.d.Manager](Manager.java:311) save block: BlockCapsule
[ hash=0000000000000000318b90bda4950d183bab0031b9005d4c0be1b180c21d6fde
number=0
parentId=0000000000000000000000000000000000000000000000000000000000000000
witness address=
generated by myself=true
generate time=1970-01-01 08:00:00.0
merkle root=c5b031aa2d4a77d237f785fcc760e17839a75f414b62765fcd0d614aff96ce09
txs size=4
]
超级节点正常出块:
15:55:06.008 INFO [Thread-5] [o.t.c.d.Manager](Manager.java:1108) update solid block, num = 109
15:55:06.008 INFO [Thread-5] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:719) update state flag = 0
15:55:06.008 INFO [Thread-5] [o.t.c.d.Manager](Manager.java:742) save block: BlockCapsule
[ hash=000000000000006d9b18d04237b60abb321264d2282d7a864083c32d0e3ddad9
number=109
parentId=000000000000006c7717e85f0d2db9fc089bccd9d5dc1c233a3a3bad5d557fb9
witness address=a008c7176410573e7a16bc62e5089bf25b49548ba4
generated by myself=true
generate time=2018-05-31 15:55:06.0
txs are empty
]
15:55:06.008 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:241) Produce block successfully, blockNumber:109, abSlot[509251102], blockId:000000000000006d9b18d04237b60abb321264d2282d7a864083c32d0e3ddad9, transactionSize:0, blockTime:2018-05-31T15:55:06.000+08:00, parentBlockId:000000000000006d9b18d04237b60abb321264d2282d7a864083c32d0e3ddad9
15:55:06.008 INFO [Thread-5] [o.t.c.n.n.NodeImpl](NodeImpl.java:347) Ready to broadcast block 000000000000006d9b18d04237b60abb321264d2282d7a864083c32d0e3ddad9
c.) 运行Full Node
目标:创建全节点,并连上自建的超级节点同步数据
准备全节点的jar包及配置文件:
在全节点服务器上创建节点目录:mkdir -p /项目路径/fullNode
拷贝步骤b)的jar包及配置文件到全节点服务器/项目路径//fullNode目录下
修改配置文件:
将超级节点加入active列表
active = [
"123.207.xx.xxx:18888"
]
修改needSyncCheck =true
block = {
needSyncCheck = true# first node : false, other : true
maintenanceTimeInterval = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms)
}
启动全节点:
cd /项目路径/fullNode
java -jar FullNode.jar -c /项目路径/fullNode/main_net_config.conf
验证全节点:
节点启动后,FullNode.jar的同级目录上将生成 logs 和 output-directory 两个文件夹
logs : 节点日志文件
output-directory : 节点数据存储目录
查看日志,确定节点是否正常启动,并在同步区块
全节点启动,并创建创世块:
16:19:15.399 INFO [main] [o.t.c.d.Manager](Manager.java:305) create genesis block
16:19:15.401 INFO [main] [o.t.c.d.Manager](Manager.java:311) save block: BlockCapsule
[ hash=0000000000000000318b90bda4950d183bab0031b9005d4c0be1b180c21d6fde
number=0
parentId=0000000000000000000000000000000000000000000000000000000000000000
witness address=
generated by myself=true
generate time=1970-01-01 08:00:00.0
merkle root=c5b031aa2d4a77d237f785fcc760e17839a75f414b62765fcd0d614aff96ce09
txs size=4
]
16:19:15.401 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:706) update latest block header number = 0
16:19:15.401 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:714) update latest block header id = 0000000000000000318b90bda4950d183bab0031b9005d4c0be1b180c21d6fde
连接超级节点:
16:24:52.645 INFO [TronJClientWorker-0] [HandshakeHandler](HandshakeHandler.java:73) channel active, /123.207.xx.xxx:18888
16:24:52.652 INFO [TronJClientWorker-0] [HandshakeHandler](HandshakeHandler.java:122) Handshake Send to /123.207.xx.xxx:18888, type: P2P_HELLO
from {
address: "47.74.xx.xxx"
port: 18888
nodeId: "\344\276\257|\232\261f\370r\367\231\203\034\t\212\336\212\034\350\260\020X\324\025\233:\223\'6\311-AD\002\203\236O\034\250\367\300,\313\211\236\210\263\352\327\026\335|\223\030\356\200\356\320D\030"
}
从超级节点同步区块
16:24:53.872 INFO [TronJClientWorker-0] [MessageQueue](MessageQueue.java:104) Receive from /123.207.xx.xxx:18888, type: BLOCK
Num:1,ID:000000000000000111033c4e558ef57e3063a949856528c368aa126c1f4e6cef, trx size: 0
16:24:53.874 INFO [TronJClientWorker-0] [MessageQueue](MessageQueue.java:104) Receive from /123.207.xx.xxx:18888, type: BLOCK
Num:2,ID:0000000000000002f385a7ade9ef2afd9139cf4a491ddd0a4a001ce20eccf3c4, trx size: 0
16:24:53.874 INFO [TronJClientWorker-0] [MessageQueue](MessageQueue.java:104) Receive from /123.207.xx.xxx:18888, type: BLOCK
Num:3,ID:0000000000000003bcbd41f1ee2e64dad8e61b40342561f3a3184930d8dc4959, trx size: 0
16:24:53.875 INFO [TronJClientWorker-0] [MessageQueue](MessageQueue.java:104) Receive from /123.207.xx.xxx:18888, type: BLOCK
Num:4,ID:00000000000000046923e5cf0f999c3935d80bdeb8b4fa55b1aec58ed056a4fb, trx size: 0
网友评论