All lessons
Work through them in order, or jump to what you need.
⛓
Smart contract fundamentals
- Your first contract: storageA contract is a Python module whose functions the chain can call. State lives in storage — and storage holds bytes, nothing else. ⌨ exercise 8m
- Numbers in a bytes-only storeStorage holds bytes, but contracts count things. The conversion pattern below is used by every Animica contract, including the token standard. ⌨ exercise 10m
- Failing correctly: require and revertA contract that accepts bad input corrupts its own state forever. abi.require is how you refuse. ⌨ exercise 8m
- Who is calling: abi.caller and ownershipWithout knowing the caller, every function is public to everyone. This is how access control works. ⌨ exercise 10m
- Events: telling the outside worldStorage is what your contract knows. Events are what it announces. Indexers, wallets and explorers read events, not storage. ⌨ exercise 8m
- Mappings: many values, one namespaceThere is no dict in storage. You build one by composing keys — and the prefix you choose is a security boundary. ⌨ exercise 9m
🚀
Compile, deploy, call
- Install the CLIOne pip package ships the wallet, the node runner, the contract tooling and the miner. 5m
- The manifest: how the chain knows your ABIYour .py file is the code. The manifest declares what the outside world may call, and with what types. 9m
- CompileTurn source into an artifact with a code hash. This is also your first real correctness check. 6m
- Deploy, then callPut the artifact on-chain, then read from it for free and write to it with a transaction. 12m
- Inclusion is not executionThe single most expensive misunderstanding in blockchain integration work — and it is not specific to Animica. 7m
🧠
The AI network
- The free inference networkAn OpenAI-compatible endpoint with no API key. What it is, what it costs, and why the first call is slow. 7m
- Prompting that survives a small modelTechniques that matter more, not less, when the model is small and the latency is high. 10m
- Streaming, and designing for slowTwenty seconds of blank screen feels broken. The same twenty seconds with tokens arriving feels fast. 9m
- Where AI can and cannot goA contract may commission inference but never receive the answer in the same breath. Understanding why explains most of the AICF design. 8m
- Put it together: an agent that pays for what it usesDiscovery, price comparison and payment — the loop that makes an autonomous agent more than a chatbot. 12m
🪙
Build a token, step by step
- A token, part 1: balances and transferMint, read a balance, move value between accounts. This is the core every fungible token shares. ⌨ exercise 14m
- A token, part 2: allowancesLetting a third party spend on your behalf — the mechanism every exchange and marketplace depends on, and its famous footgun. ⌨ exercise 14m
- A token, part 3: caps and burningA maximum supply is a promise. Enforce it in code, because that is the only place anyone can verify it. ⌨ exercise 11m
- Handing over the keys safelyOne-step ownership transfer means one typo loses the contract forever. Two steps make the mistake recoverable. ⌨ exercise 10m
🧰
Build real things
- Escrow: holding value between strangersA buyer, a seller, and a contract that will only ever do one of two things with the money. ⌨ exercise 15m
- Multisig: M-of-N approvalNo single key can act alone. The pattern behind every treasury that has not been drained by one compromised laptop. ⌨ exercise 16m
- A name registryFirst come, first served — and the transfer rules that decide whether a name is really yours. ⌨ exercise 12m
- Voting that cannot be voted twiceProposals, a deadline, one vote per address, and a result nobody can quietly change afterwards. ⌨ exercise 14m
⛓️
Working with the chain
- Reading the chainTwo free, no-auth ways to ask the network what is true — and the small mistakes that make each one fail. 11m
- Addresses, and the signatures behind themWhy Animica addresses look the way they do, and why the signature scheme is unusual — and larger than you expect. 12m
- Sending a transaction, and knowing it workedThe full lifecycle with real timings, measured by paying out this academy's own lesson rewards. 13m
🔐
Patterns worth knowing
- Hashing, and which one actually worksA one-way fingerprint of any data. The building block for commitments, ids and integrity checks — with one important footgun on this chain. ⌨ exercise 10m
- Commit-reveal: keeping a secret on a public chainEverything in storage is public forever. This is how you run a secret ballot anyway. ⌨ exercise 16m
- Vesting: paying out over timeA cliff, then a straight line. The arithmetic that governs most team and investor allocations. ⌨ exercise 14m
🛡
Security and composition
- caller vs tx_origin: the authorization bugTwo functions that look interchangeable. Using the wrong one hands your contract to anyone who can get you to click something. ⌨ exercise 12m
- A contract that asks for inferenceA contract cannot receive a model's answer — but it can commission one deterministically. Including what that primitive does and does not do today. ⌨ exercise 11m
- Calling other contracts, and reentrancyThe moment your contract calls another one, it can be re-entered before it finishes. Order your writes accordingly. 13m
- Why the VM takes things away from youEvery restriction in the contract VM traces back to one requirement: every node must compute the identical result, forever. 10m
- Testing before you deployDeployed code is permanent and public. Everything you can find locally costs nothing to fix. 11m