bazo-miner
bazo-miner
is the the command line interface for running a full Bazo blockchain node implemented in Go.
Setup Instructions
The programming language Go (developed and tested with version >= 1.12.7) must be installed, the properties $GOROOT and $GOPATH must be set. For more information, please check out the official documentation.
Getting Started
The Bazo miner provides an intuitive and beginner-friendly command line interface.
bazo-miner [global options] command [command options] [arguments...]
Options
--help, -h
: Show help
--version, -v
: Print the version
Start the miner
Start the miner with a breeze.
bazo-miner start [command options] [arguments...]
Options
--database
: (default store.db) Specify where to load database of the disk-based key/value store from. The database is created if it does not exist yet.
--address
: (default: localhost:8000) Specify starting address and port, in format IP:PORT
--bootstrap
: (default: localhost:8000) Specify the address and port of the boostrapping node. Note that when this option is not specified, the miner connects to itself.
--wallet
: (default: wallet.txt) Load the public key from this file. A new private key is generated if it does not exist yet. Note that only the public key is required.
--multisig
: (optional) The file to load the multisig's private key from.
--commitment
: The file to load the validator's commitment key from (will be created if it does not exist)
--rootkey
: (default: key.txt) The file to load root's public key from this file. A new public private key is generated if it does not exist yet. Note that only the public key is required.
--rootcommitment
: The file to load root's commitment key from. A new commitment key is generated if it does not exist yet.
--confirm
: In order to review the miner startup options, the user must press Enter before the miner starts.
Start the committee
Start the committee with a breeze.
bazo-miner committee [command options] [arguments...]
Options
--database
: (default store.db) Specify where to load database of the disk-based key/value store from. The database is created if it does not exist yet.
--address
: (default: localhost:8000) Specify starting address and port, in format IP:PORT
--bootstrap
: (default: localhost:8000) Specify the address and port of the boostrapping node. Note that when this option is not specified, the miner connects to itself.
--wallet
: (default: wallet.txt) Load the public key from this file. A new private key is generated if it does not exist yet. Note that only the public key is required.
--committee
: The file to load the validator's committee key from (will be created if it does not exist)
--confirm
: In order to review the miner startup options, the user must press Enter before the miner starts.
Example
Using a sample scenario, the use of the command line should become clear.
Let's assume we want to start two miners, miner A
and miner B
, whereas miner A
acts as the bootstrap node. Moreover, we want to start two Committee members, which will be called committee A
and committee B
.
Further assume that we start from scratch and no key files have been created yet.
Miner A (Root)
- Database:
StoreA.db
- Address:
127.0.0.1:8000
- Bootstrap Address:
127.0.0.1:8000
- Wallet:
WalletA.txt
- Commitment:
CommitmentA.txt
- Root Wallet:
WalletA.txt
- Root Commitment:
CommitmentA.txt
Miner B
- Database:
StoreB.db
- Address:
127.0.0.1:8001
- Bootstrap Address:
127.0.0.1:8000
- Wallet:
WalletB.txt
- Commitment:
CommitmentB.txt
Committee A
- Database:
StoreCommitteeA.db
- Address:
127.0.0.1:8002
- Bootstrap Address:
127.0.0.1:8000
- Wallet:
WalletCommitteeA.txt
- Committee:
CommitteeA.txt
Committee B
- Database:
StoreCommitteeB.db
- Address:
127.0.0.1:8003
- Bootstrap Address:
127.0.0.1:8000
- Wallet:
WalletCommitteeB.txt
- Committee:
CommitteeB.txt
Commands
./bazo-miner start --database StoreA.db --address 127.0.0.1:8000 --bootstrap 127.0.0.1:8000 --wallet WalletA.txt --commitment CommitmentA.txt --multisig WalletA.txt --rootwallet WalletA.txt --rootcommitment CommitmentA.txt
We start miner A at address and port 127.0.0.1:8000
and connect to itself by setting the bootstrap address to the same address.
Note that we could have omitted these two options since they are passed by default with these values.
Wallet and commitment keys are automatically created. Using this command, we define miner A as the root. Moreover, the necessary wallet and committee key for the first committee is automatically generated by spawning the root miner. Note that only miners can be bootstrap nodes.
Now, due to the architecture of this branch of BAZO, a committee member has to be started which distributes transactions to the blockchain shards. Without it, the Shard is not able to process anything. Therefore, at least one Committee member has to be running all the time.
./bazo-miner committee --database StoreCommitteeA.db --address 127.0.0.1:8002 --bootstrap 127.0.0.1:8000 --wallet WalletCommitteeA.txt --committee CommitteeA.txt
The committee member bootstraps to the bootstrap node. All it needs additionally is a database to store transactions, an own address and an address to bootstrap to.
Start additional Miners
Starting miner B requires more work since new accounts have to be registered by a root account.
In our case, we can use miner's A WalletA.txt
(i.e. copy the file to the Bazo client directory) to create and add a new account to the network.
Using the Bazo client, we create a new account:
./bazo-client account create --rootwallet WalletA.txt --wallet WalletB.txt
The minimum amount of coins required for staking is defined in the configuration of Bazo.
Thus, miner B first needs Bazo coins to start mining and we must first send coins to miner B's account.
./bazo-client funds --from WalletA.txt --to WalletB.txt --txcount 0 --amount 2000 --multisig WalletA.txt
Then, miner B has to join the pool of validators (enable staking):
./bazo-client staking enable --wallet WalletB.txt --commitment CommitmentB.txt
Start miner B, using the generated WalletB.txt
and CommitmentB.txt
(i.e. copy the files to the Bazo miner directory):
./bazo-miner start --database StoreB.db --address 127.0.0.1:8001 --bootstrap 127.0.0.1:8000 --wallet WalletB.txt --commitment CommitmentB.txt --rootwallet WalletA.txt --rootcommitment CommitmentA.txt
We start miner B at address and port 127.0.0.1:8001
and connect to miner A (which is the boostrap node).
Wallet and commitment keys are automatically created.
Start Additional Committee Members
As it is with additional miners, additional committee members need more work because they also have to be registered by a root account.
In our case, we can use miner's A WalletA.txt
(i.e. copy the file to the Bazo client directory) to create and add a new account to the network.
Using the Bazo client, we create a new committee account:
./bazo-client committee --wallet WalletCommitteeB.txt --committee CommitteeB.txt --rootwallet WalletA.txt
Wallet and committee keys are automatically created.
Now we can start committee B at address and port 127.0.0.1:8003
and conntect to miner A (which is the bootstrap node), using the generated WalletCommitteeB.txt and CommitteeB.txt files (i.e. copy them from the client application to the miner application).
./bazo-miner committee --database StoreCommitteeB.db --address 127.0.0.1:8003 --bootstrap 127.0.0.1:8000 --wallet WalletCommitteeB.txt --committee CommitteeB.txt
Generate a wallet
Generate a new public and private wallet keypair.
bazo-miner generate-wallet [command options] [arguments...]
Options
--file
: Save the public private wallet keypair to this file.
Example
./bazo-miner generate-wallet --file wallet.txt
Generate a commitment
Generate a new public and private commitment keypair.
bazo-miner generate-commitment [command options] [arguments...]
Options
--file
: Save the public private commitment keypair to this file.
Example
./bazo-miner generate-commitment --file commitment.txt