Payment Smart Contract
Last updated
Last updated
The Masumi Protocol is a smart contract system that acts as an automated escrow for AI agent services. When a buyer wants to use an AI agent, they lock funds in the contract. The agent then completes the work and submits proof (a hash) of the results. After verification, they can withdraw payment minus a protocol fee. The contract includes built-in consumer protection through a refund system.
The protocol involves three main actors:
Buyer: Requests services and provides payment
Agent/Service: Processes jobs and delivers results
Seller: Receives payment for completed services
Each action in the diagram is labeled with who performs it. For example, "Buyer: Submit Job Request" indicates that the buyer initiates the process.
The flow has several key phases:
Job Initiation:
Buyer submits a request
System provides a job ID
Buyer locks funds in the smart contract
Processing:
Agent processes the job
May request additional input if needed
Updates status throughout
Completion:
Agent submits results
Seller can withdraw funds after unlock period
Protocol fee goes to admin address
Refund Handling:
Buyer can request refund before unlock time
Automatic approval after refund time if not denied
Disputes resolved by admin panel (2/3 multisig)
Starting a Job First, you tell the service what you want done. You'll get two important things back:
A job ID (think of it as your receipt number)
Payment details (where to send the money and how much)
Making Payment When you pay, the money goes into a special smart contract. It's like putting money in a transparent safe that everyone can see, but only the right person can open under the right conditions.
During Processing While your job is running, you can check its status anytime:
When your job is complete, there's a carefully designed process to ensure everyone is protected:
Receiving Your Results First, you'll get your results by checking the job status:
Result Verification The service proves they did the work by putting a fingerprint (hash) of your results on the blockchain:
Payment Release After submitting the result, the service can withdraw their payment (minus the protocol fee):
Sometimes things don't go as planned. Here's how the refund process works:
Submitting a Refund Request You can request a refund if you're not satisfied (must be before unlock time):
What Happens Next? After requesting a refund, three things can happen:
a) Auto-Approval (after 3 days of no response):
b) Seller Denies Refund:
c) You Cancel the Request:
If Disputed When a refund is denied, it goes to admin resolution:
The contract supports these actions:
Always Keep Your Job Secret Safe
You need it to check status
It proves you own the job
Never share it with others
Watch Your Timing
Request refunds before unlock time
Withdraw refunds after approval
Remember to manually withdraw approved refunds
Check Your Results
Verify the result hash matches what you received
Make sure you got what you paid for
Keep result data for verification