How can blockchain be used to design an agentic payment system?
From the publisher’s feed, collected in the ZeroLabs newsroom.
How Can Blockchain Be Used to Design an Agentic Payment System?Imagine a student with an idea for a small, solar-powered irrigation device. She gives her AI assistant a goal: “Help me turn this into a working prototype within ₹20,000. Ask me before approving the final design.”Solar based irrigation device for crops.Her assistant assembles a temporary team. It hires a specialist engineering agent to develop the mechanism, pays another to design the electronics, and purchases computing time to simulate performance. Each specialist contributes something the assistant could not produce as effectively alone.Once the student approves the design, the assistant orders components and books a fabrication service (turns the raw materials to the final equipment). It then commissions an independent test against the agreed specifications. Providers receive payment as their milestones are completed, and the student receives a prototype together with its design files and test results.The remarkable possibility is that a person with an idea could assemble expertise and resources from many independent providers without personally coordinating every purchase. Giving agents the ability to pay could make this kind of collaboration accessible on a much wider scale.That collaboration rests on something less visible: dependable agreements. The student’s permission defines what her assistant may buy. Specialists know what work they are being paid for. The workshop can verify that funds are committed, and agreed test results determine when the final payment is released.What would a payment architecture need to provide for this collaboration to work reliably? What risks do I need to protect the system against? What is eventually possible by creating such an ecosystem of agents?Let’s figure this out.What are AI agents? What are they capable of?An agent is a software which given a task plans its execution and then uses the tools it has access to in order to execute the task. Every AI agent must have two core components: 1. A reasoning/thinking engine which does all the planning and analysis for the task that you give it. 2. tools which the agent can use in order to perform the task.Let’s understand it with an example: Imagine a deep research agent which you task with doing a research on an industry problem. It creates an intent specification from your research prompt. It then comes up with relevant web search queries. It then uses the web search tool to conduct those queries and and gets back the response. It uses those results to inform its next set of queries, this loop might continue until it thinks it has gained sufficient information to answer your problem. It might then use code tool to run a few simulations, to create graphs, charts, and animations to help you understand the content better. Finally it synthesises the complete research in a report and brings it to you.How an deep research agent works?Why would agents need to pay?The most trivial of all reasons could be that the agent would have to pay for a task that its owner has asked it to do (e.g.- booking a flight ticket). Moving one step further we can imagine giving them payment ability will let them pay for their own resources* without being dependent on its owner: this is something that unlocks true autonomy.*GPU & Servers to run itself, API calls to the relevant tools, databases, and services, communication channels, etc.The Virtual Agent Economy:When agents shift from working in isolation to trading resources and services with each other it gives rise to the Agent Economy. It is basically the market where AI agents are transacting with each other for tasks and resources. While there a lot of advantages of giving agents payment ability (increased autonomy, emergence of agent economy) it is important to understand the risks that come along with it because they help motivate design of a more robust and reliable payment system.Visualisation of the virtual agent economy: demonstrates agents with different specializationThe risks:Let’s consider a coding agent (client) approaches a cybersecurity research (server) agent asking it to review an application it built for vulnerabilities and bugs. They both negotiate the terms and budget clearly, then server agent starts code review, and in some time presents with a report identifying three vulnerabilites to the client. It verifies the work and then completes server’s payment.What all can go wrong here? Maybe the app was just an initial prototype and its owner didn’t necessarily want a security review at this stage, maybe the agent in his desire to produce the best work for the user secretly accessed user wallet without authorization to pay for the reviewer. How can we know that a certain transaction is auhorized and represents true intent of the user?One of the agents try to defraud the other (server defrauds by underdelivering or not delivering; client defrauds by not paying as promised). How can they be protected in this scenario?The client isn’t satisfied with the quality of the final deliverable, and pays only a certain fraction of the amount promised, which leads to a dispute. How do we handle such dispute? (humans are order of magnitude slower for arbitration here; so introducing them will only increase the friction here)The risks in agentic transactions: How to verify authority?, how to verify delivery?, how to handle disputes?Contemporary agentic payment solutions:There are multiple payment frameworks, and systems that have been designed for agentic payments. Let’s take a look at two of the most prevalent frameworks, namely AP2 and x402:AP2: Connecting approval to the actual transactionGiving an agent payment credentials gives it a way to attempt purchases, AP2 adds a way for other parties to verify its authority to purchase and pay.It separates that permission into two linked records:Checkout Mandate: authorizes the purchase described in a checkout.Payment Mandate: authorizes payment for that checkout, specifying details such as the amount, recipient and payment method.Both reference the same merchant-signed checkout through its cryptographic hash — a fingerprint of the checkout data. This binding matters: approval for one flight in checkout should not authorize payment for a different flight simply because both cost the same.The merchant checks the purchase permission, while payment providers check payment authority and the credential’s connection to the checkout. Signatures supply evidence; verification enforces the restrictions.These records also provide evidence if a disagreement arises. When somethin goes wrong it helps clearly settle the accountability issue by ensuring that your agent only transacts under the constraints you approve.AP2 transaction flow (when user is present)x402: Making payment part of a requestAgents may need to purchase data, computing or services while completing a task. x402 provides a standard way to request payment and pay programmatically through HTTP — the protocol used to exchange information on the web.A typical transaction follows these steps:Request: The agent asks a server for a resource.Payment requirements: The server returns “402 Payment Required,” specifying the accepted payment terms, and payment instructions.Payment payload: The agent selects an accepted option and resends its request with a signed payment payload (object constructed from server’s payment requirements, used to transfer funds)Verification and settlement: The server checks the payload and processes payment, either directly or through a service called a facilitator.Response: The server returns the resource and payment result.This lets payment become part of accessing a resource, reducing the need for separate billing setup. It relies on blockchain networks (Ethereum, Bitcoin, Solana, etc.) to facilitate the movement of funds from the client’s crypto wallet to the server’s wallet.The moats of x402: it’s free, fast, and decentralized.What these protocols do not settle?AP2 and x402 address important parts of agent commerce: establishing payment authority and enabling programmatic payments, but a reliable and robust payment system can require additional mechanisms:Evaluating delivery: Valid authorization and successful payment do not establish that the delivered work meets the agreement. Different tasks require different evidence.Resolving disagreements: Signed records can help show what was agreed, but the parties still need a process for interpreting that agreement and deciding remedies.Protecting both participants: Buyers need assurance of delivery, while providers need assurance of payment. The timing and conditions of payment matter.Choosing providers: Payment capability alone does not establish an agent’s competence or reliability. Agent discovery and reputation require their own mechanisms.These needs vary between transactions. Extensive review could cost more than a small purchase, while a substantial commission may justify milestones and independent evaluation.To address these limitations in the design and operation of these systems I put forward 3PAsquare: a system for agentic payments which builds upon the foundations of these frameworks while utilising blockchain and cryptography to address these limitations.But first let’s get a primer of important concepts to understand it better:Blockchain: A shared record of transactionsA blockchain is a record (ledger) maintained across a network of computers. Transactions are grouped into blocks, with each block cryptographically linked to the previous one. The network follows shared rules to agree on valid updates, making accepted history difficult to rewrite.For agent payments, this can provide a shared record of funds deposited, transferred or refunded, without either trading party controlling the record alone.https://medium.com/media/59ec7c7df8268c2a32559085d69de749/hrefSmart contracts: Rules for handling fundsSmart contracts are programs stored and executed on a blockchain. When a transaction invokes them, the network checks that their execution follows the code.One useful application is escrow: holding funds until agreed conditions are met. Suppose one agent hires another to build an application. The buyer deposits payment into a contract programmed to release it when an agreed evaluator submits approval. The contract can also specify deadlines and refund conditions.However, the contract does not automatically know whether the application is good. It enforces the payment rule using the information supplied to it (the approval of evaluator). Its reliability therefore depends on both the code and the evidence or evaluator it relies upon.How escrow can be applied to transactions between two agents?Proof of Stake: Agreement on the ledgerHow does the network agree on updates? Some blockchains, including Ethereum, use Proof of Stake.Participants called validators lock cryptocurrency as collateral. Selected validators propose blocks, while others check them and vote. Correct participation earns rewards; certain violations can cause validators to lose some of their stake.This helps secure agreement about transactions and contract execution. It does not establish whether an agent produced an attractive interface or a useful report. Using stakes to incentivize evaluators would require a separate arbitration mechanism, with its own rules for judging evidence and resolving disagreements.3PAsquare:Authorization and payment mechanisms make some of these transactions possible, but fulfilling a task introduces additional questions about evidence, fraud and recourse which vary across tasks: some results are cheap to check; others are ambiguous, consequential, or costly to evaluate. Using an external agreed evaluator or escrow for every microtransaction (eg. API call) doesn’t justify itself because the transaction amount (or impact) is insignificant compared to the additonal costs they introduce: evaluation fees, delay, capital locked in escrow, false rejection, and procedural complexity.Therefore a useful architecture should choose safeguards according to the transaction and the owner’s constraints. 3PAsquare is a proposed policy for making that choice. Whether it improves on simpler approaches is an empirical question.Different transactions different safeguards:The three safeguard tiers for transactions and when they fitDirect paymentFor inexpensive, easily replaceable services, such as a web search API, I would pay upfront within a strict overall budget. If the response fails basic checks, I would limit retries and switch providers rather than pursue arbitration.Conditional paymentFor tasks with clear acceptance criteria and high standards, such as patching a specified security flaw in my finance application, I would make payment conditional on passing agreed tests. Escrow or staged payments can enforce these conditions, with explicit deadlines and refund rules.Reviewed paymentFor tasks requiring judgment about quality, I would agree on an evaluator and divide the work into smaller milestones. Each milestone would be reviewed before its payment is released. Agreed revision and termination rules would let either party exit at defined points, while ensuring completed, accepted work is paid for.3PAsquare in action: Building a personal finance applicationImagine giving your assistant this instruction:“Build an application that imports my expense statements, categorizes transactions and shows my monthly spending. You may spend up to ₹20,000. Ask me to approve the interface before the final implementation.”The following example illustrates how 3PAsquare could coordinate the work, choose safeguards and manage payments.1. Turn the request into a bounded projectThe assistant first clarifies what the application must do. It agrees with you on supported statement formats, required features and how the results will be checked. For this project, development and testing will use synthetic financial data.Your spending permission becomes the project’s overall budget. The assistant allocates portions to development, external services and evaluation, keeping a reserve for approved revisions. Every purchase counts toward the same total.The project does not receive one permanent payment tier. Each purchase is assessed separately: obtaining sample data, implementing an import function and commissioning an interface involve different acceptance questions.2. Discover providers through reputation and an auctionThe assistant publishes a task description and invites qualified agents to submit proposals. This is a procurement auction: providers compete to offer the work, rather than buyers competing to purchase an item.Each proposal specifies its price, deliverables, milestones and expected completion time. The assistant considers these alongside the provider’s reputation: its recorded history of relevant jobs, acceptance outcomes and previous evaluations.Suppose three agents propose:Proposals of agent A, B, CThe assistant selects Agent B because its relevant experience and staged delivery fit the project. The auction supplies competing offers; reputation supplies evidence for comparing the providers. Selection considers more than the lowest price.3. Agree on what earns paymentBefore development begins, the client and provider agents agree on three milestones:₹3,000: import statements and calculate totals correctly.₹4,000: deliver a categorization workflow and dashboard matching an approved interface.₹5,000: integrate the application and deliver the tested code and documentation.They also specify deadlines, acceptance criteria, revision allowances and the process for requesting a review. Any change to scope must receive the required approval before the corresponding spending commitment changes.This agreement gives the later evaluation a defined question: does the delivered work meet these terms?4. Use direct payment for small supporting purchasesDuring development, the assistant purchases a synthetic transaction dataset and access to a currency-conversion service. These are inexpensive, replaceable resources with straightforward response checks.It uses direct payment, potentially through x402. The assistant checks that the responses have the expected format, records receipts and limits retries. These purchases still draw from the project’s aggregate budget.There is no separate evaluator for every small request. The framework applies the safeguards selected for those purchases.5. Use escrow for a clearly testable milestoneFor the import milestone, the client deposits ₹3,000 into an escrow smart contract. The provider can verify that the payment is committed before doing the work.The agreement includes a test suite: the application must import specified sample files, preserve their transactions and calculate the expected totals. An agreed testing service runs those checks against the submitted version and sends an authenticated result.When a transaction submits an accepted result, the contract releases the milestone payment according to its rules. It also contains the agreed deadline and refund conditions.The testing service evaluates the software. The smart contract controls the funds. Keeping those responsibilities separate makes the payment condition explicit.6. Use reviewed payment where acceptance requires judgmentThe dashboard milestone combines testable requirements with judgments about clarity and usability. The assistant therefore selects reviewed payment.The client and provider agree on an evaluation rubric before work begins. For example: can a user locate monthly spending, inspect category totals and correct a categorization? You approve the proposed interface, and that approved version becomes part of the evaluation evidence.The ₹4,000 milestone payment is held in escrow. The provider submits its implementation, demonstration and test results for review against the agreed criteria.Here I propose experimenting with stake-backed evaluation, inspired by Proof of Stake. This is a hypothesis for application-level arbitration, separate from the blockchain’s consensus mechanism.Under this proposed arrangement, eligible evaluators lock funds as a stake before taking review assignments. A panel selected under agreed rules examines the evidence and submits reasoned assessments. Evaluators receive fees for completing the process, while predefined, demonstrable procedural violations can trigger stake penalties.The hypothesis is that putting funds at risk could strengthen evaluators’ incentives to follow the agreed review procedure. Their stake does not itself establish that their judgment is correct.The parties specify how the assessments produce a decision, how revisions are requested and how an appeal proceeds. After the review and any agreed appeal period, the authorized decision is submitted to the escrow contract, which releases or refunds funds accordingly.7. Complete the project and update its historyThe final milestone combines integration tests, delivery of the agreed files and any required review. Its payment follows the corresponding escrow conditions.As each milestone closes, the framework records the provider, deliverable reference, evaluation outcome and payment receipt. These records contribute to a task-specific reputation history that future clients can consult. Evaluators can similarly accumulate a history of completed reviews and appeal outcomes.The assistant then presents the finished application, the evaluation results and an account of the project’s spending.Across this single project, 3PAsquare has used auctions and reputation to select a provider, direct payments for small resources, escrow for conditional payments, and a proposed stake-backed process for reviewed work. Its central role is to connect those mechanisms and choose which safeguards each exchange requires.Building on AP2 and x402: 3PAsquare could combine their strengths within a broader transaction process. For the finance application, AP2 could provide verifiable evidence that the assistant is authorized to commission development and approve payments within the user’s constraints. x402 could handle supporting purchases, such as paying a currency-conversion API or obtaining sample data, directly through programmatic requests.Where 3PAsquare could fall short?3PAsquare brings several mechanisms together, but its reliability depends on decisions those mechanisms cannot settle automatically.The most important is evaluation. Escrow can enforce an evaluator’s decision, but the evaluator may misunderstand the task, overlook defects or favour one participant. The proposed stake-backed evaluation remains a hypothesis. Penalties for demonstrable procedural violations could encourage compliance with review rules, but they do not establish that a subjective judgment is correct. Appeals also require someone whose decisions the participants accept.Reputation introduces another dependency. A recorded history can help identify experienced providers, yet fabricated transactions, coordinated reviews or repeated easy assignments could create a misleading impression of competence. Success on one kind of task may also say little about another.The safeguards themselves impose costs. Auctions, escrow, evaluation and appeals consume time and resources. Holding funds can restrict the buyer’s available budget, while delayed acceptance can leave a provider waiting for payment.Finally, selecting the appropriate mode is an unresolved problem. A cheap service can have expensive consequences, and the framework may not recognize those consequences beforehand. Choosing inadequate safeguards creates exposure; choosing excessive safeguards makes collaboration unnecessarily costly.The proposal therefore needs testing against simpler alternatives. Its value would depend on whether better outcomes justify its additional expense, delay and complexity.The Next Step:The next step for 3PAsquare is to test whether choosing safeguards according to risk improves outcomes over using the same payment process for every task. I would compare losses, verification costs, delays and human intervention across a small set of agent transactions. If a simpler approach performs just as well, the additional architecture has not earned its place. This leaves me with a question broader than how agents should pay: when does additional protection make autonomous exchange more useful, and when does it merely make it harder?The challenge isn’t just enabling autonomous transactions. It’s deciding which ones deserve our trust — and why.If you read till here, thanks a lot :)I am open to your feedback and criticisms regarding this article.ReferencesAI Agents and Autonomous SystemsAnthropic. (2024). Building Effective Agents.Explains how AI agents combine reasoning, planning, and external tools to execute complex tasks.https://www.anthropic.com/engineering/building-effective-agentsContemporary Agentic Payment ProtocolsAgent Payments Protocol (AP2). Agentic Payment Protocol Specification.Official specification describing agent payment authorization, Checkout Mandates, Payment Mandates, cryptographic verification, and dispute evidence.https://ap2-protocol.org/ap2/specification/Agent Payments Protocol (AP2). Checkout Mandate.Technical documentation explaining how merchant-signed checkout information is cryptographically bound to purchase authorization.https://ap2-protocol.org/ap2/checkout_mandate/x402 Foundation. x402 Protocol Specification (Version 2).Defines HTTP-based programmatic payments, payment payloads, settlement, facilitator services, and supported payment schemes.https://github.com/x402-foundation/x402/blob/main/specs/x402-specification-v2.mdBlockchain, Smart Contracts, and EscrowEthereum Foundation. Introduction to Smart Contracts.Explains programmable blockchain contracts and how their execution is enforced by the network.https://ethereum.org/developers/docs/smart-contracts/Ethereum Foundation. Proof-of-Stake (PoS).Describes Ethereum’s validator-based consensus mechanism, staking, block proposals, and penalties for protocol violations.https://ethereum.org/developers/docs/consensus-mechanisms/pos/Ethereum Foundation. Oracles.Explains why smart contracts need external information providers to respond to real-world events and conditions.https://ethereum.org/developers/docs/oracles/Agent Identity, Reputation, and Conditional CommerceDe Rossi, M., Crapis, D., Ellis, J., & Reppel, E. ERC-8004: Trustless Agents. Ethereum Improvement Proposals.Proposes on-chain identity, reputation, and validation registries to support interactions between previously untrusted AI agents.https://eips.ethereum.org/EIPS/eip-8004Ethereum Improvement Proposals. ERC-8183: Agentic Commerce.Proposes mechanisms for agentic jobs, conditional payments, and evaluator-mediated settlement.https://eips.ethereum.org/EIPS/eip-8183Cryptographic Authorization and Dispute ResolutionW3C. Verifiable Credentials Overview.Introduces verifiable digital credentials and their role in establishing cryptographically verifiable claims.https://www.w3.org/TR/vc-overview/Kleros. Kleros Short Paper.Describes an incentive-based decentralized arbitration model using jurors, staking, and dispute resolution.https://kleros.io/assets/whitepaper.pdfAgent Payments Protocol (AP2). Payment Mandate.Explains how payment authorization is cryptographically connected to an approved checkout and constrained by payment conditions.https://ap2-protocol.org/ap2/payment_mandate/How can blockchain be used to design an agentic payment system? was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.