Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hiepmai-babylonchain committed Jul 17, 2024
1 parent e3a9de8 commit 52e7087
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,39 @@ hide_table_of_contents: true

![Overview of Bitcoin Staking backend deployment](images/phase-1-overview.png)

The Babylon's Bitcoin Staking system comprises the following components:
The Babylon Bitcoin Staking system comprises of the following components:

- BTC Staking Indexer: Parses BTC blocks for valid staking, unbonding,
- [**BTC Staking Indexer**](../backend-deployment/services/staking-indexer.md):
Parses BTC blocks for valid staking, unbonding,
and withdrawal transactions, and forwards relevant events to a queueing system,
while also persisting them to an on-disk key-value storage
- RabbitMQ: Houses a set of queues containing BTC Staking transactions
- Staking API Service: Consumes BTC Staking transactions
from the RabbitMQ queues and stores them in a central data store,
additionally accepting unbonding requests
- MongoDB: Stores BTC Staking transaction data
- Staking Expiry Checker: Periodically checks MongoDB
for expired BTC Stake Delegations and Unbondings
- Unbonding Pipeline: Forwards unbonding requests
for signing to a Covenant Emulator committee and submits them to BTC
Staking Dashboard: UI that allows for creating BTC Staking transactions,
connects to the API to retrieve information about the system and historical delegations
- Covenant Signer: Receives unbonding transactions and returns the same
transactions signed by the covenant emulator's key
- Bitcoin Full Node: Operates an emulated regtest Bitcoin network
- Bitcoin Offline Wallet: Stores the Covenant Signer member keys
and signs unbonding transactions forwarded by the Covenant Signer
- A Global Configuration file that contains system-wide parameters pertinent
to the processed Staking transactions
- A Finality Provider config file that contains information
about finality providers participating in the system
while also persisting them to an on-disk key-value storage.
- [**RabbitMQ**](./infra/rabbitmq.md):
Houses a set of queues containing BTC Staking transactions.
- [**Staking API Service**](./services/staking-api.md):
Consumes BTC Staking transactions from the RabbitMQ queues
and stores them in a central data store,
additionally accepting unbonding requests.
- [**MongoDB**](./infra/mongodb.md): Stores BTC Staking transaction data.
- [**Staking Expiry Checker**](./services/staking-expiry-checker.md):
Periodically checks MongoDB for expired BTC Stake Delegations and Unbondings.
- [**Unbonding Pipeline**](./services/staking-expiry-checker.md):
Forwards unbonding requests for signing to a Covenant Emulator committee
and submits them to BTC network
- [**Staking Dashboard**](https://github.com/babylonchain/btc-staking-dashboard):
UI that allows for creating BTC Staking transactions,
connects to the API to retrieve information about the system and historical delegations.
- [**Covenant Signer**](https://github.com/babylonchain/covenant-signer/blob/dev/docs/deployment.md#covenant-signer-setup-deployment):
Receives unbonding transactions and returns the same
transactions signed by the covenant emulator's key.
- [**Bitcoin Full Node**](./infra/bitcoind.md):
Operates an emulated regtest Bitcoin network.
- [**Bitcoin Offline Wallet**](https://github.com/babylonchain/covenant-signer/blob/dev/docs/deployment.md#3-bitcoind-offline-wallet-operations):
Stores the Covenant Signer member keys
and signs unbonding transactions forwarded by the Covenant Signer.
- [**A Global Configuration file**](./global-system-configuration.md)
that contains system-wide parameters pertinent
to the processed Staking transactions.
- [**A Finality Provider config file**](./global-system-configuration.md)
that associates finality provider
BTC public keys with additional information about them such
as their moniker, commission etc.
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ hide_table_of_contents: false

## 1. Staking Parameters

The Global Configuration includes a series of versioned governance parameters
The Global Configuration includes versioned governance parameters
that greatly affect the behaviour of the system.

Detailed information can be found
[here](https://github.com/babylonchain/networks/tree/main/bbn-test-4/parameters).
[here](https://github.com/babylonchain/networks/tree/391cecff2569a57a26317e93484c5690b6ce6540/bbn-test-4/parameters).

Depending on the network, you can download the corresponding version:

- [testnet](https://github.com/babylonchain/networks/blob/main/bbn-test-4/parameters/global-params.json)
- [testnet](https://github.com/babylonchain/networks/blob/391cecff2569a57a26317e93484c5690b6ce6540/bbn-test-4/parameters/global-params.json)

## 2. Finality Providers

Finality providers can accept delegations from BTC stakers.
For more details, please visit
[this link](https://docs.babylonchain.io/docs/user-guides/btc-staking-testnet/finality-providers/overview).
[this link](https://github.com/babylonchain/networks/tree/524247c418af07beb99a291a1686413c23d22553/bbn-test-4/finality-providers).

Finality provider information registry stores additional information
such as the finality provider's moniker, website, and identity.

To generate concatenated Finality provider information,
To generate the concatenated Finality provider information,
we provide the following reference script for Linux.
Depending on the network, you can change the corresponding directory `DIR`:

Expand Down Expand Up @@ -61,5 +61,12 @@ cat $OUTPUT | jq . > $FINAL
' > generate_finality_providers.sh && bash generate_finality_providers.sh
```

This process will create a formatted JSON file
that consolidates all Finality provider information.
This script clones the Babylon networks repository,
navigates to the specified directory,
iterate over JSON files and
append them to the output filecontaining Finality provider information.

This script only uses the registry information maintained by Babylon.
Other such registries might exist,
and it is up to the staking provider to utilize a source of information
that best fits their requirements.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ sudo systemctl start bitcoind.service

## 5. Monitoring

The bitcoind server availability can be polled through Prometheus Blackbox Exporter.
The bitcoind server availability can be polled through
[Prometheus Blackbox Exporter](https://github.com/prometheus/blackbox_exporter).

Bitcoin-specific Prometheus metrics can also be exposed
by utilizing any open-source Prometheus bitcoind exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ to ensure optimal performance and reliability.

## 1. Install MongoDB

According to your operating system, follow the official instructions to install [MongoDB](https://www.mongodb.com/docs/manual/administration/install-community/)
According to your operating system, follow the official instructions to install
[MongoDB](https://www.mongodb.com/docs/manual/administration/install-community/)

## 2. Configure MongoDB Replica Set

Expand Down Expand Up @@ -61,7 +62,8 @@ rs.status()

## 3. Monitoring

The MongoDB server availability can be polled through Prometheus Blackbox Exporter.
The MongoDB server availability can be polled through
[Prometheus Blackbox Exporter](https://github.com/prometheus/blackbox_exporter).

MongoDB-specific Prometheus metrics can also be exposed
by utilizing any open-source Prometheus MongoDB exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,24 @@ The exact credentials will later be used by the services to connect to the queue
:::

```bash
sudo rabbitmqctl add_user admin password
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
sudo rabbitmqctl add_user <admin> <password>
sudo rabbitmqctl set_user_tags <admin> <administrator>
sudo rabbitmqctl set_permissions -p / <admin> ".*" ".*" ".*"
```

Replace `<admin>` with your desired username and `<password>` with your desired password.

### 2.3 Access the RabbitMQ Management Dashboard

Open your web browser and navigate to: `http://localhost:15672/`

Log in with the username `admin` and the password `password`.
Log in with the username `<admin>` and the password `<password>`
that is set from the above step.

## 3. Monitoring

The RabbitMQ server availability can be polled through Prometheus Blackbox Exporter.
The RabbitMQ server availability can be polled through
[Prometheus Blackbox Exporter](https://github.com/prometheus/blackbox_exporter).

RabbitMQ-specific Prometheus metrics can also be exposed
by utilizing any open-source Prometheus RabbitMQ exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,26 @@ cp ~/staking-api-service/config/config-local.yml ~/.staking-api-service/config.y

### 2.3 Update default configurations

- [MongoDB](../infra/mongodb.md) cluster to connect to
- MongoDB cluster to connect to

Set the MongoDB connection address (`address`)
and credentials (`username` and `password`) to match
the information from the
[installed MongoDB cluster](../infra/mongodb.md).

```yml
db:
address: "mongodb://localhost:27017/?directConnection=true"
username: "<admin>"
password: "<password>"
```
- [RabbitMQ cluster](../infra/rabbitmq.md) to connect to
- RabbitMQ cluster to connect to
Set the RabbitMQ connection address (`url`)
and credentials (`queue_user` and `queue_password`)
to match the information from the
[installed RabbitMQ cluster](../infra/rabbitmq.md).

```yml
queue:
Expand All @@ -58,13 +70,21 @@ queue:

## 3. Download global params

To run the Staking API, a `global-params.json` file
which defines all the staking parameters is needed.

To download the global parameters,
follow [this](../global-system-configuration.md#staking-parameters) instructions.
follow [these](../global-system-configuration.md#staking-parameters) instructions.

## 4. Download finality providers

To run the Staking API, a `finality-provider.json` file
that associates finality provider
BTC public keys with additional information about them such
as their moniker, commission is needed.

To download the finality providers information,
follow [this](../global-system-configuration.md#2-finality-providers)
follow [these](../global-system-configuration.md#2-finality-providers)
instructions.

## 5. Start Staking API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,26 @@ cp ~/staking-expiry-checker/config/config-local.yml ~/.staking-expiry-checker/co

### 2.3 Update default configurations

- [MongoDB](../infra/mongodb.md) cluster to connect to
- MongoDB cluster to connect to

Set the MongoDB connection address (`address`)
and credentials (`username` and `password`) to match
the information from the
[installed MongoDB cluster](../infra/mongodb.md).

```yml
db:
username: "<admin>"
password: "<password>"
address: "mongodb://localhost:27017/?directConnection=true"
```
- [Bitcoin node](../infra/bitcoind.md) to connect to
- Bitcoin node to connect to
Set the Bitcoin node connection address (`url`)
and credentials (`rpc-user` and `rpc-pass`)
to match the information from the
[installed Bitcoin node](../infra/bitcoind.md).

```yml
btc:
Expand All @@ -53,7 +65,12 @@ btc:
rpc-pass: rpcpass
```

- [RabbitMQ cluster](../infra/rabbitmq.md) to connect to
- RabbitMQ cluster to connect to

Set the RabbitMQ connection address (`url`)
and credentials (`queue_user` and `queue_password`)
to match the information from the
[installed RabbitMQ cluster](../infra/rabbitmq.md).

```yml
queue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ The default home directories for different operating systems are:

### 2.2 Update default configurations

- [Bitcoin network](../infra/bitcoind) to run on
- Bitcoin network to run on

Set the `BitcoinNetwork` to match with the information from the
[installed Bitcoin node](../infra/bitcoind.md).

```text
[Application Options]
Expand All @@ -58,6 +61,11 @@ BitcoinNetwork = signet

- Bitcoin node to connect to

Set the Bitcoin node connection address (`RPCHost`)
and credentials (`RPCUser` and `RPCUser`)
to match the information from the
[installed Bitcoin node](../infra/bitcoind.md).

```text
[btcconfig]
; The daemon's rpc listening address.
Expand All @@ -70,7 +78,12 @@ RPCUser = user
RPCPass = pass
```

- [RabbitMQ cluster](../infra/rabbitmq) to connect to
- RabbitMQ cluster to connect to

Set the RabbitMQ connection address (`Url`)
and credentials (`User` and `Password`)
to match the information from the
[installed RabbitMQ cluster](../infra/rabbitmq.md).

```text
[queueconfig]
Expand Down
4 changes: 4 additions & 0 deletions docs/user-guides/bitcoin-staking-testnet-4/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ use our backend.
## Staking via CLI

- [Instructions of staking via CLI](https://github.com/babylonchain/btc-staker/blob/9be9838ca1124b64660dd1bdd57790bd7cc74e11/docs/create-phase1-staking.md).

## Babylon Bitcoin Staking Backend Deployment

- [Instructions of how to deploy the Babylon Bitcoin Staking Backend](./backend-deployment/overview.md)

0 comments on commit 52e7087

Please sign in to comment.