Skip to content

aipop-fun/chainsms

Repository files navigation

Onchain Messenger

An decentralized messaging application built with OnchainKit that allows users to send messages directly through Base blockchain transactions. Built with privacy and decentralization in mind - no central server, no message storage, just pure blockchain communication.

OnchainKit logo vibes

Features

  • 💬 Send and receive messages directly through blockchain transactions
  • 🔒 No central server or database - all messages are stored on-chain
  • 🌐 Works on Base network for fast and low-cost messaging
  • 👥 Easy-to-use contact management
  • ⚡ Real-time message updates
  • 🎨 Clean and intuitive UI
  • 🔐 Connect with any Web3 wallet

How it Works

Instead of using a traditional smart contract, this messenger uses transaction data to send messages:

  1. Messages are encoded into transaction data
  2. Transactions are sent with 0 ETH value
  3. Recipients can decode messages from transaction data
  4. Messages are permanently stored on the blockchain

This approach has several benefits:

  • Lower gas costs (no contract deployment needed)
  • Simpler architecture
  • True decentralization
  • Message permanence

Setup

To run this project locally, you'll need to set up the following environment variables in your .env file:

# See https://portal.cdp.coinbase.com/products/onchainkit
NEXT_PUBLIC_CDP_API_KEY="GET_FROM_COINBASE_DEVELOPER_PLATFORM"

# See https://cloud.walletconnect.com
NEXT_PUBLIC_WC_PROJECT_ID="GET_FROM_WALLET_CONNECT"

# Base network configuration
NEXT_PUBLIC_NETWORK="base"

Local Development

# Install dependencies
bun install

# Run the development server
bun run dev

Technical Architecture

The application is built using:

  • Next.js 13+ with App Router
  • TypeScript for type safety
  • Viem for blockchain interactions
  • OnchainKit for Web3 components
  • TailwindCSS for styling
  • Base network for transactions

Key components:

  • MessageUtils: Handles message encoding/decoding
  • ConversationList: Manages contact list and chat history
  • MessageInput: Handles message sending
  • MessageList: Displays conversation threads

Security Considerations

  • All messages are public on the blockchain
  • Anyone can read the message history
  • Addresses are publicly visible
  • No encryption (yet) - future versions may include E2E encryption

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Resources

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you have any questions or need help, you can:

Releases

No releases published

Packages

No packages published

Contributors 11