Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use docker to build Neo private chain and debug on Mac

2025-01-16 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 docker to build Neo private chain on Mac and debug. Many people may not know much about it. In order to make you understand better, the editor summarizes the following content for you. I hope you can get something according to this article.

The problem of building private chains with virtual machines

Automation would be even better if it could be scripted. So sum up using docker to build private chains.

In addition, my purpose is to study the code, but not just look at the code, but also in-depth details, if only it can be debugged. Debugging is generally divided into two types, the simplest is to look at log, this method is actually very invincible, plus time can see the performance, timing-related problems; output to a file can investigate errors that occur after a long run. However, as a tool control, I still have to find a way to debug break points. To put it bluntly, breaking points are more convenient and lazy than inserting a lot of log into the source code.

A scheme for creating private chains and breaking point debugging

Now I have tried out the following schemes, because it took a lot of time to do Neo on mac:

Run a private chain with docker on mac and debug remotely with vs code.

Run a private chain with docker on mac, open another debug node yourself, and debug this node.

Run a private chain with docker in the windows virtual machine, and debug it on another debug node.

Conclusion:

Method 1: remote debugging with vs code in mac always fails. You can't get the debugging process, and you can't debug even if you get it. I wasted a day checking for various problems and finally gave up.

Method 2: running a private chain with docker on mac is no problem, but debugging neo-cli on mac. Will collapse. The reason is that you need leveldb. Although mac can install leveldb with brew, it seems that if you want to adapt, I won't go to the water, so open neo-cli on windows directly and connect to private chain for debugging.

The installation of docker on 3:windows is also conditional: Docker for Windows requires Windows 10 Pro or Enterprise version 10586, or Windows server 2016 RTM to run. Unfortunately, my windows virtual machine is the home version, so don't bother. It's got a neo-gui on it.

So, the final conclusion is: run a private chain with docker on mac, and then debug and play Neo-gui on the windows virtual machine. Anyway, it's good to use it. In fact, it's best to play it all in windows or linux environment. It's a bit troublesome to plug in a mac like me.

To cut the crap, let's take a look at how to build a private chain and debug it with docker.

Use docker to create a private chain

This has already been done in CityOfZion, a foreign community in Neo. Clone, just follow the steps step by step, CityOfZion/neo-privatenet-docker.

Docker usage, here is a good book docker_practice, you can read for free, the author is also a Daniel, also do block chain, interested can take a look at his project.

Required commands:

Git clone https://github.com/CityOfZion/neo-privatenet-docker.gitcd neo-privatenet-docker./docker_build.sh./docker_run_and_create_wallet.sh

When the execution is successful, a private key is generated, in which there is an extracted Neo, but it is a private chain, otherwise it will make a fortune.

Neo and Gas extracted successfully

Check the extracted Neo in Neo-gui

Let's switch back to windows (note that the virtual machine is in bridge mode) and open Neo-gui

1. Notice that the correct protocol.json of copy to the directory where neo-gui is located

Note the red box below to set the correct public key and ip address

Image.png

two。 First create a useless wallet

3. Right-click the wallet to import WIF

Then right-click the wallet and import WIF. The design of the user experience is very strange.

4. See the extracted NEO and NeoGas

Successfully imported

The second step is to right-click the import. There is no other entry for neo-gui to provide the import function.

Debug

Download the code for neo-cli

Switch to the same version as docker. My side is v2.6.0.

Directory from copy libleveldb to neo-gui

Copy protocol.json

Copy config.json, be careful to modify the port. Do not use the same port as the node in docker.

Note that if the virtual machine is in bridging mode

After reading the above, do you have any further understanding of how to build a Neo private chain and debug it with docker on Mac? 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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report