crypto.bi

ELI5: Ethereum, Gas, Gas Price, Gas Limit, Smart Contracts

To those familiar with first generation cryptocurrencies such as Bitcoin, Ethereum can seem overly complex. There are several new concepts to learn including gas, Turing-complete smart contracts, gas limit, gas price, among others.

Meanwhile Bitcoin is very straightforward, even simplistic in comparison.

BTC transaction fees are paid in the same currency as the main currency itself. The fee is set according to supply and demand – and that’s about it concerning fees.

There is a very limited programming language embedded in Bitcoin, which cannot implement very sophisticated contracts.

Overall, Bitcoin Core is a very simple system that efficiently leveraged previously existing cryptographic technologies built into the innovative cryptocurrency we know today.

Perhaps its simplicity is key to why Bitcoin has stood the test of time against elite hackers from all over the planet.

Ethereum

Enter Ethereum, a second generation cryptocurrency, which has a sophisticated and fully featured language that allows you to create complete programs called smart contracts.

With all this power, comes great complication.

In this article we take a look at Ethereum’s jargon while attempting to provide a simple explanation for each term.

Let’s start with a few definitions.

Ethereum: A world computer that is 100% decentralized. Since this computer does not actually exist, but is a disperse mass that cannot be seen, it was called Ethereum which derives from the ether (the name given to the nothingness in outer space).

ETH: ETH is the monetary unit in the Ethereum virtual world computer. It is the currency used to pay for computing power in Ethereum.

Gas: An abstract quantity that represents how much ETH will be paid for a given computation executed on Ethereum Virtual Machine

Gas Price: How much ETH value to attribute to Gas for a given computation

Gas Limit: Maximum amount of Gas to pay for a computation. If the limit is reached, the computation is aborted and all Gas spent until then is consumed.

Smart Contract: Like Bitcoin, every Ethereum transaction contains a program embedded in it. Ethereum’s programming language, called Solidity, is very powerful and allows for complex business rules to be encoded using it. These programs are called smart contracts, because they are self-enforcing and autonomously executing programs that live permanently in the blockchain. Smart contracts can be written to encode complex agreements, pay wages, pay dues when certain conditions are met and so on.

Wei: Smallest unit of Ethereum. Analog to Satoshis in Bitcoin. One wei is one ETH divided by 10 to the 18th power (18 decimal places). Gas prices are usually expressed in gwei, which is giga-wei or one billion wei.

Why Gas?

Gas is probably the hardest  Ethereum concept to grasp.

Why did the Ethereum creators choose this abstraction instead of simply charging straight up ETH for computations?

The answer is: to add one level of abstraction to the system, decoupling transaction price from the Ethereum cryptocurrency.

According to the Fundamental theorem of software engineering:

“We can solve any problem by introducing an extra level of indirection.”

This is basically the principle behind Gas.

It simply adds one layer of indirection between ETH and the price of computation.

Instead of saying a computation costs a few ETH, you say it costs some Gas. Gas has an ETH value that is determined by whoever executes the transaction, which is the Gas price.

For example, when a transaction is sent, Gas is usually set to 10000 gwei (giga wei) which is a tiny fraction of one ETH. It’d be the exact same thing if the literal ETH value was provided.

Gas uses a car’s gas tank analogy. For the Ethereum “engine” (Ethereum Virtual Machine) to run, it requires a gas tank. When you send out a transaction, you need to set the maximum Gas that will be spent on this transaction. It’s analog to the fee in Bitcoin. If there is not enough Gas to run the transaction, whatever ETH amount is returned to the sender, but the Gas fee is lost as it must spend the Gas to find out that it doesn’t have enough Gas.

This is a direct consequence of the halting problem, by which it is impossible to know whether a computer program will halt or not beforehand.

Therefore Ethereum programs must run and only during runtime do they know for sure whether there was enough Gas to complete the computation. Gas is therefore spent.

If the Gas runs out, the ETH amount that was transferred in this transaction is returned to the sender. In fact, it never truly left the sender’s wallet because in order to complete a transfer the smart contract would have to have successfully executed.

Conclusion

We hope this article clarified some of the basic concepts of Ethereum.

All these technical terms can seem a little dauting at first, but there really isn’t much difference to other cryptocurrencies.

It’s basically a matter of getting used to the terminology and, once you do, everything becomes very clear.

Ethereum is a very well implemented platform that was well thought out and which seeked to correct some of the shortcomings found in Bitcoin, especially the limited Bitcoin transactional language (scripts).

Ethereum is considered a second generation cryptocurrency and its evolution brought new concepts with it. With a bit of practice it becomes a habit to mentally calculate Gas, Gas Prices and other parameters that allow the execution of smart contracts.

#CryptoPB

Crypto.BI CryptoPB Presents