This repository houses the Merkle Price Oracle for the Casper Testnet, built as part of the Agentic Buildathon. It provides trustless, on-chain verification for over 284,000 Trading Card Game (TCG) products and connects directly to the LitVM x402 Server ecosystem.
By committing the Merkle root of our price database to Casper every hour, any agent can independently verify a card's price on-chain without trusting our off-chain API. Prices come from our conformal-calibrated risk oracle — regime-aware split-conformal price bands with honest Value-at-Risk by default; Monte Carlo (Merton jump-diffusion) is available opt-in via model=.
src/merkle_oracle.rs: Core price verification logic. Takes a Merkle root and allows verification of TCG price proofs directly on the Casper network.- The Database Contract: We upload the compressed Merkle Root of our entire 284,000+ product database to the Merkle Price Oracle Contract (Testnet) hourly. This trustless design allows any agent to independently verify a card's price on-chain without trusting our off-chain API.
- WASM Build: Compiled down to a secure
MerklePriceOracle.wasmbinary usingcargo odra build.
casper_proxy.py: A custom HTTP middleware proxy that safely routes local JSON-RPC requests tonode.testnet.cspr.cloud/rpc, seamlessly injecting CSPR API authorization headers to bypass network unauthorized errors.
casper_deployer.py&casper_merkle_builder.py: Interacts with thecasper-clientCLI via Python subprocesses.- Zero-Disruption Design: Designed to run perfectly parallel to our existing LitVM and Mantle infrastructure without disrupting ongoing operations.
The backend x402 Server exposes a Casper-anchored price endpoint behind the standard x402 payment gate:
GET /api/v1/casper/price: An agent requests a specific card's price and receives price data anchored to the on-chain Casper Merkle root — independently verifiable against the contract (0235f90c…) without trusting our API. Access is gated by the oracle's standard x402 HTTP 402 challenge (USDC on Base). The Casper contribution is the on-chain price Merkle root; the primary 402 gate settles USDC on Base. A native-CSPR lane on this endpoint verifies a 1-CSPR transfer by deploy hash (amount + recipient + replay protection) — tested end-to-end on testnet 2026-07-18 (paymente2bfa57b…→ 200 + Merkle proof; replay → 400; wrong-recipient → 402).- Automatically handles wallet signature authentication for the Casper Network via the local
.pemvault.
- cargo-odra
- Python 3.11+
casper-clientCLI
cargo odra build -b casperThe compiled binaries will be output to /wasm.
cargo odra testFirst, start the proxy to authenticate your node connection:
python casper_proxy.pyThen execute the deployment pipeline:
python casper_deployer.py- PEM Vaulting: Deployment relies on local
.pemkey generation, which is strictly.gitignore'd and securely mounted. - Stateless Proxy: The RPC proxy never stores private keys in memory—it merely injects CDP auth headers for transport.
Licensed under the Business Source License 1.1 (BUSL-1.1) by The Undesirables LLC.
Free for personal, educational, and agentic integrations. Commercial operation of competing on-chain price oracle services requires a commercial license.
