A novel component of the Archain project is our large-scale network simulation framework, with which one can test the behavior of an Archain network at-scale (including time-stretching), inside a single machine. We called this system NO-VLNS (The Never Off-Very Large Network Simulator). Enabled by the use of Erlang, to the best of our understanding it is the first time a blockchain technology startup has provided a tool to run full simulations at this scale, inside a single machine. NO-VLNS affords us the ability to launch hundreds of simultaneous runs with varied conditions, exposing 1 in a million emergent behaviour bugs before the private network phase even begins.

The architecture of the framework is as follows: the suite of tests are managed by a supervisor that launches predefined tests that run in parallel. Each test has an associated monitor that provides status updates and performs logging of simulated events. Should a test fail, the monitor logs the reason why and the supervisor re-launches the failed test. Tests themselves comprise launching simulated Archain users (clients) and miners (nodes) that interact with one another.

Tests are defined by a record that contains definitions of network properties and environment variables. In this way, we are able to define a network in terms of clients and miners and their connections as well as simulate realistic networks by defining factors such as latency, transfer speeds and the probability of packet loss over a network.

Through defining several of these network test records we are able to simulate a wide range of varied networks that run continuously, in parallel, until stopping and logging salient information upon exposing a bug. We are running a suite of tests every evening after integrating the days development work into production code.

In addition to this, we also have defined a number of smaller, static tests that test for specific behaviour (including fork recovery, double spending attacks, etc). In this way, we are able to comprehensively verify the correct functioning of a network in a general manner and for fine-grained, edge case behaviour.

You run the tests yourselves by checking out the Archain Github repository and running make test_networks . The network definitions themselves are defined in src/ar_network_tests.hrl .

-archain-devs