ACADEMY
v2
MODULE 14
LESSON 1
Writing Qubic Smart Contracts
Qubic contracts are written in a restricted C++ environment called the Qubic Programming Interface (QPI).
Key facts:
Deterministic & Secure
No dynamic memory, no pointers, fixed-size types only (e.g. uint8, uint16).
Single source file
All contract logic is self-contained and compiled to run natively on every validator (“Computor”).
Persistent State
Static variables become the contract’s on-chain state — up to 1 GiB.
Public Entry Points
Only methods registered in REGISTER_USER_FUNCTIONS_AND_PROCEDURES are callable externally.
CLI & Testnet
External data enters Qubic through Oracle Machines. These are deterministic feeders of real-world information — essential for contracts needing off-chain data.
Every contract must be deployed to Qubic testnet before submission to mainnet. This ensures validator and community testing before quorum voting.
Example (copied directly from QPI example repo):