ERC-8439 A settlement-decoupled nanopayment ledger (Settlement-Decoupled Nanopayment Ledger)

Draft · Signatures & auth · created 2026-10-09

Having the payment network, the wallet institution, and the acquirer institution all co-sign to record micropayments and refunds on an onchain ledger, so that off-chain systems can process actual fund movement based on it.

Why it is needed

Fiat micropayments (nanopayments) need to handle amounts smaller than the smallest unit of currency in metered services or agent-to-agent interactions. Processing this with existing approaches requires the wallet institution and acquirer institution to establish direct account relationships with each other, preventing the payment network from decoupling the debt obligations. Furthermore, without a shared ledger where the three parties, the payment network, wallet institution, and acquirer institution, can jointly verify their individually signed requests within a single transaction, a new signature must be obtained every time multiple requests are batched, and each implementation must separately guarantee that refunds are correctly linked to the original payment and that duplicate records or over-refunding do not occur. This drives up cost and trust issues in high-volume micropayment scenarios.

What to implement

In depth

Participant structure and three-party signature

Participants are divided into five roles: User, Merchant, Wallet (wallet institution), Acquirer (acquirer institution), and Payment Network. The onchain ledger (INanopaymentCore) verifies requests and three-party signatures, manages the institutionState/networkState accounts, and provides events and lookup functions. The off-chain fiat system performs the actual user debiting, refunds, inter-institution transfers, and merchant deposits, and reports the results independently. Each deployment identifies its payment network by the immutable signing address returned by paymentNetwork(), and the EIP-712 domain actually used for signature verification is exposed via ERC-5267's eip712Domain(). Interfaces or data models for institution onboarding, suspension, replacement, and assignment of Wallet/Acquirer roles are out of scope for this proposal. The payment network, paying institution, and receiving institution must each explicitly sign the same individual-typed request, and the caller's identity cannot substitute for a signature.

A three-party accounting model with four accounts

A transaction involves only three parties, the paying institution, the payment network, and the receiving institution, but there are four accounts. Each institution holds the debit and credit of its own statement in institutionState[institution], and the payment network holds its own debit and credit in a single networkState. pay(A) updates all four accounts together: institutionState[payerInstitution].debit += A, networkState.credit += A, networkState.debit += A, institutionState[payeeInstitution].credit += A. refund updates the same four accounts in the opposite direction (the original receiving institution becomes the paying side, and the original paying institution becomes the receiving side). flush closes out only one institution's statement independently, without touching the overall aggregates of other institutions or networkState. After every operation, the two invariants Σ institutionState[institution].debit = networkState.credit and networkState.debit = Σ institutionState[institution].credit always hold.

PaymentRequest / RefundRequest data structures

PaymentRequest consists of paymentId, payer, payerInstitution, payee, payeeInstitution, amount (uint96), and expiresAt (uint48), where paymentId is a globally unique identifier that must never be reused. RefundRequest consists of paymentId, refundId, amount, expectedRefundedAmount, and expiresAt, where refundId is a unique identifier linked to exactly one paymentId. PartyAuthorization is one party's signature, consisting of a party address and signature bytes. AuthorizedPayment bundles a request together with an authorizations array so it can be submitted either individually or included in a batch, and AuthorizedRefund additionally includes originalPayment.

pay/refund state commitment and signature verification

pay checks that paymentState(paymentId) is 0, then updates the four accounts and stores keccak256(abi.encode(P, uint96(0))), where P=hashStruct(PaymentRequest) (excluding the domain). refund recomputes P from the caller-supplied original PaymentRequest, checks that the current state matches keccak256(abi.encode(P, expectedRefundedAmount)) and that refundPaymentId(refundId) is 0, verifies that the refund amount does not exceed the original amount minus the cumulative refunded amount, updates the state to keccak256(abi.encode(P, expectedRefundedAmount+amount)), and records refundPaymentId(refundId)=paymentId. Signature verification accepts both 65-byte standard signatures and ERC-2098's 64-byte signatures for signers without code, rejecting invalid v values, high s values, and recovery to the zero address; for signers with code it accepts only 0x1626ba7e from a read-only ERC-1271 call and does not fall back to ECDSA on failure. Account type and verification policy must be evaluated against execution-time state and must not be cached.

Batch processing in batchPay and batchRefund

The Batch array must not be empty, and each call may only contain requests for a single payer/payee pair. batchPay may not contain duplicate paymentIds within the array, and batchRefund may not contain duplicate paymentIds or refundIds. Each entry undergoes the same validation as an individual pay/refund, and only after every entry passes does it update the four accounts once with the summed total amount and record each entry's state and event in input order. Batches have no separate signature type or batch root, so already-valid, unexecuted, complete authorization requests can be freely added, removed, or reordered. If any single entry fails, the entire batch is reverted with no partial results.

flush and off-chain statement reconstruction

flush can only be called by the institution itself or by paymentNetwork(), requires expectedStatementId to equal the current currentStatementId, and can close even an empty statement. On success it records the current (debit, credit) as Flushed, sets networkState.credit -= debit and networkState.debit -= credit, zeroes that institution's debit and credit, and increments currentStatementId by 1. Core does not separately store historical snapshots or transaction lists, so off-chain systems must locate Flushed by (ledger, institution, statementId) and reconstruct the statement by collecting PaymentPosted/RefundPosted events in log order from the previous Flushed up to the current Flushed. Logs from the same deployment are ordered by (blockNumber, transactionIndex, logIndex); event coordinates are only for locating logs and must not be used as business idempotency keys.

Immutability of amount units and currency settings

currency() must always return an uppercase ASCII 3-letter ISO 4217 code, and the decimals() value must not change over the deployment's lifetime. Neither value can be changed via configuration, governance, or upgrades; changing the currency or precision requires a new deployment. amount, debit, credit, and cumulative refund amounts are all expressed in units of 10^-decimals(), and uint96 can represent up to 2^96-1 of the smallest unit. A uint32 statement counter can withstand flushing once per second for about 136 years, so currentStatementId, debit, and credit can all fit together into a single InstitutionState slot (224 bits).

A proposal still in Draft stage

This proposal currently has status Draft, and no compliant reference implementation of the generalized four-account model has yet been provided. No gas cost figures have been presented either. The detailed interfaces and rules may change or be discontinued during discussion.

Things to watch out for

Original ERC · ← ERCs