Local network generation

How to launch a local network with custom settings and initial coins & rolls repartition

On Docker

Full documentation about launching a local network on Docker is available here : https://github.com/massalabs/massa-network-simulator

On your OS

Clone massa:

git clone git@github.com:massalabs/massa.git

Compile it with the sandbox feature enabled:

cd massa && cargo build --release --features sandbox

Create a keypair in massa-client:

cd massa-client && cargo run
wallet_generate_secret_key

For the rest of the tutorial we will use theses abbreviations:

  • SECRETK : The secret you just generated

  • PUBK : The public key corresponding to SECRETK

  • ADDR : The address corresponding to PUBK

Setup your node to use the secret you just generated as its public key and staking key:
  • modify or create the file massa-node/config/node_privkey.key :

{"secret_key":"SECRETK","public_key":"PUBK"}
  • modify the file massa-node/base_config/initial_ledger.json:

{
    "ADDR": {
        "balance": "80000000",
        "datastore": {},
        "bytecode": []
    }
}
  • CLEAR and modify the file massa-node/base_config/initial_rolls.json :

{
    "ADDR": 100
}

You can now launch your node :

cd massa-node && cargo run --features sandbox

On your client run the following command to add your secret key as staking key:

cd massa-client && cargo run node_add_staking_secret_keys SECRETK

The network with your node all start in 10 seconds and you can now interact it with the CLI client like a testnet node. If you want to run multiple nodes on your local network you need to use On Docker.