The $460,782 Mistake: How Blockmason’s Link Could Have Saved This Ethereum Developer 3,150 Ether
Have you ever lost almost half a million dollars in a few minutes? For some, the amount seems inconceivable. For others, perhaps an investment banker, it’s a rounding error. But, on February 19th, 2019, someone did just this. In four transactions, an unknown party ended up wasting 3,150 Ether in transaction fees. At today’s exchange rate, that amounts to more than $460,000 in wasted funds.
The question is: what happened? More importantly, how could this developer, exchange or other party avoid making this mistake? Let’s explore what exactly happened to result in these significant losses.
Understanding Ethereum Transaction or “Gas” Fees
Get Instant Updates
Before we can explore the mistakes made, it’s helpful to gain an understanding of how transaction fees work on the Ethereum blockchain. There are two components to Ethereum transaction fees: the “gas limit” and the “gas price.” (Note: Fueling your car is the simplest analogy for how these fees work, which is why they are referred to as “gas”.)
The “gas limit” is similar to the units of fuel you would use in your car, such as a gallon or liter depending on where you live. It’s a “limit” because it signals the maximum number of units of gas that you would be willing to spend for an Ethereum blockchain miner to process your transaction.
The “gas price” is the cost that you would pay for that unit of fuel. Adjusting your gas price up or down can impact when your transaction is processed. If you pay a high gas price, your transaction is more likely to be mined and processed to the blockchain faster. A low gas price may mean waiting for future blocks to be mined.
Putting those together, you can calculate your total Ethereum transaction fee as “gas limit” x “gas price.” According to ETH Gas Station, today’s “Standard” gas price is 5 gwei (one gwei is 0.000000001 Ether), and the “gas limit” is 21,000. Multiplied together, this is a transaction fee of 0.000063 ETH, which is about $0.009 in US dollars.
The fact that a developer can write a transaction to the Ethereum blockchain for such a low cost makes this massive $460,728 mistake that much more frustrating.
One Tiny Coding Mistake = 3,150 Wasted Ether
Now, let’s take a look at the four transactions that resulted in more than 3,000 wasted Ether in gas costs alone. As you can see from these four transactions that took place on February 19th, a total of 3,150 Ether was spent on transaction fees:
Did you notice that each transaction is divisible by 21? This is no coincidence. As we shared above, the gas limit typically used is 21,000. That’s one of the clues that this is a coding error made by a developer.
In each example, the total value of Ether transacted is the transaction fee multiplied by 21,000. These four transactions were likely intended to be transfers of Ether from one wallet to another. It’s possible that a mistake in the developer’s code instead multiplied the gas limit by the transaction value (rather than the gas price) and used that total as the transaction fee.
For example, the first transaction is to send 0.1 Ether but had a transaction fee of 2,100 Ether.
21000 (gas limit) * 0.1 Ether (transaction amount) = 2,100 Ether (the mistaken transaction fee)
Compare that with the likely intended transaction:
21000 (gas limit) * 0.000000005 Ether (gas price) = 0.000063 Ether (the proper transaction fee)
As you can see, a small calculation error in your code can result in significant losses!
The Solution: Use Blockmason Link
Allow us to be a bit self-serving in sharing that Link, our recent project, could have prevented this issue entirely. Link is our infrastructure-as-a-service that allows app, web and other software developers to use smart contracts and programmatic blockchains like Ethereum in their applications without requiring any blockchain experience.
Using Link, a developer can create classic, conventional web-based APIs for any smart contract written on a programmatic blockchain. Once a developer adds the smart contracts they want to use in their app to Link, they can read from and write to these smart contracts just like any other API.
As Link handles the calculation of Ethereum transaction fees, none of our users need to worry about mistakes like the ones shared above. A developer can run an application that writes to the Ethereum blockchain without ever needing to calculate gas or other costs.
If you’re a developer using Ethereum or other programmatic blockchains, you can learn more about Link here: https://blockmason.link.
In closing, note that from an outsider’s perspective, it’s impossible to know the real motives behind the massive overspending on transaction fees. Some Reddit users contemplated that it may be a miner or other party trying to launder stolen Ether. Others assume it was a “fat finger” error in entering the intended gas amounts or an errant line of software code. Whatever the case, it’s clear that losing almost half a million dollars worth of Ether due to an easily avoidable bug is a tragedy.
If you’re the developer who lost 3,150 Ether in fees, get in touch with us. We’d be happy to show you how Link works and how it can prevent these mistakes in the future!