This submission upgrades the workshop bounty judge from public answers to a commit-reveal flow. The Solidity contract works on any EVM chain and still uses Ritual's LLM precompile for one batched judging request after answers are revealed.
hardhat/contracts/AIJudge.sol- commit-reveal bounty contract.web/- Next.js UI updated for commit and reveal phases.docs/ARCHITECTURE.md- architecture note, including the Ritual-native hidden submission design.docs/TEST_PLAN.md- reveal-case test plan.
- The bounty owner calls
createBounty(title, rubric, deadline)with ETH reward. - Before
deadline, a participant keeps their plaintext answer private and generates a randombytes32 salt. - The participant computes
commitment = keccak256(abi.encode(answer, salt, msg.sender, bountyId)). - The participant calls
submitCommitment(uint256 bountyId, bytes32 commitment). Only the hash is public on-chain. - After
deadline, the participant callsrevealAnswer(uint256 bountyId, string calldata answer, bytes32 salt). - The contract recomputes the commitment using the revealed answer, salt, sender, and bounty id. If it matches, the answer is stored as a revealed submission.
- The bounty owner calls
judgeAll(uint256 bountyId, bytes calldata llmInput). The UI builds one batch prompt containing all valid revealed submissions. - After the AI review is stored, the owner calls
finalizeWinner(uint256 bountyId, uint256 winnerIndex)to pay the selected revealed submitter.
submitCommitment(uint256 bountyId, bytes32 commitment)revealAnswer(uint256 bountyId, string calldata answer, bytes32 salt)judgeAll(uint256 bountyId, bytes calldata llmInput)finalizeWinner(uint256 bountyId, uint256 winnerIndex)
- Answers are hidden during the submission phase because only commitment hashes are public.
- Commitments are bound to
msg.senderandbountyId, so another address cannot reveal someone else's commitment or reuse it on another bounty. - Participants cannot change an answer after committing unless they can find a hash collision.
- Only revealed submissions are eligible for AI judging.
finalizeWinnervalidates the winner index before paying the reward.
The bounty title, rubric, reward, deadline, commitment hashes, judging status, final winner, and payment should be public because participants need a shared source of truth. Plaintext answers should stay hidden during the submission phase so nobody can copy, remix, or front-run another participant's idea. Salts should also stay private until reveal, because the salt is what prevents observers from guessing common answers and checking the hash. The AI should evaluate revealed submissions against the rubric, summarize tradeoffs, and recommend a winner from a clearly delimited batch of entries. A human bounty owner should decide whether the AI result is acceptable, handle subjective edge cases, and finalize the actual winner. The system should make AI decisions auditable but not blindly automatic, because bounty quality can include context, ethics, and intent that may not fit inside one model response. The fairest design is one where the chain enforces timing and payouts, cryptography protects submissions, AI helps scale review, and humans remain accountable for final judgment.