NEO Blockchain C# Developers Center of Excellence
The neo-csharpcoe
project is an "umbrella" project for several initiatives related to providing tools and libraries (code), frameworks, how-to documentation, and best practices for enterprise application development using .NET/C#, C#.NEO and the NEO Blockchain software platform.
The neo-csharpcoe
is an independent, free, open source project that is 100% community-supported by people like yourself through your contributions of time, energy, passion, promotion, and donations.
To learn more about contributing to the neo-csharpcoe
, click here.
The purpose of this activity is to download, install and test the NEO private network (privatenet) Docker container using the Docker platform installed in the previous activity to insure we can build and deploy NEO smart contracts to privatenet.
- Ensure you have a working and properly configured set of NEO developer tools for creating and building smart contracts in Visual Studio with the C# programming language
- Provide reliable documentation: timely, accurate, visual, and complete
- Save as much of a person's time as possible
- Use open source software whenever possible
- Need in the NEO .NET developer community to have concise and easy-to-follow documentation to enable people to get up to speed developing NEO smart contracts in as short a time as possible
-
To ensure Docker is installed and running, start the Powershell console and enter
docker run hello-world
(and press Enter).Figure 7.1. Docker Run Hello-World
-
To download the NEO Docker container and run it, run the following script:
docker pull cityofzion/neo-privatenet docker run -d --name neo-privatenet -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp cityofzion/neo-privatenet pause
Script: NEO Docker Download/Install/Run (./scripts/neodockerinstall.bat.txt)
The script produces the following output:
Figure 7.2. NEO Docker Download/Install/Run
-
To test the NEO Docker container, run following script:
REM cd neo/bin REM python3 prompt.py -p REM block 0 docker exec -it neo-privatenet /bin/bash pause
Script: NEO Docker Python CLI/Shell (./scripts/neodockerpshell.bat.txt)
-
The above script will open a bash console for the NEO container. Execute the following commands in the Bash console to start the NEO Python CLI:
cd neo/bin python3 prompt.py -p
-
The above commands will start the NEO Python CLI. Execute the following commands to verify the NEO container (and NEO node) is working:
block 0 exit
In total, the last 3 tasks produce the following output:
Figure 7.3. NEO Docker Test
The tasks for this activity are complete. Proceed to Activity 8 - Create and compile HelloWorld smart contract sample.
For a client app to access the NEO privatenet you just created, your NEO app will need to replace the 2 JSON configuration files with the contents of the following JSON files:
- config.json: (./json/config.neodocker.json)
- protocol.json: (./json/protocol.neodocker.json)
To switch over from an existing NEO network to this privatenet, make sure you:
- Delete your old blockchain database folder
- Delete your old
peers.dat
file - Start neo-gui.exe
- Re-index your database
- NEO Docker Download/Install/Run (./scripts/neodockerinstall.bat.txt)
- NEO Docker Stop/Remove (./scripts/neodockeruninstall.bat.txt)
- NEO Docker Start (./scripts/neodockerstart.bat.txt)
- NEO Docker Stop (./scripts/neodockerstop.bat.txt)
- NEO Docker Restart (./scripts/neodockerrestart.bat.txt)
- NEO Docker Reset (./scripts/neodockerreset.bat.txt)
- NEO Docker Python CLI/Shell (./scripts/neodockerpshell.bat.txt)
- [DOCKER] docker.com, Install Docker for Windows from [https://docs.docker.com/docker-for-windows/install/] (https://docs.docker.com/docker-for-windows/install/)
- [NEODOCKER1] metachris, cityofzion/neo-privatenet from https://hub.docker.com/r/cityofzion/neo-privatenet/
- [NEODOCKER2] CityOfZion project, CityOfZion/neo-privatenet-docker from https://github.com/CityOfZion/neo-privatenet-docker
- [NEODOCKER3] Chris Haer, How to run a private network of the NEO blockchain from https://medium.com/proof-of-working/how-to-run-a-private-network-of-the-neo-blockchain-d83004557359