How to Manage Transaction Costs on Public Blockchains

 By Sam Hartnett on April 1, 2019

NOTE: This blog post was originally published April 2019 and was updated July 2019.

 

“How much does a transaction cost?”

It’s a seemingly simple blockchain question, and one we’re frequently asked by companies building applications on the Energy Web Chain. And for good reason: margins in the energy sector are famously thin, and application developers and users alike need to be confident that blockchain solutions are cost-effective before adopting them at scale.

There’s no single, simple, straightforward answer. Transaction costs on public blockchains are highly situational and subject to change over time. Additionally, there are no transaction fees on the Energy Web’s Tobalaba test network, so concrete data for the Energy Web Chain (EWC) will not be available until the launch of the production network later this year. [The Energy Web Chain officially launched in June 2019. See the update at the bottom of this page for details on initial statistics.]

Yet by looking at the role of transaction fees in public blockchains more generally—and applying that understanding to historical data from Ethereum (the EWC is a public proof-of-authority network derived from the Ethereum technology stack)—we estimate that transaction fees on the Energy Web Chain are likely to be extremely low, and also exceptionally stable and predictable compared to other public blockchains. 

 

Three key variables influence transaction cost

A transaction is any ‘write’ operation that changes the state of the blockchain (i.e., adds data or modifies values). Transferring tokens between accounts, deploying new smart contracts or accounts, and modifying the state of existing smart contracts are all examples of transactions. Most importantly, all transactions are not created equal: some are more computationally intensive than others, some are more urgent, some require greater degrees of privacy. As we’ll soon see, these differences from one transaction to the next can have an impact on ultimate transaction cost.

Three key variables influence transaction cost: 

  1. Gas cost: A transaction’s computational complexity is measured in gas, a unit that assigns a numeric value to each operational code, or instruction, that will be executed to complete the transaction. This is basically a fixed, a la carte menu of required gas to run a given transaction. The gas cost of a transaction is thus determined by the amount and sophistication of code that needs to be executed as well as the amount and type of data that will be stored on the blockchain as a result. The more complex the transaction, the higher the gas cost.

  2. Gas price: The total gas cost of a transaction is only part of the equation, however. Gas is an abstract value. To derive a concrete fee requires a gas price as well. Every user that initiates a transaction chooses a gas price they are willing to pay for that particular transaction, at that particular time. Users that want to have their transaction expedited, for example, might bid a higher gas price to ensure that it’s included as soon as possible in the next available block. Gas price is denominated in the native token or cryptocurrency (usually in miniscule units like gwei, which represent one billionth of an ether) of a public blockchain and is expressed in tokens per unit of gas.

  3. Token value: Finally, token value—usually expressed in a fiat currency equivalent—translates virtual transaction cost into ‘real’ transaction cost. And when token value varies widely, perhaps due to token market volatility, resulting transaction costs can vary too.

Calculating a given transaction’s cost thus looks like the equation:

 

Tx Cost (unit: fiat $) = 

Gas Cost (unit: gas) x Gas Price Bid (unit: token/gas) x Token Value ($/token)

 

Here’s how a fee would be calculated for a hypothetical transaction on Ethereum: 

50,000 gas x 10 gwei per gas = 500,000 gwei = 0.0005 ether

At an approximate value of $120 USD per ether, this would result in a transaction fee of $0.06. (Ether’s USD value over the past year has ranged from a low of ~$85 to a high of ~$800, resulting in a cost range of $0.04 to $0.40 for running the same transaction—assuming you otherwise hold gas price bids constant. In practice, users submitting a transaction to a blockchain typically calibrate their gas price bid relative to the token value at the time of the transaction.)

 

How to keep public blockchain transaction costs low

Those same three variables that define transaction cost also present opportunities to manage those costs and keep them low. For example:

 

–Lean smart contracts can help keep gas costs down: App developers and other smart contract writers are incentivized to write lean, efficient code—writing smart contracts and initiating transactions that are as computationally efficient as possible.

–Gas price bids should remain low on networks with high transaction capacity: Of the three variables that contribute to transaction costs, gas prices are arguably the most powerful lever, since the bidded prices are solely at the discretion of the user submitting a transaction to the network. For reasons we’ll explore below, in the absence of sustained block “congestion,” gas prices can remain low and stable.

–“Just in time” gas price calculations mitigate some risks of token value volatility: For a variety of reasons, some token markets are more volatile than others. But just because a token’s value relative to a fiat currency changes, it doesn’t mean that transaction fees similarly change without warning. Users calibrate gas price bids at the time of the transaction, and thus will bid a denomination of tokens relative to the token’s value at the time. While it is possible that a past transaction fee could end up being significantly more or less expensive relative to current (or future) token value, transaction fees at the time they are incurred should remain relatively stable as a function of fiat currency.

 

If users desire a low-cost network, why do transaction costs rise in the first place?

So why would anyone bid a high price for any transaction? Shouldn’t transaction fees remain very low, as rational users consistently attempt to minimize their costs? In reality, transaction fees vary precisely because of competition among users to get transactions confirmed. 

At any given moment there may be hundreds or thousands of transactions waiting to be confirmed and formally added to the blockchain. These pending transactions sit in a memory pool, or mempool, where they are ultimately selected by validators (miners in the case of proof-of-work blockchains) to be included in a block. But each block has a finite gas limit, meaning not all transactions can be confirmed at once. As a result, validators will typically give preference to the most-lucrative (or expensive, depending on perspective) transactions in the mempool. Transactions with lower fees may end up having to wait for their transaction to get confirmed. 

Ultimately, fees are about transaction prioritization. The higher the gas price you pay, the faster your transaction will be confirmed. If you don’t care about the amount of time it takes to confirm your transaction, you can offer a very low (or no) gas price. However, with this strategy you run the risk that your transaction never gets confirmed, and just sits in the mempool queue indefinitely. 

 

Lessons from what we know about Ethereum

At the most basic level, transaction fees on Ethereum are determined as a function of supply (e.g., computational capacity of the network, as defined by the combination block gas limit and block time speed) and demand (i.e., number of pending transactions). Volatility comes into the equation because supply, namely block time and block gas limit, is essentially fixed, whereas demand fluctuates wildly due to number of users and the popularity of certain applications. Occasionally, transaction fee trends diverge from transaction volume, but generally the two are correlated. 

Looking at historical data, it’s fair to say that transaction fees are usually relatively modest (a few cents, or fractions of a cent) but occasionally highly volatile (up to $5 or more on a daily basis, up to thousands of dollars in isolated periods). Though the historical median transaction fee is roughly $0.05, for a developer looking to launch a mass-market application, knowing that transaction costs are “probably low, but potentially exorbitant” is unsatisfying at best. 

Going forward, increasing throughput capacity through various mechanisms promises to mitigate fee volatility and potentially lower fees more generally. But until scaling solutions are implemented, the risk remains. 

 

What we know about the Energy Web Chain: reasons for confidence in low tx costs

The EW Chain’s proof-of-authority consensus mechanism currently enables roughly 3 times greater throughput capacity than the Ethereum main net thanks to faster block time. In the future, the EW Chain can potentially enable up to 7.5 times greater throughput capacity vs. Ethereum thanks to a higher gas limit. 

[That’s because of a difference between the EW Chain gas limit at launch in June 2019 compared to its theoretical upper limit. Upon launching the production chain in June 2019, EWF and the initial set of EW Chain validators started with a block gas limit of 8 million based on the results of performance testing on the Energy Web’s Volta test network. However, based on current technology in theory that block gas limit could eventually be increased to approximately 20 million.

EWF will work with validators to increase the block gas limit on demand as transaction volume increases over time, but as of July 2019 the current parameters are more than sufficient to accommodate the existing applications running on the chain. For current statistics please see the EW Chain block explorer.]

 

 

Ethereum

Energy Web Chain
(July 2019)

Energy Web Chain
(Technical Limit)

Block Time

~15 seconds

~5 seconds

~5 seconds

Block Gas Limit

~8,000,000

8,000,000

20,000,000

15-Second Gas Capacity

~8,000,000

24,000,000

60,000,000

Daily Gas Limit

~ 46.1 billion

138.25 billion

345.6 billion

 

While there have been isolated periods of congestion on Ethereum, over the course of a day Ethereum has never reached 100% utilization of daily gas limit (in fact, the latest data suggest that utilization remains around 90%). Sustained congestion on the Energy Web Chain would thus require unprecedented adoption and utilization (e.g., hundreds of millions of addresses performing multiple transactions per day each). 

Based on what we know about current projects in the EWF ecosystem—and even with aggressive adoption assumptions—we do not get anywhere close to hitting the capacity limit in the foreseeable future with our existing technology. If/when EWF or others in the energy blockchain ecosystem apply solutions like state channels and parachains, this will further mitigate the risk of block congestion, and in turn, thus mitigate transaction cost volatility.

 

The other side of the (crypto) coin: tx fees to cover block creation costs

Until this point in the article, we’ve primarily focused on public blockchain transaction costs from the user’s perspective. But let’s take a look from the block validator perspective. Because from a validator standpoint, transaction fees serve the important purpose of offsetting the costs of maintaining a validator node on the network. While these costs are not large for Energy Web Chain validators, they are real and must be taken into account.

The cost of creating blocks is exponentially lower on the Energy Web Chain vs. Ethereum. Proof-of-authority is much less energy intensive, and validator nodes can run on simple computing hardware. We estimate that it costs roughly $4,000–$6,000 USD per year to run an Energy Web validator node (inclusive of hardware, electricity, and labor). In contrast, the average Ethereum miner incurs millions of dollars in expenses (i.e., mining hardware and electricity costs). 

Based on projected validator costs and the EWC block time, the marginal cost of block creation (i.e., the sum of annual validator costs divided by number of blocks per year) will be roughly $0.10 USD. Keep in mind, this is block creation cost, and each block of course contains many transactions. We estimate block creation costs approximately $1,000 on Ethereum. Even before we consider block validation awards, the sum of all transaction fees in a given block must only be a few cents in order to more than cover the marginal cost of block creation on the Energy Web. 

In production we eventually expect hundreds, perhaps thousands, of transactions per block, which implies a per-transaction fee of a few hundredths or thousandths of a cent. In other words, the Energy Web Chain should deliver on its promise of very low transaction costs for users, while covering block creation costs for validators and overall unlocking billions of dollars in value for the energy sector.

In an industry such as energy, where many margins are notoriously thin and many utilities have regulated returns / revenues, exorbitant transaction fees are incompatible with blockchain’s promise as a low-cost solution that unlocks billions of dollars of real-world value in a digitalized, decentralized electricity future. Fortunately, the EWC is on a pathway we believe will deliver on low transaction costs that elegantly support the energy transition.

 

UPDATE: July 2019. Following the successful launch of the EW Chain in June 2019, we have initial data on transaction fees. To date, the upper boundary of fees is approximately 0.015 EW Tokens (EWT) and the vast majority of fees range from ten-thousandths to billionths of a EWT (i.e., 0.0001 to 0.000000001 EWT). To view live statistics and/or query information from the EW Chain, visit the transactions history on the EW block explorer and the associated EWF Wiki page.

 

Sam Hartnett is the research and market development manager at EWF.

 

The Energy Web is an open-source, scalable blockchain platform specifically designed for the energy sector’s regulatory, operational, and market needs.

Latest Tweets

#energyblockchain paves the way to the #futureofenergy

EWF is proud to be working with this innovative company on the future of ... connected #electricmobility.

Corporations doing business in #ASEAN are looking for better ways to ... source/verify #renewableenergy to decarbonize supply chains & meet #sustainabilitygoals. The newly announced @PTTNews Renewables Marketplace Platform is their answer. #EnergyBlockchain https://t.co/oKCndw03fH

REAL #energyblockchain applications are bringing us closer to a #decarbonized ... future.
#EnergyWeb

With the help of our Affiliate members, we're continuing to prove that ... #energyblockchainishere. See what @Cointelegraph has to say about our latest project—a renewable energy marketplace—with @PTTNews, the nat'l utility of Thailand. #EnergyWeb #EWOrigin
https://t.co/YsIrRrjHKD

Subscribe to our email newsletter today to receive updates on the latest news and blockchain technology.

linkedin-squaretwitteryoutube-playpaper-planefacebook-official