-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Photo by Shubham Dhage on Unsplash
The blockchain-starter
allows you to quickly create a private blockchain with 10 addresses and run a local network.
There are two steps to getting everything up and running:
blockchain-starter
sets up a private blockchain by creating a genesis block and generating 10 addresses.
The genesis script is responsible for creating the genesis block and generating addresses (10 of them) that can be used within the blockchain. To execute the genesis script, run:
yarn genesis
After running the yarn genesis
command above, a builds/
directory would be created within the blockchain-starter
's root directory with the following artefacts generated:
-
accounts/
containing accounts with the following details:- address: made up of 40 hexadecimal characters prefixed by
0x
- password: the password is
password
- address: made up of 40 hexadecimal characters prefixed by
-
db/
containing chain data, key store, etc - the
genesis.json
file specifying the genesis block
There are 4 options available for starting the network with mining enabled for use with DApps like eth-vue, for example:
To start the network which has been initialised in step 1 of How To, without unlocking any account, just run the start-network script. You could do this using yarn
too:
yarn start
To start the network with two accounts unlocked, 0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73
and 0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73
for example, run the following with the accounts in a comma-separated string:
yarn unlock-accounts-start 0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73,0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73
To start the network with all accounts generated in this step unlocked, run the following:
yarn unlock-all-start
To start the network with just your coinbase unlocked, run the following:
yarn unlock-coinbase-start
NOTE: the accounts generated in step 1 of How To can be imported into MetaMask if you choose to.
In addition to unlocking accounts and mining, blockchain-starter
provides ways to unlock any number of available accounts without mining. The subsections below show how to unlock accounts for the two cases (selected accounts and all accounts):
To unlock accounts like 0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73
and 0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73
, for example, simply run the following command with the accounts as a comma-separated string:
yarn unlock-accounts 0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73,0x2Abe38bB3Cb626bE1e69Cc3776c4c3EA2B1DCa73
To unlock all the accounts generated in this step, run the following:
yarn unlock-all-accounts
All accounts passed to yarn
for unlocking must have been generated in step 1 of How To for things to go smoothly.
Please send bug issues you may encounter to Issues
2020 Daniel Okwufulueze
This Blockchain Starter is distributed under the GNU GPL-3.0 licence.