Flashloans
Flashloans
ABSTRACT KEYWORDS
Flash Loan, a popular lending service in the decentralized finance Wash Trading, Flash Loan, Market Manipulation, DeFi Security
(DeFi) ecosystem, allows users to borrow a large number of virtual ACM Reference Format:
assets without any collateral. It can be leveraged to support many fi- Rundong Gan, Le Wang, Xiangyu Ruan, Xiaodong Lin. 2022. Understanding
nancial activities (such as arbitrage, collateral swap, self-liquidation, Flash-Loan-based Wash Trading. In 4th ACM Conference on Advances in
etc. ), but unfortunately, it is often abused for malicious intent. One Financial Technologies (AFT ’22), September 19–21, 2022, San Francisco, CA,
example of abusing flash loan servicing is to simultaneously sell USA. ACM, New York, NY, USA, 15 pages. https://doi.org/10.1145/3558535.
and buy the same cryptocurrency on the same exchange to mislead 3559793
the market, aka wash trading. It can manipulate the cryptocurrency
market at a very low cost (anecdotally average around 0.033 ETH 1 INTRODUCTION
gas fee for each transaction on Ethereum mainnet), thereby dra-
matically damaging the stability and fairness of the market. More
seriously, attackers can amplify the market impact by borrowing
more assets from Flash Loan platforms. Until now, there has been lit-
tle attention paid to Flash-Loan-based wash trading, but meanwhile,
74
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
Application Addresses
Validation & Analysis
Position Calculation
Transaction Information Market Impact
Event Logs Edge Deletion
Market Information Detection Results
Judgement Cost Analysis
her own assets for attacking, there will be two problems: 1) the 1.3 Motivation of this Paper
required input is large, so the attacker needs to have enough cryp- Flash Loan is an emerging financial technology in DeFi, but its
tocurrencies; and 2) if the attack transaction fails, the attacker may regulation is lacking. Our findings enable a better understanding
lose all assets. Thus, there are high risks associated with these of how Flash Loan is being abused for wash trading and provide
manipulations from the attackers’ perspective. potential avenues for regulators to disrupt these illegal activities.
However, there is an innovative and popular service called Flash
Loan [19] in DeFi systems, which clears the way for DeFi attacks.
1.4 Our Contributions
Flash Loan does not exist in traditional finance and allows users to
borrow a large amount of cryptocurrency in the same transaction In previous studies, most of the research [2, 3, 8] focuses on tradi-
without any collateral. Flash Loan offers users a fast way to get tional wash trading which is frequent in centralized exchanges. To
massive investments to participate in various financial activities, the best of our knowledge, no detection method and comprehensive
which could improve the market’s liquidity. To some extent, Flash analysis have been proposed for Flash-Loan-based wash trading,
Loan can increase the efficiency of the DeFi market and maintain the except for a small case being briefly mentioned [14]. In this paper,
balance of the entire ecosystem[14, 19]. Moreover, the cost of Flash our contributions can be summarized as follows:
Loan is low: borrowers just need to repay small gas fees (average • This paper is the first systematic study to understand Flash-
0.061 ETH on Ethereum mainnet) and loan interest (usually less Loan-based wash trading. In previous studies, wash trading
than 0.3%). In order to attract users, some flash loan lenders (e.g., using Flash Loan is only a possible attack and there is not
dYdX ) even charge only 1 W ei ( 1W ei = 10−18 ET H ) interest. enough sample evidence and principle analysis to prove the
Unfortunately, for tricky attackers, Flash Loan is like an attack possibility of such attacks. Our work confirms the possibility
booster, which finances illegal activities, amplifies the impact of and widespread existence of such attacks.
attacks, and maximizes attack profits. Attackers can destroy a fi- • A heuristic-based algorithm is proposed to detect wash trans-
nancial system at a low cost without any financial risk. Many Flash- actions using Flash Loan. Flash-Loan-based wash trading
Loan-based attacks have been reported, such as Oracle manipula- is only briefly mentioned in previous papers, and no detec-
tion, Pump&Arbitrage, and Reentrancy[4]. tion scheme has been proposed yet. We design a detection
Wash trading is one of Flash Loan’s widespread exploits but scheme based on detailed analysis of Flash Loan and the final
has been paid little attention so far. In wash transactions, trading results confirm the effectiveness of our method.
volume indicating one asset’s popularity is usually the major object • We analyze the market impact and attack cost to reveal
to be manipulated. Manipulators use a series of buy/sell actions to manipulators’ motivations. Existing research mainly focuses
increase the transaction volume for giving a false impression of on the detection of abnormal behaviours, but ignores the
high trading volume on the market [3]. In traditional wash trading, process of wash trading, for example, the market impact and
attackers may only have a small amount of start-up capital. To cost of wash transactions. Our analysis shows that Flash-
greatly increase the trading volume, the limited money will be Loan-based wash trading can amplify the market impact
reused many times and these wash trades form a closed cycle [8]. compared to traditional wash trading.
However, in Flash-Loan-based wash trading ( as shown in Figure 1),
The whole process of this paper is shown in Figure 2. Firstly, we
attackers can borrow large assets from Flash Loan applications and
filter trading data related to lending applications to get Flash Loan
use the loan to amplify the effect of manipulation. After the wash,
transactions. Then, we build a graph for each loan transaction based
all assets will be returned to the Flash Loan application. Compared
on asset transfers to detect wash transactions. Thirdly, we validate
with those traditional volume manipulations, Flash-Loan-based
the detection results and analyze the basic characteristics of these
wash trading has a bigger impact on the stability and fairness of
wash transactions. In addition, we conduct a financial analysis to
the cryptocurrency market.
determine the impact and cost of such attacks.
75
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
2 FLASH-LOAN-BASED WASH TRADING Flash Loan is non-collateralized, and the smart contract will guar-
antee that the lender is paid back. Therefore, the lender can issue
2.1 Flash Loan
credit without upfront collateral from the borrower. 2) Loan Size.
Borrowers can lend out all the funds in the capital pool which is
governed by smart contracts. The lending of largest Flash Loan
transaction in 2021 exceeds $20 billion1 . 3) Liquidation Risk. In
Lending Application Trader
T d Other Applications traditional lending, if the market price of collateral changes dramat-
ically, the borrower may be exposed to the risk of liquidation with
Call Loan Function
Action Sequence the loss of collateral. For Flash Loan borrowers, they have no such
Provide Flash Loan Swaping
risk because collateral is not required in their transactions. 4) Loan
Borrowing
Cycle. In traditional lending, the loan ends when all borrowings
Interact with other Applications
Minting
are repaid or collateral is forced to be liquidated. For Flash loan, the
Return the Loan Burning
successful validation of this transaction including borrowing and
……
repaying means the end of the lending.
Repay the Loan and Interest
76
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
Table 1: Main Differences between traditional wash trading and Flash-Loan-based wash trading on blockchains
Attack Form Multiple transactions form a closed capital cycle to Due to the limitation of Flash Loan, each transaction has a
keep the net position unchanged. full capital circle to keep the net position unchanged.
Wash Size Depends on initial funds. If the attacker has enough funds to pay gas fees and trading
fees, there is no size limit.
Capital Risk 1) If the time interval is too long, the value of hold- Failed transactions will only result in loss of gas fees.
ing assets may decrease; 2) wrong operations on
the blockchain can lead to the loss of all assets.
Attack Cost Gas fees and trading fees. Gas fees, trading fees, and loan interest.
From dYdX (Flash Loan Provider) To 0x08cb95bb8e2afa7013342a7dcbaab8e1b57f2a77 For 44.7400 WETH Take Flash Loan from dYdX
Uniswap V2 pool
From Uniswap V2 : ZCX 3 (Exchange) To 0x08cb95bb8e2afa7013342a7dcbaab8e1b57f2a77 For 46,646.5402 ZCX
From 0x08cb95bb8e2afa7013342a7dcbaab8e1b57f2a77 To dYdX (Flash Loan Provider) For 44.7400 WETH Repay the loan to dYdX
Flash Loan provider dYdX and the receiver address is 0x08cb95bb8e- reasons to confirm that these transactions are only possible for
2afa7013342a7dcbaab8e1b57f2a77. Then, the borrowed ETH is trans- wash trading.
ferred to Uniswap V2: ZCX 3 (an exchange pool) for swapping Compared with traditional wash trading, Flash-Loan-based wash
and the attacker gets 46,646.5402 ZCX back. Thirdly, ZCX is ex- trading has the following characteristics: 1) Assets used for wash
changed back before the loan is repaid. In this transaction, ETH is trading are borrowed from Flash Loan providers and the loan needs
swapped in and out in the same pool and finally repaid to dYdX, to be repaid in the same transaction, so each transaction must have
so the positions of all assets hardly change. According to the Au- a full capital circle to keep the net position unchanged. 2) Attackers
tomated Market Maker(AMM) protocols [23] of decentralized ex- can borrow a large amount of money just by paying gas fees, trading
changes, it is impossible for the attacker to arbitrage in the same fees, and a small amount of loan interest, so the wash size can be
capital pool. On the contrary, the attacker needs to pay trading fees much larger than traditional wash trading. 3) When a wash trading
(rateswap × amountswap ) in each swapping, so the borrowed ETH transaction fails due to a mistake, the state of the blockchain will
changes from 44.74 ETH to 44.30 ETH. To make up the difference roll back, so the attacker only loses a small number of gas fees. For
for repaying, the attacker needs to transfer a small number of his manipulators, these characteristics can help them effectively reduce
assets ( 44.7400 ET H − 44.3069 ET H = 0.4331 ET H ). The attack cost costs and amplify the impact of wash trading. Table 1 shows the
is about 0.4471 ETH including 0.0140 ETH gas fee and 0.4331 ETH main differences between traditional wash trading and Flash-Loan-
trading fee when loan interest is just 1 Wei for dYdX. We treat this based wash trading on blockchains.
transaction as wash trading for three reasons: 1) The net position
of each participating address is almost unchanged. 2) A sequence of
actions costs high gas fees and trading fees but makes no financial 3 PRELIMINARIES
sense (e.g., arbitrage or asset swap). 3) There are dozens of similar 3.1 Attack Model
transactions related to the smart contracts. It is unreasonable for
We assume that there is a rational adversary A, who wants to
traders to repeatedly execute meaningless transactions at a high
achieve the ultimate volume goal Vдoal and mislead innocent traders
cost unless there is a special purpose. Therefore, we have enough
to invest some tokens or applications. A has a small amount of
start-up capital, which can only cover the basic loan interest, gas
77
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
Swap
for Swap Swap
Repay
Swap Swap for for
and remove
Swap Repay
for for collateral Mortgage
for and remove and
collateral borrow
Lending Lending
Exchange 1 Exchange 2 Exchange Exchange
Exchange app app
(a) Wash Trading (b) Arbitrage (c) Self-liquidation (d) Collateral Swap
fees, and trading fees, but is not enough to manipulate the trading RQ1 How to detect Flash-Loan-based wash transactions?
volume and produce misleading information directly. However, due RQ2 What are the characteristics of these wash transactions?
to the openness of DeFi systems, A can use Flash Loan to complete RQ3 What impact does these transactions have on the market?
the manipulation. To avoid unnecessary costs including gas fees RQ4 Why do attackers choose Flash Loan for manipulation?
and trading fees, A will only perform actions related to wash trad-
ing. In our model, no matter what strategy A adopts, the victims 4 DETECTION SCHEME
V are always these innocent traders kept in the dark. This section targets RQ1.
78
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
of asset is returned in the second transfer. By buying at a • Heuristic 2: Just like traditional wash trading, there is also
low price and selling at a high price in different exchanges, a closed transaction cycle. The funding for wash trading
the trader completes the financial activity of arbitrage. mainly comes from Flash Loan, and once the loan ends, all
• Self-liquidation. In the self-liquidation of Figure 5(c), the the assets will be returned with unchanged positions for
trader does not have enough assets to redeem the collateral each address. To maintain the unchanged position, there
from a collateral-based lending application. In order to avoid must be a closed capital cycle. Due to the limitation of Flash
the risk of being liquidated, the trader borrows a flash loan Loan, traders can only use the loan in the same transaction,
to pay the debt. After taking out the collateral, the trader so this circle only exists in one transaction rather than being
sells the collateral in exchange and repays the loan to the distributed among multiple transactions like traditional wash
provider. trading.
• Collateral swap. In the collateral swap of Figure 5(d), the • Heuristic 3: When an asset is exchanged, the asset will be
trader decides to change the collateral for more profit. When exchanged back in the same path before the loan ends. As
the trader has redeemed the collateral, he/her exchanges shown in Figure 5(a), when A swaps assets on the exchange,
a new asset and re-pledges the new asset into the lending there will be an opposite transaction to get the original as-
application. To repay the flash loan, the trader borrows one sets back with close volume. A chooses such a path for two
asset again from the lending application. reasons: 1) The way users influence prices is by sending
From the above transaction patterns, we can find that there is false information to the market, not by manipulating the
an asset return path in wash trading, and the type and quantity of exchange’s price formula. When traders swap large amounts
assets held by each address remain almost unchanged. For (b)(c)(d), of assets on AMM-based exchanges, there will be large slip-
there will always be some applications that have their net asset page [24] and traders may suffer asset losses, which will be
positions changed. This is because (b)(c)(d) have a practical financial acquired by arbitrageurs and sandwich attackers [25] later.
significance which is based on valid asset transfers. Therefore, for Therefore, A needs to exchange the asset back to maintain
any meaningful transaction, there will always be a net position the state of the exchange. 2) Trading volume in finance is
change. usually the sum of the quantities sold and bought, so a return
It should be noted that these figures have been simplified and path will double the volume of wash trading.
some special actions are not shown. For example, when a trader • Heuristic 4: In order to reduce costs, the manipulator will
provides liquidity for a DeFi application, some credential tokens only focus on actions related to wash trading. Although
will be created and transferred to the trader from zero address unrelated complex actions can be used to confuse investors,
3 (zero address assetcr→ ed e nt i al
trader , which is called minting). they also result in higher gas fees, additional trading fees,
When the trader removes liquidity from the DeFi application, these and unknown risks. We assume A is rational enough and
assetcr ed e nt i al he/she always achieves the wash goal with the least cost
tokens will be destroyed (trader → zero address, which and risk. In this paper, if a transaction increases the trading
is called burning). volume, but has real financial significance (no return path),
we do not treat it as wash trading.
4.3 Heuristic-based Detection Method
Some flash loan services (e.g., Flash Swaps[15]) allow users to
4.3.1 Analysis of Flash-Loan-based Wash Trading. repay the loan with another asset. When manipulators use such
In fact, all of the patterns in Figure 5 can increase the wash tar- services to complete their transactions, there will be real financial
get’s trading volume. The reason we treat Figure 5(a) as a wash significance and the state of the exchange will change. To maintain
trading transaction is that there is a very small change in the net the state, they need to construct two opposite transactions, which
position of assets for each address and the trader does not take any will increase the cost and risk. Therefore, in this paper, we assume
risk, such as a drop in the price. In other words, such transactions that manipulators borrow and repay the same asset to reduce risks
do not make any real financial sense. This fits the description of and costs.
wash trading by Yi Cao et al.[3]: wash trading is merely fraudu-
lent activities rather than true trading actions, so each participated 4.3.2 Algorithm Description.
trader tends to maintain his own positions unchanged or minimize
the unnecessary financial loss. At the same time, gas fees for trans- Our detection method is shown in Figure 6. Asset transfer records
actions in Ethereum are expensive, and no one wants to execute between different addresses are used as input data. There are four
such a meaningless transaction except for price manipulation. main steps for detection: graph construction, position calculation,
According to the characteristics of Flash Loan and wash trading, edge deletion, and judgment. They are described as follows:
we apply the following heuristics to identify wash transactions: Graph Construction. Let’s assume there is a Flash Loan trans-
• Heuristic 1: When A uses Flash Loan services for wash action T X i that includes some actions, and these actions involve
trading, his/her own limited funds are mainly used for gas different addresses and transfers. We have already known that Flash-
fees and trading fees, rather than directly participating in Loan-based wash trading only exists in one transaction, so we build
the wash. The assets used for wash trading mainly come a graph G i (V , E,W ) for T X i to detect wash trading. One edge can be
from Flash Loan. represented as (addresssender , addressr eceiver , asset_type, amount),
where addresssender is the sender, addressr eceiver is the receiver,
3 zero address, 0x0000000000000000000000000000000000000000 asset_type is the type of asset transferred, and amount is the weight
79
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
Delete this type of edge when
the condition is met
representing transfer amount. If two edges have the same partici- Algorithm 1 Flash-Loan-based Wash Trading Detection
pating addresses and asset_type, we classify them as the same type Input: N Transactions of Flash Loan, the threshold θ
Output: Wash trading set W T .
edge edдe_type_k. W T ← {}
Position Calculation. Unlike previous studies, we calculate posi- GRAP H ← { }
// Graph construction for each transaction
tion changes based on edges rather than addresses. Calculating edge for i = 1 to N do
net positions allows us to discover those transfers that have a return G i (V , E, W ) = Gr aph _Const r uct ion(T X i )
GRAP H _S ET ← G i (V , E, W )
path. We assume a pair of trading addresses addressX and addressY EDG E _T Y P E _S ET ← edдes , nodes
from T X i , and there are M transfers of assetn between them. There end for
for G i (V , E, W ) in GRAP H _S ET do
are l transfers with the direction of addressX → addressY and for edдe _type _k in EDG E _T Y P E _S ET do
(M −l) transfers with the direction of addressY → addressX . Then // Position Calculation
Posit ion Chanдe edдe _t ype _k = P osit ion _Calcul at ion(edдes , asset n )
we can calculate the position change Position Chanдeedдe_type_k P os i t ion Chanдe edдe _t ype _k
if M AX (amount _t r ans f e r ,amount _t r ans f e r as s e t n )
≤ θ
for the edge type k by the following formula: as s e tn
X → Y Y → X
then
Position Chanдeedдe_type_k (addressX , addressY , assetn ) // Edge Deletion
G i (V , E, W ) ← Edдe _Del et ion(G i (V , E, W ), edдes)
= |amount_trans f er ass e tn − amount_trans f er as s e tn | end if
X → Y Y → X end for
= | m=l
m=1 amount_trans f er addr ess X ,addr essY ,asset n ,m
m=M // Judgement
if G i (V , E, W ) = ∅ then
− m=l +1 amount_trans f er addr essY ,addr ess X ,assetn ,m | W T ← T Xi
end if
where amount_trans f er is the amount of assetn transferred be- end for
tween two addresses. In this step, we calculate the net position Return W T
where θ is the threshold that we set to filter out meaningless transfer the loan without any other actions. 2) The loan amount is 0. These
edges. When a set of edges satisfies the above condition, we remove two types of transactions do not use loans for any operations, so we
the set of edges from G i (V , E,W ). treat these transactions as invalid transactions and remove them
Judgement. After the edge deletion in the previous step, only edges from the detection results.
with real financial significance are left. From the previous analysis,
we can know that wash trading has almost constant positions and 5 EXPERIMENTS AND ANALYSIS
does not make any financial sense, which means there are no edges 5.1 Data Collection
left here. Therefore, when the final asset transfer graph is a null dYdX 4 , Aave 5 and Uniswap V2 6 are the most popular Flash Loan
graph (G i (V , E,W ) = ∅), we consider T X i to be a wash transac- providers on Ethereum, which hold the majority of the market
tion. The description of the whole detection process is shown in share [19]. In this paper, we will analyze Flash Loan transactions
Algorithm 1. using any of the three services. In order to detect Flash-Loan-based
4.3.3 Application-targeted Flash-Loan-based Wash Trading. wash trading, we first need to get Flash Loan transactions. However,
In DeFi, the target of wash trading can be not only an asset but using the Ethereum client to sync an archive node and parse related
also an application. Similar to the mechanism of asset-targeted transactions requires more storage resources (fast SSD drive with
wash trading, application manipulators can mislead investors by 4 dYdX,https://dydx.exchange/
increasing the trading volume of an application so there will also 5 Aave,https://aave.com/
be a closed capital cycle in the transaction. Therefore, we use the 6 Uniswap V2, https://uniswap.org/
80
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
at least 6TB+ of space) and time, so it is a high-cost method for 5.2 Detection Results with Different
researchers who only want to study small-scale transactions. In Parameters
this paper, we provide a method for collecting Flash Loan transac-
Figure 7 shows the detection results under different θ . In order to
tions through third-party platforms (more details can be found in
determine the θ , we analyze these detection results.
Appendix: Data Collection). This method mainly has the following
steps:
6750
(1) Download coarse transaction data. When a transaction
81
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
Liquidity providing
Restore the asset Get the wrapped Swap assets Swap assets Use the service
asset back back
Liquidity removing
Number of Transactions
tokens: ODDZ and SAITO.
4000
(3) When θ changes from 0.2 to 1, the number of detection
results has hardly changed. This means that when the asset 3000
5.3 Validation
Through the above analysis, we found that when θ = 0, those
transactions without trading fees will be detected and the target of
these wash transactions is usually some applications. When θ is set Table 4: W ashr at io distributions for different wash targets.
to 0.20, some token-targeted transactions are found. To be able to
discover all transactions that meet the detection condition, we set W ashr at io
the value of θ to 0.20. Table 3 shows the final detection results for Percentage (%)
(Wash Volume/ Total Volume)
different patterns. For the pattern of asset wrapping, all transaction ≥ 10% 70.49
types are the same, there is only one wash target (WETH contract). ≥ 20% 49.18
For the pattern of liquidity providing, Compound, Aave, and iUSDC
≥ 30% 36.07
are the main wash targets. For the pattern of asset swapping, there
≥ 40% 22.95
are 67 different target tokens.
≥ 50% 16.39
We also counted the usage of Flash Loan services in our detected
results (as shown in Figure 9). It can be found that 6331 wash transac-
tions used the dYdX service and only 9 transactions used other Flash For each wash target tarдet j , we calculate the W ashr at io (=
W ash V olume
Loan services. This is not surprising since dYdX has almost free in- T ot al Mar ket V olume ) which represents the ratio of wash volume
terest on borrowing: dYdX loan int er est = 1W ei 1W ei = 10−18 ET H . to total market volume (trading on decentralized exchanges) during
For Aave and Uniswap V2, the cost is more expensive: Aaveloan r at e = the attack. In Table 4, we show distributions of W ashr at io for differ-
0.09%, U niswap V 2loan r at e = 0.3%. Although Uniswap V2 is the ent wash targets. As can be seen from the figure, over 70% of wash
most popular Flash Loan provider, most traders just use it to ar- targets have a 10% W ashr at io , about 50% of wash targets have a 20%
bitrage in the form of flash swaps. For arbitrageurs, Uniswap V2 W ashr at io , and about 36% of wash targets have a 30% W ashr at io .
provides a wider variety of loan assets, so they can accept a loan This shows that the transactions we detected have greatly improved
rate of 0.3%. For manipulators, there is usually no asset gain, so the trading volume of targets.
82
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
(times ≥ 10) which do not have any financial significance but cost 300000
gas fees. and 2) the on-chain funding source that financed one 200000
transaction also financed other similar transactions(times ≥ 10).
100000
Finally, 97% of transactions meet both of the above conditions, so
0
we consider the detection results to be reliable.
Wash Transactions Other Flash Loan Transactions
5.4 Characteristics of Wash Transactions
This section targets RQ2. Through statistics and analysis of these
Figure 11: Loan amount distributions for different types of
detected results, we find these wash transactions have some basic
transactions.
characteristics, which are shown below.
Gas Cost. Figure 10 shows the difference in gas cost for wash trans-
actions and other Flash Loan transactions. Compared with other for other transactions are at lower levels ($3,000∼$20,000). This
Flash Loan transactions, the gas fees of wash transactions are gen- shows that a large loan amount is not necessary for real Flash Loan
erally distributed in a lower range (average 0.033 ETH gas fee for traders and they just need the right amount of assets.
each transaction). This is because wash transactions don’t need
to compete for priority with other transactions and manipulators
only need to set appropriate gas fees for transaction execution. For
1400
manipulators, they will reduce the cost as much as possible when Datef irst wash − Datetarget creation (Days)
1200
completing the target transaction volume. In contrast, there are
1000
many competing transactions (e.g., arbitrage) and complex trans-
actions in other Flash Loan transactions, so the gas cost is higher 800
(average 0.061 ETH gas fee for each transaction). In detection results, 600
we also observed 7 transactions that have high gas fees (average 400
0.267 ETH) because they performed multiple wash actions in a 200
single transaction. 0
Wash Transactions
1.0
0.8
Figure 12: Time interval distributions of wash transactions.
Gas Cost (ETH)
0.6
Time Interval. To analyze the time feature, we calculate the wash
0.4 time interval which equals the first wash trading time Date f ir st wash
minus the target creation time Datet ar дet cr eat ion . From Figure 12,
0.2
we can find that most wash transactions start within a year of the
0.0
target creation and many wash transactions were initiated within
Wash Transactions Other Flash Loan Transactions
three months of target creation. This means wash trading usually
targets recently released assets or applications, and fake trading
volumes are created to attract traders’ attention.
Figure 10: Gas cost distributions for different types of trans- Activities of Wash Smart Contracts. In detection results, a total
actions. of 205 smart contracts were created to complete the 6340 wash
transactions. By manual inspection, we find that 65 of these smart
Loan Amount. Since different assets can be borrowed from Flash contracts have a similar activity pattern (as shown in Figure 13):
Loan applications, we convert loans to USD using the real-time 1) Manipulators control accounts to create wash smart contracts
price of each asset for comparison. Figure 11 shows loan amount and transfer ETH to them. 2) Created smart contracts are called
distributions for different types of transactions. We find that the to complete wash actions and ETH is converted into the target
loan amounts of wash transactions are distributed in a higher range asset to pay trading fees. 3) After completing all wash actions, the
($70,000∼$130,000), which is because wash trading needs more remaining ETH will be exchanged back. 4) The remaining ETH is
assets to increase the total market volume. Even though the loan is eventually withdrawn to an account controlled by the manipulator.
free, the loan amount for most wash transactions is still not very We also found that these smart contracts were never used again
high. We guess this is because cunning manipulators always avoid after completing the wash trading. This suggests these contracts
being discovered by careful investors. In contrast, the loan amounts were built specifically for creating fake transactions.
83
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
250000
Suspicious Trading Volume
Normal Trading Volume
200000
Volume (USD)
150000
100000
0
Figure 13: The most frequent activity of wash smart con-
2021-03-08
2021-03-09
2021-03-10
2021-03-11
2021-03-12
2021-03-13
2021-03-14
2021-03-15
2021-03-16
2021-03-17
2021-03-18
2021-03-19
2021-03-20
2021-03-21
tracts.
Time (Year-Month-Day)
6 FINANCIAL ANALYSIS
This section targets RQ3 and RQ4. In this section, we analyze the
market impact and attack cost to explore why manipulators are will- Figure 14: Trading volume of token 0x3383c5 on Uniswap V2.
ing to use Flash-Loan-based wash trading for volume manipulation.
Detailed results are shown in Appendix: Financial Analysis.
It should be pointed out that in some special cases (e.g., small wash
volume goal), traditional wash trading are more cost-effective.
6.1 Correlation Analysis
Figure 14 shows a case that the fake trading volume caused an 7 DISCUSSION
increase in the normal trading volume of token 0x3383c5 (part of Due to the anonymity and decentralization of blockchains, this
the hash code). From March 8th to March 14th, the normal trad- study has multiple limitations:
ing volume is always less than $10,000 while Flash-Loan-based Ground-truth based validation. First and foremost, it should be
transactions dominate the market. From March 15th, the normal made clear that how to obtain reliable labeled data is a challenging
trading volume began to increase, and the manipulators stopped task in wash-trading-related research. As far as we know, there is
the behavior of wash trading. We searched Twitter, Discord and still no conclusive evidence here to validate such criminal activity.
other social networking sites for relevant information about the Cao et al. [3] were the first team to systematically study wash trad-
token and found that a lot of promotional information was released ing, but in their study, only manually reproduced samples based on
during the period. These promotions touted the token’s bright fu- abnormal trading patterns were used to evaluate the effectiveness
ture and good performance on Uniswap V2 to attract innocent users. of their algorithm. In these studies [9, 16, 17] focusing on DeFi
Although we know there were some fake transactions, those inno- wash trading, there is still no clear ground-truth validation. It is
cent users still chose the token and it eventually led to an increase not surprising, as there are always limitations to linking abnormal
in the price (over 30%). This shows Flash-Loan-based transactions trading patterns to specific criminal activity. However, this does
can affect the trading volume and prices of target tokens. not mean that the detection and evaluation of these studies are
In the Appendix to Correlation Analysis we did some rough unreliable. In the regulation of traditional finance, wash trading has
calculations and came to some conclusions: 1) By calculating the a clear definition, and any transaction that meets the definition can
Pearson correlation coefficient, we can find the market trading be regarded as an abnormal transaction. Most traders are for profit
volume of target assets is highly related to these wash transactions, and they have no incentive to make such illegal transactions with-
which indicates that wash trading directly led to an increase in out direct profit. Therefore, transactions that conform to anomalous
market trading volume. This is not surprising as the direct purpose trading patterns can serve as evidence for legal penalties in many
of Flash-Loan-based wash trading is to increase the market volume scenarios. Of course, the research would be more convincing if we
of target assets; and 2) we also find the prices of some target assets could have more evidence (e.g. audio recordings, social network
can be affected by wash transactions within a week (other tokens chat logs, IP addresses, etc.) to validate those transactions. In the
may take longer) and this shows that fake transactions can affect future, mining more conclusive evidence for price manipulation on
the market performance of assets. the blockchain is an area worth exploring.
Prevention of wash trading. The detection algorithm in this pa-
6.2 Cost Analysis per is run “after the fact”, which means that unless miners are
Through simulation experiments of Cost Analysis, we find that willing to deploy it to reject those transactions, our algorithm can-
under certain conditions (e.g., the loan interest is less than 0.1% not defend against wash trading in real-time. In fact, the main
and the target trading volume is large enough), Flash-Loan-based purpose of our paper is to analyze and prove the abuse of Flash
wash trading can have a lower cost than traditional wash trading. Loan in wash trading, thereby drawing the attention of regulators
Under the same cost, the maximum wash volume of traditional and investors to such transactions. Although the business of wash
wash trading is much smaller than Flash Loan-based wash trading, trading has existed for a long time [1], there are few concrete so-
which means the latter can effectively amplify the impact of attacks. lutions to this problem. Decentralized exchanges haven’t shown
84
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
ACKNOWLEDGEMENT
This research was partially supported by NSERC (Natural Sciences
and Engineering Research Council of Canada), Canada.
85
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
0xc52c32 0.85 0.051 0.054 0.049 0.049 0.049 0.053 0.057 0.063
0.8
Wash volume time series for different assets
0xf74134 0.97 0.12 0.6 0.49 0.21 -0.29 -0.58 -0.73 -0.76
0.6
0x1453db 0.59 -0.12 -0.12 -0.12 -0.12 -0.12 -0.11 -0.11 -0.11
0x1fe24f 0.28 -0.2 -0.27 -0.26 -0.22 -0.18 -0.16 -0.22 -0.23 0.4
0xdece0f 0.94 -0.32 0.051 0.33 0.28 0.47 0.7 0.57 0.032 0.2
0xaef4f0 0.73 -0.23 -0.21 -0.2 -0.18 -0.19 -0.2 -0.19 -0.19 0.0
0x62786e 0.92 -0.26 -0.28 -0.31 -0.35 -0.21 -0.028 0.023 0.082
−0.2
0x2edf09 0.15 -0.38 -0.4 -0.4 -0.42 -0.45 -0.46 -0.42 -0.35
−0.4
0xa2881f 0.64 -0.75 -0.43 -0.082 0.51 0.36 -0.22 -0.4 0.026
−0.6
0xf9fbe8 0.47 -0.26 -0.027 0.1 0.014 -0.13 -0.2 0.32 0.35
M arket V olume timedelay =0 day timedelay =1 day timedelay =2 days timedelay =3 days timedelay =4 days timedelay =5 days timedelay =6 days timedelay =7 days
Different Time Series
Figure 15: Pearson correlation coefficients for different time series pairs.
A APPENDIX: FINANCIAL ANALYSIS market trading volume. This is not surprising, as the direct purpose
In this section, we analyze the market impact and cost to explore of Flash-Loan-based wash trading is to increase the market volume
why manipulators are willing to use Flash-Loan-based wash trading of the target asset. This improvement is immediate, as Flash Loan
for volume manipulation. It should be noted that all the market makes wash trading without capital restrictions.
data in this paper is obtained from Dune and Ethplore14 . By setting different timedel ay , we find that only four assets
(0x f 74134, 0xdece0f , 0xa2881f , 0x f 9f be8) have a significant cor-
A.1 Correlation Analysis relation between prices and wash volume within a week. The prices
of most assets were not significantly affected. For most assets, there
For the convenience of calculation and comparison, we mainly ana-
is no clear positive correlation between wash volume and prices,
lyze the market impact of Flash-Loan-based wash trading on target
and 0x2ed f 09 even shows a high negative correlation. On the one
assets. Firstly, we selected 10 assets with the most wash transac-
hand, the price is usually determined by multiple market factors,
tions and collected three types of time series for them: wash volume
and not every Flash-Loan-based wash trading will be successful.
Twash_volume , market volume Tmar ket _volume , and asset prices
For manipulators, they may need more actions to get investors’
Tasset _pr ice (the basic unit of time series is the day). The effect
attention, such as posting attractive news on social networking
of trading volume on prices is delayed rather than immediate, so
sites. On the other hand, the effect of trading volume on price is
we set up sliding windows Slidinд_W indow t ime with different de-
not immediate, and there may be a longer time delay.
lays timedel ay ( timedel ay ∈ {1 day, 2 days, 3 days, 4 days, 5 days,
6 days, 7 days}). The width of the Slidinд_W indow t ime is equal to
the time span of wash trading. For example, for one asset, the wash A.2 Cost Analysis
time lasts for 30 days from April 18, 2021 to May 17, 2021, so we take In this section, we discuss the attack cost of wash trading with-
three time series Twash_volume , Tmar ket _volume ,Tasset _pr ice of /without Flash Loan. Because Flash-Loan-based wash trading for
the asset during this period. When timedel ay = 2 days, We set the different targets has a similar cost structure, we just chose one
time range for Tasset _pr ice from April 20, 2021 to May 19, 2021. In scenario for discussion.
this way, we have a total of 90 pairs of time series.
In economics, the Pearson correlation coefficient is often used A.2.1 Description.
to measure the correlation between two variables. In this paper, we Flash Loan. We assume there is a flash loan platform F with
use the Pearson correlation coefficient to evaluate the impact of amount f l ash_loan of asset f l ash_loan , which the adversary A can
wash transactions on market volume and prices. Figure 15 shows borrow. The interest rate of asset f l ash_loan is rate f l ash_loan .
the correlation coefficients between different time series pairs. The Decentralized Exchange. There is a decentralized exchange
Y-axis represents Twash_volume of different assets, and the X-axis pool PX /Y , which is based on the simplest AMM mechanism (x ×y =
represents Tmar ket _volume and Tasset _pr ice with different time k). The pool includes amount X of asset X and amountY of asset Y.
delays. We use the first eight digits of the address hash to distinguish X is the popular currency (e.g., ETH or USDC) that can be borrowed
different assets. from Flash Loan services, and Y is the currency created by A. For
From the first column of Figure 15 , we can find that the market PX /Y , the trading fee of a swap action is rateswap × amountswap .
trading volume of almost all target assets is related to wash trans- We assume that the trading fee of PX /Y is not earned by A. Note
actions. Especially for asset 0x f 74134, the correlation reaches 0.97, that the slippage is ignored.
which indicates that wash trading directly led to an increase in Adversary. Adversary A has a certain amount of initial funds
C 0 and some ETHs for gas fees. His purpose is to create fake trading
14 Ethplor, https://ethplorer.io/zh/ volume V olume дoal (V olume дoal > C 0 ) in pool PX /Y .
86
AFT ’22, September 19–21, 2022, San Francisco, CA, USA Rundong Gan and Le Wang et al.
rateswap = 0.1%, V olumegoal = 800 ET H ratef lash loan = 0%, V olumegoal = 800 ET H ratef lash loan = 0%, rateswap = 1%
12
Wash Trading without Flash Loan Wash Trading without Flash Loan Wash Trading without Flash Loan
9.4 Wash Trading with Flash Loan (M=20) 12 Wash Trading with Flash Loan (M=20) Wash Trading with Flash Loan (M=20)
Wash Trading with Flash Loan (M=40) Wash Trading with Flash Loan (M=40) Wash Trading with Flash Loan (M=40)
10
9.2 Wash Trading with Flash Loan (M=60) 11 Wash Trading with Flash Loan (M=60) Wash Trading with Flash Loan (M=60)
Wash Trading with Flash Loan (M=80) Wash Trading with Flash Loan (M=80) Wash Trading with Flash Loan (M=80)
9.0 10 8
Cost (ETH)
Cost (ETH)
Cost (ETH)
8.8 9
6
8.6 8
4
7
8.4
6 2
8.2
5 0
0.0 0.1 0.2 0.3 0.4 0.5 0.5 0.6 0.7 0.8 0.9 1.0 0 200 400 600 800 1000
Flash Loan Interest (ratef lash loan ) (%) Trading Rate (rateswap ) (%) Washing Goal (V olumegoal ) (ETH)
(a) Wash trading with different r at e f l ash_l oan (b) Wash trading with different r at e sw ap (c) Wash trading with different V olume дoal
87
Understanding Flash-Loan-based Wash Trading AFT ’22, September 19–21, 2022, San Francisco, CA, USA
88