r402-casper
Casper Network support for the x402 payment protocol, part of the
r402 workspace.
Scope
This crate is a remote-facilitator integration:
- Local preflight validates wire shape, accepted↔requirements consistency,
mote amounts, timing, and
publicKey→authorization.frombinding. - Cryptographic signature verification and on-chain settlement are
performed by a hosted (or self-hosted) Casper x402 facilitator — default
https://x402-facilitator.cspr.cloud. - There is no in-process Casper RPC / key-custody stack. That keeps the dependency footprint comparable to other chain crates while matching the Casper Association deployment model.
Highlights
- Exact scheme — CEP-18 / CEP-3009
transfer_with_authorizationvia pre-signed EIP-712 authorizations (wCSPR on testnet built in). - CAIP-2 networks —
casper:casper(mainnet) andcasper:casper-test. - Exact mote arithmetic — 9 decimals; sub-mote precision is a typed error, never a silent truncation.
- Facilitator client —
/verify,/settle,/supportedwith optional local preflight and configurable timeout.
Cargo Features
| Feature | Surface |
|---|---|
client |
CasperExactClient (SchemeClient) + EIP-712 digest. |
server |
Server-side PriceTag generation. |
facilitator |
Remote facilitator client (verify / settle). |
http-client |
Default reqwest transport (ReqwestTransport). |
telemetry |
tracing instrumentation. |
full |
All of the above. |
Client (SchemeClient)
use ;
use X402Client;
// `MyWallet: CasperSigner` supplies public_key + sign_digest.
let x402 = new.register;
Facilitator (http-client)
use CasperExactFacilitator;
let facilitator = hosted_http;
// or: CasperExactFacilitator::from_env_http()?;
Quick Start (server price tag)
use Address;
use ;
let pay_to: Address = "00fedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321"
.parse
.unwrap;
let tag = price_tag;
assert_eq!;
Override the facilitator URL with R402_CASPER_FACILITATOR_URL.
References
- Scheme spec:
scheme_exact_casper.md - Casper x402 reference: https://github.com/make-software/casper-x402
- Facilitator docs: https://docs.cspr.cloud
License
Dual-licensed under MIT and Apache-2.0.