00:00:01
[Music]
00:00:08
hi everybody uh thank you for coming to
00:00:11
my talk and uh I'll present our work on
00:00:13
our study of the ethereum Arbitrage
00:00:16
ecosystem so first what is arbitrage uh
00:00:20
well simply put at a high level
00:00:22
Arbitrage is just buying an asset in one
00:00:24
location and then selling it somewhere
00:00:26
else for advantageously differing prices
00:00:30
consider a very simple real world
00:00:31
example maybe at one location you can
00:00:33
buy a tomato for $2 per tomato and then
00:00:36
by just crossing the street you can sell
00:00:38
it somewhere else for
00:00:39
$4 well obviously you make money every
00:00:42
single time you do this so you would
00:00:44
probably do it all day long or at least
00:00:46
until the shopkeepers get wise to the
00:00:48
scheme and update their prices this is a
00:00:50
normal and expected facet of financial
00:00:53
markets and some would even consider it
00:00:55
a good thing as it tends to move assets
00:00:58
from where they are more abundant in
00:01:00
cheaper to where they're scarce and more
00:01:04
expensive ethereum also has exchanges
00:01:07
where you can buy and sell assets we're
00:01:08
going to be talking about erc20
00:01:11
tokens and although this exists in many
00:01:14
forms the most prominent one is uh by
00:01:16
exchanging with an automated Market
00:01:18
maker what are these they are smart
00:01:21
contracts on the ethereum blockchain and
00:01:25
they allow users to automatically swap
00:01:27
between two different kinds of tokens
00:01:29
for an automatically determined price
00:01:32
these smart contracts maintain something
00:01:34
called a liquidity pool this is a set of
00:01:35
reserves of sometimes two usually two
00:01:38
but maybe more types of tokens and in
00:01:41
order to perform a swap a user first
00:01:43
deposits some money into the pool the
00:01:46
smart contract computes a fair price
00:01:48
subtracts off a little bit of fee and
00:01:50
then emits the token that they're
00:01:51
purchasing back to the user how does the
00:01:54
liquidity pool fill up well uh users may
00:01:57
also provide liquidity into the pool in
00:01:59
order to a share in the fees that are
00:02:01
extracted every single Swap we see in
00:02:04
the bottom corner a swapping variant for
00:02:06
a typical uh Market maker uh called the
00:02:09
constant product Market maker um it
00:02:12
exists but you don't need to know the
00:02:13
details at a high level understand that
00:02:16
typically the prices are automatically
00:02:18
computed based on the ratio of the
00:02:20
balances of the different tokens that
00:02:22
are held in
00:02:24
reserves there are many reasons why
00:02:26
Arbitrage is attractive on the ethereum
00:02:28
blockchain first ethereum has many
00:02:32
different independent applications that
00:02:34
are automated market makers and all of
00:02:36
them update prices publicly and
00:02:38
independently of one another as users
00:02:40
perform swap actions and other types of
00:02:44
Trades second there's limited risk in
00:02:47
the real world scenario maybe while
00:02:48
you're carrying your Tomatoes you trip
00:02:50
and fall and then your product is ruined
00:02:53
that's not really possible on the
00:02:54
ethereum blockchain as transactions are
00:02:56
Atomic if anything at all goes wrong
00:02:58
during the process of buying or selling
00:03:01
uh you can simply revert the transaction
00:03:03
and then all buy and sell orders are
00:03:05
undone as if they had never occurred
00:03:08
this is no secret bots of course uh
00:03:11
actively exploit these uh markets in
00:03:13
order to extract profit by doing
00:03:15
Arbitrage we know that this is a highly
00:03:17
competitive environment and that annual
00:03:19
profits are probably somewhere around
00:03:21
$100
00:03:23
million why do we care about it though
00:03:25
well there are two reasons and I'll talk
00:03:27
about them briefly so the first is
00:03:29
because of me V you might have heard
00:03:31
that term um and I'll call it minor
00:03:34
extractable value here just for
00:03:36
Simplicity uh the at a high level this
00:03:38
concept is the idea that a minor is able
00:03:40
to extract more than the typical block
00:03:43
reward by selectively censoring
00:03:45
inserting or reordering
00:03:47
transactions Arbitrage is one of these
00:03:49
types of transactions that a minor would
00:03:51
be able to insert in order to boost
00:03:53
their profits from producing a
00:03:56
block but it turns out as we'll see
00:03:59
later in the presentation this actually
00:04:01
isn't even necessary any longer as Bots
00:04:04
typically uh provide a majority of the
00:04:06
profit that they gain from Arbitrage
00:04:08
directly to the block producer anyway as
00:04:11
a sort of bribe for Priority Access to
00:04:13
the blockchain the reason we're
00:04:15
concerned about me is that it may
00:04:17
incentivize something called a Time
00:04:18
Bandit attack because of time I can't
00:04:20
really get into it too much but I'll
00:04:22
give you a very very high uh view of of
00:04:24
what it is here you can see a depiction
00:04:27
of a blockchain where the block reward
00:04:29
is is fairly steady but one block has an
00:04:33
extremely high block reward due to me
00:04:36
what we would like the block producers
00:04:38
to do is continue extending the
00:04:40
blockchain in the normal manner however
00:04:43
they may be incentivized in said to Fork
00:04:45
the blockchain and attempt to fight to
00:04:47
see who is the one to produce that block
00:04:49
with excessive reward and this might
00:04:51
cause instability so that's one reason
00:04:53
we might be concerned about that another
00:04:56
reason we're concerned is because of
00:04:58
price orical manipulation I talked about
00:05:00
automated market makers and how they
00:05:02
allow you to swap between different
00:05:03
assets well they also provide spot price
00:05:06
quotes to different types of financial
00:05:08
instruments that operate on the
00:05:10
blockchain and it's important that these
00:05:12
are accurate price
00:05:13
quotes pretty quickly in the development
00:05:16
of the uh amm ecosystem we noticed that
00:05:19
these spot prices can be manipulated by
00:05:21
people placing very large buy or sell
00:05:23
orders as a defense to this manipulation
00:05:26
they placed a Time weighted average
00:05:28
price or in most modern day amm this
00:05:32
requires that the manipulation be
00:05:34
maintained over a long period of time in
00:05:36
order to reflect a change in the spot
00:05:37
price from this Oracle in this sense
00:05:40
Arbitrage is actually good as it
00:05:42
contributes toward this defense if a
00:05:44
manipulator attempts to change the price
00:05:46
dramatically on just this exchange
00:05:48
they're going to have to fight
00:05:49
arbitragers that are taking profit by
00:05:52
leveling the prices back in line with
00:05:53
the rest of exchanges in this sense it's
00:05:56
actually quite important that Arbitrage
00:05:59
is is regularly taken and uh some prior
00:06:02
Works suggest that this may not be the
00:06:04
case so we really ought to investigate
00:06:07
if that's uh completely
00:06:09
true our study is broken into two
00:06:11
separate parts first we look at what
00:06:14
real world Arbitrage activity was
00:06:15
performed by Bots what sort of patterns
00:06:18
do we see these Bots perform and what
00:06:22
are the trends this is what we're
00:06:23
looking for and the reason we're looking
00:06:25
is because of course these Bots are
00:06:27
quite opaque with how they perform their
00:06:29
actions they don't want to reveal their
00:06:31
secrets and how they're making profit
00:06:33
out in the open and second we go and
00:06:36
ourselves go attempt to detect
00:06:38
opportunities to uh uh take Arbitrage
00:06:41
and we do this by a historical
00:06:43
analysis and we look at how much profit
00:06:46
could be made from Arbitrage how long do
00:06:48
these arbitrages
00:06:50
persist and uh in general look for
00:06:53
insights from
00:06:55
that first our analysis of the real
00:06:58
world uh arbitrages uh we do this by uh
00:07:02
graph analysis of the erc20 token flows
00:07:05
within a single con uh uh transaction uh
00:07:08
and we do that because erc20 token uh
00:07:10
trades are
00:07:11
standardized we first infer what
00:07:14
exchanges were used by and this is quite
00:07:16
simple looking for a smart contract that
00:07:19
received one token and emitted another
00:07:20
good enough we then construct a graph of
00:07:23
these token flows and we look for Cycles
00:07:26
why do we look for Cycles well I talked
00:07:28
about how Arbitrage is selling an asset
00:07:31
and then buying it back this forms sort
00:07:33
of a closed loop here you can see in an
00:07:35
example that Loop also includes an
00:07:37
intermediate hop through another asset
00:07:39
that's totally fine but ultimately it
00:07:41
has to come back to the same asset okay
00:07:44
so uh we do cycle uh detection and then
00:07:47
we analyze the cycle to see what token
00:07:49
was taken as profit how much profit was
00:07:50
gained and who
00:07:52
profited I'll dig into some of the
00:07:54
results that we have of course there's
00:07:56
much more in our papers so definitely
00:07:57
check it out we identify 3.8 million
00:08:00
arbitrages over the study period of 28
00:08:02
months in total we find that they
00:08:04
extracted about $321 Million worth of
00:08:07
profit and the most profit the most
00:08:10
arbitraged exchanges are Unis swap V2
00:08:13
and V3 Sushi swap balancer and a
00:08:15
selection of others it's important to
00:08:17
note here that the tail on this graph is
00:08:20
actually quite long extending out to the
00:08:22
uh uh to the right edge here uh and we
00:08:25
were able to observe this long tail by
00:08:27
using our generic analysis of token
00:08:31
flows here's some characteristics of the
00:08:33
arbitrages we observed first of all
00:08:36
overwhelmingly Arbitrage uh bot
00:08:39
operators tend to perform just one
00:08:40
single Arbitrage per
00:08:42
transaction these arbitrages tend to be
00:08:45
rather small in the number of exchanges
00:08:46
they use typically just two or three
00:08:49
although we did observe some going all
00:08:51
the way up to 5 six s and at the extreme
00:08:54
12 overall vastly these Bots prefer to
00:08:58
take profit in wrapped ether which makes
00:09:00
sense as wrapped ether has the most
00:09:03
trading pairs with other tokens in the
00:09:05
ecosystem and overall profit is rather
00:09:08
small per transaction somewhere around
00:09:12
$10 we also see that back running is
00:09:14
currently a dominant strategy this is
00:09:17
the strategy of selectively uh carefully
00:09:19
inserting an Arbitrage immediately after
00:09:21
the transaction that opens the
00:09:23
possibility of Performing the Arbitrage
00:09:25
despite these back running transactions
00:09:27
being a minority of arbitrages they're
00:09:29
actually dominating in terms of profit
00:09:31
taking um so this shows that some adding
00:09:34
some of this sophistication does Boost
00:09:36
profit we show that the block producers
00:09:38
share of profits is steadily climbing up
00:09:41
in fact it's now close to 90 95% of the
00:09:44
profit taken from Arbitrage goes
00:09:46
directly to the block producer as a
00:09:48
bribe for Priority Access into the
00:09:52
blockchain as a side note go check out
00:09:54
our paper but we also notice some
00:09:56
Arbitrage lookalikes that are in fact s
00:09:59
which attacks if you look quite closely
00:10:01
um I won't go into details here for time
00:10:03
but check out our paper future work that
00:10:06
researches Arbitrage definitely needs to
00:10:08
take these into account we were in fact
00:10:09
fooled by this as well and uh
00:10:12
overcounted first by5 billion of quite
00:10:14
dramatic figures so please uh consider
00:10:18
that okay let's uh talk about our
00:10:20
opportunity detection system our
00:10:23
strategy is first to limit the scope but
00:10:26
we limit it generously according to our
00:10:28
measurements from the previous section
00:10:30
we detect arbitrages and then once we
00:10:32
find them we verify the possibility by
00:10:34
running the Arbitrage on a private Fork
00:10:36
of the blockchain and then we apply a
00:10:39
fee estimated based on what arbitragers
00:10:42
were paying in terms of fees about that
00:10:44
time in history using those types of
00:10:48
exchanges we execute two different
00:10:50
groups our first group is the large
00:10:52
arbitres that Prof allegedly profit over
00:10:55
one uh one ether and we find that the
00:10:59
vast vast majority of these fail when
00:11:01
you attempt to take the Arbitrage why is
00:11:03
that well it's because when uh for the
00:11:06
majority of cases when you attempt to
00:11:08
transfer the token uh the transaction
00:11:11
reverts the token doesn't allow any
00:11:13
transfers at that moment uh so there's
00:11:16
no way you can actually buy the token
00:11:17
and complete the
00:11:18
Arbitrage uh this highlights how it's
00:11:21
important when you're studying Arbitrage
00:11:23
activity to actually perform the
00:11:25
concrete transaction to verify
00:11:27
feasibility and and we suspect that
00:11:29
prior work was likely overestimating
00:11:31
Arbitrage activity uh possibility on the
00:11:34
blockchain um some in fact did do this
00:11:38
execution including uh tin from
00:11:42
2019 we also find that the average
00:11:45
duration here is just one block which is
00:11:47
nice and short however the 75th
00:11:49
percentile can go up to four blocks
00:11:51
which does get a little bit on the long
00:11:54
side we also execute about a month's
00:11:56
worth of random selected uh arbitr
00:11:59
proes and we find that the failure rate
00:12:01
is much much lower here which makes
00:12:03
sense um most of these profit only uh a
00:12:07
little bit of money um and uh so it it
00:12:12
should be the
00:12:13
case um however we find that after
00:12:16
applying fees only about 1% of these are
00:12:18
profitable uh and that's also sort of
00:12:21
intuitive if you look at this graph it
00:12:23
seems that by selecting Arbitrage
00:12:25
possibilities randomly uh they either
00:12:28
exist for uh they're either very cheap
00:12:31
uh and exist for uh a few blocks or
00:12:34
they're quite expensive and exist for a
00:12:35
very short amount of time because they
00:12:37
will be taken uh but generally not both
00:12:40
we find that our weekly profit estimate
00:12:42
could be somewhere around $42,000
00:12:44
although it's difficult to say because
00:12:46
we didn't actually run this in the
00:12:47
competitive
00:12:50
environment to go over what we've talked
00:12:53
about uh most Arbitrage is among just a
00:12:55
handful of popular exchanges the
00:12:57
strategies are actually rather simple
00:13:00
the block producers share of profit is
00:13:02
slowly marching upward uh and that's
00:13:05
something to keep an eye on Arbitrage
00:13:07
opportunities are generally taken fairly
00:13:09
quickly but not too quickly and it is
00:13:11
absolutely essential to go and execute
00:13:13
arbitrages to verify the opportunity as
00:13:16
a lot of them uh in fact aren't feasible
00:13:18
in
00:13:19
practice uh with that I'd like to thank
00:13:22
you for attending my talk and I'll take
00:13:27
questions