© Karan Singh Garewal 2020
K. S. GarewalPractical Blockchains and Cryptocurrencieshttps://doi.org/10.1007/978-1-4842-5893-4_18

18. The Helium Testnet

Karan Singh Garewal1 
(1)
Toronto, ON, Canada
 
In this short concluding chapter, we will briefly discuss two matters that pertain to testing a Helium P2P network:
  1. 1.

    The implementation of a Helium test network on the Internet

     
  2. 2.

    Helium faucets

     

Implementing a Helium Testnet

In Chapter 15, we implemented a Helium peer-to-peer network on the localhost network. In this implementation, network nodes listen on loopback addresses (127.0.0.x). The relevant portion of the code in the file networknode.py that enables this is1
######################################################
# start the network interface for the server node on
# the localhost loop: 127.0.0.19:8081
#####################################################
if __name__ == "__main__":
     app.listen(address="127.0.0.19", port="8081")
     logging.debug('server node is running')
     print("network node starting at 127.0.0.19:8081")

We can easily change this implementation so that nodes listen on routable Internet addresses. Each network node edits its networknode.py file by replacing the address parameter of the app.listen function with a unique routable IP address that it owns.

This simple change enables us to set up a Helium testnet on the Internet that listens on some designated common port.

Implementing a Helium Faucet

Once we have a Helium testnet on the Internet, we need to provide network nodes with Helium cryptocurrency so that they can create and propagate test transactions on the network. This can be accomplished by creating a Helium faucet. A faucet is a network node that
  1. 1.

    Creates a private-public key pair

     
  2. 2.

    Creates and propagates a transaction that transfers a fixed amount of Helium coins to the owner of the key pair that has been created

     

A faucet works as follows. A requestor asks the faucet to give it some free Helium coins through a JSON remote procedure call to the faucet JSON-RPC server. The faucet generates a private-public key tuple and sends it back to the requestor. The faucet then creates a coinbase type transaction whereby a fixed number of Helium coins are transferred to the requestor, using the key pair that has been provided to the requestor. Finally, the faucet propagates this transaction on the Helium network. Eventually, this transaction will be added to a block and the block will be mined. Upon being mined, the requestor has spendable helium coins that were created by the faucet.

We can also implement a faucet as a web service. A visitor who comes to the faucet website is provided with a private-public key tuple. The website then invokes the JSON-RPC faucet server, which creates and propagates a Helium transaction that uses the key pair that has been provided to the website visitor.

Conclusion

If you are reading this, then congratulations. You have reached the terminal point of this book. We have completed a long journey from the cryptographic foundations of blockchains and cryptocurrencies to the construction of transactions, blockchains, mining nodes, and cryptocurrency networks. Along the way, we have learned the key algorithms that operate in this space. You should now have the facility to confidently architect and program blockchain and cryptocurrency applications in the language of your choice.

In the metaphysiks of the Sikh race, the material world is characterized as the terrifying world ocean. And each time the ferryman ferries someone safely over to the distant shore, a quantum of goodness is added to the equation. With your hard-acquired knowledge, you too are a master of the ferry and the power of goodness is with you.2 Thank you for your kind consideration. Good hunting.

Karan Singh

Attorney-at-law