Click here to Skip to main content
15,066,064 members
Articles / Security / Blockchain
Article
Posted 31 Jan 2019

Tagged as

Stats

4.3K views
4 bookmarked

Setup Your Private Blockchain with NEO

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
31 Jan 2019CPOL2 min read
How to setup your private Blockchain with NEO

Introduction

Private Chain is important for data privacy, permission control, as well as testing dApps and smart contracts. A private chain is an isolated copy of public blockchain which would run on your local machine. In this article, we’ll be going through the basic steps to run NEO private chain on a local machine and receive some initial NEO and GAS tokens.

To set up the NEO private network (often called private-net), we have to install and configure Docker in the local system. If you’re using Windows 10 Pro, you can download Docker directly. For an older version of Windows, you need to install and configure the Docker toolbox.

Once Docker gets installed, start and run the docker. Then, open a command line or PowerShell and write the following command:

docker –v

This will display the version of Docker that has been installed in your system.

Image 1

Pull the latest image using the following command:

docker pull cityofzion/neo-privatenet

Kindly note that the size of the image is a bit larger. So, it’ll take some time to download it.

Once the image is pulled up, start the container using the command mentioned below:

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

To check if the container is running or not, fire this command which will display the current running container(s).

Image 2

Download the NEO-GUI wallet from here or use developer version (recommended for development) from here.

Replace the content of the config.json file and protocol.json file with the following network details.

The updated config.json should look like this:

JavaScript
{  
  "ApplicationConfiguration": {  
    "Paths": {  
      "Chain": "Chain",  
      "Notifications": "Notifications"  
    },  
    "P2P": {  
      "Port": 20333,  
      "WsPort": 10333  
    },  
    "RPC": {  
      "Port": 30333,  
      "SslCert": "",  
      "SslCertPassword": ""  
    },  
    "DataDirectoryPath": "ChainTestNet",  
    "CertCachePath": "Certs",  
    "NodePort": 20333,  
    "WsPort": 20334,  
    "UriPrefix": [ "https://localhost:20332" ],  
    "SslCert": "",  
    "SslCertPassword": "",  
  }  
}  

protocol.json

{  
    "ProtocolConfiguration": {  
        "Magic": 56753,  
        "AddressVersion": 23,  
        "SecondsPerBlock": 15,   
        "StandbyValidators": [  
            "02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",  
            "02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",  
            "03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",  
            "02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62"  
        ],  
        "SeedList": [  
            "127.0.0.1:20333",  
            "127.0.0.1:20334",  
            "127.0.0.1:20335",  
            "127.0.0.1:20336"  
        ],  
        "SystemFee": {  
            "EnrollmentTransaction": 1000,  
            "IssueTransaction": 500,  
            "PublishTransaction": 500,  
            "RegisterTransaction": 10000  
        }  
    }  
}

Run the neo-gui.exe installation package and check the connection between NEO GUI and the docker container. If you can see the number of connected nodes is 4, that simply means that the connection has been established successfully and the numbers represent the consensus nodes.

Image 3

Create a new wallet from NEO GUI Tool, go to wallet > New wallet database > input wallet name and password, it will generate a new wallet file for you. 

Get some initial NEO and GAS by importing WIF key. Click to the black area > Import > Import from WIF > add key

KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr

Image 4

Click OK, and check NEO and GAS balance you have!! We can use this NEO and GAS for smart contract execution.

Image 5

In this article, we’ve have seen how to setup NEO private network and got some initial NEO and GAS tokens. These we can use in testing smart contract over a local system. There are several other ways to configure it, however, the easiest one is using Docker.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided
Group type: Collaborative Group (No members)



Comments and Discussions

 
PraiseGood Article Pin
Sarathlal Saseendran31-Jan-19 20:20
MemberSarathlal Saseendran31-Jan-19 20:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.