Skip to content

bitquery/sniper-bot-bsc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Bitquery Sniper Trading Bot

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.

🔍 How It Works: Detecting New Four Meme Tokens

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

💰 Buying and Selling Tokens Automatically

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 created
  • sellTokenViaLaunchpad → Sells after a predefined delay (default: 1 minute)

Learn more about ethers.js contract interaction and smart contract ABI usage.


⚙️ Setup Instructions

  1. 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
  2. Install dependencies:

    npm install
  3. Create your .env file with the following variables:

    KAFKA_USERNAME=
    KAFKA_PASSWORD=
    PRIVATE_KEY1=

Contact Bitquery Support or fill out this form to get Kafka Credentials.

  1. Run the bot:

    npm run start

☁️ Deployment Guide (Google Cloud)

You can deploy the bot to a cloud provider (recommended: Google Cloud) for 24/7 uptime.

Steps:

  1. Create a VM (Virtual Machine) in region eu-north-1 (Finland) for minimal latency to the Bitquery Kafka service.

  2. 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
  3. Verify installations:

    node -v
    npm -v
    git --version
  4. Follow the setup section above.

  5. 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

📊 Tech Stack

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

🧩 Related Resources


🏁 License

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%