A professional-grade sandwiching bot targeting the BNB Smart Chain (BSC). It monitors the mempool via WebSocket, evaluates profitable opportunities, and attempts atomic sandwich trades using configurable risk/return parameters. Optional Telegram notifications keep you informed in real time.
- Real-time transaction stream via WSS
- Configurable profit/slippage/gas parameters
- PancakeSwap router integration
- Telegram bot notifications with whitelisting
- TypeScript client; Foundry-based smart contracts
./
client/ # TypeScript bot/runner and Telegram integration
contracts/ # Foundry (Solidity) contracts, scripts, and tests
LICENSE
README.md
Key client modules:
client/src/config/config.ts– centralized runtime configurationclient/src/index.ts– app entrypointclient/src/core/*– trading/core logicclient/src/helpers/*– utilities and helpers
- Node.js ≥ 18
- Yarn or npm
- A BSC RPC endpoint (HTTPS and WSS)
- A funded private key (for mainnet; use with extreme caution)
- (Optional) Telegram bot token and chat IDs
- For contracts: Foundry (
forge) installed
- Clone and install dependencies
git clone <this-repo-url>
cd sandwicher/client
yarn install # or: npm install- Create a
.envfile inclient/
# Required
PRIVATE_KEY=0x...
JSON_RPC=https://bsc-dataseed.binance.org
WSS_URL=wss://bsc-ws-node.nariox.org:443
# Optional but recommended
BOT_TOKEN=123456:ABCDEF... # Telegram bot token
MIN_PROFIT_THRESHOLD=0.003 # 0.3% default if unset- Configure additional options in
client/src/config/config.tsif needed:
CONTRACT_ADDRESS– on-chain contract the bot referencesSTABLE_TOKENS– addresses for tokens considered stableEXPLORER_URL– chain explorer base URLWHITELISTED_USERS– Telegram user IDs permitted to receive alertsDEFAULT_GAS_LIMIT,GAS_FACTOR,MIN_SLIPPAGE_THRESHOLD, etc.
- Run the bot (development)
yarn start # or: npm run startTests (client)
yarn test # or: npm testThese are read in client/src/config/config.ts:
PRIVATE_KEY(required): EOA private key used to sign transactionsJSON_RPC(required): HTTPS RPC endpoint URLWSS_URL(required): WebSocket endpoint URL for mempool/blocksBOT_TOKEN(optional): Telegram bot token for notificationsMIN_PROFIT_THRESHOLD(optional): minimum profit ratio; default0.003
Security tips:
- Prefer using separate, minimally funded keys
- Consider RPCs with rate limits and IP allowlists
- Never commit
.env
Location: contracts/
Prerequisites: Install Foundry. See the official guide.
Common commands (run from contracts/):
forge build
forge test
forge script script/SandWicher.s.sol --rpc-url $JSON_RPC --broadcast --private-key $PRIVATE_KEYConfiguration is in contracts/foundry.toml.
- The client uses
ethers@5andethereum-multicall - Telegram via
telegraf - TypeScript build tooling:
ts-node-dev,ts-jestfor tests
Scripts (from client/package.json):
yarn start # ts-node-dev src/index.ts
yarn test # jest- Ensure WSS endpoint is valid and supports mempool subscriptions
- Check the account has enough BNB for gas
- Validate addresses in
config.ts(WBNB, Router, target contracts) - Increase
GAS_FACTORcautiously if front-running fails - Inspect logs and Telegram alerts for error details
| Platform | Link |
|---|---|
| 📱 Telegram | t.me/novustch |
| wa.me/14105015750 | |
| 💬 Discord | discordapp.com/users/985432160498491473 |
Feel free to reach out for implementation assistance or integration support.
This software is provided “AS IS”, without warranty of any kind. Use at your own risk. The authors and contributors are not responsible for losses or damages arising from the use of this software.