> For the complete documentation index, see [llms.txt](https://velora-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://velora-1.gitbook.io/docs/getting-started.md). Agents can also search and read this documentation through its [MCP server](https://velora-1.gitbook.io/docs/~gitbook/mcp).

# Getting Started

This guide gets you from a fresh clone to a passing test suite. It targets the final codebase (Anchor 0.32.1, single-program workspace).

## Prerequisites

| Tool       | Version               |
| ---------- | --------------------- |
| Rust       | 1.91.0 (via `rustup`) |
| Solana CLI | stable                |
| Anchor CLI | 0.32.1 (via `avm`)    |
| Node.js    | 18+                   |
| Yarn       | 1.x                   |

Install Anchor 0.32.1 with [avm](https://www.anchor-lang.com/docs/installation):

```bash
avm install 0.32.1
avm use 0.32.1
```

## Build and test

```bash
# 1. Clone
git clone https://github.com/ranggays/token-distribution-protocol.git
cd token-distribution-protocol/backend

# 2. Install JS deps
yarn install

# 3. Generate a local keypair if you don't have one
solana-keygen new --no-bip39-passphrase -o ~/.config/solana/id.json

# 4. Sync the program ID to your local keypair
anchor keys sync

# 5. Build
anchor build

# 6. Test (spins up a local validator automatically)
anchor test
```

{% hint style="warning" %}
**`anchor keys sync` is required after cloning.** Anchor enforces that the program ID in `declare_id!` matches the keypair in `target/deploy/`. Run `anchor keys sync` once before your first build, otherwise deployment fails with a program-ID mismatch.
{% endhint %}

The generated IDL and TypeScript types land in `target/idl/backend.json` and `target/types/backend.ts` after `anchor build`. The integration test suite (`tests/backend.ts`) imports those types — build before you test.

## Deploy to devnet

```bash
solana config set --url devnet
solana airdrop 2
anchor build
anchor deploy --provider.cluster devnet
```

The current devnet program ID is `Fwboky3ufxoT43egazAymFmjyAtJVDJLVJs977oLSN4V`. If you deploy your own copy, `anchor keys sync` will rewrite `declare_id!` to your keypair's pubkey — commit that change or revert it depending on whether you want your own deployment.

## Next steps

* [Integration Guide](https://velora-1.gitbook.io/docs/guides/integration.md) — create your first stream from a TypeScript client.
* [Instruction Reference](https://velora-1.gitbook.io/docs/instruction-reference/instructions.md) — every instruction, its parameters, and error codes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://velora-1.gitbook.io/docs/getting-started.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
