Interview with Jared Tate Digibyte

DigiByte (DGB) is a rapidly growing worldwide decentralized payment and security blockchain used in 82 countries. DigiByte allows you to move money over the internet similar to PayPal & Western Union but with many improvements, including lightning fast transactions with minimal or no fees.
DigiByte (DGB) is a rapidly growing worldwide decentralized payment and security blockchain used in 82 countries. DigiByte allows you to move money over the internet similar to PayPal & Western Union but with many improvements, including lightning fast transactions with minimal or no fees.

Blockchain is going to be changing perhaps everything we do. It is already beginning to challenge traditional ways we have kept records, managed supply chains, and produced trusted contracts. It will enhance security and reduce the uncertainties.

What is your business doing to capture the value of the blockchain?

WHAT IS AN INITIAL COIN OFFERING? (USA REGULATION)

WHAT IS AN INITIAL COIN OFFERING? (USA REGULATION)

An initial coin offering, or ICO, is a method of crowdfunding. ICO’s exist in a legal grey area and, depending on the opinion of your legal team, can be structured several different ways.

In general, an ICO is the issuance of a custom token to a community for investing purposes. Enthusiasts and supporters of the company purchase the token in hopes that they’ll earn a return on their investment. In return, the company issuing the token gets access to immediate and liquid capital.

No equity is exchanged during an ICO however in many cases the custom tokens can be redeemed for utility on the network sometime in the future — compute cycles, storage space, or some other form of credit.

The presence of “utility” can change the legal nature of a custom token. If a token has utility, it likely can’t be classified as a security. However, if a token lacks any sort of utility — like being sold prior to the launch of a product — the sale looks like an investment and would likely be classified security, falling under SEC regulation.

ICO’s are considered highly risky investments.

Source: https://www.coloradoblockchaincapital.com

John Mcafee on Bitcoin future Do not panic| Bitcoin will be 1 million$

McAfee first put his, err, skin in the game in July 2017, when he predicted that the Bitcoin price would reach $500,000 within three years from its then-level of $1,800. “If not, I will eat my d–k on national television,” he proclaimed. He later doubled down on that prediction in December, claiming that Bitcoin would reach $1 million during the same time frame. “When I predicted Bitcoin at $500,000 by the end of 2020, it used a model that predicted $5,000 at the end of 2017. BTC has accelerated much faster than my model assumptions,” he said. “I will still eat my d–k if wrong.” Since then, Bitcoin has entered a significant bear cycle, falling from a peak of nearly $20,000 to a present value of $7,493. Nevertheless, the former MGT Capital executive has not been deterred by the recent price decline. Last month, he tweeted that he will “ABSOLUTELY!!!” hold up his end of the bargain, arguing that it is a bet that he “cannot possibly [lose].”

Monero Original on MinerGate

XMO On Minergate
XMO On Minergate

What is XMO?

Monero (XMR) is going to have the network update (basically a fork but without making a new coin) that is scheduled for April 6, 2018. Since that point, Monero will use a new PoW algorithm that will make it incompatible with other coins for merged mining. Monero Original (XMO) is based on Monero Helium Hydra release and will continue staying on the original chain. Basically speaking, this will be the old Monero you all got used to.

How to get XMO on MinerGate?

All miners that own XMR before the fork will receive the amount of XMO equal to their confirmed balance.

How to mine XMO on MinerGate?

If you use MonerGate’s miners, download the recent miner version and select XMO (after After April 6th). If you don’t upgrade your software, after April 6, 2018 you’ll be mining XMR but the rewards will be in XMO.

Miners who mine with 3rd party miners should follow the instruction to change configuration settings.

What if I want to mine XMR?

If you’ve already been mining Monero (XMR), all you have to do is to upgrade MinerGate miner. If you’ve never mined XMR and want to start after the fork, select XMR in the updated MinerGate miner and you are all set.

Miners who use side software should change the settings and change the XMR port from 45560 to 45700.

The final address should be: stratum+tcp://xmr.pool.minergate.com:45700
VIP program members will receive special instructions by e-mail. In case you did not receive any instructions, consider contacting our support team at support@minergate.com

What happens to the unconfirmed balance?

After the fork, both your XMR confirmed and unconfirmed balances will remain the same, while you receive the amount of XMO equal to your confirmed XMR balance. As you have never mined XMO before, your unconfirmed XMO balance will be empty.

What if I have a relatively old hardware?

MinerGate welcomes all types of mining hardware including the ones with old video cards. Our team will exclusively issue a new GUI miner 8.0 Legacy that will support past generation video cards.

What if I want to continue merge mining?

After the fork XMR will be using a slightly different mining algorithm which will make it unavailable for merged mining with CryptoNight-based coins. However, you can merged mine XMO with the same coins you merged mine before with XMR.

How does XMR fork affect Cloud Mining?

Everyone who bought XMR cloud mining contracts will continue to receive XMR rewards.

We have hit the $10 Million mark

We are so pleased to be able to share with you this success from our Associate @Bitbonds

Hi e-NetworkAssosiates –  @Cryptoguild

As you may remember this February we reached the $8 million mark in cumulative loan volume. So just two months down the line we have now hit the $10 million mark! Meaning Bitbond is steadily generating $1 Million in loan volume per month!

This is a great achievement for Bitbond! But it is not just our loan volume that has grown, so has the Bitbond team. We are now 24 people strong which is huge growth from the 2017, from when there was just 5 of us! But all this growth and development wouldn’t have been possible without you, so today we just wanted to say a massive thank you from the Bitbond team.

 How to Launch an ICO – Expert Roundup

Today we published a new blog post, which focuses on ICO’s and what it takes to make them a success! We spoke to 4 successful ICO experts and delved into the details of How to launch an ICO.

That’s all for today. Thank you for reading and see you on the platform.

Best Regards,

Brigitte

Suppoman, Trevon James, and Craig Grant, the titans of cryptocurrency scams are back with a brand new way to take your money via “POWH3D”… don’t be a victim!

Trevon James and Craig Grant's Latest Scam
Trevon James and Craig Grant's Latest Scam
Trevon James and Craig Grant’s Latest Scam

Ahh, it feels good to be back from my latest ban, which happens way too often by the way, and now I have a new scam to report to you all, called Proof of Weak Hands:

First off, before I even start to break this blatant scam down, which even the developers themselves admit is a scam, below is a list of just 3 of the high profile peeps marketing this Proof of Weak Hands (POWH3D) Ponzi scheme right now:

Craig Grant
Trevon James
Suppoman
Now if that alone isn’t enough to prevent you from getting in on this blatant scam, well feel free to read on, and if you don’t recognize those names above, and you’re a noob, you may want to do some research on them first, before you get in on this scam and lose all your fucking hard-earned bread in the process.

To start with, I highly encourage that you to take a gander at the last part of Crypto Jedi’s Proof of Weak Hands review video Where you could clearly see, that the POWH3D developers actually named their smart contract… “PonziTokenV3”.

If that still isn’t enough to dissuade you, understand that there may be no hope for you, and maybe you just like losing your money, because if you don’t know what “V3” stands for, it means version 3, so the last 2 have clearly went bust already, and all these people have already lost all their money.

Finally, two of the names mentioned above are currently being sued due to the toppling of BitConnect, which as of this post was the largest exit scam in cryptocurrency history, and yet they are still stupid enough to promote this blatant scam, which if you go to the POWH3D website, the developers actually tell you it’s a scam for fuck sake.

Oh, and one last point, when, because it will go down, Proof of Weak Hands does exit scam, I fear the price of Ethereum is going to be destroyed in the process, because you can obviously tell already that the POWH3D smart contract is already killing the price. Now just imagine when the pot possibly grows to over a million Eth inside the contract, and then boom, the whole thing goes bust… what then will the price of Ethereum be?

Bonus: Trevon James and Craig Grant discussing their latest scam (POWH3D) on the telephone –

HaTTiP: https://creds.money/Trevon James and Craig Grant’s Latest Scam

What is Ethereum Gas: Step-By-Step Guide

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

What is Ethereum Gas: Step-By-Step Guide

Bitcoin, Ethereum, and the Advent of Smart Contracts

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.

What is Ethereum Gas: Step-By-Step Guide

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.

What is Ethereum Gas: Step-By-Step Guide

You can learn more about smart contracts in our in-depth guide here.

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).

 

What is Ethereum Gas: Step-By-Step Guide

 

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.

All 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 get computed.

The image below has been taken from the Ethereum Yellowpage and can be used to gain a rough idea of how much specific instructions cost gas-wise.

What is Ethereum Gas: Step-By-Step Guide

Image Courtesy: Ethereum Yellow Paper

 

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.

The car, is the operation that you want to execute, like a gas or 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 mining blocks and getting block rewards.
  • 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.

The smallest unit of gas measurement is wei. So, if we spend 1 gas unit to during an operation, we call it 1 wei.

 

The units of measurements increase like this:

What is Ethereum Gas: Step-By-Step Guide

Image Credit: Steemit

 

So, how do we convert the gas into Ether?

 

There is no fixed price of conversion, it is completely up to miners to determine the conversion price, however, the average conversion rate is usually: 1 gas = 0.02 micro Ether.

 

The following chart shows you the average Ethereum gas price chart.

What is Ethereum Gas: Step-By-Step Guide

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 operation generator (i.e. the person initiating the transaction or the smart contract creator) must specify a gas limit before they submit it to the miners. When a gas limit has been specified only then will the miners start executing the operation.

When submitting 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 wei gas.
  • Adding two variables, let’s say this costs 10 wei gas.
  • Storing the result which again costs 45 wei gas.

 

Suppose the gas limit is 120 wei.

The total gas used by the miner is (45+10+45) 100 wei.

The fees that is owed to them assuming 1 wei costs 0.02 micro ETH is (100*0.02 micro ETH) = 0.000002 ETH.

 

Now, how much gas is left over?

 

120 – 100 = 20 wei.

The 20 wei is refunded back to the operation generator.

So, having specified that, there are two scenarios that one must consider:

 

  • The Gas Limit is too low.
  • The 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 addition smart contract. The step was:

  • Storing 10 in a variable. Let’s say this operation costs 45 wei gas.
  • Adding two variables, let’s say this costs 10 wei gas.
  • Storing the result which again costs 45 wei gas.

 

However, this time, the gas limit is 90 wei.

 

Now, we know that the gas that will be required for fulfilling the contract is 100 wei, but we only have 90 wel limit.

In this scenario, the miner will do 90 wei worth of computation and then charge the operation generator fees for the 90 wei which turns out to be (90 * 0.02 micro ETH) 0.000018 ETH.

Also, the contract reverts back to its original state and is added to 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? After all whatever is leftover gets refunded to the operation generator right?

That sounds good on paper but it doesn’t really work that well in reality.

Miners are limited by a 6,700,000 gas limit per block. Each simple transaction in Ethereum usually has a gas limit of 21,000. Miners can only add operations which add up to be less than or equal to the block gas limit.

What is Ethereum Gas: Step-By-Step Guide

Image courtesy: Hackernoon

Suppose there is a transaction A which has a gas limit of 42,000 and two transactions B and C which have normal 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 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 the sensible way to go.

The following is the average gas limit chart.

What is Ethereum Gas: Step-By-Step Guide

Image Courtesy: Hackernoon

 

High and Low 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 price aka the FEES that one must 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 viable 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 recommended gas prices for different transaction fees, according to ethgasstation are:

What is Ethereum Gas: Step-By-Step Guide

What Happens in 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 more 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:

What is Ethereum Gas: Step-By-Step Guide

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.”

 
 

Join over 115,115 Members
Angel Investors, Startups & Blockchain developers…
.content-5ac2b7de61372 .cp-form-container label{display:none}.content-5ac2b7de61372 .cp-form-container label{color:rgb(153,153,153);font-size:15px;font-family:;text-align:center}.content-5ac2b7de61372 .cp-form-container .cp-form-field select{text-align-last:center;direction:}.content-5ac2b7de61372 .cp-form-container input:focus:not([type=’radio’]):not([type=’checkbox’]):not([type=’range’]),.content-5ac2b7de61372 .cp-form-container textarea:focus,.content-5ac2b7de61372 .cp-form-container .cp-form-field button,.content-5ac2b7de61372 .cp-form-container .cp-form-field input,.content-5ac2b7de61372 .cp-form-container .cp-form-field select,.content-5ac2b7de61372 .cp-form-container .cp-form-field textarea{text-align:center;font-size:20px;font-family:Lato;color:#0a0a0a;background-color:#fff;border-color:;padding-top:15px;padding-bottom:15px;padding-left:15px;padding-right:15px;border-radius:3px}.content-5ac2b7de61372 .enable_input_shadow .cp-input,.enable_input_shadow input.cp-number,.enable_input_shadow select.cp-dropdown{-webkit-box-shadow:inset 1px 1px 2px 0 rgba(66,66,66,.6)!important;-moz-box-shadow:inset 1px 1px 2px 0 rgba(66,66,66,.6)!important;box-shadow:inset 1px 1px 2px 0 rgba(66,66,66,.6)!important}.content-5ac2b7de61372 .cp-form-container .cp-submit{padding-top:10px;padding-bottom:10px;padding-left:15px;padding-right:15px}.content-5ac2b7de61372 .cp-form-container .cp-submit.cp-btn-flat{background:#f16334!important;border-radius:15px;box-shadow:1px 1px 2px 0 rgba(66,66,66,.6)}.content-5ac2b7de61372 .cp-form-container .cp-submit.cp-btn-flat:hover{background:#e45627!important}.content-5ac2b7de61372 .cp-form-field.cp-enable-box-shadow>div{border-radius:3px}

Email

Yes, Get Access!
No Thanks!

 

Tweet
Share
Share

Content retrieved from: https://blockgeeks.com/guides/ethereum-gas-step-by-step-guide/.

What is Ethereum Gas: Step-By-Step Guide

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

What is Ethereum Gas: Step-By-Step Guide

Bitcoin, Ethereum, and the Advent of Smart Contracts

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.

What is Ethereum Gas: Step-By-Step Guide

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.

What is Ethereum Gas: Step-By-Step Guide

You can learn more about smart contracts in our in-depth guide here.

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).

 

What is Ethereum Gas: Step-By-Step Guide

 

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.

All 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 get computed.

The image below has been taken from the Ethereum Yellowpage and can be used to gain a rough idea of how much specific instructions cost gas-wise.

What is Ethereum Gas: Step-By-Step Guide

Image Courtesy: Ethereum Yellow Paper

 

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.

The car, is the operation that you want to execute, like a gas or 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 mining blocks and getting block rewards.
  • 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.

The smallest unit of gas measurement is wei. So, if we spend 1 gas unit to during an operation, we call it 1 wei.

 

The units of measurements increase like this:

What is Ethereum Gas: Step-By-Step Guide

Image Credit: Steemit

 

So, how do we convert the gas into Ether?

 

There is no fixed price of conversion, it is completely up to miners to determine the conversion price, however, the average conversion rate is usually: 1 gas = 0.02 micro Ether.

 

The following chart shows you the average Ethereum gas price chart.

What is Ethereum Gas: Step-By-Step Guide

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 operation generator (i.e. the person initiating the transaction or the smart contract creator) must specify a gas limit before they submit it to the miners. When a gas limit has been specified only then will the miners start executing the operation.

When submitting 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 wei gas.
  • Adding two variables, let’s say this costs 10 wei gas.
  • Storing the result which again costs 45 wei gas.

 

Suppose the gas limit is 120 wei.

The total gas used by the miner is (45+10+45) 100 wei.

The fees that is owed to them assuming 1 wei costs 0.02 micro ETH is (100*0.02 micro ETH) = 0.000002 ETH.

 

Now, how much gas is left over?

 

120 – 100 = 20 wei.

The 20 wei is refunded back to the operation generator.

So, having specified that, there are two scenarios that one must consider:

 

  • The Gas Limit is too low.
  • The 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 addition smart contract. The step was:

  • Storing 10 in a variable. Let’s say this operation costs 45 wei gas.
  • Adding two variables, let’s say this costs 10 wei gas.
  • Storing the result which again costs 45 wei gas.

 

However, this time, the gas limit is 90 wei.

 

Now, we know that the gas that will be required for fulfilling the contract is 100 wei, but we only have 90 wel limit.

In this scenario, the miner will do 90 wei worth of computation and then charge the operation generator fees for the 90 wei which turns out to be (90 * 0.02 micro ETH) 0.000018 ETH.

Also, the contract reverts back to its original state and is added to 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? After all whatever is leftover gets refunded to the operation generator right?

That sounds good on paper but it doesn’t really work that well in reality.

Miners are limited by a 6,700,000 gas limit per block. Each simple transaction in Ethereum usually has a gas limit of 21,000. Miners can only add operations which add up to be less than or equal to the block gas limit.

What is Ethereum Gas: Step-By-Step Guide

Image courtesy: Hackernoon

Suppose there is a transaction A which has a gas limit of 42,000 and two transactions B and C which have normal 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 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 the sensible way to go.

The following is the average gas limit chart.

What is Ethereum Gas: Step-By-Step Guide

Image Courtesy: Hackernoon

 

High and Low 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 price aka the FEES that one must 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 viable 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 recommended gas prices for different transaction fees, according to ethgasstation are:

What is Ethereum Gas: Step-By-Step Guide

What Happens in 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 more 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:

What is Ethereum Gas: Step-By-Step Guide

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.”

 
 

Join over 115,115 Members
Angel Investors, Startups & Blockchain developers…
.content-5ac2b7de61372 .cp-form-container label{display:none}.content-5ac2b7de61372 .cp-form-container label{color:rgb(153,153,153);font-size:15px;font-family:;text-align:center}.content-5ac2b7de61372 .cp-form-container .cp-form-field select{text-align-last:center;direction:}.content-5ac2b7de61372 .cp-form-container input:focus:not([type=’radio’]):not([type=’checkbox’]):not([type=’range’]),.content-5ac2b7de61372 .cp-form-container textarea:focus,.content-5ac2b7de61372 .cp-form-container .cp-form-field button,.content-5ac2b7de61372 .cp-form-container .cp-form-field input,.content-5ac2b7de61372 .cp-form-container .cp-form-field select,.content-5ac2b7de61372 .cp-form-container .cp-form-field textarea{text-align:center;font-size:20px;font-family:Lato;color:#0a0a0a;background-color:#fff;border-color:;padding-top:15px;padding-bottom:15px;padding-left:15px;padding-right:15px;border-radius:3px}.content-5ac2b7de61372 .enable_input_shadow .cp-input,.enable_input_shadow input.cp-number,.enable_input_shadow select.cp-dropdown{-webkit-box-shadow:inset 1px 1px 2px 0 rgba(66,66,66,.6)!important;-moz-box-shadow:inset 1px 1px 2px 0 rgba(66,66,66,.6)!important;box-shadow:inset 1px 1px 2px 0 rgba(66,66,66,.6)!important}.content-5ac2b7de61372 .cp-form-container .cp-submit{padding-top:10px;padding-bottom:10px;padding-left:15px;padding-right:15px}.content-5ac2b7de61372 .cp-form-container .cp-submit.cp-btn-flat{background:#f16334!important;border-radius:15px;box-shadow:1px 1px 2px 0 rgba(66,66,66,.6)}.content-5ac2b7de61372 .cp-form-container .cp-submit.cp-btn-flat:hover{background:#e45627!important}.content-5ac2b7de61372 .cp-form-field.cp-enable-box-shadow>div{border-radius:3px}

Content retrieved from: https://blockgeeks.com/guides/ethereum-gas-step-by-step-guide/.

JUROCK REAL ESTATE INSIDER IS PROUD TO PRESENT ITS COVETED REAL ESTATE CONFERENCE: LAND RUSH 2018

he best real estate forecasting conference... Land Rush 2018
The best real estate forecasting conference…
Land Rush 2018

JUROCK REAL ESTATE INSIDER IS PROUD TO PRESENT ITS COVETED REAL ESTATE
CONFERENCE:
LAND RUSH 2018

APRIL 7, 2018 – All day at the Pinnacle Harbourfront Hotel in #Vancouver

These are mad times – Is real estate still the best place to be in 2018?

Last year at the Land Rush conference Ozzie Jurock said:

Buy Surrey – (Surrey condos up between 42% and 60%)
Buy #Whistler
Buy #Victoria
Buy #Port Moody
Buy East Vancouver
Buy student housing
Buy downtown strata offices
Buy strata commercial
Buy pre-sale condos (Ozzie’s Real Estate Company sold 79 units in one
building where prices are already $100,000 higher before completion!)
His US predictions were eyebrow raising successes
PLUS 29 other predictions (that all came true!)

Attendee’s comments:

“Last year, I had to change plans to attend the Landrush – and it proved to
be one of the best decisions I made all year.”

“This is my 5th Landrush and every year I come away with specific buy
recommendations. I can’t afford to miss it.”

This year his well researched money making recommendations will take you
into a better future.

Vancouver Magazine called Ozzie Jurock one of the 45 brightest people in Vancouver.

Peter Newman called him a real estate Guru and President Donald Trump includes Ozzie in his book: ‘The Best Real Estate Advice I Ever Received’.

He’ll be talking about European and Asian buyer influences on Canadian real estate, focusing on the best deal cities in Canada and the United States,
cash flow in 2018 and of course he always exciting ‘Ozzie’s AstoundingPredictions’.

Visit http://www.landrushcanada.com for more information or call us at the
office at 604.683.1111