Warning
The SDK is a work in progress and is currently under audits. Breaking changes may occur in SDK updates as well as backward compatibility is not guaranteed. Use with caution.
Symbiotic Relay is a peer-to-peer side-network designed to collect and aggregate signatures from validators, maintain validator sets on the settlement contract.
To achieve that, Symbiotic provides a set of predefined smart contracts, in general, representing the following modules:
- VotingPowerProvider - provides the basic data regarding operators, vaults and their voting power, it allows constructing various onboarding schemes such as:
- OperatorsWhitelist - only whitelisted operators can register
- OperatorsBlacklist - blacklisted operators are unregistered and are forbidden to return back
- OperatorsJail - operators can be jailed for some amount of time and register back after that
- SharedVaults - shared (with other networks) vaults (like the ones with NetworkRestakeDelegator) can be added
- OperatorVaults - vaults that are attached to a single operator can be added
- MultiToken - possible to add new supported tokens on the go
- OpNetVaultAutoDeploy - enable auto-creation of the configured by you vault on each operator registration
- Also, there are ready bindings for slashing and rewards
- KeyRegistry - verifies and manages operators' keys; currently, these key types are supported:
- ValSetDriver - is used by the off-chain part of the Symbiotic Relay for validator set deriving and maintenance
- Settlement - requires a compressed validator set (header) to be committed each epoch, but allows verifying signatures made by the validator set; currently, it supports the following verification mechanics:
- SimpleVerifier - requires the whole validator set to be inputted on the verification, but in a compressed and efficient way, so that it is the best choice to use up to around 125 validators
- ZKVerifier - uses ZK verification made with gnark, allowing larger validator sets with an almost constant verification gas cost
- Network - a standard contract that can be used as a "network" address across the Symbiotic ecosystem, it enables verifiability of delays for different actions (e.g., change of the middleware or change of the resolver)
Can be found here.
Security audits can be found here.
Clone the repo:
git clone --recurse-submodules https://github.com/symbioticfi/middleware-sdk.git
cp .env.example .env
Key parameters:
OPERATORS
- number of operators in networkVERIFICATION_TYPE
- signatures aggregation type, (0 for ZK, 1 for simple)
Before running off-chain nodes need to set up on-chain contract.
To simplify local development, we've prepared a Docker image with an Anvil node and deployed Symbiotic contracts.
docker build -t symbiotic-anvil .
docker run --rm -d -p 8545:8545 --env-file .env --name symbiotic-node symbiotic-anvil
Use the right generate_genesis
file depending on your system here.
docker run --rm -it --env-file .env --network host symbiotic-anvil yarn deploy:network
This command will execute a list of transactions to set up network contracts.
In execution logs, you can see the deployed configuration and contract addresses.
docker stop symbiotic-node
forge test
forge coverage