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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Installation

> Get started with Solana Attestations in your project

Get started with Solana Attestations by installing the necessary packages and
setting up your development environment.

## TypeScript/JavaScript

Install the Solana Attestations library, Solana Kit, and the two Kit plugins the
examples use to build a client:

```bash
npm install sas-lib @solana/kit @solana/kit-plugin-rpc @solana/kit-plugin-signer
```

## Create a Client

The examples in these docs send instructions with `client.sendTransaction(...)`
and read accounts with `fetchCredential(rpc, ...)` and the other `fetch*`
helpers. Create the client once and reuse it. The Solana Attestation Service
program is deployed on devnet and mainnet, and Surfpool forks mainnet, so both
tabs below can reach it.

<Tabs>
<Tab title="Devnet">

Create a keypair file, print its address, and paste the address into the
[Solana Faucet](https://faucet.solana.com/) to get devnet SOL:

```bash Terminal
solana-keygen new --no-bip39-passphrase --outfile payer.json
solana-keygen pubkey payer.json
```

```ts
import { createClient } from "@solana/kit";
import { solanaDevnetRpc } from "@solana/kit-plugin-rpc";
import { signerFromFile } from "@solana/kit-plugin-signer";
import { fetchAllCredential, fetchCredential } from "sas-lib";

const client = await createClient()
  .use(signerFromFile("payer.json"))
  .use(solanaDevnetRpc());

// The fee payer and credential authority used in the examples
const payerSigner = client.payer;
const authoritySigner = client.payer;

// sas-lib 1.0.10 is typed against @solana/kit 5, so strict TypeScript rejects a
// Kit 8 RPC in its fetch helpers. The calls work at runtime; the cast only
// changes the type.
type SasRpc = Parameters<typeof fetchCredential>[0] &
  Parameters<typeof fetchAllCredential>[0];
const rpc = client.rpc as unknown as SasRpc;
```

</Tab>
<Tab title="Local validator">

Start a local Surfnet with `surfpool start` (install the
[Surfpool CLI](/developers/docs/tools/surfpool/toolchain/getting-started)). It
forks mainnet, so the Solana Attestation Service program is available. This
version swaps `solanaDevnetRpc()` for `solanaLocalRpc()` and airdrops 1 SOL to a
new payer:

```ts
import { createClient, generateKeyPairSigner, lamports } from "@solana/kit";
import { solanaLocalRpc } from "@solana/kit-plugin-rpc";
import { signer } from "@solana/kit-plugin-signer";
import { fetchAllCredential, fetchCredential } from "sas-lib";

const client = createClient()
  .use(signer(await generateKeyPairSigner()))
  .use(solanaLocalRpc());
await client.airdrop(client.payer.address, lamports(1_000_000_000n)); // 1 SOL

// The fee payer and credential authority used in the examples
const payerSigner = client.payer;
const authoritySigner = client.payer;

// sas-lib 1.0.10 is typed against @solana/kit 5, so strict TypeScript rejects a
// Kit 8 RPC in its fetch helpers. The calls work at runtime; the cast only
// changes the type.
type SasRpc = Parameters<typeof fetchCredential>[0] &
  Parameters<typeof fetchAllCredential>[0];
const rpc = client.rpc as unknown as SasRpc;
```

</Tab>
</Tabs>

Next, [create a credential](/developers/docs/tools/attestations/instructions/create-credential).
