How do trades work on Ethereum?

Will
Eden Network
Published in
5 min readNov 8, 2021

How do trades work on Ethereum?

So you recently took the plunge into the Ethereum ecosystem. You bought your first ETH token on Coinbase, and transferred it to your MetaMask wallet on your web browser.

Shortly after you started dabbling with Uniswap, and bought a few blue-chip altcoins.

You think to yourself, wow, this stuff works like magic.

Then the thought pops into your head — wait a minute, how does this all even work?

What happens after I submit a trade from my wallet?

Where does my transaction go?

What is the process flow, and are there any vulnerabilities along the way?

If you’ve ever pondered questions like these and are looking for answers, you’ve come to the right place.

In this article, we explain what happens to your trade from the moment it leaves your wallet, to the moment it comes back with the tokens you swapped for.

TL;DR

  1. Trade initiation and final execution are simple, straightforward parts of the trading process
  2. After a trade is sent, it goes to the public waiting pool, where it sits pending for anywhere from seconds to hours, during which time it is vulnerable to malicious bot attacks
  3. Block producers are the party that picks up transactions from the public waiting pool and writes them to Ethereum blocks — they follow the rules of the Geth client they run
Ethereum trading process model

Initiating the trade

This first step is straightforward. The DEX you are using (e.g., Sushi or Uniswap) gives you a quote estimating how many tokens you will receive at a minimum for your swap.

You authorize the trade to occur from your wallet to conditionally spend your tokens (assuming your trade executes successfully).

Arrival in the public transaction pool

This is where things get interesting.

On Ethereum, after your transaction is sent from your wallet, it is funneled off to something called the “public waiting pool.”

Here, transactions sent from Ethereum users across the globe congregate together in a transparent holding pool before being executed.

Transactions remain in the holding pool for anywhere from a few seconds to several hours, depending on the priority fee used.

The public waiting pool is visible to everyone at any given time.

Everyone can see what trades are lined up to be executed, along with their slippage details.

Source: Eden Research & Analysis

In practice, this transparency opens up the door for malicious actors to engage in a malicious activity called “frontrunning.”

Frontrunning, along with other similar types of exploits such as sandwich attacks, have been coined under the umbrella of “MEV,” or Miner Extractable Value.

Most of the time, trades pass through without a problem — but inevitably, a substantial portion of DEX trades are exploited by bots, essentially creating a hidden tax for DEX traders.

To date, over 750m has been extracted from users.

Why do trades need to wait around in the first place?

This is because block producers have limited space in their blocks, and at any given time the number of transactions submitted greatly exceeds the available block space.

Block producers have to choose which transactions to write to the next block.

This takes us to the next step — transaction uptake by block producers.

Trade uptake by block producers

Block producers are like the scribes that write transactions to the Ethereum blockchain.

They are the party that has the final say as to what transactions are published to an Ethereum block.

How do they decide which transactions to publish?

Block producers run something called a “Geth client” that has rules and parameters that determine which transactions are uptaken and published to blocks.

By default, block producers run a version of Geth that says that “priority fee” is what determines which transactions are chosen to enter the next block.

So of all the transactions sitting around in the public waiting pool, block producers choose the ones that have the highest priority fee first.

The higher the priority fee of a transaction, the more likely it is to get chosen, and the less time it spends waiting to process in the public waiting pool.

Transaction Execution

This part is also straightforward.

When a transaction’s priority fee is high enough compared to the other transactions in the waiting pool, it is uptaken by a block producer, and written to one of the next blocks.

And there we have it — the trade is complete and written to the Ethereum blockchain forever.

How does Ethereum’s transaction flow compare with the traditional world?

In the traditional finance world, there are several additional steps and intermediates included in part of the transaction flow.

At a high level, this graphic shows the flow for buying something online with a credit card:

Source: BancardSales on YouTube

Without going into detail, we can see there are many more intermediaries involved in this process.

Each of them takes a cut along the way in some form or another.

This process is also less time efficient than Ethereum — final settlement can take up to 30 days (after the customer pays their credit card bill).

What about buying stocks on a traditional trading platform?

Source: InTheMoney on YouTube

Buyers and sellers are matched by a third party called a ‘clearing house.’

Finalizing a transaction takes two full days after a trade is executed!

Also, the trading platform (such as Robinhood or Schwab) must front a portion of the trade value created by buyers and sellers to the clearing house.

This is important because during times of extreme demand for a given stock, trading platforms may be required to front hundreds of millions or billions of dollars overnight.

This was the case with GME on Robin Hood — as a result the platform was unable or unwilling to front this capital — and ended up preventing additional buy orders from coming through.

The final result was a poor user experience and thousands of upset and frustrated traders.

Who cares?

Decentralized platforms like Ethereum are so powerful because they are permissionless and trustless.

Final settlement happens in a matter of minutes, rather than days.

There are far fewer steps along the transaction journey, and far fewer vulnerable points to be exploited.

This result is lower risk, more freedom and less stress for the trader.

Traders own their actual assets, rather than an IOU where access is subject to the discretion of a third party.

Ethereum, and Eden Network, bring power back to the traders.

Follow us on Medium for more blogs like this, and our socials on Twitter, Discord and Telegram for the latest updates from the team!

--

--