Skip to content

dynamic-labs/stablecoin-remittance-tg-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stablecoin Remittance Telegram Bot

A Telegram bot for stablecoin remittances using Dynamic's server-side wallet infrastructure and Supabase for persistence. Send stablecoins to friends and family using just their Telegram username without handling wallet addresses or seed phrases.

Features

  • Create an EVM compatible wallet (/wallet command)
  • Send stablecoins and ETH to blockchain addresses (/send command)
  • Send stablecoin remittances to Telegram users by username (/sendtouser command)
  • Sign messages with your wallet (/sign command)
  • Check wallet balance for multiple tokens (/balance command)
  • Direct username resolution via Telegram API
  • Support for multiple tokens (ETH, USDC stablecoin)
  • Built with Dynamic's server-side wallet infrastructure
  • Persistence with Supabase
  • Enhanced error handling and validation

Setup

Prerequisites

  • Bun installed

  • Telegram Bot created via BotFather

  • Dynamic account and environment

  • Supabase project with the following table structures:

    -- Wallet table
    CREATE TABLE wallets (
      id SERIAL PRIMARY KEY,
      tg_id BIGINT NOT NULL,
      walletAddress TEXT NOT NULL,
      walletID TEXT NOT NULL,
      created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
    );

Installation

  1. Clone the repository

  2. Install dependencies:

    bun install
  3. Create an .env file based on .env.example.

  4. Set up the required tables in Supabase manually using the SQL provided above.

Running the Bot

bun run start

Or for development with auto-reload:

bun run dev

Usage

  • /start - Welcome message and getting started guide
  • /wallet - Create a wallet or view your existing wallet
  • /balance - Check your wallet's current balance
  • /send <address> <amount> - Send crypto to another address
  • /sendtouser <@username> <amount> - Send crypto to another user by Telegram username
  • /sign <message> - Sign a message with your wallet
  • /help - Show detailed help information

Architecture

This stablecoin remittance bot uses a simplified architecture that:

  1. Directly resolves usernames via Telegram API without middleware or database tracking
  2. Manages wallets with Dynamic's server-side infrastructure
  3. Stores minimal data in Supabase (only wallet information)
  4. Supports stablecoins & ETH through a modular token handling system
  5. Provides user-to-user remittances by resolving usernames at transaction time

For more details on the architectural approach and implementation, see the GUIDE.md file for a comprehensive step-by-step implementation guide.

Development

This project uses:

  • Grammy for Telegram bot framework
  • Dynamic for wallet infrastructure
  • Viem for blockchain interactions
  • Supabase for database
  • Bun for JavaScript/TypeScript runtime

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published