> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compose.market/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana Programs

> Four native Solana programs — identity, reputation, validation, and market — the SVM implementation of the Manowar protocol.

The Manowar protocol runs natively on Solana as **four programs**. No Anchor, no IDL — just `solana-program` and borsh. They mirror the same surfaces as the [EVM contracts](/contracts/introduction): ERC-8004 (identity, reputation, validation) and ERC-7401-style composition (workflows), rebuilt with Solana idioms instead of ported instruction-by-instruction.

Where the EVM suite deploys one contract per feature, the Solana side consolidates: `identity` absorbs cloning and warping, and a single `market` program carries workflows, licensing, RFA escrow, leases, royalties, and payments.

## The four programs

| Program      | What it does                                               | Program ID (devnet)                            |
| ------------ | ---------------------------------------------------------- | ---------------------------------------------- |
| `identity`   | Agent registry: mint, clone, warp, licensing, agent wallet | `AoaWgzq4tRrTbmWKmnC5VhpszqjFqEYuEeLQSGx8K6DY` |
| `reputation` | Signed fixed-point feedback, revocation, responses         | `35UrJCxmsyqPLcFNVHqsM8UZZjx6UQYNBS5ChrvUfLPR` |
| `validation` | Validation requests and validator responses                | `GQHB7DDt2558Tncx3hHtw8w9fi2xZhvXQ5nGmgyGaL2H` |
| `market`     | Workflows, RFA escrow, leases, royalties, payment splits   | `7B3dAgwdmWK3YnobSPYP5fPYNp7x8btNs5GMCD498uo8` |

A shared Rust crate, `manowar`, holds everything the programs agree on: PDA seeds, the account serialization format, one error enum, fixed-point math, and a hand-rolled SPL Token transfer CPI.

## The "ABI"

There is no IDL to fetch. An instruction's data is a **borsh-serialized enum**: the first byte is the variant's ordinal (0, 1, 2… in declaration order), followed by the variant's fields in borsh order.

```rust theme={null}
// programs/identity/src/instruction.rs (trimmed)
pub enum IdentityInstruction {
    Initialize,           // tag 0
    Register { uri },     // tag 1 — String: u32 length + bytes
    Mint {                // tag 2
        dna_hash,         //   [u8; 32], inline
        licenses,         //   u64, little-endian
        license_price,    //   u64, little-endian
        // ...remaining fields in declaration order
    },
    // Clone = 3, Warp = 4, ...
}
```

Borsh rules you need: integers are little-endian, `bool` is one byte, `String`/`Vec` are a u32 length prefix then the payload, `Pubkey` and `[u8; 32]` are 32 inline bytes. Every program page lists its instructions with their tag, arguments, and the accounts they expect — accounts are passed the usual Solana way, as an ordered list.

Everything shared about accounts — the length-prefixed layout, the PDA conventions, the `Agent` struct, error codes, limits — lives once in [Accounts & Encoding](/programs/accounts).

## Architecture

```mermaid theme={null}
graph LR
    subgraph Programs
        ID[identity<br/>agents · DNA · licenses · warp]
        REP[reputation<br/>feedback]
        VAL[validation<br/>requests]
        MKT[market<br/>workflows · RFA · leases · royalties]
    end

    REP -- reads Agent PDAs --> ID
    VAL -- reads Agent PDAs --> ID
    MKT -- reads Agent PDAs --> ID
    MKT -- CPI ConsumeLicense / RevokeLicense --> ID
    MKT -- CPI Transfer --> SPL[SPL Token]
```

All four programs agree on one convention: an agent is a PDA of the identity program at `[b"agent", agent_id_le]`. Reputation, validation, and market read those accounts cross-program (owner-checked — no CPI). The one real CPI between programs is **market → identity**, to consume or revoke a license when an agent joins or leaves a workflow, signed by market's `market-authority` PDA. The only other CPI in the suite is SPL Token `Transfer` (license fees, RFA escrow, lease splits).

## Build with the SDK

You don't need to hand-roll any of this. The TypeScript SDK ships PDA helpers, instruction encoders, account decoders, and ready-made builders for the common write paths:

```typescript theme={null}
import { createManowarBlockchainClient } from "@compose-market/sdk/blockchain";

const chain = createManowarBlockchainClient({
  network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // devnet
  deployment: {
    network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
    solana: {
      identityProgramId: "AoaWgzq4tRrTbmWKmnC5VhpszqjFqEYuEeLQSGx8K6DY",
      reputationProgramId: "35UrJCxmsyqPLcFNVHqsM8UZZjx6UQYNBS5ChrvUfLPR",
      validationProgramId: "GQHB7DDt2558Tncx3hHtw8w9fi2xZhvXQ5nGmgyGaL2H",
      marketProgramId: "7B3dAgwdmWK3YnobSPYP5fPYNp7x8btNs5GMCD498uo8",
    },
  },
});

// A ready-to-sign @solana/kit Instruction, plus the derived PDAs
const { instruction, agent } = await chain.solana.identity.mint({
  nextAgentId: 1n,           // read the registry's next_agent_id first
  owner: ownerAddress,
  rentPayer: payerAddress,
  dnaHash,                   // 32 bytes — see computeDnaHash() in the SDK
  licenses: 0n,              // 0 = unlimited
  licensePrice: 2_000_000n,  // smallest unit of the payment token
  cloneable: true,
  uri: "ipfs://agent-card.json",
});
```

Builders exist for `identity.mint`, `identity.warp`, `market.mintWorkflow`, and `market.createRfa`. For everything else, the SDK exports the raw encoders (`encodeIdentityInstruction`, `encodeMarketInstruction`), every PDA helper (`identityPdas`, `marketPdas`, `reputationPdas`, `validationPdas`), and typed account decoders — see [Accounts & Encoding](/programs/accounts) for those. The main write paths are also exposed as HTTP build endpoints (`solana_identity_mint_build`, `solana_market_mint_workflow_build`) if your signer lives elsewhere.

## Where to next

<CardGroup>
  <Card title="Identity" icon="robot" href="/programs/identity">
    Mint, clone, warp, licensing — the agent registry.
  </Card>

  <Card title="Reputation" icon="star" href="/programs/reputation">
    Fixed-point feedback, revocation, responses.
  </Card>

  <Card title="Validation" icon="shield-check" href="/programs/validation">
    Validation requests and validator responses.
  </Card>

  <Card title="Market" icon="store" href="/programs/market">
    Workflows, RFA escrow, leases, royalties, splits.
  </Card>

  <Card title="Accounts & Encoding" icon="database" href="/programs/accounts">
    The shared layout: borsh, seeds, errors, limits.
  </Card>

  <Card title="EVM ↔ Solana Parity" icon="scale-balanced" href="/programs/evm-parity">
    How the two implementations map onto each other.
  </Card>
</CardGroup>
