This project aims to easily spin up custom nano-currency network on your local computer. The default config spins up a network 4 node : 1 genesis and 3 voting nodes of which each holds 33.3% of the total vote weight. Each node comes with their rpc and websocket endpoint enabled.
All configuration is done inside the config file : nanolocal/nl_config.toml
Many additional services can be enabled :
- nanolooker
- nanoNodeMonitor
- nano-vote-visualizer
- nanoticker A test-suite with some basic network- and block propagation checks can be run after having initialised the network.
- python3.7
- docker
- docker-compose (if you use docker-compose v1.xx try adding
--compose_version=1
flag)
$ ./setup_python_venv.sh
Action | Code | Description |
---|---|---|
create | $ ./nl_run.py create |
Create folders and node config |
start | $ ./nl_run.py start |
Start all nodes and services (optional flag --build = true rebuilds docker containers) |
init | $ ./nl_run.py init |
Create Epochs Canary Burn and Vote weight distribution |
test | $ ./nl_run.py test |
runs tests from [testcase] section of nl_config.toml |
pytest | $ ./nl_run.py pytest |
runs tests from [testcase] section of nl_config.toml |
stop | $ ./nl_run.py stop |
Stop all nodes and services |
stop_nodes | $ ./nl_run.py stop_nodes |
Stop nodes only |
restart | $ ./nl_run.py restart |
Restart nodes only |
restart_wait_sync | $ ./nl_run.py restart_wait_sync |
Restart nodes until 100% of blocks are confirmed |
reset | $ ./nl_run.py reset |
Delete all blocks except genesis block by removing data.ldb from all nodes |
destroy | $ ./nl_run.py destroy |
Remove all nodes and delte virtaul environment |
Each node can be queried via RPC (see the official documentation )
Node | RPC | Websocket |
---|---|---|
nl_genesis | http://127.0.0.1:45000 | ws://127.0.0.1:47000 |
nl_pr1 | http://127.0.0.1:45001 | ws://127.0.0.1:47001 |
nl_pr2 | http://127.0.0.1:45002 | ws://127.0.0.1:47002 |
nl_pr3 | http://127.0.0.1:45003 | ws://127.0.0.1:47003 |
nl_config.toml
define all aspects of the network : genesis account, burn_amount, number of nodes, versions,...
You can enable various services :
Service | Code | Description |
---|---|---|
remote_address | remote_address='127.0.0.1' |
server address inside your LAN (localhost by default) |
nanolooker | nanolooker_enable = true |
Available at http://{remote_address}:42000 |
nano-vote-visualizer | nanovotevisu_enable = true |
Available at http://{remote_address}:42001 |
nanoticker | nanoticker_enable = true |
Available at http://{remote_address}:42002 |
nano-node-monitor | nanomonitor_enable = true |
Available at http://{remote_address}:46000, 46001, 46002, ... |
All tests are configured in the [testcase]
section of nl_config.toml
$ ./nl_run.py test
runs the configured tests
Module | Test | Code | Description |
---|---|---|---|
basic | >NetworkChecks | ||
basic | rpc_online | test_rpc_online |
all nodes online |
basic | peer_count | test_peer_count |
all nodes interconnected |
basic | equal_block_count | test_equal_block_count |
all nodes have same blocks |
basic | equal_online_stake_total | test_equal_online_stake_total |
all nodes see same online weight |
basic | equal_confirmation_quorum | test_equal_confirmation_quorum |
all nodes have equal network view |
basic | equal_peers_stake_total | test_equal_peers_stake_total |
all nodes have equal peer weight |
basic | equal_representatives_online | test_equal_representatives_online |
all nodes have same online representatives |
basic | >BlockPropagation | ||
basic | account_split_10 | test_1_account_split_10 |
Create 10 accounts by splitting each account into 2 new accounts |
basic | account_split_1000 | test_1_account_split_1000 |
Create 1000 accounts by splitting each account into 2 new accounts |
To remove your virtual python environment
$ ./setup_venv.sh delete