Trust-minimized, pull-based reward claims for FoldingCash
Replace FoldingCash’s trusted monthly token pushes with pull-based claims: an on-chain Merkle root of earned rewards, and a pool contract users claim from with a proof, whenever they choose.
Summary
FoldingCash currently pays Folding@home contributors through trusted monthly distributions. This bounty asks builders to replace them with user-initiated claims that anyone can verify: the operator publishes a Merkle root of earned rewards on-chain, and each user withdraws their share with a proof, whenever they choose. Claim cost no longer grows with the number of users, and the operator has to be trusted far less.
Background
Folding@home (F@H) is a volunteer distributed-computing project. People donate spare CPU/GPU time to simulate protein behavior for disease research, and F@H tracks each contributor’s points. Site: foldingathome.org
FoldingCash (FLDCH) is a CashToken on Bitcoin Cash that rewards F@H contributors in proportion to their folding. It continues the idea behind the earlier Counterparty-era FoldingCoin (FLDC).
Resources
- Website
- folding.cash
- API
- api.folding.cash
- Repositories
- github.com/foldingcash
- Token explorer
- FLDCH on tokenexplorer.cash
- Token category
0adb865ee9cc3038de87fba682e6cd361414edc9acff0da2fd0690d75341c640- F@H stats source
- daily_user_summary.txt.bz2
How it works today
- Linking. A folder updates their F@H username to a token-enabled BCH address, or to the pattern
{name}_{address}. The address is then public in F@H’s own data, so anyone can see which address a user chose. - Data. The FoldingCash API server downloads F@H’s public daily stats file once a day. Download frequency could be increased.
- Rewards. Rewards are released on a per-block schedule and split proportionally by each user’s share of all contributed points, among users who meet the inclusion requirement: their F@H name carries a token-enabled BCH address as described in step 1.
- Payout. About once a month, the operator sends tokens to every eligible user.
Planned: compatibility linking
The token-enabled BCH address in the username remains the preferred method. To let users keep their preferred F@H name, FoldingCash plans compatibility methods for ETH, legacy BTC and plain cashaddress. These are not built yet.
- The API will issue a one-time nonce to authorize each link or update.
- Control of the external address is proven with an off-chain signature. On-chain BCH actions are an alternative being considered for verification.
- FoldingCash will store the mapping and return the BCH address from the API.
- Linking will lag by up to a day with the current download schedule.
The problem
Users must trust the operator, and the cost of paying everyone forces slow, infrequent payouts.
- Trust. Users rely on the operator to read the F@H data correctly, apply the reward formula correctly, and send what they are owed. None of this can be verified on-chain today.
- Scaling and dust. Push cost grows with users × distributions. In the FoldingCoin era, dust became worth more than the rewards for many users. FoldingCash contains costs with monthly drops, which delays everyone’s access to their funds. Monthly pushes also reflect historical choices and infrastructure that do not apply to this project.
Goal and proposed design
Goal: replace trusted monthly pushes with verifiable, user-initiated claims whose cost does not grow with the number of users, so rewards are available sooner. FoldingCash remains the oracle for F@H data. The design below is a starting point, and builders may propose better ones.
daily F@H data → rewards computed → Merkle root of cumulative entitlements committed on-chain → user requests claim → Merkle proof → user’s transaction withdraws tokens
Requirements
- Root publication. FoldingCash publishes a Merkle root of (address, cumulative earned) per epoch.
- Pool contract. Holds the reward tokens and verifies the proof on each claim. Funds have no expiry, so users can claim whenever they like.
- Double-claim prevention. BCH has no global contract state, so the likely approach is a per-user receipt NFT created at first claim, with the claimed total in its commitment.
- Root-update timelock. A new root becomes claimable only after a delay, so watchers can audit it first.
- No claim threshold, user-funded dust. A user can claim any amount at any time. The claiming user supplies the dust their tokens need, which is the fee the operator pays today when pushing, so the operator’s cost per user drops to zero. The operator’s optional push path keeps a minimum push threshold.
- Reference transaction-building code and a demo. A chipnet demo with a few hundred leaves, plus a cost comparison against the current push model.
Infrastructure
The monthly push exists partly because supporting infrastructure does not exist yet. Builders may include any of the following:
- A proof-serving endpoint (an extension of the existing API, or a static file host) so wallets can fetch a user’s proof.
- A simple claim UI or CLI.
- Optional auto-claim. A user opts in, and a relayer submits the claim once their balance crosses a threshold they choose. Funds can only go to the user’s own address, so the model stays non-custodial.
Stretch goals
- Cumulative-only roots, so a new root supersedes the old one and users can skip epochs.
- A watcher that recomputes the root from the public F@H daily file and flags mismatches. This needs each epoch’s input snapshot (or its hash) to be published alongside the root.
- Independently verifiable links for compatibility users. Publish each link’s evidence (signature, nonce, and any on-chain action) or a commitment to it alongside the root, so a watcher can verify the mapping without trusting FoldingCash’s database. Builders should propose the mechanism.
- An optional operator push path, available only after a long timelock and subject to a minimum push threshold.
- Analysis of Merkle depth and VM limits for the target user count.
Open questions for builders
Proposals for these are part of what makes a strong submission.
- Epoch cadence. Daily, weekly or monthly roots.
- Scale. The maximum number of leaves the design must support.
- Root authority. A single operator key, or multisig / threshold updates.
- Receipt NFT. The commitment layout.
- Leaf contents. Whether each leaf should record which linking method produced its address, so a watcher knows which entries it can verify from public F@H data and which depend on FoldingCash’s mapping.
- Link verification. Whether compatibility links are verified off-chain with signatures or through on-chain BCH actions.
Trust boundaries
This bounty makes the operator’s output auditable; it does not remove the operator. These parts remain trusted in the initial version:
- The F@H daily stats file is taken as given.
- FoldingCash applies its inclusion requirements.
- For users of the planned compatibility methods, FoldingCash’s stored mapping is a trust point. Users who put a BCH address in their F@H username today are fully verifiable from F@H’s public data.
The root-update timelock and the watcher exist to make mistakes in these steps visible before funds move.
Success criteria
A submission succeeds when it delivers working contracts, transaction-building code and a chipnet demo covering the required items above, with documentation another BCH developer could extend. Stretch items strengthen a submission but are not required.
Sponsor contact
Miguel Molina Jr (StrungSafe), creator of FoldingCash.
- Telegram: @strungsafe
- Discord: strungsafe
Available for questions during the hackathon (November 14–22). Brief, specific questions are welcome, and he would like to keep working with builders after the event.