# Launch Your App

> The builder's manual for Apogee VM. How a guest program is written, built, run, proved and settled on-chain, and the habits that keep it correct, provable and cheap.

A **guest** is the program Apogee proves: a `no_std` Rust binary compiled for `riscv32imac-unknown-none-elf`, with an entry point, three memory regions for its inputs and outputs, and nothing else. The **host** is everything around it: the code that supplies the input, asks Apogee for a proof and hands that proof to whoever checks it. You write both. Apogee supplies the machine, the circuits and the verifier.

This section is written for two readers at once: an engineer at a keyboard and the model they work with. Every page states its rules plainly, and the [AI Companion](https://apogee.gweb3networks.com/docs/launch/ai-companion) condenses all of them into one file you can hand to an assistant before it writes a line.

## The model

> Figure: Who does what. The input and the journal are bound by the proof; the advice, drawn dashed, is not, which is why a guest checks it. The verifier never sees the program, only its identity.

A proof says one thing: the program with this identity, started over its image with this public input and some advice of the prover's choosing, ran to `EXIT` with this status, having written this journal. Everything you build sits on that sentence.

## The workflow

| Step | What you do | Page |
| --- | --- | --- |
| 1 | Install nothing by hand: the repository pins the toolchain. Fetch the ceremony file for proving | [Set up](https://apogee.gweb3networks.com/docs/launch/setup) |
| 2 | Write the guest: an entry point, the three regions, ordinary Rust | [Write a guest](https://apogee.gweb3networks.com/docs/launch/write), [Inputs, advice and the journal](https://apogee.gweb3networks.com/docs/launch/io) |
| 3 | Reach for delegated hashing and curve arithmetic where it pays | [Delegations](https://apogee.gweb3networks.com/docs/launch/delegations) |
| 4 | Build it for the guest target, then inspect the image and its identity | [Build and inspect](https://apogee.gweb3networks.com/docs/launch/build) |
| 5 | Run it in the emulator and count where the cycles go | [Run and profile](https://apogee.gweb3networks.com/docs/launch/run) |
| 6 | Prove a run and verify it | [Prove and verify](https://apogee.gweb3networks.com/docs/launch/prove) |
| 7 | Compress the proof by recursion and check it on Ethereum | [Settle on-chain](https://apogee.gweb3networks.com/docs/launch/on-chain) |

The [Quickstart](https://apogee.gweb3networks.com/docs/launch/quickstart) walks the whole loop once with a guest of three lines.

## The rules that matter most

Each is explained, with what goes wrong and what to do instead, in the [guest programming guide](https://apogee.gweb3networks.com/docs/launch/guide).

- **`usize` and every pointer are 32 bits.** Overflowing `usize` panics in the guest alone, `x as usize` truncates silently, and anything whose layout or hash depends on a length differs between host and guest.
- **The allocator never frees.** It bumps a pointer up from `__heap_start`, so what runs a guest out of memory is the total it allocates over the run, not its peak. Reuse buffers and size them with `with_capacity`.
- **Atomics work, and you should not write them.** The machine has one hart, so the A extension is there for compatibility with code that already uses it. New guest code has nothing to synchronize.
- **There is no world outside.** No files, no clock, no randomness, no network. A guest knows its public input, its advice, and what it computes.
- **Advice is the prover's choice.** Check it against something the proof binds before anything derived from it reaches the journal.
- **The journal is small.** 16,380 bytes at most. Publish a digest of anything that grows.
- **Overflow checks stay on in release.** They are part of what the program computes, so the guest profile pins them.
- **Every executed instruction is a proved row.** Proving cost follows cycle count, so build `--release` and count cycles before you optimize anything else.

## Where to start

- [Quickstart](https://apogee.gweb3networks.com/docs/launch/quickstart): A guest, a build, a run and a proof, in one sitting.

- [Guest programming guide](https://apogee.gweb3networks.com/docs/launch/guide): The gotchas and preferences, each with its reason.

- [AI Companion](https://apogee.gweb3networks.com/docs/launch/ai-companion): One file that briefs an assistant on writing guests.
