-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init script * Add README * update cli tools version and remove npm dependency --------- Co-authored-by: Filippos Malandrakis <[email protected]>
- Loading branch information
1 parent
8005da6
commit dbbea24
Showing
31 changed files
with
1,648 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/.testnets/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[submodule "submodules/staking-api-service"] | ||
path = submodules/staking-api-service | ||
url = https://github.com/babylonchain/staking-api-service.git | ||
[submodule "submodules/staking-indexer"] | ||
path = submodules/staking-indexer | ||
url = https://github.com/babylonchain/staking-indexer.git | ||
[submodule "submodules/cli-tools"] | ||
path = submodules/cli-tools | ||
url = https://github.com/babylonchain/cli-tools.git | ||
[submodule "submodules/staking-expiry-checker"] | ||
path = submodules/staking-expiry-checker | ||
url = https://github.com/babylonchain/staking-expiry-checker.git | ||
[submodule "submodules/covenant-signer"] | ||
path = submodules/covenant-signer | ||
url = [email protected]:babylonchain/covenant-signer.git | ||
[submodule "submodules/simple-staking"] | ||
path = submodules/simple-staking | ||
url = https://github.com/babylonchain/simple-staking.git |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
DOCKER := $(shell which docker) | ||
GIT_TOPLEVEL := $(shell git rev-parse --show-toplevel) | ||
|
||
build-bitcoindsim: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/contrib/images bitcoindsim | ||
|
||
build-bitcoindsim-signer: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/contrib/images bitcoindsim BITCOIN_CORE_VERSION=26.1 | ||
|
||
build-simple-staking: | ||
cd $(GIT_TOPLEVEL)/submodules/simple-staking && docker build -t babylonchain/simple-staking . | ||
|
||
build-staking-api-service: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/staking-api-service build-docker | ||
|
||
build-staking-expiry-checker: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/staking-expiry-checker build-docker | ||
|
||
staking-indexer: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/staking-indexer build-docker | ||
|
||
cli-tools: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/cli-tools build-docker | ||
|
||
build-covenant-signer: | ||
$(MAKE) -C $(GIT_TOPLEVEL)/submodules/covenant-signer build-docker | ||
|
||
build-deployment-btcstaking-phase1-bitcoind: build-bitcoindsim build-bitcoindsim-signer build-simple-staking build-staking-api-service build-staking-expiry-checker staking-indexer cli-tools build-covenant-signer | ||
|
||
start-deployment-btcstaking-phase1-bitcoind: stop-deployment-btcstaking-phase1-bitcoind build-deployment-btcstaking-phase1-bitcoind | ||
./pre-deployment.sh | ||
docker compose -f artifacts/docker-compose.yml up -d | ||
./post-deployment.sh | ||
|
||
start-deployment-btcstaking-phase1-bitcoind-demo: start-deployment-btcstaking-phase1-bitcoind | ||
./btcstaking-demo.sh | ||
|
||
stop-deployment-btcstaking-phase1-bitcoind: | ||
docker compose -f artifacts/docker-compose.yml down | ||
rm -rf $(CURDIR)/.testnets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
# babylon-btcstaking-phase-1-demo | ||
# Babylon BTC Staking Phase-1 demo | ||
|
||
This repository contains all the necessary artifacts and instructions to set up | ||
and run Babylon's Phase-1 BTC Staking system locally. | ||
|
||
More details about the system can be found [here](DEPLOYMENT.md). | ||
|
||
## Prerequisites | ||
|
||
1. 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](https://docs.docker.com/desktop/). | ||
|
||
2. Install `make` | ||
|
||
Required to build the service binaries. One tutorial that can be followed | ||
is [this](https://sp21.datastructur.es/materials/guides/make-install.html). | ||
|
||
3. 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. | ||
|
||
```shell | ||
git clone [email protected]:babylonchain/babylon-timestamping-demo.git | ||
git submodule init && git submodule update | ||
``` | ||
|
||
## Repo structure | ||
|
||
The repository follows the below structure: | ||
|
||
```shell | ||
├── artifacts | ||
│ ├── docker-compose.yml | ||
│ ├── ... | ||
├── Makefile | ||
├── post-deployment.sh | ||
└── pre-deployment.sh | ||
``` | ||
|
||
## Perform system operations;w | ||
|
||
To start the system **along with executing an | ||
[additional post-deployment script](DEPLOYMENT.md#inspecting-the-btc-staking-phase-1-system-demo) | ||
that will showcase the lifecycle of Staking requests inside the Phase-1 | ||
system**, execute the following: | ||
|
||
```shell | ||
make start-deployment-btcstaking-phase1-bitcoind-demo | ||
``` | ||
|
||
Alternatively, to just start the system: | ||
|
||
```shell | ||
make start-deployment-btcstaking-phase1-bitcoind | ||
``` | ||
|
||
To stop the system: | ||
|
||
```shell | ||
make stop-deployment-btcstaking-phase1-bitcoind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This is a TOML config file. | ||
# For more information, see https://github.com/toml-lang/toml | ||
|
||
# There are two btc related configs | ||
# 1. [btc-config] is config for btc full node which should have transaction indexing | ||
# enabled. This node should be synced and can be open to the public. | ||
# 2. [btc-signer-config] is config for bitcoind daemon which should have only | ||
# wallet functionality, it should run in separate network. This bitcoind instance | ||
# will be used to sign psbt's | ||
[btc-config] | ||
# Btc node host | ||
host = "bitcoindsim:18443" | ||
# Btc node user | ||
user = "rpcuser" | ||
# Btc node password | ||
pass = "rpcpass" | ||
# Btc network (testnet3|mainnet|regtest|simnet|signet) | ||
network = "regtest" | ||
|
||
[btc-signer-config] | ||
# Btc node host | ||
host = "bitcoindsim-signer:18443/wallet/covenant-signer" | ||
# Btc node user | ||
user = "rpcuser" | ||
# Btc node password | ||
pass = "rpcpass" | ||
# Btc network (testnet3|mainnet|regtest|simnet|signet) | ||
network = "regtest" | ||
|
||
[server-config] | ||
# The address to listen on | ||
host = "0.0.0.0" | ||
|
||
# The port to listen on | ||
port = 9791 | ||
|
||
# Read timeout in seconds | ||
read-timeout = 15 | ||
|
||
# Write timeout in seconds | ||
write-timeout = 15 | ||
|
||
# Idle timeout in seconds | ||
idle-timeout = 120 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
version: "3" | ||
|
||
services: | ||
bitcoindsim: | ||
image: babylonchain/bitcoindsim:latest | ||
platform: linux/amd64 | ||
container_name: bitcoindsim | ||
environment: | ||
- RPC_PORT=18443 | ||
- RPC_USER=rpcuser | ||
- RPC_PASS=rpcpass | ||
- WALLET_PASS=walletpass | ||
- WALLET_NAME=default | ||
- BTCSTAKER_WALLET_NAME=btcstaker | ||
- BTCSTAKER_WALLET_ADDR_COUNT=3 | ||
- GENERATE_INTERVAL_SECS=10 | ||
ports: | ||
- "18443:18443" | ||
volumes: | ||
- ../.testnets/bitcoin:/bitcoindsim/.bitcoin:Z | ||
networks: | ||
- phase-1 | ||
|
||
bitcoindsim-signer: | ||
image: babylonchain/bitcoindsim:26.1 | ||
platform: linux/amd64 | ||
container_name: bitcoindsim-signer | ||
environment: | ||
- RPC_PORT=18443 | ||
- RPC_USER=rpcuser | ||
- RPC_PASS=rpcpass | ||
- GENERATE_STAKER_WALLET=false | ||
- GENERATE_INTERVAL_SECS=10 | ||
volumes: | ||
- ../.testnets/bitcoin-signer:/bitcoindsim/.bitcoin:Z | ||
networks: | ||
- phase-1 | ||
|
||
staking-indexer: | ||
image: babylonchain/staking-indexer:latest | ||
container_name: staking-indexer | ||
environment: | ||
- CONFIG=/home/staking-indexer/.sid/sid.conf | ||
volumes: | ||
- ../.testnets/staking-indexer/data:/home/staking-indexer/.sid/data:Z | ||
- ../.testnets/staking-indexer/logs:/home/staking-indexer/.sid/logs:Z | ||
- ../.testnets/staking-indexer/sid.conf:/home/staking-indexer/.sid/sid.conf:Z | ||
- ../.testnets/global-params.json:/home/staking-indexer/.sid/global-params.json:Z | ||
ports: | ||
- "2112:2112" | ||
depends_on: | ||
- rabbitmq | ||
- bitcoindsim | ||
entrypoint: ["/bin/sh", "-c", "/bin/sid start"] | ||
networks: | ||
- phase-1 | ||
restart: unless-stopped | ||
|
||
staking-api-service: | ||
image: babylonchain/staking-api-service:latest | ||
container_name: staking-api-service | ||
ports: | ||
- "80:8090" | ||
environment: | ||
- CONFIG=/home/staking-api-service/config.yml | ||
volumes: | ||
- ../.testnets/global-params.json:/home/staking-api-service/global-params.json:Z | ||
- ../.testnets/finality-providers.json:/home/staking-api-service/finality-providers.json:Z | ||
- ../.testnets/staking-api-service/staking-api-service-config.yml:/home/staking-api-service/config.yml:Z | ||
depends_on: | ||
- rabbitmq | ||
- mongodb | ||
networks: | ||
- phase-1 | ||
restart: unless-stopped | ||
|
||
staking-expiry-checker: | ||
image: babylonchain/staking-expiry-checker:latest | ||
container_name: staking-expiry-checker | ||
environment: | ||
- CONFIG=/home/staking-expiry-checker/config.yml | ||
depends_on: | ||
- mongodb | ||
- rabbitmq | ||
volumes: | ||
- ../.testnets/staking-expiry-checker/staking-expiry-checker-config.yml:/home/staking-expiry-checker/config.yml:Z | ||
networks: | ||
- phase-1 | ||
restart: unless-stopped | ||
|
||
simple-staking: | ||
container_name: simple-staking | ||
image: babylonchain/simple-staking:latest | ||
environment: | ||
- APP_NEXT_PUBLIC_MEMPOOL_API=https://babylon.mempool.space | ||
- APP_NEXT_PUBLIC_API_URL=http://staking-api-service | ||
restart: always | ||
depends_on: | ||
- staking-api-service | ||
ports: | ||
- 3000:3000 | ||
networks: | ||
- phase-1 | ||
|
||
unbonding-pipeline: | ||
container_name: unbonding-pipeline | ||
image: babylonchain/cli-tools:latest | ||
restart: unless-stopped | ||
depends_on: | ||
- mongodb | ||
- bitcoindsim | ||
volumes: | ||
- ../.testnets/global-params.json:/home/cli-tools/.tools/global-params.json:Z | ||
- ../.testnets/unbonding-pipeline/unbonding-pipeline-config.toml:/home/cli-tools/.tools/config.toml | ||
entrypoint: | | ||
/bin/sh -c " | ||
while true | ||
do | ||
cli-tools run-unbonding-pipeline --config /home/cli-tools/.tools/config.toml | ||
sleep 10 | ||
done | ||
" | ||
networks: | ||
- phase-1 | ||
|
||
mongodb: | ||
image: mongo:latest | ||
container_name: mongodb | ||
hostname: mongodb | ||
ports: | ||
- "27017:27017" | ||
volumes: | ||
- ../.testnets/mongo/init-mongo.sh:/init-mongo.sh:Z | ||
entrypoint: [ "/init-mongo.sh" ] | ||
networks: | ||
- phase-1 | ||
|
||
rabbitmq: | ||
image: rabbitmq:3-management | ||
container_name: rabbitmq | ||
ports: | ||
- "5672:5672" # AMQP protocol port | ||
- "15672:15672" # Management UI port | ||
environment: | ||
RABBITMQ_DEFAULT_USER: user | ||
RABBITMQ_DEFAULT_PASS: password | ||
volumes: | ||
- "../.testnets/rabbitmq_data:/var/lib/rabbitmq" | ||
networks: | ||
- phase-1 | ||
|
||
covenant-signer: | ||
image: babylonchain/covenant-signer:latest | ||
container_name: covenant-signer | ||
ports: | ||
- "9791:9791" | ||
environment: | ||
- CONFIG= /home/covenant-signer/config.yml | ||
entrypoint: ["/bin/sh", "-c", "/bin/covenant-signer start"] | ||
depends_on: | ||
- bitcoindsim | ||
volumes: | ||
- ../.testnets/covenant-signer/covenant-signer-config.toml:/home/covenant-signer/.signer/config.toml:Z | ||
- ../.testnets/global-params.json:/home/covenant-signer/.signer/global-params.json:Z | ||
networks: | ||
- phase-1 | ||
restart: unless-stopped | ||
networks: | ||
phase-1: | ||
driver: bridge | ||
ipam: | ||
driver: default | ||
config: | ||
- subnet: 192.168.15.0/25 |
Oops, something went wrong.