NEO Development: How to set up an NEO Private Net

Use Private Net for development

As a developer, it would be a good idea to run an NEO private-net on your own machine. Deploying you smart contracts on the test-net should be the final step of your development(before publishing on the main-net), so all the development, testing and debugging should be done on your own private-net. Today I'm here to show you how to easily set up an NEO private net using dockerpython on Ubuntu Linux

(Image source: Medium)

  • If you don't have Docker already, you can visit their this Installation Guild on their official website.

Step 1: Clone the Docker Image provided by City of Zion

City of Zion is an independent group of open source developers, designers and translators formed to support the NEO BlockChain, they have built the docker image of a pre-build private network, with a wallet file storing all the 100 million NEO, which we will use later.
It's much easier for people to set up a private Net with the docker image, basically, all we have to do is clone it and then run the image on our local machine.

docker pull cityofzion/neo-privatenet

Step 2: Run the docker Image

Simply run the docker image with the following command:

docker run --rm -d --name neo-privatenet -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp cityofzion/neo-privatenet

After running the image, you should be able to see the image status with command:

docker ps


Yay! Now the Neo Private net is up and running on our machine. Next, we will try to use neo-python to interact with the private net.

Step 3: Install neo-python

First of all, we need to make sure we have python3.6, also install some required packages:

apt-get install software-properties-common python-software-properties
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install python3.6 python3.6-dev python3.6-venv python3-pip libleveldb-dev libssl-dev g++

Clone the neo-python repository:

git clone https://github.com/CityOfZion/neo-python

(Recommanded)Make a virtual environment with python3.6

cd  neo-python # get into the neo-python repository
python3.6 -m venv venv
source venv/bin/activate

 

Install

pip3 install -U setuptools pip wheel
pip3 install -e .

For more detail about setting up python neo, you can visit their GitHub Readme

Step 4: Use neo-python to connect to the private net:

Delete Old private-net chain:

rm -rf Chains/privnet

Open the CLI connected to the private-net

python prompt.py -p

The -p parameter means private net, you can use prompt.py to interact with main-net or test-net as well.
After entering this command, you should see a CLI opened.

Step 5: Download the wallet file and get your 100 million NEO!

Download the wallet and save it under the neo-python directoryhttps://s3.amazonaws.com/neo-experiments/neo-privnet.wallet

In the CLI, command:

open wallet neo-privnet.wallet
and then enter the password: coz (for City Of Zion)
You can enter wallet again to see basic information about this wallet. You should be able to see the 100000000 NEO under [synced_balance]

That's It!

Now you have a NEO private-net running with a wallet containning all the assets on this blockchain! We're so rich right now! can start our development :)


I'm still playing around with NEO contract development, once I got something I'll share it on here on Steemit too:)

Hope you all have a lovely weekend, Happy Hacking!

謝謝您,我們會更進步的!
Anton Cheng
Develop a passion for learning. If you do, you will never cease to grow. — Anthony J. D’Angelo

新增留言