In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to build a private chain Private Blockchain or alliance chain based on NEO. I think it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.
1. Preparatory work
1.NEO-GUI
2.NEO-CLI
3..NET Core Runtime (cannot be 2.x version, the official recommendation is 1.12, in fact, I have no problem using 1.14)
4. Four windows operating system virtual machines (this article is based on AWS, in theory, it is no problem to run virtual machines locally)
two。 Deploy NEO nodes
First give a link to the official document-NEO node deployment (official document), which can be done against this document.
1. Prepare the virtual machine to act as the node first. Here, take AWS as an example. Open the home page of AWS, register and log in. After the login is successful, select the AWS management console, then click the service in the upper left corner, and select EC2.
two。 Launch the instance in the midpoint of the new page (PS: there is a node selection in the upper right corner, which can be switched freely, and I choose Singapore), and then select windows server 2016 Base > choose a free package that meets the criteria, and the default configuration will be fine. The key is the last step-checking the actual example to start, where you choose to create a new key pair and save it.
3. After the creation is successful, go back to the console, wait a few minutes, wait for the virtual machine to be ready, then select the virtual machine you just created, click to connect, a pop-up box will appear, click to download and select the desktop file, and follow the prompts to get the password there.
4. Open the remote desktop file you just downloaded, paste the password obtained in the previous step according to the prompt, and wait for the system initialization to be completed after the successful connection. After initialization, turn off the IE security settings of the virtual machine (otherwise you cannot download files, and you will have to warn you every time you open a web page), click the search button in the lower left corner, enter server manager, then find IE Enhanced Security Configuration in the Local server panel, click ON, and then select OFF in the pop-up panel to turn off IE security settings.
5. Open the NEO node deployment (official documentation) and download NEO-GUI,NEO-CLI,.NET Core Runtime. Tell me here, why download NEO-GUI? According to the official documentation, in theory, we can only download NEO-CLI. However, the official documentation does not specify exactly where to download the two library files needed for NEO-CLI to run. Official documentation the first step of the package here should refer to NEO-GUI, and then you can find these two library files under the x64 (or x86, depending on your operating system) file in the NEO-GUI directory. Copy these two files to the NEO-CLI file directory.
6. Install .NET Core Runtime, after the installation is complete, open the command line, I use PowerShell here, use the command line to change to the NEO-CLI directory, type dotnet neo-cli.dll, if nothing happens, the NEO node will be deployed successfully, as shown in the figure.
3. Build a private chain (or alliance chain)
Official documents are set up here-NEO private chain (official documents), which can be done together.
1. It is pointed out in the document that four virtual machines are needed, so we need four virtual machines, all of which are deployed with NEO nodes. You can configure the other 3 sets according to the previous tutorial. Here, when naming virtual machines, it is best to make a simple identity sort, otherwise the later operation may be messy, for example, the four virtual machines here are named neo-window,neo-window1,neo-window2,neo-window3 respectively. Of course, it depends on your habits.
The deployment of NEO private chain requires at least four servers to reach a consensus, each server corresponds to a consensus node, and each server has an NEO wallet file.
two。 After the other three are successfully deployed, turn on one of the virtual machines, and here I open the first one (neo-window), then start NEO-CLI, create 4 new wallets with create wallet xxxx.db3, and I create wallet1.db3 ~ wallet4.db3 here. Save the four pubkey to a txt file after the new one, which will be used later. Then copy and paste the other three wallet files into the corresponding virtual machine. Be careful to put it in the same directory as neo-cli.dll.
3. Open the AWS console in the background and record the IP addresses of the four virtual machines. This step will be used later when modifying the node configuration file. As shown in the figure, record the IPv4 public IP.
4. If you have started neo-cli.dll before, delete the Chain directory under the NEO-CLI directory first, otherwise there may be a number of connections at the end, but the block height is 0. Similarly, if you have opened NEO-GUI out of curiosity, you also need to delete the corresponding Chain directory. If not, you can skip the delete step. Then open the NEO-CLI directory and use txt to open the protocol.json file in the directory, which is the configuration file for the node. Modify according to the format of the official document
The following is my modified file, modified, saved, and copied to replace the node configuration file of the client on the other virtual machine.
{"ProtocolConfiguration": {"Magic": 66123456, "AddressVersion": 23, "StandbyValidators": ["0264e5b51fa2af8392292fd13e0381d913288e0d197086d12aef195d6823a349fa", "034a879e08069f89cdbc34067ff0df614d36bef7a30b014509dfe3170c6a9d7974", "0332c8d77ca8e2a7847325af55457f2793d285e2a914e349bc329c94e301c01dd6", "020a02297371c867c845471dc0030277dc669c89ae80071424442787535295c7a4"], "SeedList": ["54.255.212.167AddressVersion" 10333 "," 52.221.255.41AddressVersion 10333 "," 13.229.109.145AddressVersion 10333 "," 13.228.25.57v10333 "]," SystemFee ": {" EnrollmentTransaction ": 1000,500" IssueTransaction " "PublishTransaction": 500, "RegisterTransaction": 10000}
5. To modify the firewall inbound rules of a virtual machine, it is important to note that you not only need to modify the inbound rules of the virtual machine, but also go to the AWS console to modify the inbound rules in the security group. Since my four virtual machines all use the same security group, I only need to modify one. I will not specifically write the inbound rules of the windows operating system in the virtual machine. It is relatively simple to operate in the control panel. In fact, if you want to be simple and rude, just turn off the firewall of windows.
6. Open the corresponding wallet with neo-cli on each of the four virtual machines. Here, take the first virtual machine as an example. Run the dotnet neo-cil.dll command, if you want to check the current block state, you can use show state, the initial state should be height 0, node 0. Then open the wallet file for this machine and the wallet1.db3 for this virtual machine.
Enter the command open wallet wallet1.db3 to open the wallet
Then enter start consensus to open the consensus.
Do the same for other virtual machines, open the corresponding wallet files respectively, and then enter the command to open the consensus. If nothing happens, the interface shown in the figure will appear. If one of them is turned off, the other three can still reach a consensus.
7. NEO and GAS were extracted by NEO-GUI. After installing NEO-GUI, overwrite the protocol.json file in the NEO-CLI directory with protocol.json in the NEO-GUI directory, and then run neo-gui.exe. Set up multi-party signatures.
But there is a problem, there is a bit of a pit here, and it is not clearly stated in the document. NEO-CLI and NEO-GUI cannot be started at the same time, that is, when neo-cli is started with dotnet neo-cli.dll, neo-gui.exe cannot be run, and vice versa. So when there is a consensus, we need to shut down the NEO-CLI of one of the nodes and then operate on the NEO-GUI client on that node. Open four wallets in turn, set up multi-party signatures and rebuild the wallet index, which is done on the same virtual machine. You must pay attention to this.
Then transfer the NEO from the contract address to the ordinary address, open any of the four wallets, click transaction > transfer to enter the standard address and amount, and transfer 100 million NEO to this address.
Then the system will prompt "the transaction construction is complete, but there is not enough signature", then copy the code, open the second wallet, click the transaction signature to paste the code just copied, click the signature, and then copy the code. Open the third wallet, click the transaction signature to paste the code you just copied, click the signature, and you will find a broadcast button in the window. Indicates that the transaction has been signed (the minimum number of signatures required by the multi-party signature contract) can be broadcast. Click on the broadcast to start the transfer transaction, and the transfer is successful after about 15 seconds.
The above operation is also done on the same client. One more thing here, I didn't notice it the first time. I operated separately on four node clients, that is, the setting of multi-party signatures and the reconstruction of wallet indexing were done on four virtual machines. As a result, I don't have a running node (because neo-cli and neo-gui can't run at the same time, and neo-gui doesn't have a consensus feature). Then, when it comes to the extraction of NEO and GAS, my transaction signature is successful and broadcast, but the transfer is not successful. The reason for this is that although I broadcast it, there is no node to help me package the deal. So, of course, my transaction transfer was not successful, and I didn't see the corresponding NEO on the ordinary address. This is because my concept of blockchain is not deep enough, and I have been bothered here for a long time.
The above is how to build a private chain Private Blockchain or alliance chain based on NEO. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.