Running local blockchain
Specific projects require building a local network for testing and development purposes. In this article, we will go over the step-by-step process of creating a new Beam Network.

Starting a New Network

To start a new Beam Network follow the steps below:
    1.
    โ€‹Download or build Beam binaries for the node and CLI wallet.
    2.
    Initialize new wallet by running the following command in the wallet folder (see Creating new wallet for more details):
    1
    ./beam-wallet init
    Copied!
    3.
    To export the miner key, enter:
    1
    ./beam-wallet export_miner_key --subkey=1
    Copied!
    If you are running more than one mining node, repeat step three with โ€“subkey=N (N is the id of the mining nodes one, two, three, etc).
    โ€‹
    4.
    Export owner key by running the following command in the wallet folder:
    1
    ./beam-wallet export_owner_key
    Copied!
    5.
    Download sample Beam treasury file treasury.bin (Beam source folder), then copy it to the same folder as the beam-node binary.
    6.
    To launch the first node, enter:
    1
    ./beam-node --treasury_path=treasury.bin --owner_key=<owner key> --miner_key=<miner key> --pass=<wallet password>
    Copied!
    Sample output printed by the node to the console (and logs) should look like this:
    1
    I 2018-12-25.09:43:56.712 Rules signature: ddccf5d8d0f77bd2
    2
    I 2018-12-25.09:43:56.925 starting a node on 10000 port...
    3
    I 2018-12-25.09:43:56.930 Treasury size: 584661
    4
    I 2018-12-25.09:43:56.955 Node ID=a82306ff757cca58
    5
    I 2018-12-25.09:43:56.955 Initial Tip: 0-0000000000000000
    6
    I 2018-12-25.09:43:56.955 Sync mode
    7
    I 2018-12-25.09:43:56.955 Searching for the best peer...
    8
    I 2018-12-25.09:43:56.959 GenerateNewBlock: size of block = 294; amount of tx = 0
    9
    I 2018-12-25.09:43:56.960 Block generated: Height=1, Fee=0, Difficulty=02-000000(4), Size=294
    10
    I 2018-12-25.09:43:56.960 Mining nonce = 428dcf03b88fa57d
    Copied!
    When new blocks are added to the Beam blockchain, the console will read:
    1
    I 2018-12-25.09:46:00.513 New block mined: 1-a690c8aa7e14225c
    2
    I 2018-12-25.09:46:00.520 1-a690c8aa7e14225c Header accepted
    3
    I 2018-12-25.09:46:00.520 1-a690c8aa7e14225c Block received
    4
    I 2018-12-25.09:46:00.523 1-a690c8aa7e14225c Block interpreted. Fwd=1
    5
    I 2018-12-25.09:46:00.524 My Tip: 1-a690c8aa7e14225c, Work = 4
    6
    I 2018-12-25.09:46:00.527 GenerateNewBlock: size of block = 294; amount of tx = 0
    7
    I 2018-12-25.09:46:00.527 Block generated: Height=2, Fee=0, Difficulty=02-000000(4), Size=294
    8
    I 2018-12-25.09:46:00.528 Mining nonce = 32d6ce8dba24d0dd
    Copied!
    Note For GPU mining, add โ€“miner_type=gpu parameter
    7.
    Launch additional nodes To launch additional mining nodes in one or multiple Beam wallets, repeat the relevant portions of steps one through six. Extend your network by adding parameter โ€“peer=<ip:port of the first node> to connect new nodes with your original node.
Beam Nodes have an automatic discovery mechanism that detects and automatically connects to other nodes running on the local network. If you want the nodes to remain separate, change the Consensus Rules to intentionally break compatibility between the networks and avoid unwanted behavior. The simplest way to achieve this is to set "Prehistoric" parameter to a random hash value, i.e Prehistoric=1234.
Last modified 2mo ago
Copy link