# Stake Hardhat Script This will allow you to stake your validator using the Stakehouse and LSD wizard SDK. Below we have prepared a hardhat script to do this. Modify as you wish but it should work after injecting your deposit data file etc. Instructions: - Use "@blockswaplab/lsd-wizard": "2.0.0" - Use "@blockswaplab/stakehouse-sdk": "4.4.4" Script: ``` const { StakehouseSDK } = require('@blockswaplab/stakehouse-sdk'); const { Wizard } = require('@blockswaplab/lsd-wizard'); async function main() { const [account] = await ethers.getSigners(); console.log(`Using ${account.address}`); const blsPublicKey = '0xaaa933a0c6e7200a64f2e71c53587f5ce3bee3a8b42fba1c0b20220a57a118ffec27990de842e067bfd168dfe33e0f9f' const sdk = new StakehouseSDK(account) const status = await sdk.utils.getValidatorLifecycleStatus(blsPublicKey) console.log('status', status.toString()) const wizard = new Wizard({signer: account}) const aaxlLiquidStakingNetwork = (await wizard.contractInstance).liquidStakingManager('0xb0c5ed6e891b2c6718c5fbef8ccdb59ad87b51d4'); // AAAXL liquid staking manager const keystorePassword = '' const keystore = {} const depositData = [] //const depositorSignature = await sdk.utils.getPersonalSignInitials(account, depositData[0].pubkey, depositData[0].signature, account.address) // or await sdk.utils.getPersonalSignInitialsByPrivateKey() const depositorSignature = await sdk.utils.getPersonalSignInitialsByPrivateKey(depositData[0].pubkey, depositData[0].signature, '<ecdsa_private_key>') // or await sdk.utils.getPersonalSignInitials() const result = await sdk.BLSAuthentication( keystorePassword, keystore, depositData, depositorSignature ) let tx = await aaxlLiquidStakingNetwork.stake( [blsPublicKey], [`0x${result.cipher_text}`], [result.encryptor_aes_key], [ { deadline: 0, v: result.v, r: `0x${result.r}`, s: `0x${result.s}` } ], [ `0x${result.deposit_data[0].deposit_data_root}` ] ) console.log('tx.hash', tx.hash) } main() .then(() => process.exit(0)) .catch(error => { console.error(error); process.exit(1); }); ``` # Mint derivatives ``` const { StakehouseSDK } = require('@blockswaplab/stakehouse-sdk'); const { Wizard } = require('@blockswaplab/lsd-wizard'); async function main() { const [account] = await ethers.getSigners(); console.log(`Using ${account.address}`); // use a node from quick node // i.e: https://light-dark-sunset.discover.quiknode.pro/1c2409e5e53068997dd77a855bfafab573c7bec1/ const beaconChainNodeUrl = '' const blsPublicKey = '' const sdk = new StakehouseSDK(account) const status = await sdk.utils.getValidatorLifecycleStatus(blsPublicKey) console.log('status', status.toString()) const wizard = new Wizard({signer: account}) const aaxlLiquidStakingNetwork = (await wizard.contractInstance).liquidStakingManager('0xb0c5ed6e891b2c6718c5fbef8ccdb59ad87b51d4'); // AAAXL liquid staking manager const report = await sdk.balanceReport.getFinalisedEpochReport( beaconChainNodeUrl, blsPublicKey ) const result = await sdk.balanceReport.authenticateReport(beaconChainNodeUrl, report) console.log('result', result) let tx = await aaxlLiquidStakingNetwork.mintDerivatives( [`0x${result.report.blsPublicKey}`], [ { ...result.report, blsPublicKey: `0x${result.report.blsPublicKey}`, withdrawalCredentials: `0x${result.report.withdrawalCredentials}` } ], [ { deadline: result.deadline, v: result.v, r: `0x${result.r}`, s: `0x${result.s}` } ] ) console.log('tx.hash', tx.hash) } main() .then(() => process.exit(0)) .catch(error => { console.error(error); process.exit(1); }); ```