This short tutorial describes how to setup a local Libra network running 4 validator nodes, one minter node and one client node using Docker. It assumes that you have a Docker Desktop installed and running on your machine. It has been tested on macOS.
Build the Libra validator, minter and client Docker images:
$ sh build.sh
This may take a while …
The build will require 40GB of disk space for building the validator, minter and client images, but also intermediate helper images. These images can be removed after the build has completed:
docker image prune
The remaining images should take 4GB of space.
Execute the following commands in separate Terminals.
- Run the validator nodes:
$ sh libra/docker/validator/run.sh
- Run the minter node, where
<IP>
is the public IP address of a validator (i.e. the public IP address of your machine running the validator Docker containers):$ sh libra/docker/mint/run.sh libra_mint:latest <IP> 30307 info
- Run the client node:
$ docker run --rm -it -e VALIDATOR_IP=<IP> --name libra_client libra_client_local
Execute the following commands inside the client Docker container running the Libra CLI.
- Confirm that we are running a fresh Libra chain by checking that there is only the genesis transaction
This should return the genesis transaction, e.g.
libra% query tr 0 1 false
>> Getting committed transaction by range Transaction at version 0: SignedTransaction { raw_txn: RawTransaction { sender: 0000000000000000000000000000000000000000000000000000000000000000, sequence_number: 0, payload: { transaction: genesis, args: [] }, max_gas_amount: 0, gas_unit_price: 0, expiration_time: 18446744073709551615s, }, public_key: ..., signature: Signature(...), }
- Now, let's try to get the next transaction
This should return not return any transactions.
libra% query tr 1 1 false
- Create an account:
libra% account create
- Check that your account was created:
You should see a User account with index 0.
libra% account list
- Check that the created account 0 has no Libra:
libra% query balance 0
- Mint 72 Libra to your account with index 0:
libra% account mint 0 72
- Check that the minted Libra was added to your account 0:
libra% query balance 0
- Stop all the Docker containers:
docker stop $(docker ps -aq)