AI Wallet Bot • Discord & Solana

Lunary:
The AI Web3 Native

A comprehensive Discord bot that brings full Web3 wallet functionality directly into chat servers, powered by an advanced AI assistant.

OpenAI Assistant API|Discord.js v14|Hardware-Level Encryption
Lunary Mascot

Concept & Vision

Lunary was built to bridge the gap between social interaction and blockchain execution. Most Discord communities focused on Web3 face high friction: users must leave the chat to sign transactions, check balances, or swap tokens.

As a Solo Side Project, I built Lunary to serve as a unified gateway. It integrates directly into Discord using a multi-component architecture: a high-performance Node.js bot, a secure Express API, and a React management dashboard.

The centerpiece is "Luna," an AI assistant that interprets natural language into blockchain instructions. Users can simply type @Lunary send 1 SOL to @user, and Luna handles the resolution, encryption, and execution flow.

Technical Stack

AI & Bot Core

OpenAI AssistantDiscord.jsTypeScriptNode.jsRedis

Blockchain & Security

Solana Web3.jsBIP39Jupiter SDKBlowfish APIMetaplex

Data & Frontend

PrismaMongoDBReactMobXViteTailwind

Core Innovations

AI Native Wallet

Natural language processing for complex wallet operations and educational guidance.

Secure Key Vault

Encrypted BIP39 storage with user-provided password verification.

Jupiter Trading

Best-rate routing for token swaps directly through the Discord interface.

Energy Shield

Real-time phishing and scam link detection powered by Blowfish API.

Security & Architecture

Deep technical breakdown of how Lunary handles non-custodial assets and AI logic.

Encrypted Key Management

The Challenge

Storing private keys securely while maintaining usability across multiple Discord servers without becoming a custodial service.

The Solution

Implemented a multi-layer encryption strategy where seed phrases are encrypted using a combination of user-provided passwords and an application secret. Passwords are never stored on the server.

Technical Highlights

BIP39 Mnemonic standard compatibility

BIP44 Hierarchical Deterministic (HD) derivation

Encryption at rest using AES-256 equivalent

Zero-knowledge pattern for user passwords

AI-to-Blockchain Gateway

The Challenge

Converting imprecise natural language into precise, validatable blockchain instructions with proper error handling.

The Solution

Leveraged OpenAI Assistant API with function calling. The AI identifies intents (send, swap, balance) and extracts parameters, which are then passed to a validation layer before user confirmation.

Technical Highlights

Context-aware thread management via Redis

Automated address resolution (Discord IDs & SNS)

Interactive transaction simulations

Intelligent rate limiting for cost control

Implementation Showcase

Key architectural components for wallet derivation and AI function calling.

src/services/Wallet/SolanaWallet.ts
export class SolanaWallet {
  // Generate a new wallet from mnemonic
  public static async generate(opts?: {
    seed?: Buffer;
    mnemonic?: string;
    derivationIndex?: number;
  }) {
    let { seed, mnemonic, derivationIndex } = opts || {};

    // Generate seed if not provided
    if (!seed) {
      seed = await mnemonicToSeed(mnemonic || generateMnemonic());
    }

    // Derive keypair using BIP44 path: m/44'/501'/index'/0'
    let path = `${DERIVATION_PATH}/${derivationIndex || 0}'`;
    let derivedSeed = derivePath(path, seed.toString('hex')).key;
    const keypair = Keypair.fromSeed(derivedSeed);

    return keypair;
  }
}

Multi-Guild

Cross-Server Presence

Non-Custodial

Encrypted Storage

Native

On-Chain Interaction