⚠️ Development Notice: This SDK is currently under active development and testing. It is not recommended for production use at this time. For updates and documentation, please refer to our official documentation.
The SSV SDK is a TypeScript library for interacting with the SSV (Secret Shared Validator) network, enabling distributed validator operations on Ethereum.
The SDK consists of four main modules:
- Clusters: Manage validator clusters, handle deposits, and register validators
- Operators: Interact with network operators and manage operator relationships
- API: Access network data, query states, and retrieve operational information
- Utils: Helper functions for keyshare validation, share generation, and other utilities
# Using npm
npm install ssv-sdk ssv-keys viem
# Using yarn
yarn add ssv-sdk ssv-keys viem
# Using pnpm
pnpm install ssv-sdk ssv-keys viem
import { SSVSDK, chains } from 'ssv-sdk'
import { createPublicClient, createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
const chain = chains.mainnet // or chains.holesky
const transport = http()
const publicClient = createPublicClient({
chain,
transport,
})
const account = privateKeyToAccount('0x...')
const walletClient = createWalletClient({
account,
chain,
transport,
})
const sdk = new SSVSDK({
publicClient,
walletClient,
})
// Query operators
const operators = await sdk.api.getOperators({
operatorIds: ['220', '221', '223', '224'],
})
// Get owner nonce
const nonce = await sdk.api.getOwnerNonce({
owner: 'your_wallet_address',
})
import { parseEther } from 'viem'
// Deposit to cluster
await sdk.clusters.deposit(
{
id: 'your_cluster_id',
amount: parseEther('30'),
},
{
approve: true, // Auto-approve token if needed
},
)
To register validators, you'll need to:
- Create shares from your keyshares JSON file
- Register the validator using the created shares
import { parseEther } from 'viem'
// Your keyshares JSON file containing the validator's data
import keyshares from 'path/to/keyshares.json'
// First, validate and create shares from your keyshares
try {
const result = await sdk.utils.validateSharesPreRegistration({
operatorIds: ['220', '221', '223', '224'],
keyshares,
})
// Register validators using the clusters API
const receipt = await sdk.clusters
.registerValidators({
args: {
keyshares: result.available,
depositAmount: parseEther('2'),
},
})
.then((tx) => tx.wait())
} catch (e) {
// something went wrong
}
For detailed documentation and examples, visit our official documentation.