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). Issuers freeze addresses tied to hacks, scams and sanctions. USDT sent to a Tether-frozen address cannot be moved out again; Circle's contract rejects USDC sent to a blacklisted one.

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.1

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.1
File Size Uploaded Provenance Actions
x402_payee_guard-0.1.1.tar.gz 8.7 kB Without provenance Details for x402_payee_guard-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 17.3 kB

Release files / x402_payee_guard-0.1.1.tar.gz

Download URL x402_payee_guard-0.1.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ee377e1854bf4b907c42a3826dede286f9956080c1b8ee738e2b80bce227010
BLAKE2b-256 checksum
How to use checksums
c0de9f471a9f360b01ad50b46d914f092d8e3908be2b9c5f7b44020f145bdec7
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.1-py3-none-any.whl

Download URL x402_payee_guard-0.1.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cc275514972c6563d5356e17d46682297040ba6673590ec4ce38adc15d977b6
BLAKE2b-256 checksum
How to use checksums
cf70215e72fde4ca1de187dc511d2194722d28f7b57a60097d0fd050f6fad76b
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.1

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