Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.
sailorpepePublic archive

About

[DISCONTINUED 2026-07-21] Rust/Wasm TCG price oracle on Casper Testnet. Built for a DoraHacks entry; hourly Merkle pushes stopped and /api/v1/casper/price retired. Kept read-only for the submission record. Live oracle: the-undesirables.com

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TCG Oracle Banner

⛓️ Casper TCG Oracle (Merkle Price Oracle)

Agentic Buildathon Phase 1 & 2 • Odra WASM Smart Contracts • Python Deployment Proxy

Rust Casper Network Odra License: BSL-1.1

Contract Explorer (Testnet) · x402 Server Integration


⚡ Overview

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


🏗️ Architecture

1. Smart Contract (Rust / Odra)

  • 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.wasm binary using cargo odra build.

2. Secure Deployment Proxy

  • casper_proxy.py: A custom HTTP middleware proxy that safely routes local JSON-RPC requests to node.testnet.cspr.cloud/rpc, seamlessly injecting CSPR API authorization headers to bypass network unauthorized errors.

3. Parallel Python Infrastructure

  • casper_deployer.py & casper_merkle_builder.py: Interacts with the casper-client CLI via Python subprocesses.
  • Zero-Disruption Design: Designed to run perfectly parallel to our existing LitVM and Mantle infrastructure without disrupting ongoing operations.

4. x402 Server API Endpoints

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 (payment e2bfa57b… → 200 + Merkle proof; replay → 400; wrong-recipient → 402).
  • Automatically handles wallet signature authentication for the Casper Network via the local .pem vault.

📦 Usage

Prerequisites

Build the WASM Contract

cargo odra build -b casper

The compiled binaries will be output to /wasm.

Run Local Tests

cargo odra test

Deployment via Proxy

First, start the proxy to authenticate your node connection:

python casper_proxy.py

Then execute the deployment pipeline:

python casper_deployer.py

🔒 Security

  • PEM Vaulting: Deployment relies on local .pem key 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.

📝 License

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.

About

[DISCONTINUED 2026-07-21] Rust/Wasm TCG price oracle on Casper Testnet. Built for a DoraHacks entry; hourly Merkle pushes stopped and /api/v1/casper/price retired. Kept read-only for the submission record. Live oracle: the-undesirables.com

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages