@bch-intents/sdk-telegram-bot
v1.0.0
Published
BCH Intents SDK — Reference Telegram Bot Solver
Readme
BCH Intents Auto-Solver Telegram Bot
This repository contains the reference implementation of an automated cross-chain intent solver for the BCH Intents Protocol. It is designed to run as a Telegram Bot, allowing operators to easily manage funding and monitor intent resolution on-the-go.
How it Works
The Auto-Solver Bot listens for cross-chain exchange intents (e.g., swapping BCH for Solana). It acts as a liquidity provider by programmatically fulfilling the requested side of the intent, capturing a profit spread in the process.
It is built utilizing the powerful @bch-intents/sdk-cross-chain components to safely interact with Hash Time Locked Contracts (HTLCs) and secure cryptographic primitives.
Flow Example: BCH to Solana
- Monitor: The bot continuously polls the Relayer API for open
bch-to-solanaintents. - Validate: Upon finding an intent, the bot verifies the timelock duration and the profitability of the requested exchange rate.
- Execute: The bot uses its local, encrypted Solana wallet to send the required
SOLto the maker's requested address. - Claim: By fulfilling the swap, the bot gains access to the maker's secret, which it then uses to unlock the HTLC on the Bitcoin Cash network and claim the
BCHreward.
🚀 Features
- Automated Polling Engine: Enable auto-resolve mode to continuously scan and fill profitable intents without manual intervention.
- Integrated HD Wallets: Automatically generates and securely encrypts (AES-256-GCM) independent local wallets for BCH and Solana to be used exclusively as solver liquidity.
- Telegram Management: A simple command-based UI to check balances, view deposit addresses, list actionable intents, and manually trigger resolutions.
- Built on BCH Intents SDK: Natively integrates with the
@bch-intentsSDK packages to handle the heavy lifting of HTLC construction, transaction signing, and secret hashing.
Getting Started
Prerequisites
- Node.js (v18 or higher)
- A Telegram Bot Token from @BotFather
Installation
- Copy the example environment variables:
cp .env.example .envOpen
.envand fill in yourTELEGRAM_BOT_TOKEN. (Optionally configure your customSOLANA_RPC_URLorRELAYER_API_URL).Install dependencies:
npm install- Start the bot:
npm run devUsage
Interact with your bot on Telegram using the following commands:
/start- Boot up the bot and generate your solver wallets./deposit- View your BCH (Chipnet) and Solana (Devnet) deposit addresses./status- Check the solver’s current balances and the status of the auto-resolve engine./intents- Manually scan the relayer for open cross-chain intents./auto_resolve <on|off>- Toggle the background autonomous solver loop./resolve <intent_id>- Force the bot to manually attempt resolution on a specific intent ID.
Security Warning
This bot generates and stores private keys locally on the machine it runs on. It uses AES symmetric encryption derived from a secret key in your .env file. Never commit your .env file or your encrypted wallet database (.sqlite) to source control. This is a reference implementation meant for testing and development. Trade at your own risk.
