├── docker_build.sh ├── wallets ├── wallet1.db3 ├── wallet2.db3 ├── wallet3.db3 └── wallet4.db3 ├── scripts ├── private_chain_start.sh └── start_cli.sh ├── docker_run.sh ├── configs ├── config1.json ├── config2.json ├── config3.json ├── config4.json └── protocol.json ├── LICENSE ├── Dockerfile └── README.md /docker_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Splyse, Inc. 2017 4 | 5 | docker build -t neo-privnet . 6 | -------------------------------------------------------------------------------- /wallets/wallet1.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Splyse/neo-privatenet-docker/HEAD/wallets/wallet1.db3 -------------------------------------------------------------------------------- /wallets/wallet2.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Splyse/neo-privatenet-docker/HEAD/wallets/wallet2.db3 -------------------------------------------------------------------------------- /wallets/wallet3.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Splyse/neo-privatenet-docker/HEAD/wallets/wallet3.db3 -------------------------------------------------------------------------------- /wallets/wallet4.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Splyse/neo-privatenet-docker/HEAD/wallets/wallet4.db3 -------------------------------------------------------------------------------- /scripts/private_chain_start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | screen -dmS node1 expect ${1}/start_cli.sh ${1}/node1/neo-cli/ wallet1.db3 one 4 | screen -dmS node2 expect ${1}/start_cli.sh ${1}/node2/neo-cli/ wallet2.db3 two 5 | screen -dmS node3 expect ${1}/start_cli.sh ${1}/node3/neo-cli/ wallet3.db3 three 6 | screen -dmS node4 expect ${1}/start_cli.sh ${1}/node4/neo-cli/ wallet4.db3 four 7 | 8 | sleep infinity 9 | 10 | -------------------------------------------------------------------------------- /scripts/start_cli.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect -f 2 | set dnpath [lindex $argv 0] 3 | set wallet [lindex $argv 1] 4 | set password [lindex $argv 2] 5 | set timeout -1 6 | cd $dnpath 7 | spawn dotnet neo-cli.dll 8 | expect "neo>" 9 | send "open wallet $wallet\n" 10 | expect "password:" 11 | send "$password\n" 12 | expect "neo>" 13 | send "start consensus\n" 14 | expect "OnStart" 15 | #expect "LIVEFOREVER" 16 | interact 17 | -------------------------------------------------------------------------------- /docker_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Spylse Inc. 2017 4 | 5 | 6 | CONTAINER=$(docker ps -aqf name=neo-privnet) 7 | 8 | if [ -n "$CONTAINER" ]; then 9 | echo "Stopping container named neo-privnet" 10 | docker stop neo-privnet 1>/dev/null 11 | echo "Removing container named neo-privnet" 12 | docker rm neo-privnet 1>/dev/null 13 | fi 14 | 15 | echo "Starting container..." 16 | docker run -d --name neo-privnet -p 20333-20336:20333-20336/tcp -h neo-privnet neo-privnet /bin/bash /opt/private_chain_start.sh /opt/ 17 | -------------------------------------------------------------------------------- /configs/config1.json: -------------------------------------------------------------------------------- 1 | { 2 | "ApplicationConfiguration": { 3 | "DataDirectoryPath": "Chain", 4 | "CertCachePath": "Certs", 5 | "NodePort": 20333, 6 | "WsPort": 10333, 7 | "UriPrefix": [ "http://*:30333" ], 8 | "SslCert": "", 9 | "SslCertPassword": "", 10 | "Urls": { 11 | "AddressUrl": "https://www.antchain.xyz/address/{0}", 12 | "AssetUrl": "https://www.antchain.xyz/asset/hash/{0}", 13 | "TransactionUrl": "https://www.antchain.xyz/tx/hash/{0}" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /configs/config2.json: -------------------------------------------------------------------------------- 1 | { 2 | "ApplicationConfiguration": { 3 | "DataDirectoryPath": "Chain", 4 | "CertCachePath": "Certs", 5 | "NodePort": 20334, 6 | "WsPort": 10334, 7 | "UriPrefix": [ "http://*:30334" ], 8 | "SslCert": "", 9 | "SslCertPassword": "", 10 | "Urls": { 11 | "AddressUrl": "https://www.antchain.xyz/address/{0}", 12 | "AssetUrl": "https://www.antchain.xyz/asset/hash/{0}", 13 | "TransactionUrl": "https://www.antchain.xyz/tx/hash/{0}" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /configs/config3.json: -------------------------------------------------------------------------------- 1 | { 2 | "ApplicationConfiguration": { 3 | "DataDirectoryPath": "Chain", 4 | "CertCachePath": "Certs", 5 | "NodePort": 20335, 6 | "WsPort": 10335, 7 | "UriPrefix": [ "http://*:30335" ], 8 | "SslCert": "", 9 | "SslCertPassword": "", 10 | "Urls": { 11 | "AddressUrl": "https://www.antchain.xyz/address/{0}", 12 | "AssetUrl": "https://www.antchain.xyz/asset/hash/{0}", 13 | "TransactionUrl": "https://www.antchain.xyz/tx/hash/{0}" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /configs/config4.json: -------------------------------------------------------------------------------- 1 | { 2 | "ApplicationConfiguration": { 3 | "DataDirectoryPath": "Chain", 4 | "CertCachePath": "Certs", 5 | "NodePort": 20336, 6 | "WsPort": 10336, 7 | "UriPrefix": [ "http://*:30336" ], 8 | "SslCert": "", 9 | "SslCertPassword": "", 10 | "Urls": { 11 | "AddressUrl": "https://www.antchain.xyz/address/{0}", 12 | "AssetUrl": "https://www.antchain.xyz/asset/hash/{0}", 13 | "TransactionUrl": "https://www.antchain.xyz/tx/hash/{0}" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /configs/protocol.json: -------------------------------------------------------------------------------- 1 | { 2 | "ProtocolConfiguration": { 3 | "Magic": 56753, 4 | "AddressVersion": 23, 5 | "StandbyValidators": [ 6 | "02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2", 7 | "02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e", 8 | "03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699", 9 | "02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62" 10 | ], 11 | "SeedList": [ 12 | "127.0.0.1:20333", 13 | "127.0.0.1:20334", 14 | "127.0.0.1:20335", 15 | "127.0.0.1:20336" 16 | ], 17 | "SystemFee": { 18 | "EnrollmentTransaction": 1000, 19 | "IssueTransaction": 500, 20 | "PublishTransaction": 500, 21 | "RegisterTransaction": 10000 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # NEO private network - Dockerfile 2 | 3 | FROM ubuntu:16.04 4 | MAINTAINER hal0x2328 5 | 6 | ENV DEBIAN_FRONTEND noninteractive 7 | 8 | RUN apt-get update && apt-get upgrade -y 9 | RUN apt-get install -y apt-utils 10 | RUN apt-get install -y mininet netcat curl wget unzip less python screen 11 | RUN apt-get install -y ca-certificates apt-transport-https 12 | RUN apt-get install -y libleveldb-dev sqlite3 libsqlite3-dev 13 | RUN apt-get install -y expect 14 | 15 | RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg 16 | RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list 17 | 18 | RUN apt-get update && apt-get install -y dotnet-sdk-2.0.0 19 | 20 | RUN wget -O /opt/neo-cli.zip https://github.com/neo-project/neo-cli/releases/download/v2.3.2/neo-cli-ubuntu.16.04-x64.zip 21 | 22 | RUN unzip -d /opt/node1 /opt/neo-cli.zip 23 | RUN unzip -d /opt/node2 /opt/neo-cli.zip 24 | RUN unzip -d /opt/node3 /opt/neo-cli.zip 25 | RUN unzip -d /opt/node4 /opt/neo-cli.zip 26 | 27 | ADD ./scripts/private_chain_start.sh /opt/ 28 | ADD ./scripts/start_cli.sh /opt/ 29 | 30 | ADD ./configs/config1.json /opt/node1/neo-cli/config.json 31 | ADD ./configs/protocol.json /opt/node1/neo-cli/protocol.json 32 | ADD ./wallets/wallet1.db3 /opt/node1/neo-cli/ 33 | 34 | ADD ./configs/config2.json /opt/node2/neo-cli/config.json 35 | ADD ./configs/protocol.json /opt/node2/neo-cli/protocol.json 36 | ADD ./wallets/wallet2.db3 /opt/node2/neo-cli/ 37 | 38 | ADD ./configs/config3.json /opt/node3/neo-cli/config.json 39 | ADD ./configs/protocol.json /opt/node3/neo-cli/protocol.json 40 | ADD ./wallets/wallet3.db3 /opt/node3/neo-cli/ 41 | 42 | ADD ./configs/config4.json /opt/node4/neo-cli/config.json 43 | ADD ./configs/protocol.json /opt/node4/neo-cli/protocol.json 44 | ADD ./wallets/wallet4.db3 /opt/node4/neo-cli/ 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # neo-privatenet-docker 2 | 3 | Here we have provided a convenient way to setup a private Neo blockchain with an Ubuntu 16.04 docker image. 4 | Please review Dockerfile for details of software. 5 | 6 | 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. 7 | 8 | See the section below on extracting Neo and Gas as the private chain in this docker image starts at block height 0. 9 | 10 | You will also need to install and configure the neo-gui pc client on your favorite distro. This involves editing the protocol.json file to point the seeds at your docker IP addresses. 11 | 12 | 13 | ## Installation Instructions 14 | git clone https://github.com/Splyse/neo-privatenet-docker.git 15 | cd neo-privatenet-docker 16 | ./docker_build.sh 17 | ./docker_run.sh 18 | 19 | or 20 | `docker pull splyse/neo-privnet` 21 | 22 | ## Install neo-gui or neo-gui-developer 23 | Install one of the following: 24 | 25 | https://github.com/neo-project/neo-gui 26 | 27 | https://github.com/CityOfZion/neo-gui-developer 28 | 29 | Edit the protocol.json in your respective neo-gui installation to point to the IP of the system running your docker. 30 | Please note the ports listed match the private chain ports in the current docker build. 31 | 32 | 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: 33 | 34 | "SeedList": [ 35 | "127.0.0.1:20333", 36 | "127.0.0.1:20334", 37 | "127.0.0.1:20335", 38 | "127.0.0.1:20336" 39 | ], 40 | 41 | Change each occurrence of 127.0.0.1 to the IP of the system or vm running your docker image. 42 | 43 | 44 | 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: 45 | 46 | 1. Change value "Magic" to 56753 47 | 2. Copy the public keys of each of your node wallets into the "StandbyValidators" section 48 | 49 | ## Copy wallets from docker image to neo-gui 50 | 51 | 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. 52 | Note: all four must be copied. 53 | 54 | The following will copy each wallet from the docker image to the current working directory. 55 | 56 | docker cp neo-privnet:/opt/node1/neo-cli/wallet1.db3 . 57 | docker cp neo-privnet:/opt/node2/neo-cli/wallet2.db3 . 58 | docker cp neo-privnet:/opt/node3/neo-cli/wallet3.db3 . 59 | docker cp neo-privnet:/opt/node4/neo-cli/wallet4.db3 . 60 | 61 | ## Wallet Passwords 62 | node1: one 63 | 64 | node2: two 65 | 66 | node3: three 67 | 68 | node4: four 69 | 70 | ## Extracting Neo and Gas 71 | Check out the docs at http://docs.neo.org/en-us/node/private-chain.html for instructions on how to claim Neo and Gas 72 | for testing. 73 | --------------------------------------------------------------------------------