paint-brush
Building your private NEO network on AWS (part 2)by@dominicfung_58781
465 reads
465 reads

Building your private NEO network on AWS (part 2)

by Dominic FungAugust 8th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<a href="https://hackernoon.com/building-your-private-neo-network-on-aws-part-1-c01525dadc1c" target="_blank">Last week</a>, we created an AWS account, deployed an EC2 Linux instance and learned how to SSH into that server. With the help of Docker, we’ll deploy a private NEO <a href="https://hackernoon.com/tagged/network" target="_blank">network</a> within the linux AMI we’ve just created!

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Building your private NEO network on AWS (part 2)
Dominic Fung HackerNoon profile picture

Last week, we created an AWS account, deployed an EC2 Linux instance and learned how to SSH into that server. With the help of Docker, we’ll deploy a private NEO network within the linux AMI we’ve just created!

So what is Docker? Docker is containerization technology — it helps us run an “image” or package, where we don’t have to worry about the NEO nodes, network, dependencies and any pre-configurations. It is all written out for us as a docker image, all we need to do is download and run it!

Lets, though, take a moment to understand our particular Docker image. It contains 4 NEO consensus nodes, the minimum required to bring up a working NEO network, communicating internally via ports 30333-30336 TCP. We will then expose the testNet communication ports (20331–20334) to the outside world by manipulating our AWS security group.

Check out the Citizen of Zion, an open-source community in partnership with NEO. This is their Docker image source code, for those of you who want to check it out!

After entering your Amazon Linux instance via secure shell, we will install Docker …

Step 1: Install Docker




sudo yum update -ysudo yum install -y dockersudo service docker startsudo usermod -a -G docker ec2-user

Step 2: Check and deploy our Docker NEO network image


docker info #just a checkdocker pull cityofzion/neo-privatenet

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

Check that your image is running! docker ps

Step 3: Adding port 30331–30334 to your security group

Log onto the AWS console, Services > EC2. Under NETWORK & SECURITY, click Security Groups. Click Edit on the security group assigned to your instance. Create the following inbound rules:

*These rules apply immediately!

Step 4: Connect from your neo-prompt!

Open command prompt on local:


ubuntusudo -i


cd <location of neo-python>source venv/bin/activate

Remember how we made note of the public IP in the last article? Let’s use that here:

np-prompt -p <server IP>

Great! we are done!

Bonus command: Restarting the NEO block-chain.

From our experience, due to server memory constraints, your image will need to be whipped and restarted weekly. The command to do so is as follows:

docker stop neo-privatenet

Then use the following on your own np-prompt (Ubuntu):

rm -rf /root/.neopython/Chains/

As usual, I’ll give my project a shout out: Nodis.io is a marketing platform for local business, generating engagement through small activities and rewarding users with cryptocurrency they can later spend on these stores. Check us out and give us your feedback on Instagram and Facebook!

Next week’s guide: Deploying a NEP-5 smart contract (part 1)