Developer Overview
SatLayer supports two types of services:
- CosmWasm Contract: Service with deployed on-chain logic, objectively verifiable and irrefutable by the network, driven primarily by the contract code.
- Program-agnostic: Service with a program-agnostic and/or chain-agnostic logic that can be verified by the network, but not necessarily on-chain. This allows a wider range of services that can utilize shared security.
Lifecycle of a Bitcoin Validated Service (BVS)
Regardless of the type of service, the lifecycle of a Bitcoin Validated Service (BVS) is the same. BVS developers integrate with the SatLayer ecosystem through Core Contracts, either directly as EOA or governed through a set (or singular) smart contract.
The two core contracts utilized by BVS for the entire BVS lifecycle are Registry and Vault Router.
BVS Registry
The BVS Registry is a central record-keeping contract for all Operators and Services within the SatLayer ecosystem. It serves as a directory where Operators and Services can register themselves and establish mutual relationships. For on-chain services, the Operator can be queried and asserted to determine if it is validating a Service.
Example for registering a BVS service:
Program-agnostic
We execute service registration duringpub fn instantiate
, but they can be executed at any time in the contract lifecycle, e.g. during pub fn migrate
or pub fn execute
.#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
deps: DepsMut,
_env: Env,
_info: MessageInfo,
msg: InstantiateMsg,
) -> Result<Response, PauserError> {
let register: CosmosMsg = cosmwasm_std::WasmMsg::Execute {
contract_addr: "bbn1qtvnjezrv3fnqvuq869595zq6e2jk0zfhupg52aua0d6ht2a4jjsprqeae".to_string(),
msg: to_json_binary(&bvs_registry::msg::ExecuteMsg::RegisterAsService {
// Metadata of the service
metadata: bvs_registry::msg::Metadata {
name: Some("Squaring".to_string()),
uri: Some("https://the-squaring-company.com".to_string()),
},
})?,
funds: vec![],
}
.into();
Ok(Response::new()
.add_message(register))
}
BVS Vault Router
The BVS Vault Router is a central contract that manages the interaction between vaults and other contracts in the SatLayer ecosystem. As a BVS, the Vault Router coordinates the programmable slashing of vaults, serving as the execution layer for the slashing logic.
Example for initializing a slash:
Program-agnostic
TheCosmosMsg
for slashing requests to the BVS Vault Router contract, this can be called during pub fn execute
.let request_slashing = bvs_vault_router::msg::ExecuteMsg::RequestSlashing(
bvs_vault_router::msg::RequestSlashingPayload {
operator: operator.to_string(),
bips: 1,
timestamp: env.block.time,
metadata: bvs_vault_router::msg::SlashingMetadata {
reason: "Invalid Prove".to_string(),
},
},
);
let slashing_msg: CosmosMsg = cosmwasm_std::WasmMsg::Execute {
contract_addr: "bbn1m2f0ctm657e22p843lgm9pnwlqtnuf3jgln7uyqrw6sy7nd5pc5qaasfud"
.to_string(),
msg: to_json_binary(&request_slashing)?,
funds: vec![],
}
.into();
Next steps
Depending on the type of service you want to build, the next steps are different.