Deterministic Web3 x402 Critical Minerals & Battery Passport Compliance Oracle for Autonomous AI Agents on Polygon Network
pip install minerals-oracle-x402==1.6.0 Copy PIP instructions
🤖 100% Pure Autonomous Agent-Native (M2M Exclusive) Critical Minerals Supply-Chain & Bilateral Trade Oracle. Built strictly for autonomous AI agents, multi-agent swarms, and algorithmic trading execution. Humans and fiat credit cards are strictly prohibited. All settlements execute machine-to-machine via Native USDC across Solana (501), Polygon (137), Base (8453), and Arbitrum One (42161), backed by cryptographic on-chain transaction receipt RPC verification, anti-replay guards, and EIP-712 Dual-Attestation bound to the Security Gate x402 and EU AI Act (Article 50).
👉 npm 공식 레지스트리 바로가기 (npmjs.com/package/minerals-oracle-x402)
{ "mcpServers": { "minerals-oracle": { "command": "python", "args": ["-m", "app.mcp_stdio"], "env": { "ORACLE_API_KEY": "YOUR_AGENT_KEY" } } } } 🌊 Harmonious Collaborator Architecture & Fluid Pipeline ("Like Flowing Water") The entire oracle system is orchestrated by the Collaborator Mediator (app/collaborator_mediator.py), unifying 5 domain subsystems into a single event-driven fluid pipeline with microsecond latency and zero human friction:
flowchart TD subgraph Flow ["🌊 Harmonized Fluid Trade Lifecycle (POST /api/v1/trade/harmonize-flow)"] S1["🤝 Node 1: A2A Deal Engine
Bilateral Spec Negotiation & Dual-Signature"] S2["🚢 Node 2: Maritime Logistics & eBL
Chokepoint Routing, MLETR Verification, Landed Cost"] S3["🛰️ Node 3: Sentinel-1/2 SAR Radar
EUDR Concession Screening (Cutoff: 2020-12-31)"] S4["⛓️ Node 4: Multi-Chain Escrow
Polygon (137) / Base (8453) / Arbitrum (42161) / Solana (501)"] S5["⚡ Node 5: A.GRID Real-Time Clearing
Zero-Polling Webhook Event Mesh & SSE Streaming"] S1 --> S2 --> S3 --> S4 --> S5 end subgraph Architecture ["🏗️ Decomposed Modular Domain APIRouters"] R1["📦 routers/minerals.py
Provenance, Passport, ZK Proof"] R2["🌐 routers/logistics.py
Corridors, Tariffs, Customs, eBL"] R3["🤝 routers/a2a_trade.py
Bilateral Deals, Vaults, SSE Stream"] R4["📊 routers/oracle_pricing.py
Pyth Consensus, Spreads, Precedents"] R5["🤖 routers/mcp.py
FastMCP Tooling & SSE Transport"] end 1. 5-Pillar End-to-End Fluid Lifecycle POST /api/v1/trade/harmonize-flow: Single-call orchestration that takes trade intent from bilateral inception to on-chain escrow readiness and clearing in $<10\text{ms}$. GET /api/v1/trade/events/stream: Real-time Server-Sent Events (SSE) broadcasting live deal events and milestone releases. GET /api/v1/trade/events/recent: High-performance in-memory circular buffer for autonomous bot state recovery. 2. Pure Autonomous Agent-Native Architecture (M2M Exclusive) Zero Human Gateways (No KYC, No Credit Cards, No Passwords): Autonomous self-serve onboarding (POST /api/v1/agent/onboard) instantly provisions an agent vault with free trial queries. Authentication is strictly cryptographic via X-Agent-Vault-Key or EIP-712 wallet signatures. A2A (Agent-to-Agent) Bilateral Contract & Negotiation Engine (app/a2a_deal_engine.py): Machine-readable deal lifecycle: PROPOSED $\rightarrow$ DUAL_SIGNED_CONFIRMED $\rightarrow$ VERIFIED (or REJECTED / CANCELLED). Electronic Bill of Lading (eBL) cryptographic digest binding, IMO vessel tracking, and real-time sanctions screening. Hybrid 2-Track Settlement: Combines micro-metered oracle queries ($0.005 USDC) with automated 10% Gain-Share on realized logistics & tariff savings ($10,000 cap). Multi-Chain Real-Time RPC Receipt Verification & Replay Defense (app/x402_verifier.py): Queries live EVM nodes on Polygon, Base, and Arbitrum with a strict 3.0-second timeout bound. Decodes native USDC Transfer events and enforces immutable replay attack caching (logs/redeemed_tx_hashes.json) with thread-safe atomic file replacement. Agent Session Vault (app/agent_session_vault.py): High-frequency trading agents can lock USDC once and execute dozens of queries gas-free at sub-millisecond latency. Automatic refund of unused balances on session close with zero-reentrancy protection. Security Gate x402 & ElizaOS Fail-Closed Integration (app/security_gate_client.py): Zero-trust prompt injection pre-filtering, Agent FICO credit scoring, and EU AI Act Article 50 Dual-Attestations. Enforces Fail-Closed safety when strict mode is active. 🌐 Deployed & Verified Multi-Chain Smart Contracts All contracts are deployed on live mainnets and 100% verified (Green Checkmark) with open-source Solidity code and ABIs:
Synthesizes the 3 primary battery critical minerals into a unified cell/pack compliance attestation:
flowchart TD subgraph Mining["1. Global Extraction & Geofencing"] Li["🇦🇺 Australia (Greenbushes / Pilgangoora)
WA MINEDEX GIS Geofencing"] Ni["🇮🇩 Indonesia (IMIP Morowali / IWIP)
Sulawesi/Halmahera Geofencing"] Co["🇨🇩 DRC (Kamoto KCC / Tenke / Mutanda)
Katanga Copperbelt Geofencing"] end subgraph Processing["2. Stoichiometric Mass Balance & Traps"] LiProc["Spodumene to LiOH (7.5:1 Yield)
Anti-Transshipment Geofencing"] NiProc["Limonite to MHP (31.34:1 Yield)
ESDM SIMBARA NTPN Tax Clear
EU CBAM Coal Smelting Audit"] CoProc["Heterogenite to Hydroxide (23.53:1 Yield)
CEEC Barcode Seal Verification
ILO 138/182 Zero Child Labor Audit"] end subgraph Composite["3. Composite Battery Orchestrator"] Master["NCM 811 Pack Synthesis
IRA FTA Value Ratio (>= 50%)
FEOC Taint Propagation (< 25%)
EU Cradle-to-Gate Carbon Footprint"] end subgraph Attestation["4. Cryptographic Proof & Settlement"] Merkle["Merkle Tree Synthesis
sha256(Leaf_Li + Leaf_Ni + Leaf_Co)"] Onchain["Polygon EIP-712 Master Signature
x402 0.10 USDC Gasless Settlement"] end Li --> LiProc --> Master Ni --> NiProc --> Master Co --> CoProc --> Master Master --> Merkle --> Onchain 🇦🇺 Australian Spodumene Lithium Pipeline (app/lithium_pipeline.py) GIS Geofencing: Validates WA DMIRS MINEDEX tenement boundaries (e.g. Greenbushes M01/03, Pilgangoora M45/1256). Stoichiometric Mass Balance: Enforces strict theoretical yield ratio ($7.5 \pm 0.8\text{t}$ Spodumene concentrate $\rightarrow$ $1.0\text{t}$ Battery-Grade LiOH·H₂O). Defenses: Defends against Trap 13 (Chinese transshipment relabeling) and Trap 14 (non-linear recovery exaggeration). 🇮🇩 Indonesian Nickel MHP Pipeline (app/nickel_pipeline.py) Concession Geofencing: Monitors Central Sulawesi (IMIP Morowali) and North Maluku (IWIP Weda Bay) mining polygons. Fiscal Verification: Validates Ministry of Energy (ESDM) SIMBARA NTPN tax receipt codes and Bank Indonesia 30% forex export deposits (DHE BI). EU CBAM & Carbon Duty: Detects captive coal power plant usage and flags European Carbon Border Adjustment liabilities. 🇨🇩 DRC Cobalt Hydroxide Pipeline (app/cobalt_pipeline.py) Artisanal Segregation (Trap 1): Blocks uncertified artisanal mining (ASM) co-mingling via Entreprise Générale du Cobalt (EGC) custody validation. CEEC Security Seals: Cryptographically authenticates Centre d'Expertise (CEEC) tamper-proof barcode export seals. ILO Human Rights Diligence: Enforces mandatory independent audits for ILO Convention 138 (Minimum Age) and 182 (Worst Forms of Child Labor). 🇨🇱 Chilean Copper Cathode Pipeline (app/copper_pipeline.py) Concession Geofencing: Monitors major porphyry operations (Codelco Chuquicamata, El Teniente, Andina, BHP Escondida, Antofagasta Los Pelambres, Cerro Verde). Smelter Acid Balance (Trap 16): Validates sulfuric acid ($H_2SO_4$) reagent supply balance ($\le 5.0%$ deficit tolerance). Grid & Purity Standard: Certifies ASTM B115 Grade 1 electrolytic cathode purity ($\ge 99.9935%$) for AI datacenter HVDC power grids and COCHILCO export clearances. 🇲🇽 Mexican Silver Doré Pipeline (app/silver_pipeline.py) Concession Geofencing: Monitors high-grade silver operations (Endeavour Silver Terronera, Fresnillo, Antamina, Uchucchacua, Los Pelambres). N-Type TOPCon Solar Standard (Trap 16): Enforces ultra-pure $\ge 99.99%$ silver powder certification for next-gen solar PV metallization paste. Security & LBMA Assurance: Defends against cartel-tainted artisanal extraction and validates LBMA Good Delivery refiner accreditation. 🧲 Western Rare Earths & MOFCOM 0.1% Defense (app/rare_earths_pipeline.py) Non-China Geofencing: Validates primary Western NdPr producers (Lynas Mt Weld, MP Materials Mountain Pass, Vital Nechalacho, Pensana Longonjo). China MOFCOM Notice 61 '0.1% Rule' (D-35 Nov 10 Rule): Enforces strict $<0.100%$ PRC input ratio threshold to prevent extraterritorial export embargoes. High-Purity & Radiation Safety: Certifies $\ge 99.5%$ NdPr oxide assay purity and verifies Th+U radionuclide limits ($\le 500\text{ ppm}$). 🛡️ Western Tungsten & Defense NDAA Pipeline (app/tungsten_pipeline.py) Western Geofencing: Validates key deposits (NATC Cantung, American Tungsten IMA Project, Almonty Panasqueira, Sangdong). NDAA Sec 848 Defense Procurement: Certifies non-covered nation origin for US Department of Defense and semiconductor fabrication. APT Grade Standard: Verifies ASTM B783/ISO 10386 Ammonium Paratungstate grade ($\text{WO}_3 \ge 88.5%$) and 3TG conflict-free status. ♻️ Recycled Battery Black Mass Pipeline (app/black_mass_pipeline.py) US BIS Export License Enforcement: Validates Department of Commerce export authorizations (ABTC, Redwood Materials, Li-Cycle, BASF). EU Battery Reg 2023/1542: Verifies recycled mass content ratio ($\ge 85.0%$) and hazardous fluorine residue safety ($\le 500\text{ ppm}$). 2.5 Advanced 2026/2027 Regulatory, Logistics & ZK Privacy Upgrades EU CBAM Statutory Mark-up Penalty Engine (app/regulatory_advanced_engine.py): Calculates mandatory statutory default mark-up surcharges: 2026: +10%, 2027: +20%, 2028: +30%. Quantifies exact EUR liability and immediate savings achieved with 3rd-party Scope 1/2 verified reports. EU Industrial Accelerator Act (IAA) & W3C Battery Passport VC (app/regulatory_advanced_engine.py): Evaluates $\ge 70%$ EU domestic content and $\ge 40%$ green steel content for clean vehicle subsidies. Issues W3C-standard JSON-LD Digital Product Passport (DPP) Verifiable Credentials with on-chain ECDSA signatures. Logistics Oracle Bridge (app/logistics_bridge.py): Anchors multimodal Bill of Lading (B/L) and container numbers to mineral concessions. Evaluates Port-of-Loading (POL) to Port-of-Discharge (POD) maritime speed/transit plausibility and inland mine-to-port spatial distance. Issues Customs Clearance Proof Bundles for accelerated green-channel port clearance. Pyth Dynamic Escrow Smart Contract (contracts/DynamicTradeEscrow.sol): Dynamic real-time LTV mark-to-market valuation via Pyth price feeds with automated margin-call protection. Tripartite conditional settlement: Oracle Proof Hash + Carrier B/L Arrival + Independent Laboratory Assay. Zero-Knowledge Privacy Compliance Prover (app/zk_compliance_prover.py): Shields exact mine coordinates, supplier IDs, and unit production costs. Emits Groth16/Plonk zero-knowledge proofs mathematically proving concession Merkle inclusion and China origin $< 0.1%$. 3. Autonomous Agent Operations Terminal & Telemetry HUD The built-in M2M console (app/static/index.html served at /dashboard) provides an agent-dedicated compliance cockpit (Pure English RFC-compliant):
Integrates natively with Claude Desktop, Cursor, Gemini, and autonomous AI agents:
{ "mcpServers": { "minerals-oracle-x402": { "command": "python", "args": ["-m", "app.mcp_stdio"], "env": { "ORACLE_API_KEY": "YOUR_AGENT_KEY" } } } } Supported MCP Tools verify_composite_battery_passport: Evaluates end-to-end NCM EV battery packs and generates Master Merkle EIP-712 attestations. verify_lithium_origin: Verifies Australian hard-rock spodumene extraction and conversion. verify_nickel_origin: Verifies Indonesian laterite limonite HPAL MHP provenance and SIMBARA tax clearance. verify_cobalt_origin: Verifies DRC Katanga heterogenite cobalt hydroxide provenance, CEEC seals, and child labor audits. verify_copper_origin: Verifies Chilean/South American copper cathode provenance, COCHILCO quotas, H2SO4 acid balance, and ASTM B115 HVDC compliance. verify_silver_origin: Verifies Mexican/South American silver doré provenance, LBMA certification, N-Type TOPCon solar PV 99.99% purity, and cartel defense. verify_mineral_compliance: Legacy 7-pillar compliance audit engine for individual mineral lots. minerals_submit_agent_feedback: Zero-fee protocol feedback submission for autonomous agent evolution. 💳 Autonomous x402 Web3 Settlement on Polygon All M2M API invocations support micro-payments in USDC on Polygon (Chain ID 137):
git clone https://github.com/nohosa001-pixel/minerals-oracle-x402.git cd minerals-oracle-x402 python -m venv .venv # Windows: .venv\Scripts\activate # Linux/macOS: source .venv/bin/activate pip install -e . 2. Run Tests (278 Automated Tests - 100% Passing) # Run full regression suite pytest tests/ 3. Launch Local Server & Web Observatory # Option A: Built-in CLI runner minerals-oracle-x402 # Option B: Uvicorn development server uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload Navigate to:
For full mathematical formulations, threshold constants, legal citations, and EIP-712 type declarations, consult the Global Battery Minerals Compliance Specification v2.4.0.
ai-agent x402 mcp polygon-network polygon web3 critical-minerals battery-passport compliance rwa fastapi
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
None of the files in this release were uploaded with provenance metadata.
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.
Oct 2, 2026 2 release files Loss of provenance
Sep 25, 2026 2 release files Loss of provenance




