Skip to Content

👨🏻‍🎓 Register for live classes

Ethereum

Ethereum

Vitalik Buterin was part of the Bitcoin community, even being one of the co-founders of the Bitcoin Magazine .

But he envisioned that Blockchain could go far beyond transactions for cryptocurrency transfers. Given that there was no consensus to implement Vitalik’s ideas on the Bitcoin Blockchain, he created the Ethereum Blockchain.

Vitalik saw Blockchain as a decentralized global computer, an environment where smart contracts could be executed.

Ethereum is a global open source platform for decentralized applications.

We can also define it as a decentralized mining network incorporating a software development platform capable of executing smart contracts and decentralized applications using blockchain technology.

These applications work exactly as programmed, without any possibility of censorship, fraud or interference from third parties, since the source code of the smart contract is immutable.

gWei

The smallest unit of Ethereum is called wei.

It is Ethereum's 18th decimal place, meaning:

1 ETH = 1000000000000000000 wei

Gas x Fee

In Bitcoin, for a miner to be interested in validating our transaction, we leave a "leftover", or change, in the transaction, which is called fee. Miners validate transactions with the highest fees first.

In Ethereum, each command, or opcode, has a cost, called gas.

Gas is usually measured in gWei

1 gWei = 1000000000 wei = 0.000000001 ETH

For easy conversions, I recommend you use: eth-converter.com

A very common calculation is the amount of gas that a smart contract will spend.

To understand gas, gas price and gas limit, it is best to make a comparison to the real world.

Imagine that you want to go from São Paulo to Rio de Janeiro. Gas is the amount of liters of gas you need to make this route. Gas price is the price you will pay for the liter of gasoline. 50 liters can fit in the gas tank of your car, this is the Gas limit. So, even if you want to pass through other cities before arriving in Rio de Janeiro, you will have to limit your route by the capacity of the gas tank. This is also the maximum limit that you will spend.

Gas - amount

Amount of gas that will be used according to the bytecode of your smart contract.

Gas Price

The gas price is literally the price of gas.

You set the price you agree to pay. If you set a price too low, your transaction can stay in Mempool infinitely and this blocks all subsequent transactions, that is, you are unable to validate other transactions.

I have already left accounts blocked for almost 3 months, with a transaction on the Ethereum network. Day 1/1/2021 I tried to publish a smart contract using the gas price of 30 gwei Until 3/29/2021 the transaction was still in Mempool... This means that the price of gas was above 30 gwei during this period!

Gas used

To find the final amount of gas spent on gWei, you need to multiply the amount of gas that a smart contract will spend at the gas price.

Gas limit

Gas limit is the maximum limit you will spend. Gas limit exists because some transactions may vary in the amount of gas spent according to input parameters, oracles, values ​​of other variables that can generate a loop. Anyway, you have to have a limit to not lock the network and end your balance.

References

Conclusion

The purpose of this lesson was to introduce Ethereum, the blockchain for smart contracts. This lesson is just an introduction. I recommend reading the references listed.

In the next lesson you will learn about RSK.