A simple Telegram bot for creating a Solana wallet, checking its address and balance, and sending SOL.
This project uses:
Bunas the runtimeTelegraffor Telegram bot handling@solana/web3.jsfor Solana wallet and transaction logic
- Create a Solana wallet
- Show public key / wallet address
- Export private key
- Check wallet balance
- View recent transaction signatures
- Send SOL to another wallet
- 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
devnetunless you set a customSOLANA_RPC_URL.
Buninstalled- A Telegram account
- A Telegram bot token from
@BotFather
Telegram bot tokens are created through the official Telegram bot manager: @BotFather.
Steps:
- Open Telegram.
- Search for
@BotFather. - Start the chat.
- Send:
/newbot
- BotFather will ask for:
- A bot name
- A bot username
The username must usually end with bot, for example:
my_solana_wallet_bot
- 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.
Install dependencies:
bun installCreate a .env file in the project root.
Example:
BOT_TOKEN=your_telegram_bot_token_here
SOLANA_RPC_URL=https://api.devnet.solana.comUse one of these depending on where your funds are:
SOLANA_RPC_URL=https://api.devnet.solana.comSOLANA_RPC_URL=https://api.mainnet-beta.solana.comIf you do not set SOLANA_RPC_URL, the bot defaults to devnet.
Start the bot with:
bun run index.tsIf everything is configured correctly, the bot will start and wait for Telegram messages.
Open your bot in Telegram and press Start.
You will see buttons for:
Create WalletPublic KeyAddressPrivate KeyBalanceHistorySend SOLSend Token
When you click Send SOL, the bot will:
- Ask for the recipient wallet address
- Ask for the amount in SOL
- Build and submit the transfer transaction
- Return the transaction signature and explorer link
Usually one of these is true:
- You are connected to
devnet, but your funds are onmainnet-beta - You are checking a different wallet address
- 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
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.
index.ts- main bot logic.env.example- environment variable template
Possible upgrades:
- Persist wallets to a database or encrypted file
- Disable plain-text private key export
- Add SPL token transfer support
- Add transaction history details instead of only signatures
- Add better validation and error handling