Write a smart contract. Run it. Actually understand it.

35 lessons across contracts, deployment and the AI network. 19 of them are exercises where your code executes in the real Animica VM — the same vm_py engine that runs contracts on-chain. Not a simulator, not a sandboxed guess at the semantics.

Nothing here is aspirational. Every command was run against the installed CLI before it was written down, every code sample was executed, and the AI-network numbers are measurements taken on 2026-08-20 rather than targets. Where something is slow or unfinished, the lesson says so.

Smart contract fundamentals

6 lessons

Storage, reverts, callers, events, mappings. Six runnable exercises — your code executes in the real Animica VM, not a simulator.

Your first contract: storage

A contract is a Python module whose functions the chain can call. State lives in storage — and storage holds bytes, nothing else.
≈ 8 min runnable exercise

Numbers in a bytes-only store

Storage holds bytes, but contracts count things. The conversion pattern below is used by every Animica contract, including the token standard.
≈ 10 min runnable exercise

Failing correctly: require and revert

A contract that accepts bad input corrupts its own state forever. abi.require is how you refuse.
≈ 8 min runnable exercise

Who is calling: abi.caller and ownership

Without knowing the caller, every function is public to everyone. This is how access control works.
≈ 10 min runnable exercise

Events: telling the outside world

Storage is what your contract knows. Events are what it announces. Indexers, wallets and explorers read events, not storage.
≈ 8 min runnable exercise

Mappings: many values, one namespace

There is no dict in storage. You build one by composing keys — and the prefix you choose is a security boundary.
≈ 9 min runnable exercise
🚀

Compile, deploy, call

5 lessons

Manifests and ABIs, the compile step, getting on-chain, and the one misunderstanding that costs people real money.

Install the CLI

One pip package ships the wallet, the node runner, the contract tooling and the miner.
≈ 5 min walkthrough

The manifest: how the chain knows your ABI

Your .py file is the code. The manifest declares what the outside world may call, and with what types.
≈ 9 min walkthrough

Compile

Turn source into an artifact with a code hash. This is also your first real correctness check.
≈ 6 min walkthrough

Deploy, then call

Put the artifact on-chain, then read from it for free and write to it with a transaction.
≈ 12 min walkthrough

Inclusion is not execution

The single most expensive misunderstanding in blockchain integration work — and it is not specific to Animica.
≈ 7 min walkthrough
🧠

The AI network

5 lessons

Free keyless inference, prompting small models well, streaming, and what a contract can and cannot ask a model to do.

The free inference network

An OpenAI-compatible endpoint with no API key. What it is, what it costs, and why the first call is slow.
≈ 7 min walkthrough

Prompting that survives a small model

Techniques that matter more, not less, when the model is small and the latency is high.
≈ 10 min walkthrough

Streaming, and designing for slow

Twenty seconds of blank screen feels broken. The same twenty seconds with tokens arriving feels fast.
≈ 9 min walkthrough

Where AI can and cannot go

A contract may commission inference but never receive the answer in the same breath. Understanding why explains most of the AICF design.
≈ 8 min walkthrough

Put it together: an agent that pays for what it uses

Discovery, price comparison and payment — the loop that makes an autonomous agent more than a chatbot.
≈ 12 min walkthrough
🪙

Build a token, step by step

4 lessons

Balances, allowances, supply caps and safe ownership transfer. Four exercises that add up to the working core of a real token.

A token, part 1: balances and transfer

Mint, read a balance, move value between accounts. This is the core every fungible token shares.
≈ 14 min runnable exercise

A token, part 2: allowances

Letting a third party spend on your behalf — the mechanism every exchange and marketplace depends on, and its famous footgun.
≈ 14 min runnable exercise

A token, part 3: caps and burning

A maximum supply is a promise. Enforce it in code, because that is the only place anyone can verify it.
≈ 11 min runnable exercise

Handing over the keys safely

One-step ownership transfer means one typo loses the contract forever. Two steps make the mistake recoverable.
≈ 10 min runnable exercise
🧰

Build real things

4 lessons

Escrow, multisig, a name registry and on-chain voting — four exercises that mirror contracts shipped in the Animica repo.

Escrow: holding value between strangers

A buyer, a seller, and a contract that will only ever do one of two things with the money.
≈ 15 min runnable exercise

Multisig: M-of-N approval

No single key can act alone. The pattern behind every treasury that has not been drained by one compromised laptop.
≈ 16 min runnable exercise

A name registry

First come, first served — and the transfer rules that decide whether a name is really yours.
≈ 12 min runnable exercise

Voting that cannot be voted twice

Proposals, a deadline, one vote per address, and a result nobody can quietly change afterwards.
≈ 14 min runnable exercise
⛓️

Working with the chain

3 lessons

Reading state over free RPC, what bech32m and post-quantum signatures mean in practice, and the real timings of a transaction.

Reading the chain

Two free, no-auth ways to ask the network what is true — and the small mistakes that make each one fail.
≈ 11 min walkthrough

Addresses, and the signatures behind them

Why Animica addresses look the way they do, and why the signature scheme is unusual — and larger than you expect.
≈ 12 min walkthrough

Sending a transaction, and knowing it worked

The full lifecycle with real timings, measured by paying out this academy's own lesson rewards.
≈ 13 min walkthrough
🔐

Patterns worth knowing

3 lessons

Hashing, commit-reveal for a secret ballot on a public chain, and vesting arithmetic that does not strand dust.

Hashing, and which one actually works

A one-way fingerprint of any data. The building block for commitments, ids and integrity checks — with one important footgun on this chain.
≈ 10 min runnable exercise

Commit-reveal: keeping a secret on a public chain

Everything in storage is public forever. This is how you run a secret ballot anyway.
≈ 16 min runnable exercise

Vesting: paying out over time

A cliff, then a straight line. The arithmetic that governs most team and investor allocations.
≈ 14 min runnable exercise
🛡

Security and composition

5 lessons

The authorization bug that drains vaults, reentrancy, commissioning off-chain inference, determinism, and testing before you deploy.

caller vs tx_origin: the authorization bug

Two functions that look interchangeable. Using the wrong one hands your contract to anyone who can get you to click something.
≈ 12 min runnable exercise

A contract that asks for inference

A contract cannot receive a model's answer — but it can commission one deterministically. Including what that primitive does and does not do today.
≈ 11 min runnable exercise

Calling other contracts, and reentrancy

The moment your contract calls another one, it can be re-entered before it finishes. Order your writes accordingly.
≈ 13 min walkthrough

Why the VM takes things away from you

Every restriction in the contract VM traces back to one requirement: every node must compute the identical result, forever.
≈ 10 min walkthrough

Testing before you deploy

Deployed code is permanent and public. Everything you can find locally costs nothing to fix.
≈ 11 min walkthrough