The Sniper Trading Bot is an automated crypto trading tool built for detecting and trading newly created Four Meme tokens in real time.
It follows a simple, high-frequency strategy — buy instantly when the token launches and sell automatically after one minute.
Note
This is an educational purpose project only. Bitquery in no manner advice or promote any trading strategy or trading decision.
The bot leverages Bitquery’s Protobuf Kafka Streams to receive token creation events in real-time from the BSC blockchain.
You can check out the Kafka Protobuf JS example for a step-by-step JavaScript implementation.
Key features:
- Monitors new token launches instantly via Kafka Streams
- Reduces latency using Finland-based (eu-north-1) deployment
- Fully integrates with Bitquery APIs for event data streaming
The bot interacts with the Four Meme DEX Smart Contract through ethers.js.
We define custom wrapper functions:
buyViaLaunchpad→ Buys tokens as soon as they’re createdsellTokenViaLaunchpad→ Sells after a predefined delay (default: 1 minute)
Learn more about ethers.js contract interaction and smart contract ABI usage.
-
Clone the repository:
git clone https://github.com/Kshitij0O7/evm-sniper?utm_source=github_readme&utm_medium=referral&utm_campaign=evm_sniper&utm_content=repo_link&utm_term=evm-sniper cd evm-sniper
-
Install dependencies:
npm install
-
Create your
.envfile with the following variables:KAFKA_USERNAME= KAFKA_PASSWORD= PRIVATE_KEY1=
Contact Bitquery Support or fill out this form to get Kafka Credentials.
-
Run the bot:
npm run start
You can deploy the bot to a cloud provider (recommended: Google Cloud) for 24/7 uptime.
-
Create a VM (Virtual Machine) in region
eu-north-1(Finland) for minimal latency to the Bitquery Kafka service. -
SSH into the VM and install dependencies:
sudo apt-get update sudo apt-get install -y git curl curl -fsSL https://deb.nodesource.com/setup_20.x?utm_source=github_readme&utm_medium=referral&utm_campaign=evm_sniper&utm_content=node_setup&utm_term=node20 | sudo -E bash - sudo apt-get install -y nodejs
-
Verify installations:
node -v npm -v git --version
-
Follow the setup section above.
-
Install pm2 process manager to run the bot continuously:
sudo npm install -g pm2 pm2 start index.js --name "evm-sniper" pm2 status pm2 logs evm-sniper
| Component | Description | Docs |
|---|---|---|
| Bitquery API | Blockchain data API for token streams | bitquery.io |
| Protobuf Kafka Streams | Real-time blockchain event streaming | Protobuf Docs |
| ethers.js | Smart contract interaction | ethers docs |
| Node.js | Runtime environment (20 LTS) | NodeSource Setup |
| pm2 | Process manager for uptime | PM2 Docs |
This project is released under the MIT License. You’re free to use, modify, and distribute — attribution appreciated.
✨ Created by Bitquery
Empowering developers with blockchain data APIs and real-time event streams. Signup today.