ritual-dapp-onnx

Call the ONNX precompile from smart contracts for deterministic on-chain ML inference.

62|56|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/ritual-foundation/ritual-dapp-skills --skill ritual-dapp-onnx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ritual-dapp-onnx
Source: https://github.com/ritual-foundation/ritual-dapp-skills/tree/main/skills/ritual-dapp-onnx
Command: npx skills add https://github.com/ritual-foundation/ritual-dapp-skills --skill ritual-dapp-onnx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

On-chain ML model inference via the ONNX precompile eliminates reliance on off-chain inference services, enables deterministic results during block execution, and reduces latency by running models directly in the network.

Core Features & Use Cases

  • Synchronous inference: call the ONNX precompile (address 0x0000000000000000000000000000000000000800) and receive results in the same transaction.
  • Flexible input/output: uses RitualTensor encoding for tensors and supports common numeric formats (FLOAT32, etc.).
  • Use cases include real-time ML classification, regression, embeddings, and scoring in dApps that require on-chain decisions.

Quick Start

Deploy a test contract that constructs a small RitualTensor and invokes the ONNX precompile with a sample input.

Frequently Asked Questions about ritual-dapp-onnx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run machine learning inference on-chain within a smart contract?

On-chain machine learning inference is executed by calling the ONNX precompile directly from smart contracts at address 0x0000000000000000000000000000000000000800. This provides synchronous, deterministic results during block execution without relying on off-chain services.

What is the ONNX precompile for blockchain networks?

The ONNX precompile is a network-level endpoint at address 0x0000000000000000000000000000000000000800 that enables deterministic ML inference directly on-chain. It processes RitualTensor-encoded inputs and returns results synchronously within the same transaction.

How do I encode FLOAT32 tensors for on-chain ML model execution?

FLOAT32 tensors must be encoded using the RitualTensor format via the provided encoding routines in TypeScript and Solidity. This encoding standardizes input and output parameters for the ONNX precompile to process classification, regression, or embedding tasks.

Can I use synchronous ML inference in dApps without off-chain services?

Yes, dApps can perform synchronous ML inference without off-chain services by calling the ONNX precompile. Smart contracts receive inference results in the same transaction, enabling real-time on-chain decisions for scoring and classification tasks.

What are the limitations of using the ONNX precompile for on-chain inference?

The ONNX precompile requires inputs encoded in RitualTensor format and direct ABI calls to a fixed precompile address. It is limited to models compatible with ONNX and FLOAT32 data encoding, requiring parameter handling via provided Solidity and TypeScript routines.