thanhtung249 / roboape

A simple bot which will buy into every new BNB pair created on PancakeSwap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Robo Ape

A simple bot which will buy into every new BNB pair created on PancakeSwap. Built by a programmer for other programmers.


Every day, every hour, almost every minute there are new LPs (liquidity pool) created on PancakeSwap. Almost all of them (probably 99%) are rug pulls (meaning 100% loss), but the remaining 1% is worth it in the long run.

Open any newly created LP on PancakeSwap and you will see multiple transactions buying 0.002 BNB worth of tokens right away. This bot does the same thing - buys in as early as possible and later on sells in smalls portions (when profitable).

The idea is that given enough time, bot will build up enough good tokens to generate constant revenue. But to get there you will need to first burn through those rug pulls.

Bot logic

  • Listen for PairCreated events on PancakeSwap Factory contract.
  • Optionally (BSSCAN_CHECK) see if Token's smart contract is verified and if source code contains known "bad words" which we don't want buying into (see src/Services/BscScan.ts).
  • If pair (LP) is between BNB and any other token and BNB reserve is > 0 - buy in (BUY_IN_AMOUNT).
  • Every 30 minutes check all pairs that were not already rug pulled and:
    • If less than 0.5% of initial BNB reserve is remaining and current position is not profitable - mark possition as rug.
    • Check if 20% (AUTOSELL_PERCENTAGE) of our tokens is more than 0.1 BNB (AUTOSELL_MIN_PROFIT) and if so - sell those 20%.
  • Rinse & repeat.

Bot will stop buying into new positions if it's balance drops below 0.05 BNB (MIN_BALANCE).


  • Node (developed and tested on v15.4.0)
  • PostgreSQL (developed and tested ov v13.3)
  • NPM

Build & Install

Copy and edit .env file, install npm packages, build, syncModels to initiate DB.

cp .env.sample .env
npm install
npm run build
node build/syncModels.js

NOTE: you might also need to install libpq-dev or postgresql-devel or libpq-devel (depending on your OS) and make with g++:

apt install libpq-dev make g++

Local development

If you need PostgreSQL you can spin it up quickly using Docker:

docker run --name roboape-db -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres

Instead of npm run build you can use npm run dev to watch files for changes and compile on-the-fly.


Don't forget to set your private key (ACCOUNT_PK), API KEY (BSCSCAN_API_KEY) (if BSSCAN_CHECK=true) and database credentials in .env file!

To run bot:

node build/app.js

To dump all profitable tokens:

node build/dumpAll.js

To dump single profitable token provide LP pair address:

node build/dumpAll.js --single 0xLpPairAddressHere

If you want to keep bot running in background, a very easy way is to use PM2 (npm install -g pm2):

pm2 start pm2.json


  • Bot supports, but does not account for deflation ("fee on token transfer" inside of token contract)
  • Bot is optimised for PancakeSwap v2, but can be very easily adjusted to work with any other PancakeSwap (UniSwap) fork.
  • No UI is provided, this is a console application.


  • This bot comes with no warranty - use at your own risk!
  • Most of the trade will not be profitable! (see "Motivation" section)


Several examples of profitable trades:

ezoic increase your site revenue


A simple bot which will buy into every new BNB pair created on PancakeSwap


Language:TypeScript 97.2%Language:JavaScript 2.8%