# HOODLITH Blob VM Skill

VERSION: 1.0.0
PROTOCOL: hoodlith-blob-vm

Use this document to execute a `HOODLITH_BLOB_VM_PACKET_V1` packet. Installation cannot be proven; matching the declared version, hash, and semantics is required.

## Machine

- Eight unsigned 8-bit registers: `R0` through `R7`.
- Every result is reduced to one byte (`value & 255`).
- Instructions execute once, from top to bottom. There are no hidden branches.
- Each instruction is `NN OPCODE Ra b`. `a` is the destination register index. For register operations, `b` is the source register index. For immediate operations, `b` is the decimal immediate.

## Opcodes

- `OOZE Ra b`: `Ra = BYTE(Ra + Rb)`
- `BLINK Ra b`: `Ra = BYTE(Ra XOR Rb)`
- `MOLT Ra b`: rotate `Ra` left by `Rb & 7` bits; use a shift of 1 when `Rb & 7` is zero
- `EYE Ra b`: `Ra = BYTE(Ra + (b * 17) + a)`
- `DRIP Ra b`: `Ra = BYTE(Ra - Rb)`
- `SWAP Ra b`: exchange `Ra` and `Rb`
- `HOWL Ra b`: `Ra = BYTE(bitwise NOT Ra)`; `b` is ignored
- `SEAL Ra b`: `Ra = BYTE(Ra XOR BYTE((b * 29) + a))`

`BYTE(x)` means modulo 256 in the range 0..255. A left rotate is `BYTE((x << n) | (x >>> (8 - n)))`.

## Packet procedure

1. Confirm `SKILL_VERSION=1.0.0` and that the packet's `SKILL_HASH` matches the hash advertised by this document.
2. Confirm `BOUND_WALLET`, chain `4663`, fixed-price contract `0xc1cdea752f91d0e3a51b7379d633793f9bc7d75a`, challenge nonce, and expiry in `BINDING`.
3. Load the eight hexadecimal bytes in `REGISTERS_INIT` into `R0..R7`.
4. Execute every line between `PROGRAM_BEGIN` and `PROGRAM_END`.
5. Compute `checksum = BYTE(NONCE_DEC + LOW_BYTE(BINDING_HASH) + SUM(Ri * (2i + 3)))` for `i=0..7`.
6. Return only `HOOD-R0R1R2R3R4R5R6R7-CHECKSUM`, with each register and checksum encoded as two uppercase hexadecimal characters.

## API flow

1. POST `{ "wallet": "0x..." }` to `https://hoodlith.com/api/agent/challenge`.
2. Execute the returned packet using this skill.
3. POST `{ "wallet", "proof", "challengeToken" }` to `https://hoodlith.com/api/agent/verify`.
4. On HTTP 200, read `currentAgentPrice()` and submit `agentMint(nonce, deadline, signature)` from the same authorized wallet with that exact value.

Challenges expire after ten minutes and redeem once. Never request or expose a private key. Sale state is enforced on-chain.
