Keep the local example's scope explicit

This project's local test harness implements native ETH delivery on a private chain, not an ERC-4337 paymaster integration. It exercises real local signing, persisted nonce/hash, receipt checks, and duplicate-request handling with test-only accounts.

The educational provider-specific ERC-4337 example is still pending a pinned account/EntryPoint/SDK selection. A local native delivery test cannot establish that integration or mainnet sponsorship. No contract is deployed and no public demo spends external funds.

Sponsorship / Budget control

Authorize. Bound. Reconcile.

  1. Validate policy
  2. Reserve bounded budget
  3. Reconcile receipt

A callback alone is not settlement evidence.

Static walkthrough
Local funding policyTypeScript · local excerpt
// Local policy contract, not a public paymaster endpoint
const accepted = await reserveFunding(db, {
  principalId, address, quoteId,
  allowanceId, operatorId, idempotencyKey
});
// An isolated local worker persists intent, nonce and hash
// before broadcasting test-only bytes on chain 1337.
await processLocalDelivery(db, accepted.id, localAdapter);

Select or copy the complete excerpt. On narrow screens, scroll sideways; arrow keys work when the code is focused.

Define the payer and entitlement first

Sponsorship consumes the operator's budget. Native advance funding delivers ETH the user controls; reimbursement recovers the cost under a separate permission and price agreement. Those accounting models need separate policies.

A new address does not prove a new person or a fresh trial right. Eligibility must be server-owned and account-bound, with a policy version and expiry. Authentication by itself does not authorize spending.

Keep the provider contract at the server boundary

A provider adapter needs an exact SDK version, supported account and EntryPoint, authentication location, allowed input schema, quote provenance, errors, and pricing. These fields are unresolved for the external example; no fake endpoint, key, or deployed address is supplied.

The local funding contract accepts a server-issued quote ID and an idempotency key. It never accepts a browser-supplied native fee, entitlement, signer key, or arbitrary transfer payload as authoritative.

Reserve customer and operator limits together

The allowance and operator cap must be locked and reserved in the same database transaction that creates the request and outbox event. Equal idempotency keys with different quote bodies conflict. Another active request keeps the account locked.

An unknown broadcast retains its reservation. A confirmed delivery records the actual ETH-plus-delivery expense and releases unused reserve. A technical revert can be tracked as operator loss without pretending ETH was delivered.

  • Allow only the approved chain, account type, target, and action.
  • Use integer wei and scaled money with explicit round-up rules.
  • Persist the immutable intent and nonce; persist signed hash/bytes before submission.
  • Rebroadcast the same intent, never a new transfer to resolve a timeout.
  • Treat receipt reorgs as a retracted result and block new spend until reconciliation.

Run negative tests as well as the happy path

The local repository exposes test:unit, test:integration, and test:evm commands. The tests use temporary databases and a private local EVM; test keys and raw signed payloads are not rendered by the website.

Test concurrency, budget/count limits, expired quotes, duplicate-body conflicts, wrong sign-in domain, stale payment events, receipt reversals, and a crash after submission. The test runner's current results, not this description, determine what has been verified.

Sources and evidence limits

  • ERC-4337 specification — 2026-10-14. Current published specification; dependency-specific deployment remains separate.
  • SIWE / ERC-4361 — 2026-10-13. Offchain login; no execution authority.

A selected external SDK and reproducible ERC-4337 integration remain missing. This page is not accepted as the complete provider example.

Check the next implementation dependency