Ten years after the start of the Bitcoin network, blockchains have gained mainstream recognition. Though as with any new industry, products still have a long way to mature before reaching a significant audience. Part of this growth process is giving developers the proper tooling for blockchain testing. Teams should be able to quickly iterate on protocol architecture and dapp designs. They should be able to test network assumptions without significant overhead or investing too much time.
Whiteblock’s open source platform, Genesis, offers a convenient solution to these needs. Genesis allows users to provision multiple fully-functioning nodes, automate tasks, and configure environmental conditions with ease. After provisioning, users can run the network for as long as they need, able to collect the valuable data to improve the chain design.
1. Build The Network
If you haven’t already, download Genesis from the Whiteblock repo, then run it.
Genesis provides a developer friendly CLI that you can SSH into. Once you SSH into your instance, write the following command:
whiteblock build [flags]
Build will create and deploy a blockchain with the specified number of nodes. Each node will be instantiated in its own container and will interact individually as a participant of the specified network. Each node has its own linux bridge and is assigned its own unique ip address, which allows us to build test networks that emulate a full-mesh wide area network (nodes can have unique properties assigned which can simulate interaction from Paris to Beijing as opposed to a local area network).
2. Start Mining
I’m building Geth in this example and the Ethereum blockchain requires the network to have a number of nodes mining. This is how blocks are created and the more miners there are, the more secure the network becomes. To begin mining, run the command
whiteblock miner start. This will have all the nodes start mining, initiate block production and start processing transactions.
3. Configure Network Conditions
You can now introduce real world impairments and see how these network conditions affect the network performance and security.
whiteblock netconfig <command> [flags]
whiteblock netconfig all -d 100 -b 100 -l 0.5
The provided example command tells the netconfig module to apply 100ms latency, 100 MBps bandwidth, and 0.5% packet loss for all nodes.
You can also use
whiteblock ping <sender> <receiver> to measure the amount of latency or packet loss between nodes.
The following example sends ICMP pings from node 1 to node 3:
whiteblock ping 1 3
4. Send Transactions
whiteblock tx <command> [flags]
This will send transactions (in geth) with instructions on how many transactions per second to send and the value to send. This will immediately begin transactions if the network has been built properly.
wb tx start stream -t 200 -v 2
5. Examine Data for testing
After running the transactions, you can see the throughput of the network by running the command
whiteblock get stats all.
This will output all the relevant statistics of the current blockchain.
You may also use the Whiteblock GUI and other data visualization tools to examine the different data points that are being pushed directly from the blockchain.
It’s really as simple as that. Genesis focuses on making it easier for developers to carry out blockchain testing, validating assumptions before launching to mainnet. Reach out on Telegram if you have trouble at any of the steps.
Latest posts by Kevin Castro (see all)
- Blockchain testing with Whiteblock’s Genesis Platform - August 1, 2019