Key Distributer SDK
The SSV Key Distributor SDK is a JS/TS library that enables developers to integrate the distribution of validator keys to KeyShares to their application.


// Yarn
yarn add
// NPM
npm install


Keystore Method (optional)

Returns a validator key from an existing Keystore file.
// Imports
import { EthereumKeyStore } from 'ssv-keys'
// Get the private key from the keystore using the keystore password
// Get required data from the keystore file
const keyStore = new EthereumKeyStore(JSON.stringify(keystore));
// Get public key using the keystore password
const publicKey = await keyStore.getPublicKey(keystorePassword);
// Get private key using the keystore password
const privateKey = await keyStore.getPrivateKey(keystorePassword);
// Log the public key
console.debug('Public Key: ' + publicKey);
// Log the private key
console.debug('Private Key: ' + privateKey);

KeyShares Method

Returns KeyShares (SharesPublicKey & SharesEncrypted) from a validator key and set of operator keys.
// Build the shares
// Imports
import { Encryption, Threshold } from 'ssv-keys'
import { encode } from 'js-base64'
const operators = require('./operators.json');
// Initialize the Threshold class
const thresholdInstance = new Threshold();
// Create the threshold instance using the private key
const threshold = await thresholdInstance.create(privateKey);
// Build the shares using an array of operator public keys
let shares = new Encryption(operators, threshold.shares).encrypt();
// Loop through the operators RSA keys and format them as base64
shares = => {
share.operatorPublicKey = encode(share.operatorPublicKey);
// Return the operator key and KeyShares (sharePublicKey & shareEncrypted)
return share;

Register Validator Payload Method

Returns the registerValidator() transaction payload from a validator key and set of operator keys
// Build transaction payload
// Imports
import { encode } from 'js-base64'
import { Web3 } from 'web3'
const operatorIds = require('./operatorIds.json');
// Initialize the web3 class
const web3 = new Web3();
// Loop through the operators and encode them as ABI parameters
const operatorsPublicKeys = => web3.eth.abi.encodeParameter('string', encode(operator)));
// Get all the public keys from the shares
const sharePublicKeys = => share.publicKey);
// Get all the private keys from the shares and encode them as ABI parameters
const shareEncrypted = => web3.eth.abi.encodeParameter('string', share.privateKey));
// Token amount (liquidation collateral and operational runway balance to be funded)
const tokenAmount = web3.utils.toBN(123456789).toString(); /
// Return all the needed params to build a transaction payload
return [
Copy link