SatLayer
Restake now
  • 🟨Overview
    • Introduction to SatLayer
  • SatLayer on Babylon
  • 🏛️Architecture
    • SatLayer Overview
  • Roadmap
  • Protocol Rewards
  • Slashing
  • SatLayer Contracts
  • 🔓Security
    • Audits
      • Staking App
      • SatLayer Core
      • Cube by SatLayer
    • Contracts
      • Staking App
      • SatLayer Core
      • Cube by SatLayer
    • Bug Bounty
  • 🪙Restakers
    • How to Restake
    • Sats² Staker Rewards
      • Earning Sats²
      • Monthly Sats² Sprints
      • Referral Guide
      • Sats² FAQs
      • Current Campaigns
        • 5 Million Sats² OKX Wallet Giveaway Rewards
        • The Order of the Sats
      • Past Campaigns
        • OKX Cryptopedia
        • Journey to the Sats
        • The Great BTC Meme War
  • Partner Rewards
    • Babylon
    • Bedrock
    • Tower Finance
  • 🎛️Operators
    • Overview
    • 👉Apply as Operator
  • BVS Developers
    • Introduction
  • 👉Apply as Developer
  • SatLayer Testnet
    • Operator Onboarding
    • BVS Onboarding
  • 🧊Cube by SatLayer
    • Introduction
    • Understanding the LST
    • How to Stake
      • Cube and cBABY FAQ
  • 🧰Resources
    • Website
    • Discord
    • Twitter
    • GitHub
    • SatLayer Brand Guidelines
Powered by GitBook
On this page
  • Prerequisites and dependencies
  • Running the Hello World BVS
  • Step 1: Clone repository
  • Step 2: Prepare your environment
  • Step 3: Run or Start the Task Monitor
  • Step 4: Run off-chain process
  • Step 5: Run Aggregator
  • Step 6: Run RewardUploader
  • Step 7: Run TaskCaller

Was this helpful?

  1. BVS Developers
  2. Hello World BVS

Running the BVS

Last updated 5 months ago

Was this helpful?

This guide will walk you through running your own BVS by utilizing our Hello World BVS example.

Prerequisites and dependencies

The Hello World BVS requires a few components from your system. This guide assumes you are using a common Linux distribution with systemd as the init system. If you're using a different setup, we assume you already possess the necessary knowledge to configure your environment appropriately.

  • Golang compiler

  • Working Redis server (By default, the BVS expects it on localhost:6379. However, please feel free to use other addresses and change the configuration accordingly).

  • git

Installing dependencies on Linux

For and other -based system run:

sudo apt-get install redis golang-go

For based systems, run:

sudo pacman -S redis go

For and other based systems:

sudo dnf install golang redis

After installing Redis, you can start the service using the following command:

sudo systemctl start redis.service

It's advisable to check if Redis has started correctly. You can do this by running the following command:

sudo systemctl status redis

You should see the status as active (running), and it should indicate that it is listening on port 6379.

❯ sudo systemctl status redis
● redis.service - Advanced key-value store
     Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; preset: disabled)
     Active: active (running) since Fri 2024-10-11 13:34:21 CST; 2s ago
 Invocation: 7a3a9e4dc334453cb75cc98dd240f5ce
   Main PID: 254535 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 6 (limit: 71906)
     Memory: 8.3M (peak: 9.4M)
        CPU: 28ms
     CGroup: /system.slice/redis.service
             └─254535 "/usr/bin/redis-server 127.0.0.1:6379"

Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.330 # Failed to write PID file: Permission denied
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.330 * Running mode=standalone, port=6379.
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * Server initialized
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * Loading RDB produced by version 7.2.5
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * RDB age 839578 seconds
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * RDB memory usage when created 1.11 Mb
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * Done loading RDB, keys loaded: 172, keys expired: 0.
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * DB loaded from disk: 0.000 seconds
Oct 11 13:34:21 martha redis-server[254535]: 254535:M 11 Oct 2024 13:34:21.331 * Ready to accept connections tcp
Oct 11 13:34:21 martha systemd[1]: Started Advanced key-value store.

Installing dependencies on MacOS

brew install redis

After installing Redis, you can start the service using the following command:

brew services start redis

It's advisable to check if Redis has started correctly. You can do this by running the following command:

brew services info redis

You should see the status as both loaded and running

redis (homebrew.mxcl.redis)
Running: ✔
Loaded: ✔
User: martin
PID: 165415

Running the Hello World BVS

Without deploying your own contract, you will only be able to run the monitor, caller, and the off-chain compute (assuming you have registered as an operator).

Step 1: Clone repository

Clone the repository and cd into it.

git clone https://github.com/satlayer/devnet-hello-world-bvs
cd devnet-hello-world-bvs

Step 2: Prepare your environment

You should firstly edit go.mod in devnet-hello-world-bvs to your cloned satlayer-api lib path:

# Modify go.mod to as satlayer-api is not public yet (will be!)
echo "\nreplace github.com/satlayer/satlayer-api v0.3.0 => /path/to/your/clone/of/devnet-satlayer-api" >> go.mod

Now, start each component in the following sequence.

Each pre-formatted text block should be interpreted as a new terminal session, starting from the root of the Hello World BVS project.

Each program folder contains a env.toml file, which stores configuration for the off-chain programs. To make the Hello World program run successfully, modify your env.toml to point towards your account and use the os keyring backend.

# xxx/env.toml

[owner]
keyringBackend = "os"
keyName = "<your-wallet-name>"

Step 3: Run or Start the Task Monitor

First, run the task monitor. In this example BVS, the monitor continuously tracks and updates the status for display. While this service is not technically required for a BVS, it is useful during development.

cd task
go run main.go monitor

This will initiate the monitor, allowing you to see real-time updates and statuses as tasks are processed in your Hello World BVS.

Step 4: Run off-chain process

Next, run the off-chain process. This program listens for tasks to perform the desired computation.

cd offchain
go run main.go

Step 5: Run Aggregator

Afterwards, you can run the Aggregator, which collects results from the above off-chain process and submits to the blockchain.

cd aggregator
go run main.go

This Hello World BVS example does not need aggregation due to it's simplicity. We implemented it as a demonstration of what can be done. In a more advanced BVS, you can implement your own quorum or other availability schemes, along with additional on-chain capabilities. This approach enhances the reliability and robustness of task processing within the BVS framework.

Step 6: Run RewardUploader

Once you have ran the previous sequence, you can run RewardUploader which listens for finished results, calculates how future rewards should be spread and uploads it to the blockchain.

cd uploader
go run main.go

Step 7: Run TaskCaller

At the last sequence, run TaskCaller. In the real world, this would be a BVS client.

cd task
go run main.go caller

In this Hello World BVS example, it loops and tries to make BVS invocations every few seconds.

We recommend using to install dependencies. Please follow before proceeding. Afterwards, install redis.

Afterwards, please follow the instructions on the to install the Go compiler.

For instructions on configuring the BVS to use alternative accounts, please refer to the section.

🛠️
👉
Ubuntu
Debian
Arch
Fedora
RHEL
Homebrew
Homebrew's installation instructions
Golang install page
deploying a BVS