A Primer on Blockchain Fees

Why can’t I buy coins without clicking buttons?

I’m looking for the most efficient way to swap my fiat into coins that I self-custody. More specifically, I want a no-click (or low-click) solution that also optimizes for fees incurred along the way.

Over the next few weeks, I’m trying to better understand the size of the problem and current alternatives that exist for users like me. And if I find out that what I’m looking for doesn't already exist, I might have to build it.

In many cases, CEXs are superior to DEXs

A few days ago, Variant published this art piece to commemorate the launch of their newsletter. To mint the NFT on mainnet, I had two options:

  1. Convert some USDC from my MetaMask to ETH on a DEX, or

  2. Go to a CEX, buy some ETH using fiat and then transfer the tokens to MetaMask

To attempt the first option, I went to Uniswap. Per the quote, swapping 20 USDC for its equivalent in ETH was going to cost me nearly $10 in transaction fees. Since I couldn’t justify paying a 50% fee for an onchain swap, I considered the second option.

No thanks
No thanks

On Newton, I swapped fiat for ETH and paid ∼1% in transaction fees. Then, I sent the ETH to my MetaMask for free since Newton covers onchain transfer fees under $5. In cases like these where trading amounts are small, it is clearly cheaper to go from fiat to tokenB on a CEX and then transfer onchain, than to go from tokenA to tokenB on mainnet using a DEX like Uniswap.

So, why was it cheaper to go through a CEX? On Newton, the swap from CAD to ETH occurs offchain. Then, Newton simply takes some of the ETH it already holds onchain and transfers it to a user’s wallet. Whereas through Uniswap, the swap from USDC to ETH occurs on mainnet and therefore demands higher transaction fees.

I am looking for a “set it and forget it” onramp

So why does this all matter? In my last post, I outlined a problem that I think is worth solving. Right now, I can’t buy coins and self-custody them without clicking buttons and manually jumping through different apps. Not only that, but I am incurring fees almost every step of the way. Even if going the CEX route resulted in lower fees, both alternatives presented earlier still require manual effort.

I believe that if we want to see onchain adoption at scale, then there has to be a better way to effortlessly go from fiat to coins. And at this stage in my research, I think this will involve the creation of a “smarter” CEX that abstracts away everything going on in the backend.

To better understand the problems facing users as they convert fiat to tokens for their own self-custody, I need to revisit the notion of blockchain transaction fees. The rest of this post will explore these concepts in more detail.

Why do blockchains require fees?

Onchain transactions occur when a block containing the transaction data is generated and approved by the network of validators. Without transaction fees, blockchains would be subject to spam, since anyone would be able to crowd the network at no cost. At the same time, transaction fees are required to compensate validators. In short, transaction fees are what makes a blockchain an effective mechanism for incentive alignment.

Fees on the Bitcoin network

On the Bitcoin network, miners receive transaction fees for confirming transactions to a new block. Transaction fees fluctuate with demand for blockspace, since block sizes are limited to 1 MB or around 2000 transactions. Generally, transaction fees are directly proportional to the size of the transaction. In other words, more BTC transferred = more bytes = higher fees.

At the time of writing this, demand for blockspace is higher than the two-year average, with transaction fees costing around 84 satoshis per byte. There are 100M Satoshis in each unit of Bitcoin. In this case, if a Bitcoin transfer between two wallets requires 200 bytes of data, then 16,800 Satoshis would be required to compensate miners to include the transaction in the next block.

84 Sats per byte * 200 bytes = 16,800 Sats or 0.000168 BTC

Fees on the Ethereum network

While blocks on the Bitcoin network are limited in terms of space (bytes), blocks on the Ethereum network are limited in terms of computing power. This computing power is measured in units of gas, and each block has a target size of 15M gas with a cap at 30M.

Generally, the amount of gas required to process a specific type of transaction will remain the same, while the cost per unit of gas fluctuates with demand for blockspace. During periods of high demand, a unit of gas will simply cost more. Gas fees are often denoted in Gwei and they are paid to stakers for processing transactions. There are 1B Gwei in each unit of Ether.

Typically, ETH transfers between two wallets require the lowest amounts of gas, whereas ERC-20 transfers, approvals, and Uniswap trades all demand an increasing amount of gas. Here’s a dashboard with historical costs for each of these onchain actions.

Here’s a snapshot of the transfer between Newton and my wallet that I mentioned earlier. At the time when Newton had to transfer some mainnet Ether from their wallet to mine, the market gas price was 42 Gwei per unit of gas. Given that the total transaction fee was 0.00088 Ether or 880K Gwei, I can work out that it required nearly 21K units of gas, which cost $1.62 at the time.

42 Gwei per unit of gas * 21K units of gas = 880K Gwei or 0.00088 Ether

Takeaways

We need blockchain fees to incentivize validators and prevent spam. Since block sizes are finite, transactions will always be subject to fees that fluctuate with demand. For this reason, mainnet fees are generally too high to justify onchain swaps.

Since trades occur offchain, CEXs can offer better fees to users who don’t care about transacting directly on crypto networks. While CEXs are the only alternative to swap fiat for coins, swapping from tokenA to tokenB also tends to be cheaper on a CEX than a DEX. In cases like these, I think users will simply optimize for lower transaction costs.

As users, are we therefore stuck with the current UX provided by CEXs?

Will we always have to click buttons to swap our fiat into coins?

Will it ever be cheaper to transact onchain without manually jumping through bridges?

Might it be worth taking the best parts of a CEX, getting rid of the rest, and designing a no-click onramp?

These are some questions that I’ll be thinking about. 

In my next post or two, I’ll explore the following:

  • Blockchain scaling solutions: Layer 2’s and the Bitcoin Lightning Network

  • Gasless swaps

  • Stablecoin onramps offered to Canadians and Americans

More soon.

Subscribe to Jacob
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.