Installation of NEO-CLI
This section describes the procedure for installing the official NEO-CLI released package and starting the NEO node. Alternatively, you can directly publish NEO-CLI source from GitHub into an executable file. Especially when you use macOS, that is the only way to set up NEO-CLI. For more information refer to Publishing from Source.
Installing the environment
Install one of the following depending on your system:
- For Windows 7 and Windows 10, install .NET Core and .NET Framework.
- For Linux (ubuntu 17.10), install .NET Core Runtime.
After the installation is complete, you can run the following command to check whether the .NET Core environment was installed successfully.
dotnet new console -o hwapp cd hwapp dotnet restore dotnet run
If you see the final output "Hello World!", The .Net Core installation is successful.
Installing the NEO-CLI package
Download the latest Neo-CLI package according to your operating system on Github and unzip it.
On Linux, install the LevelDB and SQLite3 dev packages. For example, on ubuntu 17.10 run the following:
sudo apt-get install libleveldb-dev sqlite3 libsqlite3-dev libunwind8-dev
On Windows, you can skip this step as those files are already included in the installation package.
Starting the NEO node
Open the command line, navigate to the neo-cli directory, and enter the following command to start the NEO node:
On Windows 10:
On Linux (ubuntu 17.10):
NEO-CLI provides a series of APIs for external access. If you want to start the node while opening the API, you can add the parameter
-r, for example:
dotnet neo-cli.dll --rpc
To log the smart contract information, e.g. the NEP-5 assets transactions, you can add
-l, for example:
dotnet neo-cli.dll --log
If you want to only connect seed nodes in the configuration file, enter the following:
dotnet neo-cli.dll --nopeers
If you want the external program to access the node API need to open the firewall port: 10331-10334, 20331-20334
If you open the API service and the wallet in NEO-CLI, you need to set up your firewall policy. For example, set a whitelist for the firewall to only allow access to these ports by whitelisted IP addresses. If completely opening the service to external network, others may be able to export the private key or transfer assets using API.
Synchronizing blockchain data
The client must be fully synchronized before use. In order to speed up network synchronization you can download an offline package of the blockchain data up to a certain block height. This means the client will only need to sync the additional blocks from the NEO network rather than the entire blockchain. For more information, see Synchronizing the blockchain faster.