Luganodes Docs
TwitterLinkedInMedium
  • Luganodes
  • Native ETH Staking
    • Features
      • Stake
      • Portfolio
  • Custodians
    • Fireblocks
    • Ledger
  • Networks
    • Overview
    • Active Networks
      • Aptos
      • Archway
      • Avail
      • Avalanche
      • bitsCruch
      • Canto
      • Cardano
      • Chiliz
      • Composable Finance
      • Concordium
      • Cosmos
      • Covalent
      • dYdX
      • Eigen Layer
      • Ethereum
      • Elixir
      • Flare
      • Gitopia
      • Kava
      • Kroma
      • Kusama
      • Lukso
      • MultiversX
      • Namada
      • Near
      • Neutron
      • Noble
      • Persistence
      • Polkadot
      • Polygon
      • Radix
      • Ronin
      • River
      • Saga
      • Solana
      • Stride
      • Sui
      • Tenet
      • Tron
      • Ton
      • Vanar
      • Walrus
      • Zilliqa
  • Staking APIs
    • Overview
    • Ethereum
      • Staking Guide
      • Authentication
      • Node Provisioning APIs
      • Consolidation & Switch
      • Exits
      • FAQs
    • Solana
      • Staking Guide
      • Staking
      • Withdrawals
  • TOOLS
    • Ethereum
      • Pectra CLI
    • Hyperliquid
      • Hypermon Monitoring Tool
    • Flare
      • FTSOv2 Monitoring Tool
    • Solana
      • Solana Indexer
    • Berachain
      • Berachain Indexer
Powered by GitBook
On this page
  • Staking
  • Supported Environments
  • Unstaking
  1. Staking APIs
  2. Solana

Staking Guide

Simplifying Solana Staking

PreviousSolanaNextStaking

Last updated 4 days ago

Staking

Staking on Solana involves delegating your SOL to a validator to help secure the network and earn rewards. This is done using the Stake API, which returns an unsigned transaction. You must sign and broadcast this transaction with your wallet's private key. Once confirmed, your SOL is actively staked and starts earning rewards from the next epoch.

Supported Environments

Luganodes supports the following environments on SOL, as defined below

Solana Mainnet

Please contact hello@luganodes.com in order to receive an API key.

Step:

  • Call → sign & broadcast the transaction

Script for signing and broadcasting unsigned stake transaction

import { Connection, Transaction, Keypair } from "@solana/web3.js";
import dotenv from "dotenv";
import bs58 from "bs58";

dotenv.config();

// Connect to the Solana cluster
const connection = new Connection(
  "https://api.mainnet-beta.solana.com",
  "confirmed"
);

const walletKeypair = Keypair.fromSecretKey(
  bs58.decode(process.env.SOLANA_PRIVATE_KEY)
);

const unsignedTransaction = ""; //paste unsigned transaction here

const decodedTransaction = Buffer.from(unsignedTransaction, "base64");

const transaction = Transaction.from(decodedTransaction);
transaction.partialSign(walletKeypair);

(async () => {
  const txSignature = await connection.sendRawTransaction(
    transaction.serialize()
  );
  console.log(`Transaction sent: https://solscan.io/tx/${txSignature}`);
})();

Create a .env file in your project root and add your wallet's private key

Unstaking

Unstaking is a two-step process: Deactivation followed by Withdrawal. First, use the Deactivate API to stop the validator from using your stake—this begins the cooldown period (typically 1 epoch). Once the stake is fully deactivated, use the Withdraw API to transfer your SOL back to your wallet. Both steps return unsigned transactions that must be signed and broadcasted.

Steps:

Script for signing and broadcasting unsigned deactivate and withdraw transaction

import { Connection, Transaction, Keypair } from "@solana/web3.js";
import dotenv from "dotenv";
import bs58 from "bs58";

dotenv.config();

// Connect to the Solana cluster
const connection = new Connection(
  "https://api.mainnet-beta.solana.com",
  "confirmed"
);

const walletKeypair = Keypair.fromSecretKey(
  bs58.decode(process.env.SOLANA_PRIVATE_KEY)
);

const unsignedTransaction = ""; //paste unsigned transaction here

const decodedTransaction = Buffer.from(unsignedTransaction, "base64");

const transaction = Transaction.from(decodedTransaction);
transaction.Sign(walletKeypair);

(async () => {
  const txSignature = await connection.sendRawTransaction(
    transaction.serialize()
  );
  console.log(`Transaction sent: https://solscan.io/tx/${txSignature}`);
})();

Call → sign & broadcast

Wait for deactivation to complete (check with forstatusof stake account if needed)

Call → sign & broadcast the transaction

https://staking.luganodes.com/solana
Deactivate API
Withdraw API
Stake API
Balance API