Skip to content

HA2345567/Solana_Bonk_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bonk Bot

A simple Telegram bot for creating a Solana wallet, checking its address and balance, and sending SOL.

This project uses:

  • Bun as the runtime
  • Telegraf for Telegram bot handling
  • @solana/web3.js for Solana wallet and transaction logic

Features

  • Create a Solana wallet
  • Show public key / wallet address
  • Export private key
  • Check wallet balance
  • View recent transaction signatures
  • Send SOL to another wallet

Important Notes

  • Wallets are currently stored in memory only.
  • If you restart the bot, previously generated wallets are lost.
  • Private key export is enabled, which is convenient for testing but risky for real use.
  • The bot uses devnet unless you set a custom SOLANA_RPC_URL.

Requirements

  • Bun installed
  • A Telegram account
  • A Telegram bot token from @BotFather

1. Create a Telegram Bot Token

Telegram bot tokens are created through the official Telegram bot manager: @BotFather.

Steps:

  1. Open Telegram.
  2. Search for @BotFather.
  3. Start the chat.
  4. Send:
/newbot
  1. BotFather will ask for:
  • A bot name
  • A bot username

The username must usually end with bot, for example:

my_solana_wallet_bot
  1. After creation, BotFather will give you a bot token.

It looks like this:

123456789:AAExampleTokenHere

Keep this token private. Anyone with it can control your bot.

2. Clone and Install

Install dependencies:

bun install

3. Configure Environment Variables

Create a .env file in the project root.

Example:

BOT_TOKEN=your_telegram_bot_token_here
SOLANA_RPC_URL=https://api.devnet.solana.com

RPC Options

Use one of these depending on where your funds are:

SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com

If you do not set SOLANA_RPC_URL, the bot defaults to devnet.

4. Run the Bot

Start the bot with:

bun run index.ts

If everything is configured correctly, the bot will start and wait for Telegram messages.

5. Use the Bot

Open your bot in Telegram and press Start.

You will see buttons for:

  • Create Wallet
  • Public Key
  • Address
  • Private Key
  • Balance
  • History
  • Send SOL
  • Send Token

Send SOL Flow

When you click Send SOL, the bot will:

  1. Ask for the recipient wallet address
  2. Ask for the amount in SOL
  3. Build and submit the transfer transaction
  4. Return the transaction signature and explorer link

Common Problems

Balance shows 0 SOL

Usually one of these is true:

  1. You are connected to devnet, but your funds are on mainnet-beta
  2. You are checking a different wallet address
  3. The bot restarted and the in-memory wallet was lost

Check:

  • Your current SOLANA_RPC_URL
  • The wallet address shown by the bot
  • Whether the bot process was restarted

Security Warning

This project is fine for learning and testing, but not production-safe yet.

Reasons:

  • Private keys are kept in process memory
  • Private keys can be exported in chat
  • No database or encrypted wallet storage
  • No per-user authentication beyond Telegram chat identity

Do not store large amounts of SOL in this bot in its current form.

Project Structure

Next Improvements

Possible upgrades:

  1. Persist wallets to a database or encrypted file
  2. Disable plain-text private key export
  3. Add SPL token transfer support
  4. Add transaction history details instead of only signatures
  5. Add better validation and error handling

About

A Telegram-based Solana wallet bot for creating wallets, checking balances, viewing addresses, and sending SOL.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors