/kryptonite

Automated crypto swapping bot, written in Node.js. Supports multiple protocols like Uniswap, Curve, SushiSwap, Balancer, etc using 1inch AggregatorV4 router. Under active development.

Primary LanguageTypeScriptMIT LicenseMIT

Kryptonite Logo

kryptonite

Issues License Release

Automated crypto swapping bot, written in Node.js. Supports multiple protocols like Uniswap, Curve, SushiSwap, Balancer, etc using 1inch AggregatorV4 router. Under active development.

Not production ready yet

Table of Contents

Introduction

This project started as a hobby to figure out a way to keep an eye on the crypto market while juggling my day job. The Crypto market is highly volatile. Cryptocurrencies can fluctuate in price drastically within seconds you have your eyes off the screen. Unless you are a trader by profession, you cannot actively manage your portfolio, or make any meaningful and profitable moves or prevent a loss.

For people with assets on a hosted wallet or an exchange like Coinbase or Binance, you can set limit and stop loss orders. However, for people with crypto assets in a self-custodial wallet (not on exchanges like Coinbase or Binance), there are limited options.

With Kryptonite, you can set limit buy/sell, stop-loss orders and execute them automatically on your behalf, without manually confirming each time (although you can choose to confirm each one manually). Kryptonite can react to a market crash quickly and execute your stop loss order to protect your investment/profits. Importantly, Kryptonite strives to reduce your anxiety levels in an uncertain market.

Think of Kryptonite as an "Autopilot for Crypto Swapping". Kryptonite does not execute swaps on exchanges like Coinbase and Binance, simply because you cannot access your wallet's private key. Private keys are required by Kryptonite to execute an order on your behalf.

Features

  • Bundled with a webserver UI to view past swaps, current metrics and portfolio performance so far (under development)
  • Executes Buy/Sell/Stop Loss orders manually using confirmations from you via the telegram bot
  • Executes Buy/Sell/Stop Loss orders automatically based on set limits
  • Supports multiple protocols like Uniswap, Curve, SushiSwap, Balancer, etc using the 1inch Aggregation protocol API

Setup

Requirements

Parameters

The following command line parameters are supported.

Parameter Description Type Default
privateKey Your wallet private key string
publicKey Your wallet public address string
chainId Chain to use. Allowed options: 1 (Ethereum), 10 (Optimism), 56 (Binance Smart Chain), 137 (Polygon/Matic), 42161 (Arbitrum) integer 137
stableToken Stable token (ERC20) to use. Example: USDC, USDT, DAI string USDC
targetToken Target ERC20 token to hold. Example: WETH, WMATIC, LINK. string WETH
stableTokenTickerKraken Ticker symbol of the stable token in Kraken. Example: USDCUSD, DAIUSD, USDTUSD. string USDCUSD
targetTokenTickerKraken Ticker symbol of the target token in Kraken. Example: ETHUSD, BTCUSD, MATICUSD. string MATICUSD
slippagePercent Slippage tolerance during swap. Example: 1, 2, ..50 integer 1
redisAddress Redis server host. Example: 192.168.1.100:6379 string
botToken Telegram bot token used to send and receive transaction confirmations string
chatId Your telegram chat id. You will receive this when you authorize yourself with the bot for the first time. string
password Password to share with the bot to authorize yourself as the admin string kryptonite
minProfitPercent Minimum profit percent at which the bot will execute a sell order integer 50
mode Mode of operation. Allowed options: MANUAL, AUTO string MANUAL

Usage

docker run -d --name kryptonite pravinba9495/kryptonite:latest kryptonite \
                --privateKey=<PRIVATE_KEY> \
                --publicKey=<PUBLIC_ADDRESS> \
                --chainId=<CHAIN_ID> \
                --stableToken=<STABLE_TOKEN> \
                --targetToken=<TARGET_TOKEN> \
                --stableTokenTickerKraken=<STABLE_TOKEN_TICKER_KRAKEN> \
                --targetTokenTickerKraken=<TARGET_TOKEN_TICKER_KRAKEN> \
                --slippagePercent=<SLIPPAGE_PERCENT> \
                --redisAddress=<REDIS_ADDRESS> \
                --botToken=<BOT_TOKEN> \
                --chatId=<CHAT_ID> \
                --password=<PASSWORD> \
                --minProfitPercent=<MIN_PROFIT_PERCENT> \
                --mode=<MODE_OF_OPERATION>

Instructions

Examples

Log

Swap Example

Swap

Swap Example

Disclaimer

By using Kryptonite, you understand and agree that there might be bugs in the code that could potentially lead to financial loss. You and only you are responsible for the use of this tool and any financial loss that it may cause. Nobody else shall be held accountable in this regard. Stop using this tool if you do not agree to this. Do conduct your own due diligence and consult your financial advisor before making any investment decisions.

Development

Kryptonite is still under active development. Contributions are always welcome!

Contributors

License

MIT