Skip to content

Aneizi/sol-devnet-staking

Repository files navigation

Sol Devnet Staking

A minimal dApp to connect a Solana wallet and stake SOL to a validator on devnet. Built with Next.js, @solana/web3.js, and the Solana wallet adapter. Uses the free public devnet RPC (api.devnet.solana.com).

Run it

pnpm install
pnpm dev

Open http://localhost:3000.

Stake in 5 steps

  1. Switch your wallet to devnet. Phantom: Settings → Developer Settings → Testnet Mode → Devnet. Solflare: Settings → Network → Devnet.

  2. Connect your wallet. Click Select Wallet in the top-right.

  3. Get devnet SOL. Click Airdrop 1 SOL. (You need ~0.003 SOL for rent + fees on top of whatever you stake.)

  4. Pick a validator and stake.

    • Choose a validator from the dropdown (sorted by total stake).
    • Enter the amount of SOL.
    • Click Stake to Validator and approve the transaction.
  5. Wait one epoch. Your stake account appears in Your stake accounts with status activating. Devnet epochs are ~1–2 hours; once it flips to active, you're earning rewards.

Unstake

  1. Click Deactivate on the stake account. Approve the tx.
  2. Wait for the next epoch — status flips to inactive.
  3. Click Withdraw to send the SOL back to your wallet.

States

State Meaning
activating Delegated; will activate at next epoch boundary
active Earning rewards
deactivating Cooling down; withdrawable at next epoch
inactive Ready to withdraw

Project layout

src/
├── app/                    Next.js App Router pages + layout
├── components/
│   ├── wallet-provider.tsx ConnectionProvider(devnet) + WalletProvider
│   ├── wallet-button.tsx   WalletMultiButton (client-only)
│   ├── status-banner.tsx   Tx status toasts
│   └── staking-dashboard.tsx All staking UI + hooks
└── lib/
    ├── format.ts           lamports → SOL helpers
    └── staking.ts          Build create+delegate / deactivate / withdraw txs

Notes

  • Every successful tx links to https://explorer.solana.com (devnet) so you can inspect it on chain.
  • Devnet airdrops are rate-limited. If Airdrop 1 SOL fails, wait a minute and try again, or use https://faucet.solana.com.
  • The dApp creates a new stake account for each stake action. You can have many.

About

Stake devnet SOL through your extension wallet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors