-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Parent Issue
Closes part of #47
Description
Build a two-party escrow contract where funds are released when both parties provide matching secret codes (witness encryption pattern).
Use Case
Traditional escrow requires a trusted third party. TLOS enables:
- Both parties commit codes at deployment
- Funds released only when BOTH codes are revealed correctly
- No trusted intermediary needed
Example Flow
Party A Contract Party B
| | |
| deploy(codeHashA, codeHashB) | |
|------------------------------->| holds funds |
| | |
| provideCode(codeA, puzzle) | |
|------------------------------->| verifies A's code |
| | |
| |<--- provideCode(codeB, puzzle) --|
| | verifies B's code |
| | |
| | BOTH valid → release funds |
|<-------------------------------|----- funds -------------------> |
Key Features
- Two code hashes stored at deployment
- Each party must solve puzzle + provide correct code
- Funds split or sent to designated recipient
- Timeout for refund if one party doesn't participate
- Optional: partial release on single code
Security Model
- What's hidden: The actual codes (until revealed)
- What's public: Code hashes, fund amount, participants
- Guarantee: 2^76 per code to brute-force
Use Cases
- Atomic swaps without hash time locks
- Two-party agreements (both must confirm)
- Dead drops (funds released when both secrets known)
- Mutual authentication
Acceptance Criteria
- Contract compiles and passes tests
- Both-party and timeout flows tested
- Gas benchmark documented
- Security warnings in header
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels