๐Ÿงช

LazorKit

Devnet
โ† Back to Home
๐Ÿฅฉ

Gasless Liquid Staking with Marinade

Stake SOL for mSOL with zero gas fees via LazorKit

โš ๏ธ

Devnet Notice

This demo runs on Solana Devnet. Liquidity pool depth may vary, affecting unstake fees.

๐Ÿค Marinade x LazorKit

Liquid staking with LazorKit smart wallet integration.

โœ“Stake SOL and receive mSOL (liquid staking token)
โœ“mSOL value grows as staking rewards accrue
โœ“Gas fees sponsored by LazorKit Paymaster
โœ“Use mSOL in DeFi while earning staking rewards

What is mSOL?

mSOL is Marinade's liquid staking token. When you stake SOL with Marinade, you receive mSOL in return.

Unlike regular staking, mSOL is liquid โ€” you can trade it, use it in DeFi, or unstake at any time.

The mSOL/SOL exchange rate increases over time as staking rewards accrue.

๐Ÿ’ฐ Token Account Rent

On your first stake, Solana creates an mSOL token account which requires a one-time rent deposit of ~0.002 SOL.

This rent is fully reclaimable if you close the account later. The LazorKit paymaster covers gas fees, but rent is paid from your SOL balance.

Making Marinade Work with LazorKit

1.Get Transaction from Marinade SDK

Initialize Marinade and build the stake/unstake transaction:

const config = new MarinadeConfig({
  connection,
  publicKey: new PublicKey(wallet.smartWallet),
});
const marinade = new Marinade(config);

// Build stake transaction
const { transaction } = await marinade.deposit(
  new BN(amount * LAMPORTS_PER_SOL)
);
2.Remove ComputeBudget Instructions

LazorKit manages compute budget automatically. Remove any ComputeBudget instructions from the SDK:

const COMPUTE_BUDGET_PROGRAM = new PublicKey(
  'ComputeBudget111111111111111111111111111111'
);

const instructions = transaction.instructions.filter(
  ix => !ix.programId.equals(COMPUTE_BUDGET_PROGRAM)
);
3.Add Smart Wallet to All Instructions

LazorKit's execute_cpi validates that the smart wallet is present in ALL instruction account lists:

instructions.forEach((ix) => {
  const hasSmartWallet = ix.keys.some(
    k => k.pubkey.toBase58() === wallet.smartWallet
  );
  if (!hasSmartWallet) {
    ix.keys.push({
      pubkey: new PublicKey(wallet.smartWallet),
      isSigner: false,
      isWritable: false
    });
  }
});
4.Send via LazorKit
await signAndSendTransaction({
  instructions,
  transactionOptions: { computeUnitLimit: 400_000 }
});

๐Ÿ’ก This pattern applies to most Solana protocols when integrating with LazorKit

What You'll Learn

  • โœ“Integrate Marinade SDK with LazorKit
  • โœ“Process external SDK transactions for LazorKit
  • โœ“Fetch real-time quotes from Marinade state
  • โœ“Display liquid staking token (mSOL) balances

Connect Your Wallet

Use LazorKit smart wallet for gasless staking