Staking Guide
Simplifying Solana Staking
Staking
Supported Environments
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}`);
})();Unstaking
Script for signing and broadcasting unsigned deactivate and withdraw transaction
Last updated