Code Monkey home page Code Monkey logo

neo-privatenet-docker's Introduction

neo-privatenet-docker

Build Status

This is a convenient way to run a private Neo blockchain. This image is meant to skip the overhead of having to wait to get enough gas for smart contract testing on testnet and to bypass the steps of creating your own private chain. See the section below on extracting Neo and Gas as the private chain in this Docker image starts at block height 0.

Note: There is also a turnkey Docker image with the initial 100M NEO and 16.6k GAS already claimed in a ready-to-use wallet available here: https://hub.docker.com/r/cityofzion/neo-privatenet

Note: If you are running Ubuntu on Windows (WSL), refer to this article to install and operate docker from Ubuntu: https://medium.com/@sebagomez/installing-the-docker-client-on-ubuntus-windows-subsystem-for-linux-612b392a44c4

  • If copying and pasting the commands from the article ensure you delete and re-enter any quotation marks that you paste.

These instruction reference the official instructions from Docker found here: https://docs.docker.com/install/linux/docker-ce/ubuntu/. But, the steps following installation (after step 6) are required in order to run docker from Ubuntu.

Instructions to use the private network image

Use these commands to pull the image from Docker hub and run it:

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

Take a look at the documentation at Docker Hub for more information about how to use the wallet and the supplied WIF key: https://hub.docker.com/r/cityofzion/neo-privatenet

Instructions to build the image yourself

Clone the repository and build the Docker image:

git clone https://github.com/CityOfZion/neo-privatenet-docker.git
cd neo-privatenet-docker
./docker_build.sh

docker_build.sh has a few possible arguments:

  • Disable Docker image caching with docker_build.sh --no-cache
  • Use a custom neo-cli zip file docker_build.sh --neo-cli <zip-fn>
  • Show the help with docker_build.sh -h

After the image is built, you can start the private network like this:

./docker_run.sh

Start the private network, create a wallet and automatically claim the initial NEO and 48 GAS (takes about 5 minutes):

./docker_run_and_create_wallet.sh

or, if you prefer docker-compose, you can start the nodes with:

docker-compose up -d

You can now claim the initial NEO and GAS:

./create_wallet.sh

./create_wallet will display several internal error messages, which is expected as long as at the end you still get a success message.

If you call ./create_wallet.sh or ./docker_run_and_create_wallet.sh, it will create 2 files in your current directory:

  • neo-privnet.wallet: a wallet you can use with neo-python
  • neo-privnet.wif: a wif private key you can import into other clients (neo-gui for example).

Those files will get you access to the wallet containing all the NEO and GAS for your private network.

Install neo-gui or neo-gui-developer

Install one of the following:

https://github.com/neo-project/neo-gui

https://github.com/CityOfZion/neo-gui-developer

Edit the protocol.json in your respective neo-gui installation to point to the IP of the system running your docker. Please note the ports listed match the private chain ports in the current docker build.

If you copy the protocol.json file from the configs directory of this repo and replace your neo-gui protocol.json you will only need to find and edit the section that looks like the following:

"SeedList": [ "127.0.0.1:20333", "127.0.0.1:20334", "127.0.0.1:20335", "127.0.0.1:20336" ],

Change each occurrence of 127.0.0.1 to the IP of the system or vm running your docker image.

If you don't copy the protocol.json from the docker configs directory of this repo, in addition to the "SeedList" modifications mentioned above, you will also need to edit the following:

  1. Change value "Magic" to 56753
  2. Copy the public keys of each of your node wallets into the "StandbyValidators" section

For users who use docker machine (i.e Windows Home Edition users without Hyper-V)

You'll need your docker machine IP. First, get the name of your machine:

docker-machine ls

And get the ip with:

docker-machine ip "Nameofyourmachine"

(By default, the machine name is "default"). Use this ip to replace each occurence of 127.0.0.1 in the SeedList array.

Copy wallets from docker image to neo-gui

Note: You won't need this step if you used ./create_wallet.sh or ./docker_run_and_create_wallet.sh in the previous step (The multiparty signature and neo/gas extraction should already be done).

Once your docker image is running, use the following commands to copy each node's wallet to your neo-gui home directory in preparation for multiparty signature and neo/gas extraction. Note: all four must be copied.

The following will copy each wallet from the docker image to the current working directory.

docker cp neo-privnet:/opt/node1/neo-cli/wallet1.json .
docker cp neo-privnet:/opt/node2/neo-cli/wallet2.json .
docker cp neo-privnet:/opt/node3/neo-cli/wallet3.json .
docker cp neo-privnet:/opt/node4/neo-cli/wallet4.json .

Wallet Passwords

node1: one

node2: two

node3: three

node4: four

Extracting Neo and Gas

Check out the docs at http://docs.neo.org/en-us/node/private-chain.html for instructions on how to claim Neo and Gas for testing.

neo-privatenet-docker's People

Contributors

ashrolls avatar belane avatar canesin avatar d-sfounis avatar dethos avatar hal0x2328 avatar jseagrave21 avatar localhuman avatar lysandergg avatar melvin0008 avatar metachris avatar nunojusto avatar omarspx avatar vncoelho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo-privatenet-docker's Issues

Mac or Linux instance?

When I do git pull I see that the NEO-Privatenet-docker is for Linux. Is there a MAC instance of neo-privatenet-docker? This instance is causing the ./docker_build.sh command to fail on MAC.

MAC: neopy cmd shows container nut running.

Followed City of Zion instructions for setting up private net and container. ./docker_build.sh does not run on MAC with zion build. Getting errors. Error: private network container doesn't seem to be running, or RPC is not enabled.

Says Linux only. Is the CityofZion project only meant to be running on Windows? If so this should be stated in Prerequisites.

Error when running on Fedora 30

Description

neo-python can't connect to the container running neo-privatenet-docker, producing the following error:

[E 190624 10:16:25 prompt:273] Error: private network container doesn't seem to be running, or RPC is not enabled.

Reproduction steps

Follow the steps outlined in https://hub.docker.com/r/cityofzion/neo-python/ on Fedora 30, running the following:

# Pull the latest images from Docker hub
docker pull cityofzion/neo-python
docker pull cityofzion/neo-privatenet

# Start the private network container. Maps the current working directory on the host into 
# `/neo-python/sc/` and exposes the ports.
docker run --rm -d --name neo-privatenet -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp cityofzion/neo-privatenet

# Start the neo-python container
docker run --rm -it --net=host -v $(pwd):/neo-python/sc -h neo-python --name neo-python cityofzion/neo-python /bin/bash

# Start neo-python
np-prompt -p -v

Details

Full shell output

Line breaks added to increase readability

[corollari@localhost neo-priv]$ docker pull cityofzion/neo-python
Using default tag: latest
latest: Pulling from cityofzion/neo-python
Digest: sha256:b4a8a830e64b761c5c54c6d96bcc5251ff9795d2106e5a78f001ac06b1a70fdc
Status: Image is up to date for cityofzion/neo-python:latest

[corollari@localhost neo-priv]$ docker pull cityofzion/neo-privatenet
Using default tag: latest
latest: Pulling from cityofzion/neo-privatenet
Digest: sha256:3d1ae4149dc68e9a9155d0c8081d55bf49e7fa614e275d137850ff1b7f0073f7
Status: Image is up to date for cityofzion/neo-privatenet:latest

[corollari@localhost neo-priv]$ docker run --rm -d --name neo-privatenet -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp cityofzion/neo-privatenet
0b92e13483bd6c69ae343fe3e0ca2e3cf6f69d67ff42e5b796b76c58978df924

[corollari@localhost neo-priv]$ docker run --rm -it --net=host -v $(pwd):/neo-python/sc -h neo-python --name neo-python cityofzion/neo-python /bin/bash

root@neo-python:/neo-python# np-prompt -p -v
[E 190624 10:16:25 prompt:273] Error: private network container doesn't seem to be running, or RPC is not enabled.

root@neo-python:/neo-python#

docker-ps output

CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                                                                        NAMES
46e3ab0b351a        cityofzion/neo-python       "/bin/bash"              16 minutes ago      Up 16 minutes                                                                                    neo-python
0b92e13483bd        cityofzion/neo-privatenet   "/bin/bash /opt/run_…"   17 minutes ago      Up 17 minutes       0.0.0.0:20333-20336->20333-20336/tcp, 0.0.0.0:30333-30336->30333-30336/tcp   neo-privatenet

Versions

Docker: version 18.06.3, build d7080c1
OS: Fedora 30 (linux kernel 4.20.16-200.fc29.x86_64)

Notes

I came across this problem when debugging a downstream issue (see CityOfZion/neo-local#178) that I think is directly caused by this error.

The problem I'm seeing could also be caused by something in neo-python, but based on my testing I think the root cause is in neo-privatenet-docker. Still, I could be wrong, so if you think the issue is caused by something else just tell me and I'll transfer the issue.

claim script incompatible with new neo-python release

The claim_neo_and_gas script doesn't work anymore with the new neo-python release. Here's the claim script: https://github.com/CityOfZion/neo-privatenet-docker/blob/master/scripts/claim_neo_and_gas_fixedwallet.py

The error is

Traceback (most recent call last):
  File "/neo-python/claim_neo_and_gas_fixedwallet.py", line 43, in <module>
    from neo.Prompt.Commands.LoadSmartContract import ImportMultiSigContractAddr
ImportError: cannot import name 'ImportMultiSigContractAddr'

Currently I've updated the Dockerfile to use neo-python v0.8.2. If you want to work at this, comment this line to use the master branch of neo-python.

I pulled the Docker image and used it, but I can not synchronize the wallet.

Hello. Please do not hesitate to contact me because my private network connection is not good.

I docker pull Ver: 2.9.1 image and use it.
https://hub.docker.com/r/cityofzion/neo-privatenet?ref=login

After I run the image, I copy the local Smart contract to the container and erase the old block chain data.

docker cp localFilePath / compileSmartContract.avm neo-privatenet: /neo-python/filename.avm
rm -rf /root/.neopython/Chains/privnet*

Then start the interface with the neopy command.

When opening the wallet with the following command and checking the wallet with the wallet command, it seems that it is "percent_synced": 0 "and it is not possible to synchronize the wallet.
open wallet neo-privnet.wallet

Progress of PriveteNet is displayed as 1/1.
If you connect immediately after PC start up, you may be able to synchronize well in rare cases.

Do you know for why this phenomenon is caused? Thank you very much.

neo-privatenet ver: 2.9.1
Docker Desktop ver: Version 2.0.0.0-win81 (29211)
OS: Windows10

TODO: Isolate a node in just one small container

  • Description:
    Install only one node in a single container and get rid of all possible stuff around.

  • Objective
    To have a really small docker image, that can be used after with docker compose.

Error claiming the NEO and GAS

I was trying to setup a private NEO blockchain using this repository, but I wasn't able to proceed through the create_wallet step. Until that phase everything went as expected, however when I run the script to claim the NEO and GAS I've got the following error:

Starting script to claim NEO and GAS...
docker exec -it neo-privnet python3.5 /opt/neo-python/claim_neo_and_gas.py -o /tmp/wallet -p coz -w /tmp/wif

Traceback (most recent call last):
  File "/opt/neo-python/claim_neo_and_gas.py", line 39, in <module>
    from neo.Wallets.KeyPair import KeyPair
ImportError: No module named 'neo.Wallets.KeyPair'

Copying wallet file and wif key out of Docker container...
Error response from daemon: lstat /var/lib/docker/aufs/mnt/b3c504555eaffe399cba56873972902fce413077832c54845775be7d6b5ba9f8/tmp/wif: no such file or directory
Error response from daemon: lstat /var/lib/docker/aufs/mnt/b3c504555eaffe399cba56873972902fce413077832c54845775be7d6b5ba9f8/tmp/wallet: no such file or directory

--------------------

All done! You now have 2 files in the current directory:

  neo-privnet.wallet .. a wallet you can use with neo-python (pwd: coz)
  neo-privnet.wif ..... a wif private key you can import into other clients

Enjoy!

And none of the files were created.
I suspect, this might be related to recent changes on neo-python such as CityOfZion/neo-python#156

privenet docker_run_and_create_wallet.sh problem

I try to use docker_run_and_create_wallet.sh script. Based on the README it's typical to have some internal errors during its execution.
However I got some errors that seems fatal and prohibit me to use it.
It includes failed to extract from json file and insufficient fund for asset id.

I attach the running log and I will be appreciated if anyone can give me any idea about solving the problem.

Thanks in advance

log.txt

Could not find a version that satisfies the requirement neo-boa==0.3.3

While running

$ ./docker_build.sh

I ran into the problem below:

Collecting neo-boa==0.3.3 (from -r /opt/neo-python/requirements.txt (line 35))

Could not find a version that satisfies the requirement neo-boa==0.3.3 (from -r /opt/neo-python/requirements.txt (line 35)) (from versions: 0.1.5, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2) No matching distribution found for neo-boa==0.3.3 (from -r /opt/neo-python/requirements.txt (line 35))

The command '/bin/sh -c pip3 install -r /opt/neo-python/requirements.txt' returned a non-zero code: 1

neopy crashed

It crashed by it self ? when I try to run neopy

Traceback (most recent call last):
  File "/usr/local/bin/np-prompt", line 11, in <module>
    load_entry_point('neo-python', 'console_scripts', 'np-prompt')()
  File "/neo-python/neo/bin/prompt.py", line 296, in main
    blockchain = LevelDBBlockchain(settings.chain_leveldb_path)
  File "/neo-python/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 115, in __init__
    raise Exception('Leveldb Unavailable')
Exception: Leveldb Unavailable

Error when running docker_run_and_create_wallet.sh

Hi there.

I try to run my own NEO privnet following instructions from readme.

I have successfully built and run docker container. Then I tried this:
./docker_run_and_create_wallet.sh and got the following error:

Starting container...
6ecdf34e49cfe2187140e01f5ab55a0a011fd7b1098b62d1d0e2289cbc55ba12
Waiting 10 seconds to let consensus nodes start...
Starting script to claim NEO and GAS...
docker exec -it neo-privnet python3.6 /neo-python/claim_neo_and_gas_fixedwallet.py

Traceback (most recent call last):
  File "/neo-python/claim_neo_and_gas_fixedwallet.py", line 46, in <module>
    from neo.Prompt.Commands.Send import construct_and_send
ImportError: cannot import name 'construct_and_send'

Copying wallet file and wif key out of Docker container...
Error: No such container:path: neo-privnet:/tmp/wif

--------------------

All done! You now have 2 files in the current directory:

  neo-privnet.wallet .. a wallet you can use with neo-python (pwd: coz)
  neo-privnet.wif ..... a wif private key you can import into other clients

Enjoy!

After this file neo-privnet.wallet is present in /neo-python directory but there's no neo-privnet.wif file.

And finally I have no NEO and no GAS in the wallet. What I try:

root@neo-privnet:/neo-python# np-prompt -p
Privatenet useragent '/NEO:2.8.0/', nonce: 1092010408
[I 181122 09:22:11 LevelDBBlockchain:112] Created Blockchain DB at /root/.neopython/Chains/privnet 
[I 181122 09:22:11 LevelDBBlockchain:156] Current stored headers empty, re-creating from stored blocks...
[I 181122 09:22:11 NotificationDB:73] Created Notification DB At /root/.neopython/Chains/privnet_notif 
NEO cli. Type 'help' to get started


neo> open wallet neo-privnet.wallet                                                                                                                                                                         
[password]> ***                                                                                                                                                                                             
Opened wallet at neo-privnet.wallet
neo> wallet rebuild                                                                                                                                                                                         
neo> send c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b AZ81H31DMWzbSnFDLFkzh9vHwaDLayV7fU 10                                                                                            
[E 181122 09:22:59 Wallet:1071] insufficient funds for asset id: c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b 
[D 181122 09:22:59 Send:162] insufficient funds

Why this happens? Maybe I do something wrong? How to fix this?

Thank you!

update to neo-cli 2.9.0

The image is still on 2.7.6 whereas 2.9.0 is out
It would be nice to have a docker image with the latest version that supports things like stack isolation and the map contract parameter

neo-cli v2.5.0+ doesn't create blocks anymore

This issue is for tracking the current issue that neo-cli >= v2.5.0 doesn't create blocks anymore.

This is the output of neo-cli version 2.4.1 (current in this master branch, and last neo-cli version that works):

$ ./docker_build.sh

$ ./docker_run.sh
Starting container...
f76bb5849ead5f991b90cfe9f05aef182df6637aa700a3f422cb6bbe6f5bdcb1

$ docker exec -it neo-privnet /bin/bash

root@neo-privnet:/# screen -ls
There are screens on:
    39.node4	(12/14/17 15:12:26)	(Detached)
    26.node3	(12/14/17 15:12:26)	(Detached)
    11.node2	(12/14/17 15:12:26)	(Detached)
    8.node1	(12/14/17 15:12:26)	(Detached)
4 Sockets in /var/run/screen/S-root.
root@neo-privnet:/# screen -d -r 11.node2

This is the output inside the screen:

spawn dotnet neo-cli.dll --rpc
NEO-CLI Version: 2.4.1.0

neo> open wallet wallet2.db3
open wallet wallet2.db3
password: two
***
neo> start consensus
start consensus
[15:14:06] OnStart
[15:14:06] initialize: height=1 view=0 index=0 role=Backup
[15:14:11] OnPrepareRequestReceived: height=1 view=0 index=1 tx=1
[15:14:11] send perpare response
[15:14:11] OnPrepareResponseReceived: height=1 view=0 index=2
[15:14:11] relay block: 0xa868990dc63031d2fc12ff344778e88341461ccd187f1e876a69ad511121af96
[15:14:11] persist block: 0xa868990dc63031d2fc12ff344778e88341461ccd187f1e876a69ad511121af96
[15:14:11] initialize: height=2 view=0 index=0 role=Backup

When running the latest neo-cli (eg neo-cli 2.5.2 from this branch: https://github.com/CityOfZion/neo-privatenet-docker/tree/252), with the same initial commands as above, this is the output inside the screen:

spawn dotnet neo-cli.dll --rpc
NEO-CLI Version: 2.5.2.0

neo> open wallet wallet2.db3
open wallet wallet2.db3
password: ***
neo> start consensus
[11:03:36] OnStart

And it just hangs there without generating blocks.

wallet is not sync.

Even when connecting to privatenet executed by docker, the index of the block does not change from 1/1.
"Current stored headers empty." Is displayed. What is the cause?
pn

Installation stuck

I'm new to neo developing. I'm trying to pull the privatenet for the first time using
docker pull cityofzion/neo-privatenet
but it's been 5 hours and terminal stuck at extracting. Sorry for my bad English. I am using mac os. Is this normal? or should I restart it?

Build docker image, pip3 install problem

Hi,

I'm trying to use the neo privatenet docker and I want to build it by myself.
I run the "docker_build.sh" script. In building the docker image by Dockerfile, during the installation of neo-python module by pip3 process, unfortunately it's halting.

I ran the script on ubuntu-14.04. In the following I attach the log:

Downloading https://files.pythonhosted.org/packages/90/50/4c315ce5d119f67189d1819629cae7908ca0b0a6c572980df5cc6942bc22/Twisted-18.7.0.tar.bz2 (3.1MB)
Downloading from URL https://files.pythonhosted.org/packages/90/50/4c315ce5d119f67189d1819629cae7908ca0b0a6c572980df5cc6942bc22/Twisted-18.7.0.tar.bz2#sha256=95ae985716e8107816d8d0df249d558dbaabb677987cc2ace45272c166b267e4 (from https://pypi.org/simple/twisted/)
Updating cache with response from "https://files.pythonhosted.org/packages/90/50/4c315ce5d119f67189d1819629cae7908ca0b0a6c572980df5cc6942bc22/Twisted-18.7.0.tar.bz2"
Caching due to etag
Running setup.py (path:/tmp/pip-build-ade69cj_/Twisted/setup.py) egg_info for package Twisted
Running command python setup.py egg_info

The script is halting after above log forever !!

Thanks in advance for the reply,
M. Labbaf

No connected peers

I get an No connected peers-error by neo-python, when sending mulitple smart-contract invocation per second.
Current Behaviour:
i send multiple invocations per second and after 2 minutes or so i get for a few seconds no connected peers and after that all invocations are successfull again. No matter how much invocations i send per second it always occures in the same pattern. What could be the reason to this?

I am connected to a remote server where my docker-container is running and i send them with a python script in the neo-python venv.

The used Pyhton script for sending the Invocation can be find here:
https://github.com/TimRi91/Distributed-Ledger-Testbench/blob/master/NEO/kvstore-workloadclient.py

Block height cannot increase

I am trying to setup private neo blockchain using this repository but create_wallet step doesn't work. Until that phase everything went as expected but it prints Waiting for wallet to sync.. message to screen for hours. I have no idea how to solve this problem. Unfortunately, there is no meaningful message for the issue.

Any help or suggestion would be appreciated. Thank you!

script docker_wait_and_commit.sh sometimes misses some blocks

Description
This script checks if the current block reached a certain chosen block to trigger all work but sometimes fails and misses the trigger.

How can we reproduce the problem?
The problem occurs sometimes when we use the --until-block option.
The sleep time between iterations is 60 seconds and blocks ~12 seconds. So, we will have almost 6 blocks each iteration.
That could make us fail to trigger the work.

Solution
Decrease the sleep time to 10 seconds when we are using --until-block option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.