Let's suppose we are using Kelp with the balanced strategy and we fund the bot with an equal value of both assets. The bot starts working based on the config parameters and will create buy/sell offers.

Let's suppose someone sends more funds of either asset to the bot's account, this will affect the value of both assets as estimated by the bot, skewing the bot's calculations. This might hamper the functionality when using the balanced strategy, which depends on asset balances to estimate price. An attacker could use this to manipulate the price.

Is there any functionality in Kelp to overcome such an attack?

This question was originally asked as a Github issue, rephrased in the question here: https://github.com/lightyeario/kelp/issues/24

1 Answer 1


When using the balanced strategy, if a malicious attacker sends some funds to your bot then the bot will set (what might be considered) an incorrect price for the tokens, since it will include these additional funds when computing the relative price of the two tokens.

However, because of this incorrect price, the market should, in theory, correct itself by buying up the tokens that were sent to the bot (since those tokens are now priced cheaper), resulting in the bot eventually exchanging some of those additionally received funds for the equivalent true value of the other token.

The balanced strategy intelligently limits the amount of each order it places, so an attacker cannot skew the price along with the amount, which is a critical point in protecting from such attacks.

The end result of receiving these additional funds would be that the bot has more of both tokens. Therefore, I do not consider this as a bug and this may even be beneficial for the bot!

With that said, I'm not aware of any real benefit that an attacker can gain by sending funds to a Kelp bot that is using the balanced strategy since they are losing 100% of the funds that they send.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.