
How does stETH use clever contract design to automatically distribute earnings daily?
TechFlow Selected TechFlow Selected

How does stETH use clever contract design to automatically distribute earnings daily?
Although the account has no transactions, the amount of stETH is increasing.
By: ZAN Team
After exchanging my limited amount of ETH for stETH, I noticed that the stETH balance grows naturally every day, continuously generating returns. Yet, I didn't see any transactions recorded in my account—why is this? This article will explore the clever design behind this mechanism and reveal the secret of how staking rewards are distributed.

One stETH has already accumulated some yield over the past few days
Before diving in, let’s briefly review how stETH earns yield—the core concept being Ethereum staking. Readers familiar with this can skip ahead.

Originally, like Bitcoin, Ethereum used Proof of Work (PoW) as its consensus mechanism. However, due to concerns around energy consumption and limitations in security and scalability, Ethereum transitioned to Proof of Stake (PoS) in September 2022.
Instead of relying on computational power to achieve network consensus, Ethereum now incentivizes users to participate by staking ETH to gain voting rights and earn rewards through PoS, thus maintaining network security.
By staking 32 ETH, users can join the Ethereum network as validators responsible for storing data, processing transactions, and adding new blocks to the blockchain. As long as they correctly package transactions into new blocks and verify other validators’ work, they receive ETH rewards—effectively allowing staked ETH to generate relatively stable returns.
However, this model presents challenges for ordinary users: not only is 32 ETH a high barrier to entry, but it also requires running dedicated hardware online 24/7. Additionally, staked ETH loses liquidity during the staking period. To address these issues, Liquid Staking Derivatives (LSDs) were introduced. LSDs lower participation barriers and restore liquidity by allowing users to stake less than 32 ETH without running their own nodes. Instead, users delegate ETH to third-party services (like Lido or Rocket Pool) and receive liquid staking tokens (e.g., stETH or rETH). These tokens represent ownership and can be freely traded, lent, or used across DeFi platforms—enabling users to earn staking rewards while maintaining capital flexibility.

In essence, when you deposit ETH into Lido, Lido uses your ETH to participate in Ethereum’s PoS consensus and generates yield. In return, you receive stETH as a receipt. The next step is how Lido distributes the generated rewards back to stETH holders.
We observe that stETH yields update automatically each day. The image below shows our test results—daily yield accruals can be verified directly in your crypto wallet.

At this point, those familiar with smart contract development might wonder: distributing such small daily rewards could cost more in gas fees than the reward itself.
Indeed, if Lido distributed rewards via direct token transfers to thousands of addresses daily, the gas costs would be prohibitive. Intuitively, sending tokens to countless wallets would incur astronomical transaction fees.
Yet somehow, Lido manages to make stETH balances grow automatically in users’ wallets—with no visible transactions. How is this achieved?
We examined Lido’s contract at https://etherscan.io/token/0xae7ab96520de3a18e5e111b5eaab095312d7fe84 and traced the `balanceOf` method:

`balanceOf` is an ERC-20 standard function used by wallets to query a user’s token balance.
Notice that the stETH contract calls `getPooledEthByShares` inside `balanceOf`. This function takes input from `mapping (address => uint256) private shares;`, which tracks how many "shares" each user holds. But clearly, this does *not* represent the actual stETH balance—if it did, every address’s balance would need constant updates. While batch updates via a single transaction are possible, they’d still consume massive amounts of gas.
By now, you may have guessed how the contract actually works. Let’s examine the `getPooledEthByShares` method:

The final result is calculated as: `(sharesAmount * _getTotalPooledEther()) / _getTotalShares()`.
Here, `_getTotalPooledEther` represents the total amount of pooled ETH (equivalent to total stETH, assuming a 1:1 peg), and `_getTotalShares` is the total number of shares issued. Therefore, each address’s stETH balance is dynamically computed on-the-fly rather than stored statically.
For example, suppose there are 1,000 total shares (`_getTotalShares`) and 1,000 stETH-equivalent ETH (`_getTotalPooledEther`). If Address A holds 100 shares, its stETH balance is: `100 × 1,000 / 1,000 = 100 stETH`.
Now, when Lido stakes the pooled 1,000 ETH and earns 1 ETH in rewards, `_getTotalPooledEther` increases to 1,001. Recalculating A’s balance: `100 × 1,001 / 1,000 = 100.1 stETH`.
In short: each user’s share count remains fixed, but the value per share increases over time—automatically increasing their effective stETH balance without any direct token transfer.
Looking deeper into the code, `_getTotalPooledEther` is updated via the `handleOracleReport` function, which is periodically called by an external oracle contract at https://etherscan.io/address/0x852deD011285fe67063a08005c71a85690503Cee. This oracle submits staking report data (via `submitReportData`), triggering `handleOracleReport` in the Lido contract to update the total pooled ETH and total shares:

As shown, this update occurs daily—explaining why your stETH balance changes daily even though no transactions appear in your wallet history.
This illustrates a key feature of Ethereum ERC-20 contracts: token balances aren’t always pre-written to addresses—they’re often computed dynamically via contract functions. As a result, a wallet can show changing token balances without any incoming or outgoing transactions. While this design enhances flexibility, it can confuse users unfamiliar with smart contract mechanics. We hope this article helps deepen your understanding of how smart contracts work—and enables safer interactions with them.
Lastly, while staking ETH as stETH offers seemingly stable returns, risks remain. This article serves only as a technical analysis of staking contracts and does not constitute investment advice.
Join TechFlow official community to stay tuned
Telegram:https://t.me/TechFlowDaily
X (Twitter):https://x.com/TechFlowPost
X (Twitter) EN:https://x.com/BlockFlow_News














