Technology
Explore the technical architecture of Animica: PoIES consensus, Python-VM execution, post-quantum cryptography, and P2P networking.
Animica is built on four core technical pillars: post-quantum security, deterministic execution, useful-work consensus, and decentralized networking. Each layer is designed with transparency, verifiability, and long-term sustainability in mind.
Consensus: PoIES
Proof-of-Integrated-External-Services combines hash-based security with verifiable useful work
How PoIES Works
PoIES (Proof-of-Integrated-External-Services) accepts blocks when a miner's score exceeds a moving threshold (Θ). The score combines:
- Hash-share work: Traditional cryptographic hashing with exponential scoring H(u) = −ln(u)
- Useful work proofs: Verified AI computation, quantum tasks, storage proofs, and VDF results
Each proof type has policy-defined caps (Γ) to maintain security and fairness. The threshold Θ adjusts dynamically using EMA-based retargeting to maintain target block times.
Security Model
PoIES maintains security by:
- Bounded proof contributions: No single proof type can dominate block production
- Nullifier windows: Prevents proof reuse across blocks with time-to-live tracking
- Fixed-point math: Deterministic scoring using micro-nats (μ-nats) for consensus stability
- EMA difficulty adjustment: Smooth retargeting based on recent block times
Useful Work Integration
Miners can augment their hash-based score with proofs of useful computation:
- AI proofs: Inference results, model training contributions
- Quantum proofs: Quantum circuit execution, quantum random numbers
- Storage proofs: Data availability commitments, erasure coding
- VDF proofs: Verifiable delay functions for randomness
All proofs are verified deterministically by nodes before being included in the score calculation.
Execution: Python-VM
Deterministic Python smart contracts with gas metering and reproducible state transitions
Python Smart Contracts
Animica's execution layer runs smart contracts written in Python. The Python-VM ensures deterministic execution with:
- Pure functions: No I/O, clock access, or non-deterministic operations
- Gas metering: Per-opcode costs tracked for predictable resource usage
- Canonical encoding: CBOR serialization with sorted keys for state consistency
- Journaled state: Track reads/writes per transaction for rollback and snapshots
Contract Lifecycle
Deploying and calling contracts follows a standard workflow:
- Write contract in Python following Python-VM spec
- Compile to intermediate representation (IR)
- Deploy via transaction with manifest and code
- Call contract functions via transactions
- Receive deterministic receipts with gas used and logs
Gas & Metering
Gas costs are defined per-opcode in `gas_table.json`. Common operations:
- Storage read: 200 gas
- Storage write: 5000 gas
- Contract call: 700 gas + execution costs
- Event emission: 375 gas + data costs
Transactions specify a gas limit. If exceeded, execution reverts but gas is still consumed.
Post-Quantum Cryptography
Quantum-resistant signatures and encryption built-in from day one
Signature Schemes
Animica supports two NIST-standardized post-quantum signature schemes:
- Dilithium3 (ML-DSA-65): Default stateless signature scheme with fast verification
- SPHINCS+: Alternative stateful scheme for high-security scenarios
Both schemes provide security against quantum attacks using lattice-based (Dilithium) or hash-based (SPHINCS+) constructions.
Key Management
Keys are managed with:
- BIP39 mnemonics: 24-word phrases for seed generation
- Hierarchical derivation: Multiple keys from a single seed
- Address encoding: Bech32m format with 'anim1' prefix
- Domain separation: Unique prefixes for tx, commitment, header signatures
Encryption & Handshakes
P2P connections use quantum-resistant encryption:
- Kyber768: Key encapsulation mechanism for session keys
- ChaCha20-Poly1305: Symmetric encryption for data transport
- Noise protocol: Handshake patterns with forward secrecy
P2P Networking
Fully decentralized gossip protocol with multi-transport support
Peer Discovery
Nodes discover peers through multiple mechanisms:
- DNS seeds: Bootstrap from well-known seed nodes
- mDNS: Local network discovery for devnets
- Kademlia DHT: Distributed hash table for global discovery
- Peer exchange: Share known peers via gossip
Transport Protocols
Animica supports multiple transport protocols:
- TCP: Reliable stream protocol for stable connections
- QUIC: UDP-based with built-in encryption and multiplexing
- WebSocket: Browser-compatible for web clients
All transports use end-to-end encryption with quantum-resistant handshakes.
Gossip Protocol
Block, transaction, and proof propagation uses an efficient gossip protocol:
- Push-pull: Proactive and reactive sync
- Bloom filters: Efficient set reconciliation
- Prioritization: High-value data (new blocks) spreads faster
- Rate limiting: Prevent spam and DoS attacks
Data Availability
NMT-based commitments for light client verification
Namespaced Merkle Trees (NMT)
Animica uses NMTs for data availability commitments, allowing light clients to verify data for specific namespaces without downloading entire blocks. This enables efficient data availability sampling (DAS) for resource-constrained nodes.
Light Client Verification
Light clients can verify block headers and sample data without full state:
- Download headers with NMT roots
- Sample random data shares to probabilistically verify availability
- Request Merkle proofs for specific transactions or state
For detailed specifications, see the documentation:
spec/poies_math.md- PoIES scoring and retargetingvm_py/specs/- Python-VM gas, determinism, ABIexecution/specs/- Receipts, scheduler, state managementp2p/- Networking architecture and protocolspq/- Post-quantum cryptography implementation
Ready to build on Animica?
Start deploying Python smart contracts and exploring the technology today