NIZO is an intelligent AI agent that simplifies DeFi operations on the Solana blockchain through natural language interactions. Built with Next.js and integrated with LangChain for AI processing, Jupiter swap api, NIZO enables users to perform complex DeFi transactions, check balances, and receive information through an intuitive chat interface.
๐ Built for the Solana AI Hackathon (December 10-23, 2024) This project is our submission to the first-ever Solana AI Hackathon, where developers worldwide compete to build innovative AI agents on the Solana blockchain. The hackathon features $185,000+ in cash prizes across multiple tracks focusing on AI agent development.
Try NIZO

- Natural language processing for DeFi operations using LangChain
- Token swaps via Jupiter Protocol integration
- Real-time wallet balance checking on Solana
- Transaction history tracking
- Secure wallet management with Wallet Adapter
- Dark mode support
- Contact management system
-
Smart Contact Management
- Save and manage frequently used wallet addresses
- Execute transactions using contact names instead of addresses
- Simplified peer-to-peer transfers through natural language commands like "Send 2 SOL to John"
- Secure address book storage with encryption
-
Voice Interaction & Accessibility
- Full voice command support for all DeFi operations
- Screen reader optimization for visually impaired users
- Voice feedback for transaction confirmations and balance checks
- Natural speech processing for complex DeFi operations
- Multi-language voice support for global accessibility
These features align with our mission to make DeFi operations more accessible and user-friendly for everyone, regardless of technical expertise or physical abilities.
System Architecture
NIZO Architecture
โโโ Frontend (Next.js 14)
โ โโโ Chat Interface (React)
โ โโโ Wallet Connection (@solana/wallet-adapter)
โ โโโ UI Components (shadcn/ui)
โโโ AI Processing Layer
โ โโโ LangChain Integration
โ โโโ GPT-4 Mini Model
โโโ Blockchain Integration
โโโ Jupiter Protocol (Swaps)
โโโ Solana Web3.js// src/contexts/WalletProvider.tsx
export const WalletAdapterProvider = ({ children }: Props) => {
const endpoint = clusterApiUrl("devnet");
const wallets = useMemo(() => [], []);
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider autoConnect wallets={wallets}>
<WalletModalProvider>{children}</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
);
};// src/api/langchain.ts
const IntentSchema = z.object({
intent: z.enum(['swap', 'checkBalance', 'transfer', 'normalChat', 'unknown']),
amount: z.number().optional(),
sourceToken: z.string().optional(),
destinationToken: z.string().optional(),
error: z.string().optional(),
generalResponse: z.string(),
});// src/api/jupiter-swap-example.ts
const swap = async ({
inputAmount,
inputMint,
outputMint,
slippageBps = 50,
}: SwapParams): Promise<string> => {
// ... swap implementation
};// src/components/dashboard/switch-board-price-feeds.tsx
const SwitchboardPriceFeed = () => {
// Fetch and update price feeds
const fetchPrice = async (symbol: string) => {
const response = await fetch(
`https://www.binance.com/api/v3/ticker/price?symbol=${symbol}USDT`
);
const data = await response.json();
// Update price state
};
// Wallet-verified on-chain price updates
const updateFeed = async (feed: SwitchboardFeed) => {
const updateIx = {
programId: switchboardProgramId,
keys: [
{ pubkey: new PublicKey(feed.address), isWritable: true },
{ pubkey: publicKey, isSigner: true, isWritable: true },
],
};
// Execute transaction
};
};const model = new ChatOpenAI({
model: 'gpt-4o-mini',
temperature: 0,
apiKey: process.env.NEXT_PUBLIC_LANGCHAIN_API_KEY,
});Before running NIZO, ensure you have the following installed:
- Node.js (v18.0.0 or higher)
- npm (v8.0.0 or higher)
- A Solana wallet (e.g., Phantom, Solflare)
- A modern web browser (Chrome, Firefox, Safari, or Edge)
- Clone the repository:
git clone https://github.com/your-username/nizo.git
cd nizo- Install Dependencies:
npm install- Set up environment variables: Create a
.env.localfile in the root directory with the following variables:
# Required API Keys
NEXT_PUBLIC_LANGCHAIN_API_KEY=your_langchain_api_key
NEXT_PUBLIC_SOLANA_RPC_URL=your_solana_rpc_url # Optional: Defaults to public endpoints
# Optional Configuration
NEXT_PUBLIC_ENVIRONMENT=development # or production- Run the development server:
npm run dev- Run the linter to check code quality:
npm run lint- Build for production:
npm run build- Start production server:
npm startThe application will be available at http://localhost:3000
NIZO uses a chat interface where you can input natural language commands. Here are some supported operations:
User: "Swap 2 SOL to USDC"
NIZO: "I'll help you swap 2 SOL to USDC. Current rate is [rate]. Would you like to proceed?"
User: "What's my SOL balance?"
NIZO: "Your current SOL balance is [amount] SOL"
User: "Show my recent transactions"
NIZO: "Here are your recent transactions: [list of transactions]"
User: "What's the current SOL price?"
NIZO: "The current price of SOL is $XX.XX USD. Would you like me to update this price for you?"
User: "Yes, update the price"
NIZO: "I'll update the SOL price feed. Please approve the transaction in your wallet."
Based on the implementation in langchain.ts:
- swap: Token swap operations
- checkBalance: Balance inquiries
- transfer: Token transfers
- normalChat: General inquiries
- unknown: Fallback for unrecognized intents
- Your wallet, your keys: We never store or have access to your wallet's private keys - only you control your funds
- Safe transaction signing: All transactions are signed directly in your browser using your personal wallet (like Phantom or Solflare)
- Reliable connections: We use multiple backup connection points to the Solana network to ensure the app stays working even if one connection fails
const FALLBACK_RPCS = [
'https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY',
'https://try-rpc.mainnet.solana.com',
// ...
];- Price protection: We protect you from unexpected price changes during swaps (maximum price change allowed: 0.5%)
- Safety checks: We test each transaction before executing it to ensure it will work as expected
- Reliable processing: If one connection fails, we automatically try other secure connections
- Error protection: If something goes wrong, we have systems to help recover and fix the issue
// Example of transaction security measures
const confirmation = await connection.confirmTransaction(txid, 'confirmed');
if (confirmation.value.err) {
throw new Error(`Transaction failed: ${confirmation.value.err.toString()}`);
}- Secure chat history: Your chat messages are only stored temporarily while you use the app
- No sensitive storage: We never store your private financial information
- Limited local storage: We only save basic information like contact names on your device
- Protected secrets: All sensitive API keys and configurations are securely stored and never exposed to users
- Frontend: Next.js 14
- UI Components: shadcn/ui
- Blockchain: Solana Web3.js
- DEX Aggregator: Jupiter Protocol
- Price Oracle: Switchboard Protocol
- AI Processing: LangChain with GPT-4 Mini
- Wallet: Solana Wallet Adapter
- Styling: Tailwind CSS
- Quick Response Time: The app shows you immediate feedback for your actions while processing happens in the background, making everything feel faster
- Efficient Chat History: Your chat messages are managed right in your browser, making conversations quick and responsive
- Eye-Friendly Design: Switch between light and dark themes based on your preference to make the app comfortable to use, especially during long sessions
Messages and chat history are managed through React Context:
export function MessageProvider({ children }: { children: React.ReactNode }) {
const [messages, setMessages] = useState<Message[]>([]);
return (
<MessageContext.Provider value={{ messages, setMessages }}>
{children}
</MessageContext.Provider>
);
}- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
For support, please:
- Open an issue on GitHub
Built with โค๏ธ by the NIZO team