Test Networks and Fund Requests for Smart Contract and dApp Testing on the NEO Blockchain

You have some smart contracts built, but you need to test them beyond just using the neo-debugger. There are several different environments you can deploy your Smart Contract to, but you are going to need GAS to test.

Getting NEO/GAS is relatively simple, however it can be confusing at first not only to know which network you should be testing on, but also then how to receive funds to test on that given network. This short article will give you a 10 minute crash-course in getting the funds you need on the appropriate network to test your smart contracts and dApps.

Available Test Networks

There are multiple environments that can be used to test while developing for the NEO Blockchain. Each network has a different amount of traffic, and a different level of testing it should be used for. When starting out, it’s hard to know which network to use. It’s really pretty simple and comes down to the scope and how much testing you’ve done on your Smart Contract or dApp.

Privnet (or Private Network)

The privnet is your own private NEO blockchain you can run on your computer and have total control over.

This is the easiest and fastest place to get rolling with testing, here you run your own docker image and you can simply reset the image and essentially have an unlimited supply of GAS and NEO to test your application (okay, well not unlimited, but enough to do whatever it is you need to do for sure). Chris Hager has done an excellent job setting this up and providing detailed instructions here: https://medium.com/proof-of-working/how-to-run-a-private-network-of-the-neo-blockchain-d83004557359

When to use: If you are working on a new project that will need multiple deploys, or if you need to watch all transactions on the blockchain closely, Privnet is the clear choice here. You can do multiple deploys, essentially have unlimited GAS/NEO, and reset it any time you like. Also, this is your own private sandbox, so there are no other transactions going on but your own, so it’s less “noisy”.

City of Zion Testnet

This is a public test network run by the City of Zion open source community.

When to use: Once you are confident your dApp or Smart Contract is working as intended through testing on your Privnet, it’s time to choose a Testnet to deploy to and test in more of a “live” sandbox. On the test networks you will have other users and transactions, and get a better sense of what a live deploy will be like. Given the ease of getting funds, my recommendation is to use the City of Zion Testnet.

NEO Testnet

This is the Testnet of the NEO Smart Economy parent organization.

When to use: The use case for this network is essentially the same for the CoZ Testnet, however the traffic and size is much larger in scope.

Wallets and Addresses to Receive Funds

In order to receive funds, you need to create a wallet and have an address that will hold the funds (and subsequently, this will also be the wallet you would use to send funds in the context of your Smart Contract or dApp). There are a few options when it comes to wallets, but NEO-GUI is the official wallet and client app of NEO, so that’s what I will use in the context of this article. If you are working with other clients such as neo-python, there may be a variety of differences, but the fundamental concepts will still apply.

NEO-GUI requires a full synchronized local copy of the blockchain to process transactions, but you can use NEO-GUI to processs transactions on any of the NEO networks — Privnet, NEO Testnet, CoZ Testnet, and even the NEO Mainnet.

Note: You can use the same wallet file and address on all networks, simply change the underlying configuration. You will be scoped to that address on whatever network you are configured for.

Syncing the Blockchain of theTarget Network

If your blockchain isn’t synchronized to the block level of a transaction (for example, a transaction that sent funds to your address), your balance will not reflect that transaction. In order to see an accurate balance of a wallet or to create transactions using those funds, the blockchain needs to be fully synchronized.

Settings and Changes Needed to Synchronize with a Network

When using NEO-GUI and switching networks, there are a few changes that you need to make to update the configuration (see links to network specific configurations below). Any time you change networks, you need to:

  1. Delete /<your-neo-gui-path>/peers.dat
  2. Delete the contents of /<your-neo-gui-path>/ChainTestNet/
  3. Update /<your-neo-gui-path>/protocol.json
  4. Update /<your-neo-gui-path>/config.json

Click the links below to view example configurations for the various networks (these can also be found deployed with NEO-GUI in the root directory as alternatively named .json files whose contents can simply be copied into the primary file):

Privnet: [View]

CoZ Testnet [View]

NEO Testnet [View]

Bootstrapping

Bootstrapping will help you save a ton of time getting your local blockchain synchronized by downloading a snapshot of the blockchain instead of syncing a few blocks at a time using network nodes.

You can always find the latest available bootstrap files for the NEO and CoZ Testnets (and Mainnet as well if needed) here: https://github.com/CityOfZion/awesome-neo

Download the appropriate file for the target network, then unzip the contents to: /<your-neo-gui-path>/ChainTestNet/

Checking Synchronization Progress

You can monitor the synchronization of blocks in NEO-GUI by looking in the bottom left corner.

The number of total blocks will vary by network, but you can find out the block count for a given network by using Neoscan.

Privnet
This synchronization is quick (around 1.2k blocks), so you should be fully synced in a matter of a few minutes.

CoZ Testnet
The CoZ testnet is a bit larger (420k blocks at current), so synchronization for this network really needs to be bootstrapped or you will be waiting quite awhile. You can see the network information here: https://coz.neoscan-testnet.io/

NEO Testnet 
Obviously even larger than the CoZ Testnet (1.2mil blocks at current), this definitely requires bootstrapping and has substantially more activity. You can see the network information here: https://neoscan-testnet.io/

Requesting GAS / NEO for Testing

Privnet

You can simply restart your docker image and you’ll be reloaded with all the NEO and GAS you need. You don’t need to make any requests. Just start the docker, configure your wallet for the Privnet, and you should have plenty of GAS and NEO.

CoZ Testnet

City of Zion has set up a convenient faucet to get your NEO and GAS from for the City of Zion Testnet. Simply go to http://faucet.cityofzion.io/ and provide your CoZ Testnet address.

Shortly after, you will have 2000 GAS and 100 NEO (at current) sent to the provided address. You don’t need to do anything else.

NEO Testnet

The fund request from NEO is a bit more cumbersome and takes a bit longer, and seemingly a bit trickier to find (the link to the NEO Testnet NEO/GAS request link is buried in the NEO Test Network documentation). To request NEO / GAS, go to https://neo.org/Testnet/Create and fill out the form to make the request. It takes a little bit (sometimes a few days) to get a response to your request.

Finding your Public Key
Open NEO GUI, Right Click your Address

Retrieving your Funds
NEO will send you an e-mail with instructions on how to retreive your funds (assuming your request was granted).

Create a Multi-Signature Contract Address using NEO-GUI

The e-mail provides us with all the details on how to retreive the funds. You will need to add their public key to the contract, add your public key to the contract (see above), and set the minimum signature number to 1. Once you confirm, a contract address will be created in your wallet:

Sometimes it is necessary to rebuild the index for your wallet to get accurate balances. The way to do this is in the “Wallet” menu:

Once you rebuild, you should see funds in your Contract Address. From there, you can transfer the funds to your own address of your choosing by selecting Transaction -> Transfer, and click the + to add a payment.

Once the transaction is processed, you will have funds in the target address, drawn from the multi-sig contract that contained the funds.

And that’s it. You now should have a fully synchronized wallet with funds available on your target network, and you should be ready to go develop and deploy Smart Contracts and dApps for the NEO Blockchain!

Need additional help?

City of Zion
If you need further assistance in getting started, feel free to join the City of Zion NEO Smart Economy Discord Server. The community will help you get set up in no time.