Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

Setting Up a Non-Custodial Staking Pool for Your DAO

A technical guide for developers to build a staking pool where users delegate assets to a community validator while retaining custody. Covers contract design, reward mechanisms, and integration with liquid staking protocols.
Chainscore © 2026
introduction
GUIDE

Setting Up a Non-Custodial Staking Pool for Your DAO

This guide explains how to deploy a secure, non-custodial staking pool for your DAO, allowing members to stake tokens without surrendering custody.

A non-custodial staking pool is a smart contract that allows users to deposit and lock tokens to earn rewards while retaining full control of their assets. Unlike custodial models where a central entity holds the keys, the staked funds are managed by immutable, on-chain logic. For a DAO, this is critical for building trust and aligning incentives. Popular implementations use standards like ERC-20 for the staking token and often ERC-721 for representing staking positions as NFTs, enabling composability with other DeFi protocols.

The core architecture involves three main contracts: a staking token (the asset being staked), a reward token (the incentive distributed), and the staking pool logic itself. The pool contract must handle key functions: stake(uint256 amount), withdraw(uint256 amount), and claimRewards(). Security is paramount; the contract should be free from reentrancy vulnerabilities, use checks-effects-interactions patterns, and have a clear reward distribution mechanism, often using a rewardPerTokenStored variable that accrues over time based on total staked supply.

To deploy, you'll first write and test your staking contract. Using a framework like Hardhat or Foundry is recommended. A basic staking function might look like this:

solidity
function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
    require(amount > 0, "Cannot stake 0");
    stakingToken.safeTransferFrom(msg.sender, address(this), amount);
    _stakes[msg.sender] += amount;
    _totalSupply += amount;
    emit Staked(msg.sender, amount);
}

The updateReward modifier is crucial for calculating a user's accrued rewards before their stake balance changes.

After thorough testing and auditing, you'll deploy the contract to your target network (e.g., Ethereum Mainnet, Arbitrum, Optimism). The DAO treasury, typically a Gnosis Safe multi-sig, should be set as the contract owner to manage parameters like the reward rate. You must then fund the staking contract with the reward tokens and configure the emission schedule. Transparency is key: document the contract address, audit reports, and reward details in your DAO's governance forum for member review before launching.

Once live, integrate the staking pool with your DAO's front-end using a library like wagmi or ethers.js. Users can connect their wallets (like MetaMask) to view their stake, pending rewards, and execute transactions. For ongoing management, the DAO can use Snapshot for off-chain signaling or its on-chain governance to vote on proposals adjusting reward rates or migrating to new contract versions, ensuring the pool evolves with the community's needs.

prerequisites
FOUNDATION

Prerequisites and Required Knowledge

Before deploying a non-custodial staking pool for your DAO, you must establish a secure technical and operational foundation. This section outlines the essential skills, tools, and conceptual understanding required.

A non-custodial staking pool is a smart contract that allows a DAO to manage pooled assets from its members without ever taking custody of the funds. Unlike a centralized service, the logic for deposits, rewards, and withdrawals is encoded in immutable, on-chain code. You need a solid grasp of Ethereum Virtual Machine (EVM) fundamentals, including how transactions, gas, and state changes work. Familiarity with the concept of a multi-signature wallet or a DAO treasury module (like Safe{Wallet}) is also crucial, as this will be the ultimate owner and beneficiary of the pool's fees.

Your primary development tools will be a smart contract language and a testing framework. Solidity is the standard, and you should be comfortable with its syntax, security patterns, and common vulnerabilities (reentrancy, integer overflows). You will write and test your contracts using Hardhat or Foundry, which provide local blockchain networks, debugging, and script execution. Essential companion skills include using Node.js and npm/yarn for package management, and Git for version control. You'll also need a basic understanding of ERC-20 tokens, as your staking pool will mint and burn a derivative token representing a user's share.

You must decide on the core economic parameters your pool will enforce. This includes the staking token (e.g., your DAO's governance token or a stablecoin), the reward token (which could be the same asset or a different one), and the reward distribution mechanism. Will rewards be compounded automatically or claimed manually? What is the fee structure for the DAO treasury (e.g., a 10% performance fee on rewards)? These decisions must be codified in your contract's logic. Furthermore, understanding oracle integration (e.g., Chainlink) is necessary if your reward calculations depend on external price data or off-chain events.

Security is paramount. You must be prepared to conduct rigorous audits before mainnet deployment. This involves writing comprehensive unit and integration tests with Hardhat/Waffle or Forge/Foundry, aiming for 95%+ test coverage. You should understand common testing patterns for staking contracts, such as simulating time jumps to test reward accrual. Planning for a multi-phase deployment on a testnet (like Goerli or Sepolia) is non-negotiable. You will also need a small amount of testnet ETH to pay for gas during deployment and dry runs. Consider using a verification service like Etherscan's Solidity Flattener to publish your contract source code publicly.

Finally, operational knowledge is required for post-deployment management. You must know how to interact with your deployed contract using a library like Ethers.js or Viem, either through custom scripts or a front-end interface. The DAO will need a process for upgrading the contract if you use a proxy pattern (like OpenZeppelin's TransparentUpgradeableProxy), which involves careful coordination via governance. Preparing documentation for your community on how to stake, claim rewards, and withdraw is the final step in ensuring a successful launch.

architecture-overview
SMART CONTRACT ARCHITECTURE OVERVIEW

Setting Up a Non-Custodial Staking Pool for Your DAO

This guide outlines the core contract architecture for building a secure, non-custodial staking pool where DAO members can stake tokens to earn rewards without surrendering custody of their assets.

A non-custodial staking pool is a foundational DeFi primitive for DAOs, enabling community participation while minimizing custodial risk. Unlike centralized models, the smart contract logic manages staking, rewards, and slashing without ever taking permanent ownership of user funds. The core architecture typically involves three key contracts: a staking token (often an ERC-20), a rewards distributor, and the main staking pool contract. This separation of concerns enhances security and upgradability, a critical consideration for long-lived DAO treasuries.

The staking pool's state is managed by several crucial data structures. A mapping like mapping(address => uint256) public userStakes tracks each participant's locked balance. A totalStaked variable maintains the global sum. For reward calculation, the contract often uses a "reward per token" accumulator pattern, storing a cumulative rewardPerTokenStored value and a lastUpdateTime timestamp. This design efficiently calculates owed rewards for any staker at any time without expensive iteration, a gas optimization essential for Ethereum mainnet deployment.

Reward distribution mechanics are central to the system's incentive model. A common approach is to fund the pool with reward tokens, which are then emitted over time based on a schedule or a rewards-per-second rate. The StakingRewards contract by Synthetix is a canonical reference implementation. When a user calls stake(uint256 amount), their tokens are transferred via safeTransferFrom and their reward debt is updated. The getReward() function calculates the user's accrued rewards using the difference between the current and their last recorded rewardPerToken value, then sends the tokens.

To enforce protocol rules, you must implement slashing logic for security or behavior violations. This is often done by allowing a privileged role (governed by the DAO) to call a slash(address user, uint256 amount) function, which reduces the user's staked balance and transfers the slashed tokens to a treasury or burn address. This function must carefully update the reward accounting to prevent exploitation. Always use the Checks-Effects-Interactions pattern and consider time-locks on slashing authority to align with DAO governance best practices.

Finally, the architecture must integrate with the DAO's governance system. The staking contract should have role-based access control, typically using OpenZeppelin's AccessControl, where the DEFAULT_ADMIN_ROLE is held by a timelock or governor contract like OpenZeppelin Governor or Compound's Governor Bravo. This allows the DAO to vote on parameter changes such as the reward rate, staking duration, or slashing conditions. The contract should emit clear events like Staked, Withdrawn, RewardPaid, and Slashed for off-chain indexing and transparency.

design-choices
ARCHITECTURE

Key Design Choices and Considerations

Building a non-custodial staking pool for a DAO involves critical technical and governance decisions. These choices define security, scalability, and long-term sustainability.

05

Smart Contract Audit & Security

Non-custodial pools hold significant value, making security the top priority. A rigorous process is non-negotiable.

  • Audit Scope: Budget for multiple audits from reputable firms before mainnet launch.
  • Bug Bounty Program: Establish a public program on platforms like Immunefi to incentivize white-hat hackers.
  • Time-locked Upgrades: Implement a delay (e.g., 48-72 hours) on governance-executed upgrades to allow for community review.
$50M+
Avg. Bug Bounty
06

Monitoring & Risk Management

Operational oversight to ensure pool health and respond to incidents. This is an ongoing requirement.

  • Validator Performance: Monitor uptime, commission changes, and governance proposals from validators.
  • Slashing Alerts: Set up real-time alerts for any slashing events on your pool's validators.
  • Economic Security: Track the pool's total stake relative to the network to assess centralization risks.
DAO STAKING OPTIONS

Liquid Staking Protocol Integration: Lido vs. Rocket Pool

Comparison of leading liquid staking protocols for DAOs considering non-custodial staking pool setup.

Feature / MetricLidoRocket Pool

Protocol Architecture

Permissioned Node Operator Set

Permissionless Node Operator Network

DAO Governance Token

LDO

RPL

Staking Token Issued

stETH

rETH

Minimum Stake for Node Operators

Not applicable (permissioned)

16 ETH + 1.6 ETH worth of RPL

DAO Integration Fee

10% of staking rewards

15% of RPL inflation (node operator commission)

Smart Contract Audits

Time to Full Withdrawal

1-5 days

~2.5 days

Current Total Value Locked (TVL)

$20B

$3B

step-by-step-implementation
IMPLEMENTATION GUIDE

Setting Up a Non-Custodial Staking Pool for Your DAO

A technical walkthrough for deploying a secure, self-custodied staking pool using smart contracts, enabling your DAO to manage member contributions and rewards without relying on a third-party custodian.

A non-custodial staking pool is a smart contract-based system where users deposit assets to earn rewards, but the contract—not a central entity—holds the funds. For a DAO, this is critical for trust minimization and transparency. Unlike centralized services, the pool's logic is enforced on-chain, and users retain control via withdrawal functions. The core components are a staking token (like your DAO's governance token), a reward token (which can be the same), and a set of rules for distributing rewards over time, often using a staking derivative model to represent a user's share.

The first step is designing the contract architecture. A standard implementation involves two main contracts: a StakingPool contract that handles deposits/withdrawals and an RewardsDistribution contract that manages reward accrual. Key functions to implement include stake(uint256 amount), withdraw(uint256 amount), claimRewards(), and getRewardBalance(address user). Security is paramount; you must guard against common vulnerabilities like reentrancy attacks using the checks-effects-interactions pattern and ensure proper access control, typically with OpenZeppelin's Ownable or AccessControl libraries.

Here is a simplified code snippet for a basic staking function using Solidity and OpenZeppelin's SafeERC20:

solidity
function stake(uint256 amount) external nonReentrant {
    require(amount > 0, "Cannot stake 0");
    totalStaked += amount;
    stakedBalance[msg.sender] += amount;
    // Using SafeERC20 for safe transfer
    stakingToken.safeTransferFrom(msg.sender, address(this), amount);
    // Mint staking derivative token to represent share
    _mint(msg.sender, amount);
    emit Staked(msg.sender, amount);
}

This function updates state before interacting with external tokens, a critical security practice.

After development, you must test thoroughly and audit the contracts. Use a framework like Hardhat or Foundry to write comprehensive unit and integration tests covering edge cases: zero-value transfers, reward calculation accuracy, and multiple user interactions. Once tested, deploy the contracts to a testnet (like Sepolia or Goerli). Use a verifiable deployment script that sets initial parameters: the staking and reward token addresses, reward emission rate (e.g., 100 tokens per block), and any timelock durations for withdrawals. Tools like OpenZeppelin Defender can help automate and secure this process.

Finally, integrate the staking pool with your DAO's frontend and governance. Create a simple interface using a library like wagmi or ethers.js that connects users' wallets (e.g., MetaMask) to the deployed contract addresses. The DAO treasury, controlled via a multisig or governance contract like Governor Bravo, should be configured to fund the rewards distributor. Establish clear governance proposals for adjusting parameters like the emission rate or adding new reward tokens. Document the contract addresses and ABI on your DAO's documentation portal, such as using Docusaurus, to ensure transparency for all members.

reward-mechanisms
TUTORIAL

Setting Up a Non-Custodial Staking Pool for Your DAO

A guide to deploying a secure, on-chain staking pool that allows DAO members to stake tokens and earn rewards without relinquishing custody.

A non-custodial staking pool is a smart contract that holds user-deposited tokens for a defined purpose, such as governance participation or protocol security, while allowing users to retain ownership and withdraw at any time. Unlike custodial models, the DAO or pool operator never gains control of the staked assets. The core contract logic handles user deposits, tracks individual shares via an internal accounting system (like balanceOf), and calculates proportional rewards. This model is fundamental for building trustless, transparent incentive mechanisms in DAOs, as seen in protocols like Lido (for liquid staking) and Curve (for gauge voting).

The architecture typically involves three key contracts: a staking token (the asset users deposit), a reward token (distributed to stakers), and the main staking pool contract. The pool must securely manage two core states: the total staked amount and each user's share. A common pattern uses a _balances mapping and a _totalSupply variable. When rewards are distributed, they are often added to a virtual rewards pool, and users claim their accrued share based on their stake proportion over time. It's critical to use a pull-over-push pattern for rewards to prevent gas-based denial-of-service attacks and reentrancy vulnerabilities.

To implement basic staking, start with a contract that inherits from OpenZeppelin's ReentrancyGuard and ERC20 (to represent staking shares). The stake(uint256 amount) function should transfer tokens from the user to the contract using safeTransferFrom and mint corresponding staking shares. The withdraw(uint256 shareAmount) function burns shares and returns the staked tokens. For reward distribution, a common method is to have an external notifyRewardAmount(uint256 reward) function, callable only by the DAO treasury, which updates a rewardRate and a rewardPerTokenStored accumulator. Users then call a claimRewards() function to transfer their accrued rewards.

Here is a simplified code snippet for the core staking logic using Solidity 0.8.x:

solidity
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract NonCustodialStakingPool is ReentrancyGuard {
    IERC20 public stakingToken;
    IERC20 public rewardToken;
    uint256 public totalStaked;
    mapping(address => uint256) public userStake;
    
    constructor(address _stakingToken, address _rewardToken) {
        stakingToken = IERC20(_stakingToken);
        rewardToken = IERC20(_rewardToken);
    }
    
    function stake(uint256 amount) external nonReentrant {
        require(amount > 0, "Cannot stake 0");
        stakingToken.transferFrom(msg.sender, address(this), amount);
        userStake[msg.sender] += amount;
        totalStaked += amount;
        // Emit event
    }
    
    function withdraw(uint256 amount) external nonReentrant {
        require(userStake[msg.sender] >= amount, "Insufficient stake");
        userStake[msg.sender] -= amount;
        totalStaked -= amount;
        stakingToken.transfer(msg.sender, amount);
        // Emit event
    }
    // Reward distribution logic would be added here
}

Beyond basic functionality, consider implementing fee mechanisms to fund DAO operations. A typical model applies a small percentage fee on claimed rewards (e.g., 5-10%), which is diverted to the DAO treasury. This fee should be transparently calculated within the claimRewards() function. For security, the contract should have a timelock or multi-signature control for critical parameters like the fee percentage or reward duration. Always conduct a thorough audit, as staking contracts are high-value targets. Use established libraries like OpenZeppelin and consider integrating with snapshotting tools (e.g., ERC-20Votes) if staking confers governance power.

Finally, deploy and verify your contract on a testnet like Goerli or Sepolia first. Use a framework like Hardhat or Foundry to write comprehensive tests covering edge cases: zero-value transactions, reward calculations after multiple stakes and withdrawals, and fee accrual. Once live, provide clear documentation for your DAO members on how to interact with the contract via a UI or directly through Etherscan. A well-designed non-custodial pool enhances DAO participation by aligning incentives without compromising member sovereignty over their assets.

NON-CUSTODIAL STAKING

Security Risks and Mitigations

Setting up a non-custodial staking pool for your DAO introduces unique security considerations. This guide addresses common developer questions and pitfalls related to smart contract architecture, key management, and operational security.

The most critical vulnerability is a single point of failure in access control. This often manifests as an over-privileged owner or admin role that can upgrade the contract, withdraw funds, or change staking parameters without delay.

Common flaws include:

  • A single EOA (Externally Owned Account) holding the DEFAULT_ADMIN_ROLE.
  • Missing timelocks for privileged functions.
  • Lack of a multi-signature wallet requirement for sensitive operations.

Mitigation: Implement a decentralized governance model using a DAO treasury multisig (like Safe) as the contract owner. Use OpenZeppelin's AccessControl with clearly defined roles (e.g., REWARD_MANAGER, PAUSER). Enforce a 24-72 hour timelock for all administrative functions using a contract like TimelockController.

NON-CUSTODIAL STAKING POOLS

Frequently Asked Questions

Common technical questions and solutions for DAOs implementing self-hosted staking infrastructure.

The fundamental difference is key management. In a custodial pool, a single entity (like an exchange) controls the validator's signing keys, holding custody of user funds. A non-custodial pool uses a smart contract as the validator's withdrawal address and often employs a Distributed Validator Technology (DVT) cluster or multi-party computation (MPC) to manage signing keys. This means:

  • User funds are never pooled into a central wallet; they are directly staked.
  • Exit and withdrawal authority is programmatically enforced by the smart contract, not a person.
  • Slashing risk is distributed and mitigated through fault-tolerant architectures like Obol or SSV Network.
conclusion
IMPLEMENTATION SUMMARY

Conclusion and Next Steps

You have successfully configured a non-custodial staking pool for your DAO, establishing a transparent, community-aligned incentive mechanism.

Your deployed staking contract now provides a secure foundation for governance participation. Key security features you have implemented include a timelock on pool withdrawals, a slashing mechanism for malicious proposals, and a multi-signature wallet for treasury management. These elements mitigate risks like rug pulls and ensure that staked assets are governed by the DAO's collective will. The contract's non-custodial nature means users retain custody of their staked tokens, interacting only with the immutable logic on-chain.

For ongoing operations, you must establish clear processes. This includes defining the criteria for a successful governance proposal that releases rewards, setting the slashing penalty percentage for bad actors, and scheduling regular reward distribution epochs. Tools like Snapshot for off-chain voting signaling and Tally for on-chain governance execution can integrate with your staking pool. Monitor key metrics such as Total Value Locked (TVL), participant count, and proposal pass/fail rates to gauge ecosystem health.

To extend functionality, consider integrating with other DeFi primitives. You could allow staked tokens to be used as collateral in lending protocols like Aave via a wrapper contract, or implement a veToken model where longer lock-ups grant greater voting power. For advanced use cases, explore layer-2 solutions like Arbitrum or Optimism to reduce gas fees for participants, or use a staking vault from Balancer to automate reward compounding.

The next critical step is a comprehensive security audit. Engage a reputable firm such as Trail of Bits, OpenZeppelin, or CertiK to review your contract's code, economic incentives, and access controls. Share the public audit report with your community to build trust. Simultaneously, develop clear documentation for end-users explaining how to stake, vote, and claim rewards, possibly using a tool like Docusaurus for a developer-friendly docs site.

Finally, focus on sustainable growth. Use the staking pool to bootstrap liquidity for your DAO's native token by pairing it in a DEX liquidity pool with rewards. Plan iterative upgrades based on community feedback, utilizing a proxy upgrade pattern for your staking contract to allow for future improvements without migrating staked assets. Your non-custodial pool is now a core piece of infrastructure, aligning long-term incentives and decentralizing control over your project's future.

How to Set Up a Non-Custodial Staking Pool for a DAO | ChainScore Guides