0

I would be grateful if someone was able to clarify this, given my assumptions:

  1. Mining difficulty is depending on the amount of computational power invested into verifying transactions on the blockchain needed to keep it decentralized and "unhackable".
  2. Miners are rewarded for investing their computational power depending on the MH/s and network difficulty ratio. More miners mean higher difficulty which means lower ROI compared to electricity costs and a longer time to break even the investment in the hardware (often GPUs or ASICs).
  3. Gas is the fuel needed by people to execute a smart contract transaction. E.g. selling/buying NFTs. Gas fees are used to pay for the computational power in a form of the abovementioned rewards to miners.

With the above assumptions, I have the following questions:

  1. Why it is possible for a transaction to fail, in case you run out of gas? Why wouldn't you either not have a chance to ask for the execution of such a transaction, or you would have an option to wait for XX hrs or days to get it executed? Instead, you lose money on trying to execute transactions that may not go through and it causes great frustration and disbelief in Crypto as such.
  2. Why are gas fees climbing so extremely high when there is a higher demand for transactions? And overall, why are they so high constantly? If difficulty raises, meaning the number of miners/computational power raises and the demand for transactions raises as well, should it all be linear and the ratio remains more or less the same and so fees should remain static?
  3. Lately, the reward for mining on ETH blockchain has decreased to nearly half of what it used to be 3 months ago. They say it's caused by the risen difficulty. Fair enough, but why haven't gas prices go down?

Potential answer?

I thought about it a bit more and I think I might have an answer. If we have a scenario, where demand for transactions is constant, fees are constant and miners and therefore difficulty on the network rises, the reward for miners goes down.

Question #1 still remains valid. Also, why rewards for mining doesn't decrease, to enforce the number of miners/computational power needed to verify transactions and therefore decrease gas fees?

Basically, the only thing that needs to be done is lower the gas fees and everything else would happen on its own, isn't that right?

1 Answer 1

1

It's often hard to answer why questions, but I try.

A1. Mining difficulty depends on the amount of computational power invested into verifying transactions on the blockchain needed to keep it decentralized and "unhackable".

No. The difficulty depends on an algorithm that aims to keep the block production to the frequency defined by design (Bitcoin ~10 minutes, Ethereum ~15 seconds, and so on). It fights against the consensus algorithm, which aims to produce valid blocks instead.

Suppose the community assigns enough resources (hashing power) to find a valid hash for the block in less than 15 seconds, and it constantly does it for some time. In that case, the difficulty algorithm adjusts the block difficulty up until blocks production returns to ~15 seconds. The same happens in the opposite situation: if the network produces blocks in more than 15 seconds, the difficulty decreases.

Verification of transactions is another topic. It does not intersect with the difficulty or the PoW consensus (i.e., you can have, and you have, perfectly valid blocks without any transaction inside).

A2. Miners are rewarded for investing their computational power depending on the MH/s and network difficulty ratio. More miners mean higher difficulty which means lower ROI compared to electricity costs and a longer time to break even the investment in the hardware (often GPUs or ASICs).

No. Block production is fixed (or, tends to be), so the block rewards. You pay electricity and infrastructures with FIAT ($, €, and so on) and not with ethers, so the ROI is much more affected by the exchange price. If there are more miners and higher difficulty, this is because more people use Ethereum, so usually, the price goes up. Even if you produce fewer blocks and get fewer rewards, you can still reach break-even with the same infrastructure.

You have more problems when difficulty decreases because that probably means less interest and fewer transactions in the network, so less value for your ethers, and eventually the inability to pay costs in FIAT.

Please also note that price, hash power, transactions, network congestion, etc., all influence each other with force feedback; Ethereum is a complex ecosystem; it's not a straight line of causes and effects.

A3. Gas is the fuel needed by people to execute a smart contract transaction. E.g. selling/buying NFTs. Gas fees are used to pay for the computational power in a form of the abovementioned rewards to miners.

No. Gas is the measure of the computational cost of every Ethereum transaction, regardless they involve a smart contract. You pay with ethers. How much? It's up to you to decide because it's up to you to set a gas price you are willing to pay for your transaction to be executed.

Because block size is limited, if someone else offers much higher fees, miners are more likely to choose those transactions and not yours. In this situation, your transactions remain in the memory pool until there are no other more appealing transactions to mine.

With this game, it's the network congestion that brings the gas price up.

I often use the following metaphor to explain how this process works:

My fuel tank is empty. I need to travel 500 km (the entire smart contract's code you want to execute), my car consumes one liter (gas) per 20 km (single line of code), I need at least ~25 liters (gas). I go to the gas station and say I want to pay the gasoline at a maximum of € 1,5 per liter (gas price). How much is it now? € 1,7 because many people are refueling (executing transactions) and there's also a long waiting queue (memory pool). Ok, I wait here until the price goes down, or I get tired of waiting, and I raise the price (override my old transaction with another with the same nonce but higher gas price).

Q1. Why it is possible for a transaction to fail, in case you run out of gas? Why wouldn't you either not have a chance to ask for the execution of such a transaction, or you would have an option to wait for XX hrs or days to get it executed? Instead, you lose money on trying to execute transactions that may not go through and it causes great frustration and disbelief in Crypto as such.

You are mixing different concepts.

Ethereum - as other Blockchains - is all about the client's responsibility. A transaction fails 99% of the time because of the client, not the network. And clients can always test locally if a transaction fails. Ethereum clients do it, and even a lot of wallets (i.e., MetaMask) can predict, in almost every case, if you are sending something that will fail.

In rare cases, transaction depends on an on-chain state that can change unexpectedly, leading to unpredictable error. Running out of gas is a sign that you attached too few gas (because you made a mistake calculating by your own) or transaction resulted in an exception (again, 99% you made a mistake creating the transaction, 1% chance the blockchain's state was changed unexpectedly by other transactions you cannot predict).

Cryptocurrencies are all-in with verifiability and provability, so you must not believe in crypto, you must verify crypto ;)

Q2. Why are gas fees climbing so extremely high when there is a higher demand for transactions? And overall, why are they so high constantly? If difficulty raises, meaning the number of miners/computational power raises and the demand for transactions raises as well, should it all be linear and the ratio remains more or less the same and so fees should remain static?

Now you know why: it's not related to difficulty but network congestion. Some attempts were made to use a more flexible block gas limit (see EIP-1559), but Ethereum is so used and useful that results may not be as evident as expected.

Q3. Lately, the reward for mining on ETH blockchain has decreased to nearly half of what it used to be 3 months ago. They say it's caused by the risen difficulty. Fair enough, but why haven't gas prices go down?

They are wrong. The most recent decrement in block reward is due to the gas-burning mechanism introduced by EIP-1559.

Basically, the only thing that needs to be done is lower the gas fees and everything else would happen on its own, isn't that right?

No, because gas price is not determined by a central authority or an algorithm but by users, aka the transaction's signers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.