6.2. 0.2% Keeper Bounty
The 0.2% Keeper Bounty is the economic engine that powers the decentralized automation of the Fhenix-FairMarket protocol. By converting the auction finalization function (triggerFinalize) into a public, incentivized action, the protocol removes reliance on centralized internal infrastructure. Instead, it creates a competitive, self-sustaining market where external Keepers (such as Gelato, Chainlink, or independent bots) are economically motivated to ensure auctions close exactly at their scheduled endTime.
This mechanism guarantees protocol liveness: even if the core development team’s servers fail, the economic reward ensures that independent actors will step in to finalize auctions, process CoFHE requests, and settle trades.
Core Design Principles
| Principle | Technical Implementation |
|---|---|
| Decentralized Liveness | triggerFinalize() is public. Any actor can call it, removing single points of failure. |
| Success-Based Reward | The bounty is only paid upon successful execution. If the transaction reverts (e.g., auction not ended), the caller pays gas but receives no bounty, preventing DoS attacks. |
| First-Come-First-Served | The reward is allocated to the single successful caller (msg.sender) per auction. This naturally discourages “gas wars” as the incentive is fixed (0.2%). |
| Economic Alignment | The bounty covers the gas cost of the finalization transaction plus a profit margin, ensuring long-term viability for Keeper operators. |
| Split from Success Fee | The 0.2% is mathematically derived from the total 0.5% Success Fee (representing 40% of the fee), ensuring the protocol captures the remainder for Treasury/Insurance. |
️ Technical Implementation
1. Bounty Calculation & Distribution
The bounty logic is integrated into the settlement phase. To ensure fairness and precision, it uses safe integer math and is distributed immediately upon successful state transition to RESOLVING (or finalized settlement depending on architecture).
// packages/contracts/settlement/SettlementEngine.sol (Conceptual Logic)
/**
* @notice Distributes the Keeper bounty to the executor
* @dev Called atomically after triggerFinalize() succeeds
*/
function _distributeKeeperBounty(uint256 auctionId, address finalizer) internal {
// Retrieve the winning bid value (must be available or pre-calculated)
// Note: In Async CoFHE, this might be estimated or distributed after AVS settlement.
// Here we assume distribution upon valid resolution for simplicity of the incentive model.
uint256 winningValue = auctions[auctionId].resolvedValue;
// Calculate 0.2%: (Value * 2) / 1000
uint256 bounty = (winningValue * 2) / 1000;
require(bounty > 0, "Bounty too low");
// Transfer to the successful Keeper
(bool success, ) = finalizer.call{value: bounty}("");
require(success, "Keeper payout failed");
emit KeeperBountyPaid(auctionId, finalizer, bounty);
}2. Integration with triggerFinalize()
The core contract enforces the conditions under which the bounty becomes claimable.
// packages/contracts/core/FhenixFairMarket.sol
function triggerFinalize(uint256 auctionId) external nonReentrant {
Auction storage auction = auctions[auctionId];
// 1. Strict Time Condition
require(block.timestamp >= auction.endTime, "Auction not ended");
require(auction.state == AuctionState.ACTIVE, "Already processing");
// 2. State Transition (Locks the auction)
auction.state = AuctionState.RESOLVING;
// 3. Emit Event for Off-Chain Processing
emit DecryptionRequested(auctionId, auction.ciphertextHashes);
// 4. Incentive Logic
// The bounty is often recorded in a pending state to be claimed
// or paid out directly if gas permits and value is known.
pendingBounties[auctionId] = msg.sender;
// If paid later upon AVS settlement:
// settlementEngine.claimBounty(auctionId);
}Economic Flow & Keeper Incentives
The Keeper operates on a profit-and-loss basis. The protocol ensures that the 0.2% reward is consistently higher than the average gas cost of a triggerFinalize transaction.
| Scenario | Keeper Outcome | Protocol Outcome |
|---|---|---|
| Successful Finalization | Profit: Receives 0.2% of auction value. Covers Gas + Profit. | Success: Auction moves to RESOLVING. CoFHE processing begins. |
| Failed Transaction (Revert) | Loss: Pays Gas cost. No bounty received. | Safety: State remains unchanged. No false triggers. |
| Duplicate Execution | Loss: Second Keeper reverts because state is already RESOLVING. | Efficiency: Only one bounty is ever paid per auction. |
️ Security & Anti-Griefing Measures
- Revert Protection: The bounty logic is only reachable if the state transition succeeds. A malicious actor cannot drain the bounty pool by spamming failed transactions.
- Race Condition Handling: While multiple Keepers may attempt to call the function simultaneously, the EVM executes them serially. The first transaction succeeds and claims the bounty; subsequent transactions revert with “Already processing,” ensuring zero overpayment.
- Gas Limit Optimization: The
triggerFinalizefunction is designed to be gas-efficient (O(1)), maximizing the Keeper’s net profit margin and encouraging participation. - Decentralized Redundancy: By incentivizing external actors, the protocol ensures that if the primary automation infrastructure (e.g., Gelato) goes down, independent bots will likely pick up the incentive and finalize the auction.
Audit Gate Compliance (P0)
The protocol enforces strict verification gates for the incentive mechanism:
- [] Fixed Percentage Enforcement: The calculation
(value * 2) / 1000is hardcoded or controlled by immutable constants to prevent inflation attacks. - [] Single Payout Guarantee: Unit tests confirm that only one address receives the bounty per
auctionId, even under concurrent execution simulations. - [] Source of Funds: Bounty is strictly deducted from the protocol fee allocation, never from user principal or escrow deposits.
- [] No Pre-mature Payout: Bounty is only released after the auction state has irrevocably transitioned to
RESOLVING(orFINALIZED).
Next Steps
- Proceed to 6.3. Net Fee Distribution to understand how the remaining 0.3% is split between Treasury, Insurance, Grants, and Bug Bounties.
- Review 4.4. Phase 4: Keeper Network & Infrastructure for the technical implementation of the
auctionMonitorandcofheDispatcherservices.- Explore Security Model → Threat Matrix for specific mitigations against Keeper manipulation or spoofing.