Skip to main content

x402-payee-guard

Screen the payee before your x402 agent pays.

An x402 client pays whatever payTo address a 402 response names. An agent that finds sellers on its own will, sooner or later, be handed an address it has never seen. This package adds one hook to the official x402 Python SDK: before the client signs a payment, it looks up the payTo address and aborts the payment when the address is

  • on the US Treasury OFAC SDN sanctions list,
  • a known drainer, phishing or scam address, or
  • frozen by a stablecoin issuer (Tether or Circle; EVM and Tron addresses) — USDT or USDC sent there can never be moved out again.

EVM, Bitcoin, Solana and Tron addresses are accepted.

from x402 import x402ClientSync
from x402_payee_guard import guard_payees

client = x402ClientSync()
# client.register("eip155:*", ExactEvmScheme(signer=...))   # your usual setup
guard_payees(client)

That's it. Every payment the client creates afterwards is screened first. A do_not_pay payee makes the client raise x402.PaymentAbortedError instead of signing.

Cost and who runs the lookup — please read

The lookup is Veriql's /api/v1/payee endpoint, and each uncached lookup costs USD 0.01, paid over x402 in USDC on Base from the same wallet your client already pays with. This package is made by Veriql, which runs that endpoint.

  • Answers are cached per address: no_known_risk for 1 hour, do_not_pay for 24 hours (both configurable), so an agent that pays the same seller all day pays for one lookup an hour.
  • The guard's own USD 0.01 payment to Veriql is not screened again.
  • Pass trusted=[...] for sellers you already know; they are never looked up.
  • Prefer another provider or your own list? Pass fetcher= and nothing is sent to Veriql (see below).

Install

pip install "x402-payee-guard[requests]"   # for x402ClientSync
pip install "x402-payee-guard[httpx]"      # for the async x402Client

Python 3.10+. The only dependency is x402 (2.20 or newer).

Async client

from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402_payee_guard import guard_payees

client = x402Client()
# client.register("eip155:*", ExactEvmScheme(signer=...))
guard_payees(client)

async with x402HttpxClient(client) as http:
    r = await http.get("https://seller.example/paid-endpoint")

Options

guard = guard_payees(
    client,
    allow_ttl=3600,          # seconds a no_known_risk answer is reused
    block_ttl=86400,         # seconds a do_not_pay answer is reused
    trusted=["0x..."],       # never looked up
    on_incomplete="allow",   # or "block" when not every check could answer
    on_error="allow",        # or "block" when the lookup itself fails
    on_decision=lambda verdict, allowed: print(verdict.verdict, allowed),
    timeout=20.0,
)
Option Default Meaning
allow_ttl 3600 Cache lifetime of a no_known_risk answer, in seconds. 0 disables.
block_ttl 86400 Cache lifetime of a do_not_pay answer.
trusted () Addresses never looked up. EVM addresses match case-insensitively.
on_incomplete "allow" What to do when some checks could not answer.
on_error "allow" What to do when the lookup fails (network, unpaid, bad response). Errors are never cached.
on_decision None Callback (Verdict, allowed: bool) for your logs or metrics.
fetcher None Replace the HTTP lookup: address -> Verdict (an async function for the async client).
endpoint Veriql /api/v1/payee Lookup URL, if you run a compatible service.
timeout 20.0 HTTP timeout for the lookup, in seconds.

The defaults fail open: a network blip never stops your agent from paying. For a treasury agent, on_incomplete="block", on_error="block" fails closed.

Verdicts

Verdict Meaning Guard
do_not_pay At least one check found the address (sanctioned, listed, or frozen). blocks
no_known_risk Every applicable check answered and none found it. allows
incomplete Some checks could not answer. on_incomplete
error The lookup itself failed. on_error

no_known_risk means none of these lists has the address today. It is not a promise about the seller.

You can also call the guard directly, for example before an ordinary transfer:

v = guard.check("0x...")       # or: await guard.acheck("0x...")
if v.blocked:
    print(v.reasons)

Your own lookup

from x402_payee_guard import Verdict, guard_payees

DENY = {"0x...", "0x..."}

def my_lookup(address: str) -> Verdict:
    return Verdict(address, "do_not_pay" if address.lower() in DENY else "no_known_risk")

guard_payees(client, fetcher=my_lookup)

License

MIT

Metadata

Release files for x402-payee-guard 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for x402-payee-guard 0.1.0
File Size Uploaded Provenance Actions
x402_payee_guard-0.1.0.tar.gz 8.7 kB Without provenance Details for x402_payee_guard-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for x402-payee-guard 0.1.0
File Interpreter ABI Platform Actions
x402_payee_guard-0.1.0-py3-none-any.whl Python 3 none any Details for x402_payee_guard-0.1.0-py3-none-any.whl

Total release size: 17.2 kB

Release files / x402_payee_guard-0.1.0.tar.gz

Download URL x402_payee_guard-0.1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b2d0d13ba8d369ca15ed011bfb9fae00600e21e5482e777c9aac2ab6861e5cb
BLAKE2b-256 checksum
How to use checksums
939fb605ba112fbae4535d609c47b4c0f5b659e05d8f489324a4e0920de7d231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Release files / x402_payee_guard-0.1.0-py3-none-any.whl

Download URL x402_payee_guard-0.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f02c905b6f095995ec2fd65f862288dc833f51a3eadf342f3402691aa21046e9
BLAKE2b-256 checksum
How to use checksums
900097985983c2610b32ebebc4e037b582edbe73c5d79214aa1cf9317376bf04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.6

Security for x402-payee-guard 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page