Skip to content

Latest commit

 

History

History
113 lines (76 loc) · 5.93 KB

07-installneoprivatenetcontainer.md

File metadata and controls

113 lines (76 loc) · 5.93 KB

NEO Blockchain Quick Start Guide for .NET Developers

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.

Activity 7 - Download, install and test NEO privatenet Docker container

Purpose

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.

Goals, Non-Goals and Assumptions

  • 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

Principles

  • Provide reliable documentation: timely, accurate, visual, and complete
  • Save as much of a person's time as possible
  • Use open source software whenever possible

Drivers

  • 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

Download and install the NEO privatenet Docker Container

  1. To ensure Docker is installed and running, start the Powershell console and enter docker run hello-world (and press Enter).

    Docker Run Hello-World

    Figure 7.1. Docker Run Hello-World

  2. 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:

    NEO Docker Download/Install/Run

    Figure 7.2. NEO Docker Download/Install/Run

Test the NEO privatenet Docker Container

  1. 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)

  2. 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
    
  3. 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:

    NEO Docker Test

    Figure 7.3. NEO Docker Test

The tasks for this activity are complete. Proceed to Activity 8 - Create and compile HelloWorld smart contract sample.

Additional Notes

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:

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

Script Library

References