This repository contains all the necessary artifacts and instructions to set up and run a Babylon network locally, using several different deployment scenarios.
-
Install Docker Desktop
All components are executed as Docker containers on the local machine, so a local Docker installation is required. Depending on your operating system, you can find relevant instructions here.
-
Install
make
Required to build the service binaries. One tutorial that can be followed is this.
-
Clone the repository and initialize git submodules
The aforementioned components are included in the repo as git submodules, so they need to be initialized accordingly.
git clone [email protected]:babylonlabs-io/babylon-deployment.git git submodule init && git submodule update
Every deployment scenario lives under the deployments directory, on a dedicated subdirectory. The following scenarios are currently available:
- BTC Staking Phase-2 System (BTC backend: bitcoind): Spawns a Babylon network showcasing Babylon's BTC Staking and BTC Timestamping protocols, backed by a bitcoind-based BTC simnet
Each deployment scenario subdirectory follows the structure indicated below:
├── artifacts
│ ├── docker-compose.yml
│ ├── ...
├── Makefile
├── post-deployment.sh
└── pre-deployment.sh
The Makefile generally adheres to the following template:
build-deployment-X:
...
start-deployment-X:
...
stop-deployment-X:
...
Initiating a deployment is achieved through make start-deployment-X
. The
following events will occur automatically:
- Stop any existing deployment (by invoking the
make stop-deployment-X
command) - (Re)Build Docker images for all the underlying services (by invoking the
make build-deployment-X
command) - Execute the
pre-deployment.sh
bash script that will:- Create a genesis file used to bootstrap the Babylon network
- Prepare service configuration originally placed under the
artifacts
folder
- Execute a
docker compose
command that will spin up all the required services for the network as Docker containers; thedocker-compose.yml
file is also under theartifacts
folder - Execute the
post-deployment.sh
bash script (if it exists) that will generate funded Babylon keyrings for the services that need to send Babylon transactions
The repository hosts a central Makefile which places calls to all the underlying Makefiles. It will be utilized to start deployments directly from the repo root.
Below, we document how to deploy each scenario. The following guidelines should be followed:
- For Linux systems, the make commands must be prefixed with
sudo
. - After having deployed a deployment scenario
X
, make sure to stop it through the correspondingmake
command that will be designated below before switching to another deployment scenarioY
.
ℹ️ Note: The repository will by default boot all the containers through publicly available Docker images on Dockerhub. You may also choose to start a deployment using git submodules; in order to achieve that, prepend
USE_DOCKERHUB_IMAGES=FALSE
to yourmake
command.
To start the network along with executing an additional post-deployment script that will showcase the full lifecycle of Babylon's BTC Staking Protocol, execute the following:
make start-deployment-btcstaking-bitcoind-demo
Alternatively, to just start the network:
make start-deployment-btcstaking-bitcoind
To stop the network:
make stop-deployment-btcstaking-bitcoind
Refer to the dedicated GitHub repo for Phase-1.