Skip to main content

Spinning up a new LSD

The Liquid Staking Derivative (LSD) Network allows anyone to join an LSD as a node operator or a staker depending upon the conditions of that specific LSD. In case someone wants to create their own LSD and would like to have conditions that suit their need, the LSDN factory allows them to do so.

The LSD Network is deployed on Goerli Testnet currently. You can find the deployment addresses here

To spin up your own LSD, the easiest way is to use the LSD Wizard SDK

Assuming that you’ve got a basic node js project created, follow these steps to proceed.

Pre-installations

yarn add typescript typechain @typechain/ethers-v5 @types/lodash

Installing the libraries

yarn add @blockswaplab/lsd-wizard ethers@5.7.2

ethers library will be needed to create provider and signer instances.

Importing the libraries

const { ethers } = require('ethers');
const { Wizard } = require('@blockswaplab/lsd-wizard');
// or import Wizard
// import { Wizard } from '@blockswaplab/lsd-wizard';

Initializing the SDK

The SDK uses ethers.js library and it is recommended to use this library to create a provider and a signer instance, required for signing the transaction.
You can use any provider API that you want from this list. For this tutorial, Infura is used.

const provider = new ethers.providers.InfuraProvider('goerli', {
projectId: INFURA_PROJECT_ID,
projectSecret: INFURA_PROJECT_SECRET,
});
const ethersSigner = new ethers.Wallet(PRIV_KEY, provider);

Once the provider and signer instances are created, next initialize the Wizard SDK.

const wizard = new Wizard({
signerOrProvider: ethersSigner,
});

The Wizard SDK also takes other parameters as input but they are optional. To spin up a new LSD, the only required parameter is the signer instance.

Using the SDK to deploy new LSD

The LSD Wizard SDK exposes functions inside various sub-class. For this tutorial, use the deployer sub-class as shown below.

const tx = await wizard.deployer.deployNewLiquidStakingDerivativeNetwork(
daoAddress,
stakehouseTicker,
commission, // optional
gateKeeping, // optional
);

daoAddress: Any Ethereum address that will have ownership rights of the LSD.
stakehouseTicker: 3-5 character long name for the LSD.
commission: Optional commission percentage that LSD takes from node operator’s revenue. This value is represented as uint256 in the LSDN Factory.
gateKeeping: Optional gatekeeping. If set to true, allows only certified node operators to join your LSD network. One can build their own verification logic on top of gatekeeping. If set to false, anyone can become a node operator.

Script

const { ethers } = require('ethers');
const { Wizard } = require('@blockswaplab/lsd-wizard');

const main = () => {

const provider = new ethers.providers.InfuraProvider("goerli", {
projectId: INFURA_PROJECT_ID,
projectSecret: INFURA_PROJECT_SECRET
});
const ethersSigner = new ethers.Wallet(PRIV_KEY, provider);

const wizard = new Wizard({
signerOrProvider: ethersSigner
});

const tx = await wizard.deployer.deployNewLiquidStakingDerivativeNetwork(
daoAddress,
stakehouseTicker,
commission, // optional
gateKeeping // optional
);
console.log(“tx:, tx);
};

Getting the LSD data

Once the above transaction is confirmed, head over to LSD Subgraph and run the following query to get your LSD specific information. Replace the $ticker with your stakehouseTicker to get the results.

If you had deployed in LSD v1, then run the same query on LSD v1 Subgraph

{
liquidStakingNetworks(where:{ticker:$ticker}) {
id
ticker
commission
optionalGatekeeper
feeRecipientAndSyndicate
savETHIndex
dao
savETHPool
feesAndMevPool
}
}