Deploying a BVS
This section guides you through the steps needed to deploy your custom Hello World BVS from scratch, including setting up the required environment, building your contract, and utilizing CLI commands efficiently to modify and inspect your BVS deployment.
Setting up wallets
At a minimum, you'll need four wallets, which we will name: bvs-owner, bvs-operator, bvs-aggregator.
The easiest way to create these wallets is through the babylon command. Please refer to our babylon command guide for installation details.
To create the wallets, run the following commands in a terminal:
babylond keys add bvs-owner
babylond keys add bvs-operator
babylond keys add bvs-aggregatorOptionally, you can create a bvs-user wallet if desired.
babylond keys add bvs-userNext, fund each account with tokens to cover gas and fees in the later steps.
NOTICE: Ensure that your keys have enough tokens to send transactions and register the BVS/Operator.
Build and deploy the BVS Contract
Prerequisites
Rust: Ensure you've installed Rust in your computer.
Install Rust by https://rustup.rs/.
Docker: Docker is used to compile CosmWasm contract. You should install it in your computer.
Read this doc to install CosmWasm.
CosmWasm: Read the CosmWasm Documentation to set up the environment.
Babylond: Ensure you've installed
babylondcommand line toolSee babylon guide
Satlayer CLI: Ensure you've installed
satlayer-cliSee our satlayer-cli guide
For this tutorial, you will need to install jq since we use it to extract information from the JSON responses returned by Babylon nodes.
Build Hello World BVS Contract
Here are the steps to clone the repository, compile the contract, and run tests:
Step 1: Clone the Repository
Step 2: Move to the Contract Directory
Step 3: Compile the Contract:
Step 4: Locate the Compiled WASM File
The compiled WASM file will be found at:
The checksums.txt file contains the SHA256 hash of the WASM file.
Step 5: Install Rust
It's recommended to have both versions of Rust:
The version provided in Docker have optimizations to help CosmWasm reduce it's size and gas cost.
The version installed on your system, which is easier to use during coding and testing.
Step 6: Run Tests
Execute all tests in the contract by running the following command outside of Docker:
Make sure all tests pass before proceeding with the next steps.
Deploying Hello World BVS Contract
Step 1: Upload the contract to Babylon Testnet
The following is an example output of the command.
On success, no error message should show up and txHash printed. This transaction hash can be used on our block explorer to view details about the transaction. (For instance: upload code tx)
code_id can be acquired from the explorer by scrolling near the end of the JSON section. Next, find "attributes". In this case, our code_id is 44.

Alternatively, you can use the following command to query and extract code_id directly from the node.
For example:
Step 2: Instantiate the contract:
You can click this link to view the instantiate tx hash in our blockchain explorer.
Step 3: Get contract address
The contract address can be acquired by an API call to the node.
For example:
Step 4: Register the BVS contract to BVS directory
This command will return 3 txHash, use the Register bvs success txHash to get bvs_hash in tx_repsonse/events/wasm field as follows:

Alternatively, you can use the following command:
For example, the 40ec465b57ea30cbf7045f423731830f31d7aa56bf9fa6e4b20cae11309b3d18 is our BVS hash.
Register operator to DelegationManager and BVSDirectory
The approver has no active role in the operation of a BVS (but in accepting stakes from stakers). Approver address is optional, if you don't it, don't need to write it.
Manual interaction with the BVS
If you'd like to delve into the specifics of the BVS, here are instructions for manually interacting with it through the command line. However, we DO NOT anticipate that most users will require this.
Execute the contract
In actual, you don't need to manual to respond to task, because it's called by aggregator program automatically. You can view the create_new_task and respond_to_task tx information in our blockchain explorer.
Query the contract data
Upgrade the contract
CosmWasm supports contract upgrade by via the migrate command. You should add migrate function in your contract like this.
You should do the following steps:
Upload a new contract to testnet
Get the code id
Execute the following commands:
In addition, you should set --admin when you execute first instantiate command. This helps upgrade the contract without changing contract address.
Pointing off-chain programs to the new BVS
With the BVS contract uploaded and instantiated, you can now modify the Hello World BVS to point at your contracts and aggregator.
Point the bvsHash to the BVS hash you get from the above contract deployment step. Please make sure to change the owner settings to use the bvs-aggregator key you have created earlier.
The same change is needed for bvs_offchain/env.toml. But this time point it towards the operator.
Now, modify task/env.toml to point it to the bvs-user account (or use the operator account if you decided to skip that).
Running the BVS programs
You should firstly edit go.mod in devnet-hello-world-bvs to your cloned satlayer-api lib path:
The same approach outlined in the Hello World BVS documentation can be applied to launch the newly configured BVS. Here, we'll present a streamlined version.
First, start Redis and the aggregator.
Next, run the off chain compute process.
Afterwards, start the task caller to start the BVS.
You should start seeing tasks and results appearing after a few seconds. Congratulations, you've successfully deployed your own BVS!
Last updated
