Raxol.Payments.EchoServer (Raxol Payments v0.2.0)

Copy Markdown View Source

Self-pay x402 endpoint for validating the AutoPay stack end-to-end.

The server responds 402 with a real x402 payment-required challenge. On retry with x-payment, it decodes and verifies the EIP-712 signature against the configured wallet address. It does NOT submit anything on-chain -- success only proves that the agent built and signed a valid payment payload.

Use this before pointing your agent at a real x402 facilitator. If the echo server accepts a payment, the agent's signing flow is correct; if it rejects, the failure surfaces locally without spending any money.

Running

iex> Raxol.Payments.EchoServer.start_link(
...>   port: 4002,
...>   pay_to: "0x" <> String.duplicate("ab", 20),
...>   amount: 10_000,
...>   network: "eip155:8453"
...> )

Or as a Mix task:

mix raxol_payments.echo --port 4002 --amount 10000

Options

  • :port -- HTTP port, default 4002
  • :pay_to -- recipient address (hex, 0x-prefixed). Default is a deterministic dev address; override for any real use.
  • :amount -- atomic units (USDC has 6 decimals; 10_000 = $0.01)
  • :network -- CAIP-2 chain id, default "eip155:8453" (Base)
  • :asset -- ERC-20 contract address. Default is a placeholder.

Summary

Functions

Start the echo server under a supervised Cowboy listener.

Functions

start_link(opts \\ [])

@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}

Start the echo server under a supervised Cowboy listener.