Technology

Bot Transaction Analysis Report

As we shared in our previous article, transaction processing delays caused by a sudden flood of transactions into the network have created a poor user experience. Our team at Klaytn has been looking into the reason behind this sudden surge in transactions as well as an effective solution to handle such transaction load spikes on the network. In this article, we would like to share our findings so far.

We have noticed an emerging network behavior where sudden bursts of transactions with sustained high transaction volume which continue for a period of time ranging between a couple of minutes up to several hours. The chart below shows the network situation on January 11 at 13:00 PM, during which an episode lasted for about 2 hours and 30 minutes. During this period the Klaytn mainnet Cypress in fact maintained its 1-second finality, processing 9.7 million transactions in 150 minutes.

Our research into the situation has found that most of these transactions are estimated to come from DeFi arbitrage bots. Arbitrage bots are programs that automatically generate transactions for the purpose of trading (and oftentimes in very high volume). We found that 87% of the transactions during the burst on January 11 stemmed from six contract addresses, all of which have been subsequently confirmed to originate from arbitrage bots.

We have determined from the transaction history of the bots that their net profit before subtracting the transaction fees was 9 times higher on average as compared to the transaction fees they were paying to run their bulk transactions. However, we also found that most of these transactions were empty transactions which didn’t involve any token transfers. One contract, for example, sent out 14 million transactions in just a couple of days, of which merely 2,300 (0.016%) were actual arbitrage transactions, the rest were terminated by the contract logic because market conditions were not favourable for a trade at that time. It can be concluded, therefore, that most of what the bots generated are indeed spam transactions.

Until now, the Klaytn team has been implementing technical measures to address the issue. Early January, the Klaytn team deployed a feature to apply QoS to contracts that frequently created revert transactions (PR#1092). This measure led to a dramatic decline in reverted transactions, but the total number of transactions remained the same as some of these bots adjust their internal contract logic to bypass this filter by not reverting the transactions but instead simply returning without revert when market conditions are not favorable.

To tackle this persisting problem, the Klaytn team is contemplating additional technical measures as well as an increase in network transaction fees. If the gas price were to rise, bots would face higher transaction fees, which would induce them to reduce the number of spam transactions. The graph below depicts the responsiveness of bots that earn a 800% profit under the current gas price to a potential price hike. The x-axis denotes the gas price, while the y-axis denotes the number of estimated transactions.

For a bot to remain on its yield curve, it must reduce its number of non-trade transactions to accommodate an increased transaction fee without incurring a loss. The red curve denotes the current yield rate, and the blue curve consists of points where the arbitrage profit equals the transaction fees, corresponding to a yield rate of 0%. If the gas price were to be gradually increased to 750 ston, bot operators would be forced to reduce their transactions following the points (1), (2) and (3).

At point (1) if the bot continues to send that same amount of transactions, this would push down the yield rate to 0. At point (2) the bot is forced to reduce transactions to prevent losses from transaction fees. At point (3) to increase yield, it would be forced to further cut down its spam transactions.

Since a transaction fee increase is an issue that affects all Klaytn users, we want to have all stakeholders within the Klaytn community and especially KLAY holders engaged in the discussion and preparation leading up to any future decision on the matter. There will be more announcements on this in the near future. Klaytn takes the issue of network congestion very seriously, and it is of paramount importance that Klaytn’s resources remain available to the wider public. We will continue to seek ways to find better solutions.