Running local blockchain
In this tutorial we will explain how to run local blockchain. It will be extremely useful for testing your dapps locally, before deplying them to public networks
Download node and wallet
Create an empty folder (called dappnet in our examples) and download the binaries for the node and CLI wallet from beam website
Initialize wallet
First, let's change the wallet configuration file to make everything easy and seamless when we run it later. Edit the beam-wallet.cfg file and set the following flags:
Note the Maturity.Coinbase=0 flag. It means that you can spend coinbase rewards immediately (unlike the 60 block lockup in mainnet) It is useful for testing in a local environment, since you do not have to wait for your mined rewards to before available
Now let's move on to wallet initialization. Run
beam-wallet-dappnet.exe init
(or ./beam-wallet-dappnet on Mac)
Save the generated seed phase somewhere in a text file ( we might need it later)
Now print the owner key by running:
beam-wallet-dappnet.exe export_owner_key
And last generate the mining key by running
beam-wallet-dappnet.exe export_miner_key --subkey=1
Save both keys in the same file as the seed phrase
Initializing the Node
Before we start configuring the node, download sample Beam treasury file treasury.bin, and copy it to the same folder as the beam-node
binary.
Now, open beam-node.cfg file in a text editor and set the following flags:
Make sure to set miner and owner keys to those generated by your wallet
Make sure peer list is empty (to avoid accidental connections to other nodes)
Check that mining_threads flag is set to 1
We are now ready to run the node using the command:
beam-node-dappnet.exe
Sample output should look something like this
Wait for about 30 seconds to make sure new blocks are produced. A new block shoud appear every 15 seconds or so
Synchronizing the wallet
In another command line (or Terminal) window, run the CLI wallet with the following command:
beam-wallet-dappnet.exe listen
This will synchronize the wallet state with the blockchain. Your output should read something like:
Stop the wallet (by clicking Ctrl + C) and check your current balance by running:
beam-wallet-dappnet.exe info
You should see the mined BEAM coins in your wallet
You now have a local network!
For a full reference on Beam CLI wallet see the CLI Wallet Guide
Last updated