Skip to main content
Staking and Delegation hero

Overview

Starkzap supports Starknet’s native staking protocol. Validators run pools where delegators can stake tokens and earn rewards. What users can do with staking:
  • 💰 Earn passive income - Stake tokens (like STRK) and earn rewards over time, similar to a savings account with interest
  • 🏦 Support network security - Stake tokens to help secure the Starknet network while earning rewards
  • 📈 Grow their holdings - Rewards compound over time, allowing users to increase their token holdings without additional purchases
  • Flexible participation - Add more tokens anytime, claim rewards when ready, and exit when needed (with a cooldown period)
Real-world analogy: Think of staking like putting money in a high-yield savings account or certificate of deposit (CD). You lock up your tokens for a period, and in return, you earn interest (rewards). The longer you stake, the more you can potentially earn.
Staking contract is selected automatically from chain-aware presets. You only need staking.contract if you want to override the default.

Configuration

Staking works out of the box when using a supported chain preset:
Optional override:

Discovering Validators and Pools

Using Validator Presets

Getting Stakeable Tokens

Getting Pools for a Validator

Entering a Pool

Stake tokens for the first time in a validator’s pool. The SDK handles the token approval automatically.
This will:
  1. Approve the staking contract to spend your tokens (if needed)
  2. Call enter_delegation_pool on the staking contract
  3. Return a transaction you can track
Use wallet.stake() when you don’t want to branch on membership manually:
wallet.stake() automatically:
  • calls enter_delegation_pool for first-time stakers
  • calls add_to_delegation_pool for existing members

Adding to an Existing Stake

If you’re already a pool member, add more tokens:

Claiming Rewards

Users earn rewards continuously while their tokens are staked. Rewards accumulate over time and can be claimed at any time:
What users get: Rewards are paid in the same token they staked (e.g., if you stake STRK, you earn STRK rewards). Users can claim rewards and either:
  • Withdraw them to their wallet
  • Re-stake them to compound earnings (add them back to the pool)

Exiting a Pool (Two-Step Process)

Exiting a pool is a two-step process with an exit window:

Step 1: Declare Exit Intent

Tokens stop earning rewards immediately:

Step 2: Complete Withdrawal

Wait for the exit window, then complete the withdrawal:

Querying Position

Get detailed information about your staking position to show users their earnings:
What this shows users:
  • How much they’ve staked (their original investment)
  • How much they’ve earned in rewards (their passive income)
  • Their total position value (staked + rewards)
  • When they can withdraw if they’ve initiated an exit

Position Interface

Checking Membership

Getting Commission Rate

Using Transaction Builder

The transaction builder makes it easy to combine staking operations with other actions:
The .stake() method automatically:
  • Calls enter_delegation_pool for new members
  • Calls add_to_delegation_pool for existing members

Staking Flow Examples

Complete Staking Flow

Here’s a complete example showing how users can stake, earn, and manage their position:

Monitoring Rewards

Show users their earnings and help them claim rewards:
User experience: Users can see their earnings growing in real-time, claim rewards whenever they want, and watch their total position value increase over time.

User Benefits Summary

What users can do with staking in your app:
  • 💰 Earn passive income - Stake tokens and earn rewards automatically, like interest on a savings account
  • 📈 Grow their holdings - Rewards accumulate over time, increasing their total token balance
  • 🔄 Flexible management - Add more tokens anytime, claim rewards when ready, exit when needed
  • 🏦 Support the network - Help secure Starknet while earning rewards
  • ⏱️ Set and forget - Once staked, tokens earn rewards in the background without daily management
Real-world use cases:
  • Savings feature - Let users “save” their tokens and earn interest
  • Investment tool - Enable users to grow their crypto holdings over time
  • Rewards program - Users can stake tokens to earn additional rewards
  • Long-term holding - Encourage users to hold tokens by offering staking rewards

Best Practices

  1. Always check pool membership before calling addToPool
  2. Monitor rewards regularly and show users their earnings
  3. Help users understand exit windows before initiating exit
  4. Use transaction builder to batch staking with other operations
  5. Override staking contract only if needed (custom deployments, forks, or private environments)
  6. Display earnings clearly - Show users their staked amount, earned rewards, and total position value

Troubleshooting

”No staking contract configured for chain …”

The SDK has no staking contract for the current chain, or you set a custom staking.contract that doesn’t match. Remove the override to use the built-in preset, or set the correct contract for your network.

Pool Not Found

Ensure you’re using the correct pool contract address. Use getStakerPools() to discover available pools.

Next Steps