Harmony (ONE) is one of the latest projects that is trying to tackle the issue of blockchain scalability. They have built their platform from the ground up with optimisation in mind.
Using a “full-stack” approach, Harmony is developing a sharding based blockchain that is not only scalable but provably secure, and energy efficient. They are also the latest project to be raising funds on the Binance Launchpad. This after completing a large private seed sale back in May of 2018.
So, should you consider it?
In this Harmony review I will give you everything you need to know to make that decision. I will dig into their technology, team and development. I will also analyse the long term adoption potential of their ONE token.
What is Harmony?
Harmony provides a high-throughput, low-latency and low-fee consensus platform designed to power the decentralized economy of the future. They plan to address the issues faced in other blockchain ecosystems through the use of the best research and engineering practices in an optimally tuned system.
The technical focus of the project is on resharding and secure staking with decentralized randomness. Harmony also implements optimal cross-shard routing and fast block propagation.
In practice, Harmony helps businesses to build marketplaces for fungible token usage (such as loyalty points or energy credits) and non-fungible assets (such as in-game digital assets). Harmony also uses its zero-knowledge proofs to enable data sharing with consumer privacy. Benefits of the Harmony Protocol. Image via Harmony.one
This incentivizes users and could be used for credit ratings, ad exchanges, and other data sharing that’s traditionally seen centralized platforms profiting and users being left with nothing.
After launching its mainnet in June 2019 Harmony has seen excellent growth, and as of June 2020 there are more than 1,000 nodes helping to decentralize the network. The project has also been able to migrate from the ERC-20 and BEP-2 tokens originally issued to its own native tokens.
Finally, the project has implemented a staking system based on Effective Proof of Stake (EPoS). It’s been a busy year at Harmony, so let’s dig in and explore some of the details of the progress being made.
The Harmony Technology Stack
In order to achieve the goals of scalability the Harmony built the entire technology stack from the ground up with a focus on optimisation. They have built in a number of important innovations into their Consensus Protocol, internal systems and network engineering.
By implementing these innovations, Harmony will provide a platform for Decentralised Applications (dApps) which were not feasible on other blockchains. These include dApps such as decentralised exchanges, high-throughput payment systems and Internet-of-Things transactions.
Consensus Protocol
Blockchains are goverened by consensus and the type of protocol used can drastically impact on the speed with which decentralised consensus is achieved. Currently, blockchains such as Bitcoin’s, use Proof-of-Work consensus protocols which have become inherently expensive and slow.
Other protocols such as Proof-of-Stake use different incentive mechanisms that overcome some of these challenges. Indeed the Ethereum protocol is trying to move to their Casper PoS consensus to address their scalability issues. However, PoS has its own unique challenges. Network Communication in a round of Consensus. Source: Whitepaper
The Harmony consensus protocol, which they call Effective Proof of Stake, uses the latest design principles such as sharding and pipelining. This allows the network to process numerous different transactions in parallel. This means that there is no single bottleneck to the confirmations for all of the transactions.
Essentially, with the Harmony approach, connection latency is greatly reduced and the transaction throughput can scale as the network grows.
Network Infrastructure
Harmony is implementing networking techniques that can improve the speed of message propagation and achieve consensus faster. As stated in their whitepaper, Harmony uses RaptorQ fountain code which allows the network to propagate blocks quickly or within shards. Not only does Harmony shard its network nodes, it also shards blockchain states, which allows for linear scaling in all three aspects of storage, transactions, and machines.
They also adopt Kademlia routing which is able to achieve these cross-shard transactions which can scale logarithmically with the number of shards in the network. This entire implementation allows Harmony to run a highly concurrent protocol.
The infrastructure has also been decentralized to avoid single shard attacks. Eventually the network is built to contain shards of 1,000 nodes in order to provide cryptographic randomness and to re-shard regularly, however currently Harmony is using four shards of 250 nodes each.
This gives the network a strong security against Byzantine behaviors. In addition the network uses a Verifiable Random Function for unpredictable and unbiased shard membership.
The ONE Token Ecosystem
The Harmony platform is powered by the native ONE token, which allows users to participate in the ecosystem and serves as a payment mechanism for various actions. By using the Harmony blockchain developers and businesses are able to create alignment in the goals and incentives of various stakeholders.
In addition, the upcoming zero-knowledge proof implementation will make Harmony a data sharing platform that is capable of overcoming the common problem of many data markets; that is the mistrust that participants have for sharing data, even as they have a strong desire to acquire the data of others. “Open Consensus for 10 billion people”. Image via Harmony
The Harmony ONE token is designed to have the following three functions within the protocol:
The token is used as a stake for the EPoS consensus model, allowing staking holders to earn block rewards and transaction fees.
The token will pay for transaction fees, gas fees and storage fees.
The token will be used in the governance of the protocol by allowing token holders voting rights for on-chain governance.
In January 2020 Harmony kicked off the migration of the ONE token from the Ethereum and Biannce chains to its own blockchain. This was needed to realize the plans for staking and on-chain governance. Users are required to swap their ERC-20 (Ethereum) and BEP-2 (Binance) tokens for native ONE tokens if they wish to participate in staking, governance or any other network activities.
As of June 2020 the harmony team has not announced a deadline for the swap to the native ONE coins. Holders should know there is no way to manually swap the tokens to mainnet coins. The process is done automatically on any exchange that is participating with a bridge to Harmony.
That includes BitMax, Binance, KuCoin, Gate.io and the staking service HonestMining. To make the swap simply deposit any ERC-20 or BEP-2 ONE tokens on a participating exchange and when withdrawn the native ONE tokens will be delivered.
Staking Harmony ONE Token
Harmony made history on May 16, 2020 when it launched staking, making it the very first sharded blockchain to offer staking. According to the Harmony team staking was necessary in order to create trust for network participants without knowing them.
This will allow for much greater decentralization as it opens up the protocol to the public. Now that staking has been made available 320 of the 1,000 nodes are being run by the public rather than by Harmony or one of its trusted partners. List of Some of the Validators Staking Harmony. Image via Harmony
Staking launched with 16 staking partners who can be used by anyone to easily stake coins. These partners include Staked, Stake.fish, Blockdaemon, Everstake, and InfStones among others. Several exchanges also provide staking, such as BitMax and Binance. The current reward for staking is just north of 10%, although any of the staking services will keep a small portion. You can see a full list of current staking services here.
It isn’t required to use a staking service though, and the Harmony team encourages standalone staking because of the decentralization benefits. Running a validator requires 10,000 ONE tokens (currently worth $43) as well as a computer with a minimum of two cores, 2GB of memory, and 30GB of storage.
However due to the current limit of 320 public nodes the actual minimum required to run a node is roughly $20,000 worth of ONE tokens. Eventually there will be slots for 1,000 public validators.
The Harmony Team
The team behind Harmony is combined of experts in building lasting companies, engineering, and academic research. They come from the likes of Google, Amazon, Apple, Microsoft and a number of successful startups. And they’ve worked on some of the largest systems in the world such as the AWS infrastructure, Apple’s Siri, and Google Maps.
While the team remains small, with just 20 full-time members and an additional 4 collaborators, they bring to the table experience in software development, machine learning, artificial intelligence, virtual reality, and blockchain technology.
The CEO and leader of the team is Stephen Tse, an avid coder who has spent his life studying and working on compilers and security protocols. He graduated with a doctoral degree in security protocols and compiler verification from the University of Pennsylvania. Some of the Harmony Team members
He then went on as a researcher at Microsoft Research, a senior infrastructure engineer at Google, and a principal engineer for search ranking at Apple. Later he founded the mobile search Spotsetter with institutional venture capital; Apple later acquired the startup.
There are four additional co-founders, most of whom are artificial intelligence experts, and one who is a Harvard MBA.
The Harmony team completed a private seed sale of tokens back in May of 2018. In this sale, they were able to raise about $18m in exchange for 22.4% of the total token supply (price of c. $0.0065). There were a number of blockchain focused VC funds that took part in this. The full list can be seen on the Harmony website.
The Harmony Community
Harmony has pursued a blend of offline and online community building. Since 2017 the Harmony team has held a weekly 4-hour meetup in San Francisco to increase interest in the project and to increase its community of partners.
The online community building has led to a smallish group, but one that appears to be extremely well engaged and excited about the potential for the Harmony protocol. For example, the Harmony subreddit has just 1,300 readers, but there are multiple daily posts and a number of comments on each post. The subreddit has only been in existence for 3 months.
Other social media accounts are equally small, but with equally engaged communities. The Twitter account has just over 6,000 followers, but an outsized number of shares and comments on its tweets. The Telegram channel is the largest community, with over 11,700 members.
Overall the Harmony community is a positive and encouraging sign. It may be small, but the members are very engaged and excited about the possibilities of the protocol.
The ONE Token
As noted above the ERC-20 and BEP-2 ONE tokens have been deprecated and the official coin is now the native ONE coin. Users holding the Ethereum or Binance chain versions can easily swap them by depositing them at an exchange that has a bridge to Harmony, such as Binance, Gate.io, BitMax, and others. Once deposited the deprecated tokens are automatically converted to native ONE tokens. Register at Binance and Swap ERC-20/BEP-2 Tokens for Native ONE Coins
As a staking token ONE is expected to gain in value, and in fact it has doubled since hitting a mid-April low of $0.002109. The real gains began after Harmony announced staking, with the token jumping from a value of $0.002684 before the announcement of live staking, to $0.004310 just one month later. It should be noted that this is slightly below the $0.004730 value of ONE on January 1, 2020 but the upward momentum is promising.
As far as storing your ONE tokens, the Ledger is your best choice. There’s no native staking wallet yet for ONE, but it is in development. In the meantime the multi-currency Guarda, Trust Wallet, and math Wallet all support storing ONE coins.
Harmony Development & Roadmap
The Harmony project has been working on their protocol for over two years already and has made significant progress. Determining exactly how much work has been done can sometimes be tough. However, one of the best estimates is to take a look at the coding activity in their public repositories.
Hence, I decided to jump into the Harmony Protocol GitHub to check out what the developers have been pushing since the project launch. Below are the code commits for three of their most active pinned repos. Code commits to select repositories over past 12 months
As you can see, there has been quite a lot of activity and commits to these repos over the past year. It is also worth noting that there are another 16 repositories in their GitHub – some of which that also have significant activity. There may also be other work that is taking place in private repos that have not being published yet.
This is indeed quite encouraging and is a far departure from the previous ICO status quo. Projects would raise millions of dollars with nothing more than a whitepaper. In fact, the level of development that I see here is more than I have seen with other projects which ICOed 1-2 years ago.
All of this development does make sense when you take a look at the milestones the team has met over the past year. There is also much more to look forward to in their roadmap for the rest of 2020:
Q1 & Q2 2020: Open staking implemented, EPoS mechanism added, token swap to native ONE token implemented, stablecoins added, and HRC-721 added for branded assets. SEED becomes the very first HRC-721 token, and Harmony becomes the very first sharded blockchain to implement staking.
Q3 2020: Improvement to 3-second finality, and the addition of DeFi middlewares. Creation of staking wallet and an Ethereum bridge, as well as global fiat gateways.
Q4 2020: Auditable privacy and cross-border finance. 100% decentralized nodes and community governance.
If you would like to keep up to date with the latest from the developments from the project then you can always head on over to their official blog.
Conclusion
Given the active community behind the Harmony project it should come as no surprise that the project has been seeing increased adoption and a rise in the price of its token now that ONE is both native and Harmony is an EPoS blockchain that rewards those holding ONE tokens.
The project was able to launch its mainnet in June 2019, which is just over a year after beginning development. And despite the rapid evolution of the project it has held up well, showing the strength of its design. The token suffered alongside the entire cryptocurrency markets through 2018 and 2019, but has been coming on strongly in 2020 as demand for the token and the blockchain is seen to be increasing.
The team behind Harmony is a strong one, with a great deal of expertise in many areas that are useful for this type of project. So far the team has been able to hit its roadmap deadlines, and that’s a big positive.
The days where investors were willing to forgive late commits has passed, and these blockchain projects need to deliver what they said when they said it will be ready. Harmony has been able to do this successfully.
The largest threat to the project at this point is competition. Harmony will need to remain ahead of existing competitors such as Zilliqa (ZIL) as well as keeping ahead of any potential future competitors. So far it seems to be doing that easily, taking advantage of the rapid development cycles to add new functionality and improved scalability and speed.
Terra is a proof of stake blockchain created for price-stable cryptocurrencies with a focus on payments and commerce.
How it works
Terra uses PoS Tendermint BFT consensus.
dPoS-like scheme driven by a set of 100 top validators.
Blocks every 6 seconds.
Miners need to stake LUNA to mine Terra transactions.
At every block period, the protocol elects a block producer from the set of staked miners, weighted by the size of the active miner’s Luna stake.
Terra stable currencies
Pegged to USD, EUR, CNY, JPY, GBP, KRW, and the IMF SDR.
Users can convert TerraKRW for TerraUSD instantly at the effective KRW/USD exchange rate.
Oracle price feeds
For any Terra sub-currency – TerraKRW, TerraUSD, TerraSDR – miners submit a vote for what they believe to be the current exchange rate in the target fiat asset.
Taking the weighted medians as the true rates.
Those who voted 1 standard deviation of the elected median are rewarded. Those who voted outside may be punished via slashing of their stakes.
Price stability
The system uses Luna to stabilize the price of Terra currencies by agreeing to be counter-party to anyone looking to swap Terra and Luna at Terra’s target exchange rate.
Price < 1 SDR, users and arbitragers can send 1 TerraSDR to the system and receive 1 SDR’s worth of Luna.
Price > 1 SDR, users and arbitragers can send 1 SDR’s worth of Luna to the system and receive 1 TerraSDR.
LUNA supply
Volatility is moved from Terra price to Luna supply.
This Luna dilution presents a problem for miners; their Luna stakes are worth a smaller portion of total available mining power post-contraction.
The system burns a portion of the Luna supply until it has reached its 1 billion equilibrium.
Miner rewards
Transactions fees default to 0.1% and are capped at 1%.
When demand for Terra increases, the system mints Terra and earns Luna in return. This is called seignorage.
Miners voting within the median for price feeds of price earn rewards from the seignorage.
The system burns a portion of earned Luna, making mining power scarcer.
Gas 中译是:瓦斯、汽油,代表一种可燃气体。 这形象地比喻以太坊的交易手续费计算模式,不同于比特币中直接支付比特币作为转账手续费, 以太坊视为一个去中心化的计算网络,当你发送Token、执行合约、转移以太币或者在此区块上干其他的时候,计算机在处理这笔交易时需要进行计算消耗网络资源,这样你必须支付燃油费购买燃料才能让计算机为你工作。最终燃料费作为手续费支付给矿工。
Decentraland is an Ethereum-powered virtual reality platform. In this virtual world, you purchase plots of land that you can later traverse, build upon, and monetize. There’s no limit to what you can do. It’s the first digital platform that’s completely owned by its users.
In this Decentraland beginner’s guide, we’ll dig into:
Similar to games like Skyrim and Fallout, Decentraland is an all-immersive virtual universe. However, instead of playing on a two-dimensional screen, you participate in a three-dimensional world. It seems to be the logical next step before creating full-blown AI-based games in the physical space, à la Westworld.
What Is LAND?
In Decentraland, the spaces that you interact with are LAND, non-fungible digital assets that you purchase in the game. Once you own a plot of LAND, you’re free to do with it as you choose. You can create games, applications, gambling services, or even dynamic 3D scenes. But, why stop there? Although not its primary purpose, you can also create LAND-based services around education, professional development, tourism, etc.
The number of LAND is capped, and each plot of LAND is 33 feet by 33 feet, but there’s no limit to its height. Recently Decentraland created LAND Estates, a feature that allows you to more easily manage your LAND by associating adjacent plots. If you’re interested in purchasing LAND (or just want to see the map), you should check out the LAND marketplace.
Similar groupings on LAND comprise Districts. Districts are basically communities that revolve around a shared theme. For example, there may be a District just for crypto enthusiasts with cryptocurrency apps and services. You can vote on District issues through Decentraland’s voting dApp, Agora. The amount of LAND you hold in a specific district correlates to the weight of your vote. Decentraland created Agora to give you more control over what happens in your districts, and to provide feedback on the platform at large.
What Is MANA?
MANA is Decentraland’s cryptocurrency token. It’s an ERC20 token that you use to purchase plots of LAND as well as pay for in-world goods and services.
When you buy LAND, Decentraland burns the MANA that you purchase it with. The Decentraland team originally sold each plot of LAND for 1000 MANA. Now that there’s a secondary market, though, the LAND prices vary. Currently, the cheapest plot of LAND is 11,750 MANA while more popular areas have price tags in the millions. The highest selling plot went for 2,000,000 MANA, or $175,578, in March 2018. This was quite a bit of money for a virtual plot of land and left the seller with a nice profit.
Consensus layer: Tracks land ownership and land content through an Ethereum smart contract.
Land content layer: Uses a decentralized distribution system to render the content in the virtual world.
Real-time layer: Provides peer-to-peer connections for users to interact with one another.
The team is building the virtual reality platform using A-Frame. To build in the world, you can first create a model in SketchUp and/or Blender, and then import it onto the platform.
Decentraland Team & Progress
The Decentraland team is led by Ari Meilich (Project Lead) and Esteban Ordano (Tech Lead). Ordano previously worked at Bitpay as a software engineer and founded Smart Contract Solutions, Inc. Both founders have also worked together in creating Stremium and Bitcore.
Decentraland has been around for longer than you may think. The team hit their first development milestone, Stone Age, in June 2015. This was a simple, pixelated grid that allocated pixels to users through a proof-of-work algorithm. Most recently, they held a Terraform Event in which they sold LAND in the new, 3D world.https://267db645734dd440dbc53370a2db3c85.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.htmlThe team has also partnered with district0x, Aragon, and imToken to provide some of their services.
Decentraland is fairly unique in the blockchain world with no large, direct competitors. High Fidelity and Sansar both provide spaces to create and sell virtual reality experiences, but they aren’t blockchain based. MARK.SPACE seems to be the most similar project; however, it’s far behind Decentraland in both development and notoriety.
Trading
The MANA price was relatively stagnant until the December/early-January market explosion. Since then, the coin has done relatively well compared to the rest of the altcoin market, maintaining about 75% of its Bitcoin value in the subsequent downturn.
MANA hit its all time high in January 2018 at $0.26, hitting two more peaks in May and July, $0.18 and $0.14 respectively. Since July 2018 MANA has continued to fall, reflecting the trends of the crypto markets.https://267db645734dd440dbc53370a2db3c85.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html
Because the only use for MANA, right now, is to purchase LAND, it’s hard to predict what will affect the price. An increase in demand for LAND may only lead to a rise in the amount of MANA you need to purchase some – not a rise in the MANA value itself. The MANA price should increase, though, as you become able to buy more things with it.
Where to Buy MANA
You can purchase MANA on most major exchanges with either Bitcoin or Ethereum. Binance and OKEx have the largest trading volume of the exchanges.
MANA is an ERC20 token, so there are numerous wallet options for you to choose from. We recommend using a hardware wallet like the Trezor or Ledger Nano S. These keep your funds offline and are less susceptible to malicious software.
MyEtherWallet is another popular option if you’re not looking to spend the money on a hardware wallet.
Conclusion
Decentraland is a virtual reality platform that you can purchase land on. Tapping into the imagination of gamers and entrepreneurs everywhere, you’re able to do whatever you want with the land that you purchase.
This is a unique project in a largely untested market. The popularity of “alternative life” games is a good sign, but it’s hard to tell if this will carry over into the 3D and blockchain space. However, if Decentraland gains the adoption that its supporters hope it will, then we may just see an entirely new ecosystem of businesses and experiences flourish before our eyes.
Ethereum Gas is a unit that measures the amount of computational effort that it will take to execute certain operations.
Every single operation that takes part in Ethereum, be it a transaction or smart contract execution requires some amount of gas.
Miners get paid an amount in Ether which is equivalent to the total amount of gas it took them to execute a complete operation.
Ethereum Gas – is the lifeblood of the Ethereum ecosystem, there is no other way of putting that. Gas is a unit that measures the amount of computational effort that it will take to execute certain operations.
Every single operation that takes part in Ethereum, be it a simple transaction, or a smart contract, or even an ICO takes some amount of gas. Gas is what is used to calculate the amount of fees that need to be paid to the network in order to execute an operation.
In this guide, we are going to understand how gas works. But before we do so, there are several concepts that we must learn. So, without further ado, let’s begin our deep dive on Ethereum Gas.
What is Ethereum Gas: Step-By-Step Guide
Why is gas not needed in Bitcoin?
Bitcoin was created because everyone was asking the same questions.
Will it be possible to create a form of money which can be transferred between two people without any middleman?
Will it be possible to create a decentralized money which can function on something like the blockchain?
Satoshi Nakamoto answered these questions when he created bitcoin. We finally had a decentralized monetary system which can transfer money from one person to another.
However, there was a problem with bitcoin which is a problem with all first-generation blockchains. They only allowed for monetary transactions, there was no way to add conditions to those transactions.
Alice can send Bob 5 BTC, but she couldn’t impose conditions on those transactions. Eg. She couldn’t tell Bob that he will get the money only if he performed certain tasks.
These conditions would need extremely complicated scripting. Something was required to make the process more seamless.
…And that “something” was a smart contract.
What is a smart contract?
Smart contracts help you exchange money, property, shares, or anything of value in a transparent, conflict-free way while avoiding the services of a middleman.
Vitalik Buterin’s Ethereum is easily the stalwart of this generation. They showed the world how the blockchain can evolve from a simple payment mechanism to something far more meaningful and powerful.
So, what are these “smart contracts” and what’s the big deal?
Smart contracts are automated contracts. They are self-executing with specific instructions written in its code which get executed when certain conditions are made.
Smart contracts are how things get done in the Ethereum ecosystem. When someone wants to get a particular task done in Ethereum they initiate a smart contract with one or more people.
Smart contracts are a series of instructions, written using the programming language “solidity”, which works on the basis of the IFTTT logic aka the IF-THIS-THEN-THAT logic. Basically, if the first set of instructions are done then execute the next function and after that the next and keep on repeating until you reach the end of the contract.
The best way to understand that is by imagining a vending machine. Each and every step that you take acts like a trigger for the next step to execute itself. It is kinda like the domino effect. So, let’s examine the steps that you will take while interacting with the vending machine:
Step 1: You give the vending machine some money.
Step 2: You punch in the button corresponding to the item that you want.
Step 3: The item comes out and you collect it.
Now look at all those steps and think about it. Will any of the steps work if the previous one wasn’t executed? Each and every one of those steps is directly related to the previous step. There is one more factor to think about, and it is an integral part of smart contracts. You see, in your entire interaction with the vending machine, you (the requestor) were solely working with the machine (the provider). There were absolutely no third parties involved.
So, now how would this transaction have looked like if it happened in the Ethereum network?
Suppose you just bought something from a vending machine in the Ethereum network, how will the steps look like then?
Step 1: You give the vending machine some money and this gets recorded by all the nodes in the Ethereum network and the transaction gets updated in the ledger.
Step 2: You punch in the button corresponding to the item that you want and record of that gets updated in the Ethereum network and ledger.
Step 3: The item comes out and you collect it and this gets recorded by all the nodes and the ledger.
Every transaction that you do through the smart contracts will get recorded and updated by the network. What this does is that it keeps everyone involved with the contract accountable for their actions. It takes away human malice by making every action taken visible to the entire network
What is the Ethereum Virtual Machine?
Before we understand what the Ethereum Virtual Machine (EVM) is, we must understand why a “Virtual Machine” is needed.
So let’s go back to smart contracts.
What are the desirable properties that we want in our smart contract?
Anything that runs on a blockchain needs to be immutable and must have the ability to run through multiple nodes without compromising on its integrity. As a result of which, smart contract functionality needs to be three things:
Deterministic.
Terminable.
Isolated.
Feature #1: Deterministic
A program is deterministic if it gives the same output to a given input every single time. Eg. If 3+1 = 4 then 3+1 will ALWAYS be 4 (assuming the same base). So when a program gives the same output to the same set of inputs in different computers, the program is called deterministic.
There are various moments when a program can act in an un-deterministic manner:
Calling un-deterministic system functions: When a programmer calls an un-deterministic function in their program.
Un-deterministic data resources: If a program acquires data during runtime and that data source is un-deterministic then the program becomes un-deterministic. Eg. Suppose a program that acquires the top 10 google searches of a particular query. The list may keep changing.
Dynamic Calls: When a program calls the second program it is called dynamic calling. Since the call target is determined only during execution, it is un-deterministic in nature.
Feature #2: Terminable
In mathematical logic, we have an error called “halting problem”. Basically, it states that there is an inability to know whether or not a given program can execute its function in a time limit. In 1936, Alan Turing deduced, using Cantor’s Diagonal Problem, that there is no way to know whether a given program can finish in a time limit or not.
This is obviously a problem with smart contracts because, contracts by definition, must be capable of termination in a given time limit. There are some measures taken to ensure that there is a way to externally “kill” the contract and to not enter into an endless loop which will drain resources:
Turing Incompleteness: A Turing Incomplete blockchain will have limited functionality and not be capable of making jumps and/or loops. Hence they can’t enter an endless loop.
Step and Fee Meter: A program can simply keep track of the number “steps” it has taken, i.e. the number of instructions it has executed, and then terminate once a particular step count has been executed. Another method is the Fee meter. Here the contracts are executed with a pre-paid fee. Every instruction execution requires a particular amount of fee. If the fee spent exceeds the pre-paid fee then the contract is terminated.
Timer: Here a pre-determined timer is kept. If the contract execution exceeds the time-limit then it is externally aborted.
Feature #3: Isolated
In a blockchain, anyone and everyone can upload a smart contract. However, because of this the contracts may, knowingly and unknowingly contain virus and bugs.
If the contract is not isolated, this may hamper the whole system. Hence, it is critical for a contract to be kept isolated in a sandbox to save the entire ecosystem from any negative effects.
Now that we have seen these features, it is important to know how they are executed. Usually, the smart contracts are run using one of the two systems:
Virtual Machines: Ethereum uses this.
Docker: Fabric uses this.
Let’s compare these two and determine which makes for a better ecosystem. For simplicity’s sake, we are going to compare Ethereum (Virtual Machine) to Fabric (Docker).
So, as can be seen, Virtual Machines provide better Deterministic, terminable and isolated environment for the Smart contracts. However, dockers have one distinct advantage. They provide coding language flexibility while in a Virtual Machine (VM) like Ethereum, one needs to learn a whole new language (solidity) to create smart contracts.
The EVM is the virtual machine in which all the smart contracts function in Ethereum. It is a simple yet powerful Turing Complete 256-bit virtual machine. Turing Complete means that given the resources and memory, any program executed in the EVM can solve any problem.
What is Ethereum Gas?
As explained in the introduction, Gas is a unit that measures the amount of computational effort that it will take to execute certain operations.
Note: Before we continue, huge shoutout to Joseph Chow for his amazing presentation on Ethereum gas.
Most of the smart contracts that run in the EVM are coded using Solidity (Ethereum is planning to move on to Viper from Solidity in the future). Each and every line of code in Solidity requires a certain amount of gas to be executed.
ETH gas price chart
The image below has been taken from the Ethereum Yellowpaper and can be used to gain a rough idea of how much specific instructions cost gas-wise. Every transaction requires at least 21,000 gas according to this table:
To better understand how gas works in Ethereum, let’s use an analogy. Suppose you are going on a road trip. Before you do so you go through these steps:
You go to the gas station and specify how much gas you want to fill up in your car.
You get that gas filled up in your car.
You pay the gas station the amount of money you owe them for the gas.
Now, let’s draw parallels with Ethereum.
Driving the car is the operation that you want to execute, like executing a function of a smart contract.
The gas is well….gas.
The gas station is your miner.
The money that you paid them is the miner fees.
All the operations that users want to execute in ethereum must provide gas for the following:
To cover its data aka intrinsic gas.
To cover its entire computation.
Now that we have covered the bare basics, you maybe asking the following question.
Why do we have this Gas system?
The answer is simple…incentivization.
Like any proof-of-work peer-to-peer system, Ethereum is heavily dependent on the hashrate of their miners. More the miners, more the hashrate, more secure and fast the system.
In order to attract more miners into the system, they need to make the system as profitable and alluring as possible for the miners. In Ethereum, there are two ways that miners can earn money:
By becoming temporary dictators of their mined blocks.
Let’s explore the second point.
The miners are responsible for putting transactions inside their blocks. In order to do so, they must use their computational power to validate smart contracts. The gas system allows them to charge a certain fee for doing so.
This fee is known as the miner’s fee and it helps incentivize them enough to take part actively in the ecosystem.
So, how much fees can they charge? Before we can calculate that let’s understand how we measure gas.
Gas is simply measured in units of gas. A transaction sent to the Ethereum network costs some discrete amount of gas (e.g. 100 gas) depending on how many EVM instructions need to be executed.
So, how do we convert the gas into Ether?
There is no fixed price of conversion. It is up to the sender of a transaction to specify any gas price they like. On the other side, it is up to the miner to verify any transactions they like (usually ones that specify the highest gas price). The average gas price is typically on the order of about 20 Gwei (or 0.00000002 ETH), but can increase during times of high network traffic as there are more transactions competing to be included in the next block.
The following chart shows you the average Ethereum gas price chart.
Image courtesy: Etherscan.
Before we go any further, it is important to know the concept of gas limit.
What is Ethereum Gas Limit?
In order to get an operation done in Ethereum, the sender of the transaction must specify a gas limit before they submit it to the network. The gas limit is the maximum amount of gas the sender is willing to pay for this transaction.
When specifying a gas limit, the following points must be considered:
Different operations will have different gas costs (as has been shown before).
The miners will stop executing the moment the gas runs out.
If there is any gas left over, it will be immediately refunded to the operation generator.
Let’s see this in operation in a hypothetical scenario.
Suppose, we are adding two numbers and for that the contract must do the following actions:
Storing 10 in a variable. Let’s say this operation costs 45 gas.
Adding two variables, let’s say this costs 10 gas.
Storing the result which again costs 45 gas.
Suppose the sender specifies a gas limit of 120 gas.
The total gas used by the miner to run the computation is (45+10+45) = 100 gas.
The fee that is owed to the miner, assuming 1 gas costs 20 Gwei, is (100 * 20 Gwei) = 0.000002 ETH.
Now, how much gas is left over?
120 – 100 = 20 gas.
The 20 unused gas is returned back to the sender (20 * 20 Gwei) = 0.0000004 ETH.
So, having said that, there are two scenarios that one must consider:
The specified gas limit is too low.
The specified gas limit is too high.
Scenario #1: The Gas Limit is too low
If an operation runs out of gas, then it is reverted back to its original state like nothing actually happened, however, the operation generator must STILL pay the miners the fee for their computational costs and the operation gets added to the blockchain (even if it has not been executed).
Going back to our road trip analogy, if you haven’t filled up enough gas in your car, then you will not be able to reach your destination, but even then you paid the gas station the money for the fuel right?
Let’s see how this works in our hypothetical smart contract. The steps were:
Storing 10 in a variable. Let’s say this operation costs 45 gas.
Adding two variables, let’s say this costs 10 gas.
Storing the result which again costs 45 gas.
However, this time, the sender sets a gas limit of 90 gas.
Now, we know that the gas that will be required for fulfilling the transaction is 100 gas, but we only specified 90 gas limit.
In this scenario, the miner will do 90 gas worth of computation and then charge the sender fees for the 90 gas which turns out to be (90 * 20 Gwei) = 0.0000018 ETH.
Also, the contract reverts back to its original state and the transaction is included in the blockchain.
Scenario #2: The Gas Limit is too high
So, what if we set the gas limit too high?
That would make sense to do right? Afterall, whatever is leftover gets refunded to the sender right?
That sounds good on paper but it doesn’t really work that well in reality.
Miners are limited by the block gas limit, which we’ll suppose is 6,700,000 gas. A basic transaction (simple transfer of ETH) has at least a gas requirement of 21,000 gas. Miners can only include transactions which add up to be less than or equal to the block gas limit.
Image courtesy: Hackernoon
Suppose there is a transaction A (which does a simple transfer of ETH) and has a specified gas limit of 42,000 and two transactions B and C (also simple transfers of ETH) which have specified gas limits of 21,000.
Which will make more sense for a miner to put in their block?
Will they put in transaction A and refund back a huge amount of unused gas?
Or will they put transactions B and C and refund little to nothing back?
The second point makes more sense to them economically right?
This is precisely why having a bloated gas limit is not a sensible way to go. It is more reasonable to set a gas limit which is just a little higher than the required amount of gas for your transaction.
The following is the average gas limit chart.
Image Courtesy: Etherscan
High and Low Ethereum Gas vs High and Low Fee
It should be clear to you so far that gas and ether are not the same things. Gas is the amount of computational power required while ether is the currency used to pay for that gas.
Now with the knowledge of everything we have obtained so far, let’s go through certain gas and fees scenarios.
If an operation has LOW gas, then the miners won’t even pick it up because it doesn’t have enough gas to finish computation.
If an operation has LOW fees, then it might have just enough gas to cover it but still, the miners won’t be chomping at the bits to pick it up because an operation with low fees isn’t economically appealing for them.
If an operation has HIGH gas, then it means that the operation is bloated with a high gas limit and hence the miners will not pick it up.
If an operation has HIGH fees, then the miners know that they will make a lot of money from it and will be picking it up instantly.
The currently recommended gas prices for different types of transaction speeds, according to ethgasstation are:
What Happens in Ethereum Gas Refund Scenarios?
In solidity, there are two commands which ensure that you get some gas refund back.
SUICIDE: This basically kills the smart contract. Doing so will get you back 24000 gas.
SSTORE: Storage deletion, which gets you back 15,000.
So, if your contract is using up 14,000 gas and deletes a storage then you should get back (15000-14000) 1000 gas refunded to you right?
It isn’t that simple.
If that was the case, then miners will lose all incentive. After all, the miners shouldn’t pay you to do your computations right?
To avoid scenarios like these, a condition was put in.
The refund that has been accumulated cannot exceed half the gas used up during computation.
Let’s take an example to clear this up.
…Suppose we have a smart contract which uses up 14,000 gas.
The gas limit that we have set up is 20,000 gas.
The smart contract also includes an SSTORAGE command.
So, how much gas will the contract creator get back post computation?
Firstly, they will get back (20,000-14,000) = 6,000 units of unused gas.
Now, the SSTORAGE command has also been used, so theoretically they should get back 15,000 gas as well.
However, the amount of gas that has been used in the contract is 14,000 and since 15,000 > 14,000/2, the REFUND generated will be 14,000/2= 7000.
So the total gas that the creator is getting back in the end is 6000+7000 = 13,000.
Let’s take another example.
Suppose this time the contract uses up 70,000 gas and it includes a SUICIDE function.
A SUICIDE function should give you 24,000 gas back which is < 70,000/2.
In this situation, the gas refund will be 24,000 + unused gas.
Criticism of Ethereum Gas. Is it Justified?
Even though the gas system has gotten praise for presenting a smoothly running mechanism which incentivizes the miners pretty positively, it has come under criticism lately for being a tad too expensive for developers and smart contract creators.
Regarding this, Danny Ryan did some interesting studies in his Hackernoon article.
Consider the following scenario:
When two numbers are added a million times in Ethereum it costs ~$26.55 in fees.
Danny Ryan compared that to a standard AWS system. He said that he can add two numbers a million times using python in 0.04 seconds, which going by the $0.0059 hourly Amazon EC2 rate costs $0.000000066.
This means that computation in Ethereum is 400 million times more expensive!
Based on his studies, this is the conclusion he made:
“To be fair, adding two numbers together 1 million times is a bit contrived. A well written contract would likely move such computational complexity off-chain and deal more with updating state in the contract. Storing vast amounts of data to the blockchain is also not an ordinary task. Depending on the task, a user would likely store a cryptographic reference (a hash) of the data on-chain and keep the rest of the data off-chain.
That said, we as developers need to be aware of these costs, and design dApps accordingly. We need to find the balance between on-chain and off-chain complexity, while still leveraging the decentralized capabilities of the blockchain.”
Increasing Ethereum Gas Prices Affecting Innovation
The problem with Ethereum’s high gas prices is that it makes it impossible for a developer to microtransaction payments to their projects. Lately, it has increased significantly due to network congestion from DeFi and the increasing transaction fees.
As you may be aware, DeFi (decentralized finance) apps are going through a boom period right now. Everyone wants to have a slice of the yield farming pie. As of writing, the amount of value locked up in DeFi is around $11 billion with UniSwap, Maker, WBTC being the most popular apps.
From a developer POV, the beauty of DeFi lies in its composability. One can easily incorporate different DeFi features and create a whole new app. However, with the skyrocketing gas fees, it’s becoming harder for the developers to incorporate an internal economic system that enables micropayments.