In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to use geth to build a multi-node private chain, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
1. Create at least two different paths. Here are node1 and node2.
Mkdir / tmp/node1mkdir / tmp/node2
2. Edit the initialization configuration file. What I use here is
{"config": {"chainId": 10, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0}, "alloc": {}, "coinbase": "0x0000000000000000000000000000000000000000", "difficulty": "0x20000", "extraData": "," gasLimit ":" 0x2fefd8 "," nonce ":" 0x0000000000000042 " "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": "0x00"}
3. Use the geth command to enable the node
Geth-datadir / tmp/node1-rpc-rpcport 8546-networkid 1101-rpccorsdomain "*" console
Parameter description
Rpc indicates that rpc mode is enabled
Rpcport specifies rpc port
Nerworkid through which port the node is connected to the network? if you want to associate multiple nodes, the networkid of the node must be consistent. Otherwise, it won't be connected.
Rpccorsdomain indicates which networks or nodes are allowed to link to this node.
Console means to open the command line in this window.
Geth-datadir / tmp/node2-networkid 1101-port 30304 console
Port means to specify the port on which this node is running.
The last command did not, because the default port number is 30303.
4. Connect nodes
Select one of the nodes that are already open
Type in console
Admin.nodeInfo.enode
Returns the string of the enode node, something like this
"enode://b33db66202917898415228cb6dfca3911c504d1064c681e05250f162d6e8ef9bd09d7e98120893c14f488fac02aa6b2ee7aefde24cb8bdd47a3e26dd4683da09@127.0.0.1:30304"
Copy the string.
Type in the console of another node
Admin.addPeer ("string just copied by enode")
Hit enter and return to true.
Then verify it.
Net.peerCount
Return 1. It means that the connection between the nodes is successful.
After reading the above, do you have any further understanding of how to use geth to build a multi-node private chain? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.