> ## Documentation Index
> Fetch the complete documentation index at: https://luminouslabs-cc5545c6-indexing-tokens.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create your first compressed tokens in under 5 minutes.

<Steps>
  <Step>
    ## Prerequisites

    <Accordion title="Installation">
      <Tabs>
        <Tab title="npm">
          Install packages in your working directory:

          ```bash theme={null}
          npm install @lightprotocol/stateless.js@beta \
                      @lightprotocol/compressed-token@beta
          ```

          Install the CLI globally:

          ```bash theme={null}
          npm install -g @lightprotocol/zk-compression-cli@beta
          ```
        </Tab>

        <Tab title="yarn">
          Install packages in your working directory:

          ```bash theme={null}
          yarn add @lightprotocol/stateless.js@beta \
                   @lightprotocol/compressed-token@beta
          ```

          Install the CLI globally:

          ```bash theme={null}
          yarn global add @lightprotocol/zk-compression-cli@beta
          ```
        </Tab>

        <Tab title="pnpm">
          Install packages in your working directory:

          ```bash theme={null}
          pnpm add @lightprotocol/stateless.js@beta \
                   @lightprotocol/compressed-token@beta
          ```

          Install the CLI globally:

          ```bash theme={null}
          pnpm add -g @lightprotocol/zk-compression-cli@beta
          ```
        </Tab>
      </Tabs>
    </Accordion>

    <Tabs>
      <Tab title="Localnet">
        ```bash theme={null}
        # start local test-validator in a separate terminal
        light test-validator
        ```

        <Note>
          In the code examples, use `createRpc()` without arguments for localnet.
        </Note>
      </Tab>

      <Tab title="Devnet">
        Get an API key from [Helius](https://helius.dev) and add to `.env`:

        ```bash title=".env" theme={null}
        API_KEY=<your-helius-api-key>
        ```

        <Note>
          In the code examples, use `createRpc(RPC_URL)` with the devnet URL.
        </Note>
      </Tab>
    </Tabs>
  </Step>

  <Step>
    ## Mint Compressed Tokens

    ```typescript theme={null}
    // 1. Load wallet and connect to Localnet
    // 2. Create SPL mint with token pool for compression via createMint()
    // 3. Mint compressed tokens to recipient account via mintTo()
    // 4. Verify compressed token balance via getCompressedTokenAccountsByOwner

    import { createRpc } from "@lightprotocol/stateless.js";
    import { createMint, mintTo } from "@lightprotocol/compressed-token";
    import { Keypair } from "@solana/web3.js";
    import { readFileSync } from "fs";
    import { homedir } from "os";

    // Step 1: Load wallet from filesystem
    const payer = Keypair.fromSecretKey(
      new Uint8Array(JSON.parse(readFileSync(`${homedir()}/.config/solana/id.json`, "utf8")))
    );

    // Connect to local test-validator
    const RPC_ENDPOINT = "http://localhost:8899";
    const COMPRESSION_ENDPOINT = "http://localhost:8784";
    const PROVER_ENDPOINT = "http://localhost:3001";
    const connection = createRpc(RPC_ENDPOINT, COMPRESSION_ENDPOINT, PROVER_ENDPOINT);

    const main = async () => {
      try {
        // Step 2: Create SPL mint with token pool for compression
        console.log("\nCreating SPL mint with token pool for compression");
        const { mint, transactionSignature } = await createMint(
          connection,
          payer,
          payer.publicKey, // mintAuthority
          9
        );

        console.log(`Mint address: ${mint.toBase58()}`);
        console.log(
          `Create mint transaction: https://explorer.solana.com/tx/${transactionSignature}?cluster=custom&customUrl=http://localhost:8899`
        );

        // Step 3: Mint compressed tokens to recipient account
        console.log("\nMinting compressed token...");
        const mintAmount = 1000000000; // mintAmount with decimals
        const mintToTxId = await mintTo(
          connection,
          payer,
          mint, // SPL mint with token pool for compression
          payer.publicKey, // recipient.publicKey
          payer, // mintAuthority
          mintAmount
        );

        console.log(`Compressed Token minted ${mintAmount / 1e9} token`);
        console.log(
          `Transaction: https://explorer.solana.com/tx/${mintToTxId}?cluster=custom&customUrl=http://localhost:8899`
        );

        // Step 4: Verify compressed token balance via getCompressedTokenAccountsByOwner
        const tokenAccounts = await connection.getCompressedTokenAccountsByOwner(
          payer.publicKey,
          { mint } // SPL mint with token pool for compression
        );
      } catch (error: any) {
        console.error("Error:", error.message);
      }
    };

    main().catch(console.error);
    ```
  </Step>
</Steps>

# Next Steps

<Card title=" Learn more about compressed tokens." icon="chevron-right" color="#0066ff" href="/compressed-tokens" horizontal />
