> For the complete documentation index, see [llms.txt](https://ggai.gitbook.io/ggai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ggai.gitbook.io/ggai-docs/high-level-architecture/glitchgremlinprogram-on-chain.md).

# GlitchGremlinProgram (On-Chain)

The GlitchGremlinProgram is written in Rust and deployed on Solana Main-net. It has multiple entry points (i.e., instructions) that define how users and off-chain services interact with $GREMLINAI.

### Program Responsibilities Are as Follows

**Chaos Request Initialization:**&#x20;

• Checks whether the caller has enough $GREMLINAI to pay for the requested chaos.&#x20;

• Transfers (escrows) the required amount from the caller’s wallet into the program’s escrow account.&#x20;

• Creates a *`ChaosRequest`* Account that stores the request parameters and references.

**Chaos Request Finalization:**&#x20;

• Off-chain AI engine calls back with a signed proof of chaos completion.&#x20;

• The program updates the `ChaosRequest` Account to mark the request as “<mark style="background-color:green;">completed</mark>” or “<mark style="background-color:red;">failed.</mark>”&#x20;

• If partial refunds or additional fees are applicable, the program updates token balances accordingly.

**Governance Hooks:**&#x20;

• Integrates with a standard Solana governance module.&#x20;

• Allows for proposals that, if passed, automatically create or fund chaos tests from the protocol treasury.&#x20;

• Potentially triggers special events (e.g., distributing rewards to voters or top community participants).
