Skip to content

Staking Module Development for Chains, Protocols and Apps

Protofire builds staking contracts for chains and protocols, and staking flows inside apps. Both record each position from stake through unbonding to withdrawal, and the client's Safe holds each admin key. We built KyberDAO's pool-master proxy contract in 2020 and a Safenet staking interface in 2026.

Diego Torres

Reviewed by Diego Torres, Offer Owner at ProtofireLast reviewed: November 2026

On this page
  1. Overview
  2. Why Protofire
  3. What you get
  4. How it runs
  5. How work starts
  6. Not the right fit
  7. Related guides and services
  8. FAQ

Work shipped for 60+ networks and 95+ protocols, including

  • Chainlink
  • Ethereum
  • Solana
  • Safe
  • Ripple
  • Aave

Two staking failures that look like small bugs

Staking module development deals with two failures that look like small bugs. One is a record that is ahead of the chain, and the other is a contract role that nobody renounced. For example, a staker asks to leave and your app already says "withdrawable", but the chain says the tokens are still bonded.

On a Cosmos SDK chain, a delegator who unbonds can still be slashed for the whole UnbondingTime, for offenses committed while bonded (Cosmos SDK). Solana rejects a new delegation while stake is still cooling down (Anza). A dashboard that marks such a position withdrawable overstates what will arrive, and so does the firm's ledger behind the dashboard.

A second failure is in the contract roles. In OpenZeppelin Contracts 5.x, a TimelockController administers itself, plus an optional admin named at deployment (TimelockController.sol). Until that admin renounces its role, the admin can grant and revoke roles without the delay. Stakers who joined under one fee or lock rule are then exposed to whoever holds that key.

This delay protects the users of the smart contract by giving them time to review the maintenance operation and exit the system if they consider it is in their best interest to do so.
OpenZeppelin, Access Control documentation, Contracts 5.x, OpenZeppelin Contracts · Library documentation, read November 2026

Who owns each layer of a staking build

Stakers sign their own stakes and withdrawals. Your Safe holds the contract roles. The network decides bonding, unbonding and penalties. Where an app stakes through a provider, the provider runs the validators.

Stakers, or the firm's custody

Stakers' wallets or the firm's custody

Stakers or the firm's custody sign each stake, unstake, claim and withdrawal that the flow prepares. They also hold the Solana withdraw authority or the Ethereum withdrawal address.
The client's Safe and governance

Contract roles

These roles cover owner and upgrade rights, the minimum stake, lock and fee settings, and pause. They also include the key that funds rewards or posts a reward root, behind a timelock where you want a delay.
Protofire builds

Staking and delegation contracts

The contracts take stakes and delegations, hold the unbonding queue and the reward ledger, and emit an event for each state change.

Staking flow, indexer and position records

The flow prepares each transaction for signing. The indexer keeps one record per on-chain position and turns chain and contract events into states.
The network and its provider

Validators, provider API and staking protocol

Validators run consensus and hold validator signing keys, and the protocol bonds, unbonds and penalizes by the chain's rules. Where an app uses Kiln, Figment or Blockdaemon, that provider's validators and API are part of the validator layer.

Our staking record: KyberDAO in 2020 and Safenet in 2026

Kyber Network named Protofire for staking work in 2020, and the Safe Foundation named Protofire for staking work in 2026.

The KyberDAO pool-master proxy contract, built in 2020

Protofire built the pool-master proxy contract for KyberDAO staking in 2020, during KyberDAO's launch preparations (case study). Kyber Network's post of 28 May 2020 thanked Protofire for "professional support" on a "trustless smart contract proxy" for non-custodial KNC staking and voting delegation. KNC holders delegated their voting power to a pool operator's contract. The operator voted for the holders and, in the repository's words, had "no control over their KNC or ETH rewards". The code is public on GitHub, with the MIT license and a v1.0.0 audit report. Stake Capital later built staking products on that code. Kyber's ecosystem report of June 2020 described the proxy contracts Protofire built for KyberDAO pool operators.

The Safenet staking interface, built in 2026

In its Q3 2026 report, the Safe Ecosystem Foundation lists Protofire among the teams it signed grant agreements with to build independent Safenet staking interfaces. Protofire built an alternative interface for staking SAFE on Safenet, and that grant supported the development (GitHub). The interface reuses staking, rewards and withdrawal logic from the Foundation's open-source interface, and it calls the same contracts. The repository calls the interface an independent project and not an official Safe product. The interface's code is public. From the KyberDAO and Safenet builds, Protofire applies the role design, the claim records and the staker-facing interface to new staking work.

What you get from staking module development

A chain or protocol gets the staking contracts.An app on a network's own staking gets the flow, the position records and the interface.

Staking contracts and a screen your auditor can follow

Your stakers get a screen built on recorded amounts and states. Protofire builds stake, delegate, redelegate and unstake functions for your token, operator or pool contracts. We also write tests for each path your terms name, including a stake after a slash and an unstake during a pause.

Position records that match the chain

Your dashboard stops promising a withdrawal the chain has not released. A position reads pending, active, unbonding, withdrawable, withdrawn or slashed, and it moves to a new state on a finalized chain or contract event. Protofire builds the unbonding queue and an indexer keyed by UnbondingID, stake account or validator index. The indexer keeps one record per request, from the request to the withdrawal.

Checks that catch a retry or a mismatched address

A timeout, a retry or a wallet's speed-up does not create a second position. Protofire's flow reads the signer's nonce or the stake account on chain before it prepares anything new. The flow also lists each hash tied to a position. On Ethereum, the flow decodes the deposit data a provider returns. It checks that the credentials in that data name the address the staker chose. The flow makes this check because the first deposit for a validator key fixes the credentials (consensus specs).

Slashing penalties recorded per position

When a slash occurs, each affected position, active or unbonding, shows a slashed state with the amount and the event behind it. Protofire builds the indexer to read the slash event a Cosmos SDK chain emits. On Ethereum, the indexer reads the status and balance a beacon node reports (Beacon API). Where your rules define a contract penalty, the indexer reads your contract's own penalty event.

Reward ledgers that trace each amount to an event

Each staker sees accrued, claimable and claimed amounts, and each amount traces to an event. Protofire builds one of three reward ledgers, chosen with you. The first is a per-share index with direct claims. The second is a Merkle root posted each period, with a proof per staker. The third is a pool share whose redemption value moves. Your key funds the rewards or posts the root. For the Merkle ledger, Protofire builds the service that computes each period's root, and your staff deploy that service in your environment.

Parameter changes that give stakers notice

A fee or lock change reaches stakers with notice, and a pending value shows before the change takes effect. Minimum stake, lock or unbonding length, fee and pause each have a named holder, behind your Safe or a timelock. Protofire writes the parameter register and sets each delay against the unbonding period. We also flag each upgrade or pause path that skips the delay.

How a staking module build with Protofire runs

The work starts from your staking rules and ends with a deployment your Safe controls.You send the chain, the token, your unbonding, penalty and fee rules, and the Safe that will hold the contract roles.

  1. Step 1

    A role table in the first proposal

    The first proposal names the holder of each contract role and each timelock role. It also sets each parameter delay against the unbonding period. Where you want a delay, a TimelockController owns the contracts. Protofire creates the TimelockController with no optional admin, so it administers itself. Its proposer and canceller roles go to your Safe.
  2. Step 2

    Contracts, indexer and flow tested against the chain

    Protofire writes the contracts, the indexer and the flow, with tests for each path your terms name. Each position record is checked against the chain's own entries.
  3. Step 3

    An audit firm you choose reviews the code

    You choose the audit firm. Protofire hands the firm the test suite and the parameter register, and we fix what the firm finds. An audit lowers risk, but it does not promise code free of bugs.
  4. Step 4

    Deployment from your key

    The deployment runs from your key. Your Safe holds each admin, upgrade and parameter role from the deploy transaction on. The key that funds the reward pool or posts a reward root is also yours, and a service you own uses that key.
  5. Step 5

    The roles and keys you hold after launch

    After launch, Protofire holds no admin, upgrade, parameter, pause or reward role. In app staking, the staker or the firm's custody holds the Ethereum withdrawal address. The same holder keeps the Solana stake and withdraw authorities and a Cosmos SDK delegator's account. Whoever runs the signer holds the validator signing keys. The signer may be run by the firm, by its provider, or by Protofire where a validator operations scope puts the signer on our machines.

How work with Protofire starts

Protofire's shared terms apply to a staking build, and how we work gives the detail.

Proposal
In writing, one business day after the discovery call: findings, a plan in phases and the first step we recommend.
Price
Fixed per phase when you commission it, against written acceptance criteria. Overruns inside them are ours to absorb, invoices follow delivered milestones, and you can stop at any phase boundary. Anything we operate after launch is priced in the proposal as its own recurring line, with the notice to end it.
Ownership
Code we write for you, contracts, the keys and credentials this work creates and the accounts your infrastructure runs in are yours by contract, within the license of any third-party software involved. Keys that a custody platform or a staking provider holds under its own key model stay with it under your contract; every other custody key stays with you or the custodian you appoint. Where the scope places something on servers we rent, it says what moves to you and when. An NDA is available from your first message, and we sign a data processing agreement (DPA) together with it.
After launch
Delivery closes with a hypercare window and a defect warranty, with their terms written into the proposal. A service we operate continues under its written scope until that scope ends.
Access
Read-only by default. A role that can start requests only if your written scope names one; never a signer, approver, administrator, key holder or recovery role on your contracts, wallets or custody platform. Services we build call each platform on credentials your staff issue and keep in your vault. Anything that approves or moves funds runs in your environment, and a scope under which we operate a service lists every write call it makes. Where the scope has us operate nodes, validators, monitors, explorers or indexers, it names the role and any key we hold on those servers, and in your own cloud account you can remove it.
Licenses
Protofire is an engineering firm and holds no financial or crypto-asset license; licensed activity stays with you and your providers.

How we work shows a worked proposal.

When a staking module build does not fit

A staking module build records stakes held in your own contracts or app.Receipt tokens, vote locks, a single provider connection and a chain whose stock modules already fit each need a different build.

Open source we’ve shipped

The Protofire repositories behind this page.

Part of 190+ open-source repositories from Protofire

FAQ

What is staking module development?
Staking module development is the engineering of the contracts and app flow that record a stake from deposit through unbonding to withdrawal. Protofire builds it in two ways. For a protocol's own token, we build staking, delegation, an unbonding queue and a reward ledger. For an app on a network's own staking, we build transaction preparation, position records and an indexer.
Who can build staking contracts for a protocol, or a staking flow for a wallet or fintech app?
Protofire builds both. For protocols, Protofire's record is the KyberDAO pool-master proxy contract (2020) and a Safenet staking interface (2026). For an app on Ethereum, Solana, a Cosmos SDK chain or Polkadot, we build the in-app flow and one record per on-chain position. We also build the connection to a provider such as Kiln, Figment or Blockdaemon. The stake runs on the network's own staking.
What happens to an unbonding position when its validator is slashed, and who bears the loss?
An unbonding position can still be slashed. Under the chain's rules, the loss falls on the staked tokens. The Cosmos SDK says delegators who unbond remain slashable for the whole UnbondingTime, for offenses committed while their tokens were bonded (x/staking). A staking build from Protofire keeps the position open to penalties and writes a slashed state with the amount and the chain's event. The build records a slash, but it neither prevents the slash nor makes good the loss. Where a contract penalty exists, your rules say who bears it.
Can a lock period or fee change reach stakers who are already in?
A lock period or fee change reaches existing stakers after the delay that the contracts set, and not before. Each parameter change runs through your Safe, and a timelock or a notice counted in epochs holds the change back. Where the delay is longer than the unbonding period, a staker who disagrees can leave first. Where the delay is shorter, the change applies to positions opened after the change.
Who signs a user's stake and withdrawal in an app?
The user's wallet or the firm's custody signs each stake and withdrawal. On Solana, the stake authority delegates and deactivates, and the withdraw authority moves tokens out (Anza). On Ethereum, an exit can start from the withdrawal address without a validator signing key (ethereum.org). The flow that Protofire builds prepares each transaction, and the user or the firm keeps the signer.
Who audits the staking contracts?
An outside audit firm that you choose audits the staking contracts before launch. Protofire hands the auditor the test suite and the parameter register, and we fix the findings. The KyberDAO pool-master proxy contract keeps its v1.0.0 audit report in its public repository.
Do you also run the validators?
Validator operations are a separate Protofire service, offered under a written scope or as a setup for your own team. Protofire runs no validators under its own name or stake today, so there is no Protofire validator to delegate to. The staking build reads validator state and holds no validator key. Our validator operations page describes that service.

Get a proposal

Tell us what you are building. An engineer reads it, we have a short call, and the written proposal follows within one business day.

Luis MedeirosField CTO, reads every request · LinkedIn

A demo or repository link also works.