Full lesson
solana-chatgpt-kit
What it does
From the project README:
Perform Solana blockchain operations directly from ChatGPT using natural language. Swap tokens, send SOL, check balances, stake assets, and more—all without leaving your conversation.
- Original
- The-x-35/solana-chatgpt-kit
- SuperStack fork
- Blockchains/solana-chatgpt-kit @
28cd712 - Stars
- 27
- Last push (original)
- 2025-10-27
- Languages
- TypeScript, CSS, JavaScript
- Detected stack
- Next.jsweb3.js
- Categories
- AI & AgentsConsumer & Social
- Licence
- MIT
Architecture
39 source files. By extension: .ts ×28, .tsx ×11.
| Top-level directory | Source files |
|---|---|
app | 25 |
lib | 6 |
components | 5 |
(root) | 3 |
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/solana-chatgpt-kit/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
app/api/transfer/route.ts L97–120 @ 28cd712 · MIT · original const lamports = Math.round(solAmount * LAMPORTS_PER_SOL); const transaction = new Transaction().add( SystemProgram.transfer({ fromPubkey: fromPublicKey, toPubkey: destination, lamports, }) ); transaction.feePayer = fromPublicKey; const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); transaction.recentBlockhash = blockhash; // If using external wallet, return unsigned transaction for client to sign if (externalWallet) { console.log("Prepared unsigned transfer transaction for client signing."); const serialized = transaction.serialize({ requireAllSignatures: false }); const transferTransaction = Buffer.from(serialized).toString("base64"); // Settle x402 payment after preparing transaction if (x402 && paymentHeader) { await x402.settlePayment(paymentHeader, paymentRequirements); }- Line 108
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 117
// Settle x402 payment after preparing transaction: Uses x402, an HTTP 402 pattern where an agent pays per request with an on-chain payment.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | next dev --turbopack |
. | npm run start | next start |
. | npm run build | next build --turbopack |
What you could build from it
- Fork the SuperStack copy and extend it within the AI & Agents gaps listed on the idea page.
- Learn the pattern first: AI agents on Solana
- Learn the pattern first: Building and sending transactions from a client
- Learn the pattern first: Blinks and Solana Actions