Optimized, fast and unsafe Uniswap sniping bot for buying new listings.

Overview

project logo

Optimized, fast and unsafe Uniswap sniping bot for buying new listings.

Table of content

How does it work?

We use BloXroute's streams to listen to liquidity add transaction and call swapExactETHForTokens on Uniswap V2 Router 02 contract. By sending our transaction with the same gas price, we have a very high chance of being very close to the original transaction in the block, hence buying tokens just after liquidity add and just before the price significantly rises.

Pregeneration

pregen-diagram We pregenerate transactions with the most probable gas prices to send them instantly, hence skip signing process which is rather slow. This solution turned out to be around 2.5x faster on our testing machines.

Used libraries

Project structure

Directory structure

libs/ - contains all external libraries, see Used libraries
includes/ - contains all headers
tests/ - contains code testing
benchmarks/ - contains code benchmarking
doxygen/ - contains Doxygen configuration
img/ - contains images
libs.build/ - contains built libraries
build/ - contains built executables
docs/ - contains generated documentation

Headers

includes/utils.hpp - converters and other utilities
includes/rlp.hpp - Recursive Length Prefix Encoding used to serialize objects in Ethereum
includes/transaction.hpp - creating and signing Ethereum transactions
includes/bot.hpp - tools to parse BloXroute messages, build transaction data, etc.
includes/config.hpp - configuration file, see Configuration

Configuration

Configuration is saved in includes/config.hpp.

  • Config
    • Config::Transaction - transaction fields
      • Config::Transaction::Nonce - transaction nonce (hexadecimal)
      • Config::Transaction::Value - transaction value (hexadecimal, wei)
      • Config::Transaction::To - receiver of the transaction, mostly Uniswap V2 Router 02 (address)
      • Config::Transaction::GasLimit - transaction gas limit (hexadecimal)
      • Config::Transaction::PrivateKey - private key of sending wallet
    • Config::Transaction::SwapExactETHForTokens - values to construct transaction data to call SwapExactETHForTokens method
      • Config::Transaction::SwapExactETHForTokens::AmountOutMin - minimum amount of tokens to receive from the swap (hexadecimal)
      • Config::Transaction::SwapExactETHForTokens::TokenAddress - token's address we want to buy (address)
      • Config::Transaction::SwapExactETHForTokens::ReceiverAddress - address of receiving wallet (address)
    • Config::BloXroute
      • Config::BloXroute::Connection - BloXroute Cloud API connection credentials
        • Config::BloXroute::Connection::Address - address of the server
        • Config::BloXroute::Connection::AuthToken - authorization token
      • Config::BloXroute::Filters - newTxs stream filters
        • Config::BloXroute::Filters::MaxGasPrice - maximum gas price of the transaction (we do not want to lose millions on gas, do we?) (decimal, wei)
        • Config::BloXroute::Filters::MinValue - minimum transaction value, skips fake liquidity adds or tokens with small liquidity (decimal, wei)
        • Config::BloXroute::Filters::TokenAddress - alias for Config::SwapExactETHForTokens::TokenAddress, left for consistency (do not change!)
    • Config::TransactionPreGen - configuration for transaction pregeneration, for further explanation see Pregeneration
      • Config::TransactionPreGen::GasPriceGweiFrom - from gwei
      • Config::TransactionPreGen::GasPriceGweiTo - to gwei
      • Config::TransactionPreGen::GasPriceGweiDecimals - gwei decimals (eg. 1000 means generating transactions with gas price steps of 0.001 gwei)
      • Config::TransactionPreGen::ArraySize - precalculated based on above values (do not change!)
    • Config::Size
      • Config::Size::TransactionQuantityBuffer - size of transaction quantity buffer (do not change!)
      • Config::Size::TransactionAddressBuffer - size of transaction address buffer (do not change!)
      • Config::Size::TransactionDataBuffer - size of transaction data buffer, change when necessary (eg. when calling different method requiring more arguments)
      • Config::Size::TransactionRawBuffer - size of raw signed transaction, change when necessary (see above)
      • Config::Size::BloXrouteTransactionMessageString - size of both incoming and outcoming messages to the Cloud API

Installation guide

Installing required packages on Debian

sudo apt update
sudo apt install git make build-essential cmake autoconf libtool xsltproc libasio-dev
If you use macOS, you might have to manually link the OpenSSL
ln -s /usr/local/opt/openssl/lib/*.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/*.a /usr/local/lib/

Cloning repository

git clone --recurse-submodules -j8 https://github.com/sszczep/UniswapSniperBot.git
cd UniswapSniperBot

Building and running main executable

make main
./build/main

Building and running tests

make test
./build/test

Building and running benchmarks

make benchmark
./build/benchmark

Generating documentation

make docs
Documentation is available here.
Owner
Sebastian Szczepański
21yo programmer, loves to create websites and other tech-related stuff, electronics hobbyist
Sebastian Szczepański
alie, simplified Discord bot, that's it. As fast and stable as possible.

alie alie, simplified Discord bot, that's it. As fast and stable as possible. Requirements Linux-compatible OS (aka Linux distribution) A C compiler w

mecura 8 Nov 15, 2021
RemixDB: A read- and write-optimized concurrent KV store. Fast point and range queries. Extremely low write-amplification.

REMIX and RemixDB The REMIX data structure was introduced in paper "REMIX: Efficient Range Query for LSM-trees", FAST'21. This repository maintains a

Xingbo Wu 75 Jul 22, 2022
It is a Simple Telegram Bot, which will listen to GitHub Webhook and inform via Telegram

GitHub-Webhook-Bot ?? Simple Telegram Bot, which will listen to GitHub Webhook and inform via Telegram Setting Up Config ✍ Go to src/helper.h ---> Her

GautamKumar 32 Jun 19, 2022
A 3-D Printed Bot which can talk, cheer, dance and manage your day-to-day schedule.

cheerup A 3-D Printed Bot which can talk, cheer, dance and manage your day-to-day schedule. In childhood many of us have watched this show "SpongeBob

Aniket Dhole 4 Sep 5, 2021
A D++ Discord Bot template for Visual Studio 2019 (x64 and x86)

D++ Windows Bot Template A D++ Discord Bot template for Visual Studio 2019 (x64 and x86, release and debug). The result of this tutorial. This templat

brainbox.cc 19 Jul 16, 2022
Real Time, High performance BOT detection and protection

REAL-TIME BOT PROTECTION CHALLENGE IronFox https://innovera.ir IronFox is a real-time and high performance bot protection, that using Nginx as a reve

Khalegh Salehi 3 Jun 5, 2022
A Discord Bot to protect your server from spam, invitations, fake nitro ads and more written in C++

Antispambot An efficient Discord Bot to prevent spam written in C++. Tested on a large discord server and mitigates around 90% spam. Its well commente

Phil 6 Jul 27, 2022
Stock market Telegram bot

Stonky Telegram Bot README Stonky is a Telegram bot that provides access to financial informations. It is backed by the publicly available Yahoo Finan

Salvatore Sanfilippo 204 Jun 9, 2022
🍌 C++ Telegram Bot API library

?? banana - thin wrapper over Telegram Bot API written in C++17. Key Features Simple API Single interface for both blocking, non-blocking and even cor

Alexander 29 Mar 5, 2022
A simple growtopia bot!

CPPBot By DrOreo002 Fixed by Lucy Usage It should be easy to build this, but apparently visual studio wouldn't allow you to. Because sometimes thing c

inf 9 Oct 20, 2021
Tetris bot

Lemon Tea Guildline versus tetris bot How to build Notices Lemon Tea makes use of standard library header <bit> available in C++20, so make sure your

null 4 Jan 8, 2022
A Bouncing Seal Discord Bot's Source Code.

A Bouncing Seal It's a fun bot with leveling and funny bouncing seal videos. Information Invite Support Server How to run locally You need DPP, follow

SirObsidian 4 Sep 10, 2021
Bot for participation to the Lux AI Challenge

Lux AI Challenge This repository is a cleaned version of the official LUX AI Challenge kit that can be found here: https://github.com/Lux-AI-Challenge

AB Normals 2 Dec 6, 2021
Bot for the Cee.Studio server

cee-bot Bot for the Cee.Studio server. Getting Started Open config.json and match the cee_bot field to your server primitives Head to listeners/ and f

cee.studio 1 Jan 12, 2022
Entertainment bot for Discord made with D++ - the C++ Discord library

Beerist-Bot Entertainment bot for Discord made with D++ - the C++ Discord library Invite Beerist to your Server here! GUIDE FOR BUILDING AND SELFHOSTI

DJ::Ötzi 3 Jun 16, 2022
rax/RAX is a C++ extension library designed to provide new, fast, and reliable cross-platform class types.

rax rax/RAX is a C++ extension library designed to provide cross-platform new, fast, and reliable class types for different fields such as work with I

MaxHwoy 5 May 2, 2022
GROR:A New Outlier Removal Strategy Based on Reliability of Correspondence Graph for Fast Point Cloud Registration

GROR GROR:A New Outlier Removal Strategy Based on Reliability of Correspondence Graph for Fast Point Cloud Registration About (a): correspondences gen

Pengcheng Wei 38 Aug 7, 2022
Signed - a 3D modeling and construction language based on Lua and SDFs. Signed will be available for macOS and iOS and is heavily optimized for Metal.

Signed - A 3D modeling language Abstract Signed is a Lua based 3D modeling language, it provides a unique way to create high quality 3D content for yo

Markus Moenig 89 Jul 4, 2022
Browser and NodeJS Web Assembly audio decoder libraries that are highly optimized for size and performance.

WASM Audio Decoders WASM Audio Decoders is a collection of Web Assembly audio decoder libraries that are highly optimized for browser use. Each module

Ethan Halsall 56 Jul 25, 2022