Start

Quickstart: fund an agent

From a wallet to an agent's first paid request, and that payment in the ledger.

This page takes an owner from a wallet holding USDC to an agent's first paid request, and to that payment in the grant's ledger. The agent buys from Alba's demo seller, an API with two paid routes.

You need a Solana wallet with some USDC, and Node 22 or later for the agent.

  1. Open your balance

    Go to the app, connect your wallet and press Open balance. The wallet asks you to sign a message, which moves no funds. Alba derives your key from the signature and scans the pool for your notes.

  2. Deposit

    Under Balance, enter an amount and press Deposit. Your wallet signs one transfer into the pool. When it settles, the amount shows as Available to grant or withdraw.

  3. Create a grant

    Press New grant and set the terms:

    FieldFor this quickstart
    Amount1.00
    Cap per payment0.05
    Expiry1 day
    SellersAny seller
    Labelresearch-agent

    Press Create grant. The browser proves the spend and the facilitator relays it. Your wallet signs nothing.

  4. Copy the credential

    The app shows the grant credential, a string beginning alba_grant_. Press Copy credential. You can show it again later from the grant's page.

  5. Give it to the agent

    In the agent's project, install the SDK and set the credential in its environment:

    bash
    npm install @alba/sdk
    export ALBA_GRANT=alba_grant_…
  6. Make a paid request

    agent.ts
    import { alba } from '@alba/sdk'
    
    const res = await alba.fetch('https://alba-seller-production.up.railway.app/papers/search?q=privacy')
    
    console.log(res.status)
    console.log(await res.json())

    The demo seller prices this route at 0.01 USDC. Its first answer is 402. The SDK proves a payment from the grant and asks again, and alba.fetch returns the second answer: status 200 and a JSON body with query, papers and source.

  7. Read the ledger

    Back in the app, open Grants and then the grant. Its ledger has one row: the time in UTC, the seller's address, the memo GET with the URL the agent asked for, the amount and the transaction. Open the transaction on an explorer and the payer you see there is the pool.

The demo seller's second route, /papers/extract?id=alba-demo-001, costs 0.02 USDC. Call it and a second row joins the ledger.