A revolutionary decentralized email platform that combines traditional email functionality with blockchain-powered crypto transfers. Send emails and crypto assets to any email address, even if the recipient doesn't have a wallet.
- Decentralized Email System: Messages stored on IPFS with blockchain indexing
- Traditional Email Compatibility: Send/receive emails from Gmail, Outlook, and other providers
- Wallet-First Authentication: Primary login via wallet signature (Traditional email/password login coming soon)
- Full Email Client: Inbox, sent items, compose, and message management
- Send Crypto via Email: Transfer ETH, ERC20 tokens, and NFTs to other DexMail users
- Cross-Platform Transfers: (Coming Soon) Transfer to non-DexMail addresses with claim link generation
- No Wallet Required: Recipients can claim crypto without an existing wallet
- Smart Contract Wallets: Automatic deterministic wallet generation for email addresses
- Gas-Sponsored Claims: Optional gasless transactions for recipients
- Multi-Asset Support:
- Native ETH transfers
- ERC20 tokens (USDC, USDT, DAI, etc.)
- ERC721 NFTs
- Batch transfers
- Balance Guard: Built-in validation prevents sending more than you own
- One-Click Onboarding: Recipients claim crypto and create wallets in one step
- Email Content Parsing: Automatic detection of crypto transfer markers like
[SEND: 100 USDC] - Claim Links: Secure, time-limited claim links sent via email
- Wallet Management: Link existing wallets or create new ones
- Transaction History: Track all sent and received emails with crypto attachments
- Framework: Next.js 15.3.3 with React 18
- Styling: Tailwind CSS with custom design system
- UI Components: Radix UI primitives
- Blockchain:
- Ethers.js v6 for smart contract interactions
- Wagmi v2 for wallet connections
- RainbowKit for wallet UI
- Viem for type-safe Ethereum interactions
- State Management: React Context API
- Form Handling: React Hook Form with Zod validation
- Date Handling: date-fns
- Authentication: JWT tokens with bcrypt password hashing
- BaseMailer.sol: Main email protocol contract for message indexing
- TrustedRelayer.sol: Handles email-to-wallet mappings and crypto transfers
- Account Abstraction: ERC-4337 compatible smart contract wallets
DexMail-frontend/
βββ contracts/ # Smart contract files
β βββ BaseMailer.sol # Core protocol contract
β βββ TrustedRelayer.sol # Relayer logic
β βββ abi.ts # Generated ABIs
βββ docs/ # Documentation
β βββ blueprint.md
β βββ frontend-services.md
βββ public/ # Static assets
β βββ illustrations/ # Onboarding & Auth SVGs
β βββ ...
βββ scripts/ # Utility & Test scripts
β βββ generate-wallet.ts
β βββ test-outbound-email.ts
βββ src/
β βββ app/ # Next.js app router pages
β β βββ (auth)/ # Authentication (login/register)
β β βββ dashboard/ # Main app interface
β β β βββ inbox/
β β β βββ sent/
β β β βββ drafts/
β β β βββ profile/
β β βββ onboarding/ # New user flow
β β βββ api/ # Backend API routes
β β βββ auth/ # Auth endpoints
β β βββ email/ # Email & Drafts management
β β βββ tokens/ # Token fetching
β β βββ wallet/ # Wallet operations
β βββ components/ # React components
β β βββ mail/ # Email-specific (Compose, List, Display)
β β βββ ui/ # Reusable UI primitives
β β βββ providers/ # Context providers wrapper
β βββ contexts/ # React contexts
β β βββ auth-context.tsx # Auth state
β β βββ mail-context.tsx # Email data & actions
β βββ hooks/ # Custom hooks (useWallet, useTable)
β βββ lib/ # Utilities & Services
β β βββ models/ # Mongoose schemas
β β βββ services/ # API integations (mail, nft, token)
β β βββ utils.ts # Helpers
β βββ types/ # TypeScript definitions
βββ next.config.ts # Next.js configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md # Project documentation
- Node.js 20+
- npm or yarn
- A wallet (MetaMask, Coinbase Wallet, etc.)
- Access to Base network (testnet or mainnet)
-
Clone the repository
git clone <repository-url> cd DexMail-frontend
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env.localfile in the root directory:# Blockchain Configuration NEXT_PUBLIC_CHAIN_ID=8453 NEXT_PUBLIC_RPC_URL=https://mainnet.base.org # Smart Contract Addresses NEXT_PUBLIC_BASE_MAILER_ADDRESS=0x... NEXT_PUBLIC_TRUSTED_RELAYER_ADDRESS=0x... # API Configuration NEXT_PUBLIC_API_URL=http://localhost:4000/api # IPFS Configuration NEXT_PUBLIC_IPFS_GATEWAY=https://ipfs.io/ipfs/ # Authentication JWT_SECRET=your-secret-key # Database (MongoDB) MONGODB_URI=mongodb://localhost:27017/dexmail # Email Server (optional) SMTP_HOST=localhost SMTP_PORT=2525 IMAP_HOST=localhost IMAP_PORT=1143
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
npm run build
npm startNote: Currently, crypto attachments are only supported when sending to other
@dexmail.appaddresses. Cross-platform transfers are coming soon.
Hey John,
Thanks for the great work! Here's your payment.
[SEND: 100 USDC]
Best,
Alice
- Click "Compose" in the dashboard
- Fill in recipient (must be
@dexmail.app), subject, and message - Click "Attach Crypto"
- Select token type and amount
- Approve the transaction in your wallet
- Send the email
- Receive Email: Recipient gets an email notification
- Click Claim Link: Opens the claim page
- Verify Email: Enter verification code sent to email
- Deploy Wallet: System creates a smart contract wallet (gas-sponsored)
- Access Funds: Crypto is immediately available in the new wallet
- Click "Connect Wallet" on the login page
- Select your wallet provider (MetaMask, Coinbase, etc.)
- Sign the authentication message
- Access your account
- Feature currently under development
- will support email/password login with optional wallet linking
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLintnpm run typecheck- Run TypeScript type checkingnpm run start:mail-server- Start local SMTP/IMAP server
src/lib/services/: All API interaction logicsrc/contexts/: Global state managementsrc/components/mail/: Email UI componentscontracts/: Smart contract ABIs and deployment info
The application includes comprehensive testing for:
- Email sending and receiving
- Crypto transfer flows
- Wallet deployment and claiming
- Authentication flows
- Non-Custodial: Platform never holds user funds
- End-to-End Encryption: Email content encrypted before IPFS storage
- Deterministic Wallets: CREATE2 for predictable wallet addresses
- Time-Limited Claims: Claim links expire after 7 days
- Email Verification: Required before wallet deployment
- Gas Sponsorship: Optional gasless transactions via ERC-4337
- Account Abstraction (ERC-4337) for enhanced security
- Multi-signature support for high-value transfers
- Upgradeable contracts with governance
Full API documentation is available in api.md.
POST /api/auth/register- Register new userPOST /api/auth/login- Login with email/password or walletPOST /api/auth/challenge- Get wallet signature challenge
POST /api/mail/send- Send email with optional cryptoGET /api/mail/inbox- Get inbox messagesGET /api/mail/sent- Get sent messagesGET /api/mail/message/:id- Get specific message
POST /api/crypto/send- Send crypto to emailGET /api/crypto/pending/:email- Get pending transfersGET /api/crypto/wallet/:email- Get wallet for email
POST /api/wallet/deploy- Deploy smart walletPOST /api/wallet/sponsor/transaction- Execute gasless transaction
POST /api/claim/verify- Verify claim tokenPOST /api/claim/deploy- Deploy wallet and claim assets
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
- Built on Base blockchain
- Uses RainbowKit for wallet connections
- UI components from Radix UI
- Inspired by the vision of decentralized communication
For questions and support:
- Open an issue on GitHub
- Check the API documentation
- Review the idea document for detailed specifications
- Mobile app (React Native)
- Multi-chain support (Ethereum, Polygon, Arbitrum)
- Email templates and scheduling
- Advanced spam filtering
- Group email support
- Email aliases
- Custom domain support
- Integration with traditional email providers (Gmail API, Outlook API)
- Enhanced NFT gallery view
- DeFi integrations (send yield-bearing tokens)
- DAO governance for protocol upgrades
Built with β€οΈ for the decentralized future