Overview
Proof-of-Inference (PoI) is a cryptographic verification system that enables trustless verification of AI model outputs on the blockchain. By creating hash-based commitments for inputs, outputs, and model identifiers, Nexis ensures that inference results can be verified without requiring the full computation to be replicated on-chain.Cryptographic Commitments
Hash-based commitments for inputs, outputs, and models
IPFS Integration
Decentralized storage for proof artifacts
On-Chain Verification
Smart contract attestation and validation
Economic Security
Stake-backed guarantees with slashing
Architecture
The Proof-of-Inference system consists of several interconnected components:InferenceCommitment Structure
The core data structure for proof-of-inference is theInferenceCommitment struct:
Field Descriptions
Hash Commitment Scheme
Input Hash
The input hash is a cryptographic commitment to the input data:Output Hash
The output hash commits to the inference result:Model Hash
The model hash identifies the specific model version used:Recording Inference
TherecordInference function creates an on-chain commitment:
Implementation
Event Emission
When an inference is recorded, the contract emits an event:Verification Process
The verification process involves multiple steps:Attestation Implementation
Attestation Event
IPFS Integration
Proof Artifact Structure
The proof URI points to a comprehensive artifact on IPFS:Uploading to IPFS
Security Considerations
Hash Collision Resistance
The keccak256 hash function provides:- Collision Resistance: Computationally infeasible to find two inputs with same hash
- Pre-image Resistance: Cannot reverse hash to recover original input
- Second Pre-image Resistance: Cannot find different input with same hash
Timestamp Validation
- Temporal ordering of inferences
- Deadline enforcement
- Replay attack prevention
Proof URI Integrity
Best practices:- Pin to Multiple Services: Use Infura, Pinata, and local nodes
- Verify CID: Recompute content hash and compare with URI
- Set Expiry: Implement proof retention policies
- Backup Critical Data: Archive important proofs off IPFS
Advanced Patterns
Batch Verification
Verify multiple inferences in a single transaction:Probabilistic Verification
Reduce costs by verifying a random sample:Optimistic Verification
Assume valid unless challenged:Performance Optimization
Gas Optimization
IPFS Optimization
- Use CDN Gateways: Cache frequently accessed proofs
- Implement Lazy Loading: Load proofs only when needed
- Compress Artifacts: Use gzip compression for JSON data
- Batch Uploads: Combine multiple proofs in single IPFS object
Event Indexing
Use The Graph or similar service for efficient event querying:Testing & Development
Local Testing
Troubleshooting
Common Issues
Hash Mismatch Errors
Hash Mismatch Errors
Problem: Computed hashes don’t match on-chain commitmentsSolutions:
- Ensure consistent serialization (sort JSON keys)
- Use same encoding (UTF-8 for strings)
- Verify byte order for binary data
IPFS Upload Failures
IPFS Upload Failures
Problem: Cannot upload proof artifacts to IPFSSolutions:
- Check IPFS node connectivity
- Verify API credentials (Infura/Pinata)
- Reduce artifact size if too large
- Use alternative IPFS service
Verification Timeouts
Verification Timeouts
Problem: Attestation takes too long or times outSolutions:
- Implement async verification queue
- Use probabilistic sampling for large batches
- Optimize IPFS gateway performance
- Cache frequently accessed proofs
Next Steps
AI Agents Guide
Learn about agent registration and management
LangGraph Integration
Build complex workflows with state machines
Complete Examples
View full implementation examples
API Reference
Explore the complete API documentation