Skip to content
On this page

Stake Babylon

The boost method creates unsigned transaction for boosting (staking)

  • boost(address, amount): boost specific amount
js
import {Berrachain} from '@everstake/wallet-sdk-berrachain';
import Web3 from 'web3';

const rpc = 'https://some-berrachain-rpc.com';
const privateKey = "1a...02";

const web3 = new Web3(rpc);

// your account
const account = web3.eth.accounts.privateKeyToAccount(privateKey);

// create instance of Berrachain class
const berrachain = new Berrachain('testnet', rpc);

// boost (stake) amount
const boostAmount = '0.00000001';

const txDetails = await bera.boost(account.address, boostAmount);
const nonce = await web3.eth.getTransactionCount(account.address);

const tx = { ...txDetails, nonce };
const signedTx = await web3.eth.accounts.signTransaction(tx, privateKey);
if (signedTx.rawTransaction) {
    const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
    console.log("Transaction receipt:", receipt);
}