Search…
⌃K

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 applications.

Installation

// Yarn
yarn add https://github.com/bloxapp/ssv-keys.git
// NPM
npm install https://github.com/bloxapp/ssv-keys.git

Methods

Import Keystore and operator data

import { ISharesKeyPairs, SSVKeys } from 'ssv-keys';
const keystore = require('./test.keystore.json');
const operators = require('./operators.json');
const operatorIds = require('./operatorIds.json');
const keystorePassword = 'testtest';

Keystore Method

Returns a validator key from an existing Keystore file.
const ssvKeys = new SSVKeys();
const privateKey = await ssvKeys.getPrivateKeyFromKeystoreData(keystore, keystorePassword);

KeyShares Method

Returns KeyShares (SharesPublicKey & SharesEncrypted) from a validator key and set of operator keys.
const threshold: ISharesKeyPairs = await ssvKeys.createThreshold(privateKey, operatorIds);
const shares = await ssvKeys.encryptShares(operators, threshold.shares);

Register Validator Payload Method

Returns the registerValidator() transaction payload from a validator key and set of operator keys
const payload = await ssvKeys.buildPayload(
threshold.validatorPublicKey,
operatorIds,
shares,
123456789,
);
console.log(payload);