Wallet design,
security & AI integration.
A complete walkthrough of how autonomous AI agents own and operate Solana wallets — from keypair generation to encrypted keystores to live devnet transactions. Every BUY and SELL in this prototype produces a real, verifiable on-chain signature.
1. Why agents need their own wallets
Traditional Solana wallets (Phantom, Backpack) are built for humans. Every transaction requires a UI prompt, a manual review, and a button click. AI agents can't do any of that — they operate at machine speed, 24/7, and need to sign in milliseconds without blocking on human approval.
An agentic wallet is a wallet the agent fully controls: it holds the private key, decides when to sign, and broadcasts transactions autonomously. No human is in the loop at runtime. Agentixx runs a fleet of these wallets concurrently, each with independent state, independent balances, and independent on-chain history.
2. Keypair generation
Every agent gets a fresh ed25519 keypair generated via Keypair.generate() from @solana/web3.js, which internally calls Node.js crypto.randomBytes — seeded by the OS CSPRNG (/dev/urandom on Linux). This gives 256 bits of entropy, sufficient for real-world use.
Each agent gets an independent keypair. There is no shared master seed. Compromise of one agent's key does not affect any other agent in the fleet.
3. Encrypted keystore format
Private keys at rest are encrypted with AES-256-GCM. The encryption password is hardened through scrypt — a memory-hard KDF that makes brute-force attacks orders of magnitude more expensive.
The GCM auth tag is critical — if anyone modifies even a single byte of the encrypted key on disk, decryption throws before returning any key material. The IV is regenerated on every saveKeystore() call so no two keystores look alike.
4. Autonomous transaction signing — all three actions
Every trade action in this prototype produces a real, verifiable transaction on Solana devnet. There are no simulated signatures. Here is exactly what each action does on-chain:
BUY — a real SOL transfer from the agent wallet to the DEX treasury address. The agent signs with its own keypair autonomously, with no human prompt. The resulting signature is linked directly from the dashboard.
SELL — a Memo program transaction. The agent signs a zero-lamport transaction that permanently records the sell decision as UTF-8 metadata on-chain. This is the standard pattern for audit-logging decisions when no counterparty transfer is possible without a deployed program.
Both BUY and SELL now produce verifiable on-chain signatures. Click any signature link in the dashboard to inspect the full transaction on Solana Explorer (devnet).
HOLD — no transaction. The decision is recorded in the agent's local trade history. The autonomous loop uses HOLD to signal "market neutral" without burning transaction fees unnecessarily.
Solana's recentBlockhash mechanism prevents replay attacks — each transaction includes a recent blockhash and is rejected by the network after ~90 seconds. The agent fetches a fresh blockhash before every transaction.
5. The autonomous decision loop
startAgentLoop(id, callback, intervalMs) runs the agent's decision callback on a fixed timer — every 15 seconds by default. The loop is started automatically for all funded agents on page load, and can be stopped per-agent from the dashboard.
The decision function autonomousDecision(price) implements momentum-based rules. It is the same function called by both the manual trade button and the autonomous loop, ensuring behavioral consistency regardless of how a trade is triggered.
To upgrade to an LLM-driven agent, replace autonomousDecision(price) with an OpenAI or Anthropic API call. Pass the agent's balance, recent trade history, and price signal as context. The wallet layer below it stays identical — only the decision function changes.
The loop enforces a MIN_BALANCE_SOL = 0.05 reserve. If an agent's balance drops below this threshold, the loop halts automatically and logs a warning — preventing an agent from spending itself into dust and becoming unable to pay transaction fees.
6. Multi-agent fleet architecture
WalletRegistry manages a fleet of independent agents. Each agent has its own keypair, its own encrypted keystore file, and its own autonomous loop running concurrently. No state is shared between agents. A Map<string, NodeJS.Timeout> inloop.ts tracks which agents are running without any shared mutable state.
7. Security threat model
8. Run it yourself
The demo runs entirely on Solana devnet — no real funds involved. Every BUY transaction and every SELL memo is verifiable on Solana Explorer (devnet). The autonomous loop fires every 15 seconds — open the dashboard and watch the trade count tick up in real time.