Homework on Mining and Proof of Work - Questions

  1. they must spend money in the form of electricity upfront, it keeps them honest and helps ensure integrity of blockchain
  2. each block contains the previous hash of the block before it. The hash is based on transactions inside the block, the previous hash, and nonce. Changing any of these would result in having to re-mine every previous block and re-mine all new blocks that were added which would take thousands of years and is impossible
  3. the more miners there are, the lower the target is, the lower the target is the more difficult it is to mine. An increase in miners on the network will result in the target being lowered and mining becoming more difficult
1 Like
  1. Why is it important to make sure that miners spend money (on electricity) while mining?

The more electricity used in the mining network, the more you can earn and the more secure the network becomes.

  1. Why would it be very difficult for someone to go back change a previously added block?

The incentive to change a bitcoin transaction is not there because it would cost far too much to do so. This can only happen if at least 51% of the hashrate of the entire Bitcoin network is used.

  1. How does the network regulate mining difficulty?

As soon as there are more miners, the difficulty of mining is increased. This is achieved by setting a lower target when calculating the hash puzzle and thus automatically requiring more energy or more mining power to calculate this low value.

1 Like

For the Bitcoin system to work, the right incentives have to be in place when it comes to mining.

The ultimate goal of mining is to ensure there are enough nodes running the network efficiently, signing valid transactions and discarding invalid or forged transactions. This is encouraged by giving away some new minted coins in return to miners.

The word “mining” is somewhat misleading. By evoking the extraction of precious metals, it focuses our attention on the reward for mining, the new bitcoin created in each block. Although mining is incentivized by this reward, the primary purpose of mining is not the reward or the generation of new coins. If you view mining only as the process by which coins are created, you are mistaking the means (incentives) as the goal of the process. Mining is the mechanism that underpins the decentralized clearinghouse, by which transactions are validated and cleared. Mining is the invention that makes bitcoin special, a decentralized security mechanism that is the basis for P2P digital cash.

Mastering Bitcoin 2nd Edition, Chapter 10 - Programming the Open Blockchain (Andreas M. Antonopoulos).

If mining was free, bad actors could attempt to sign fake transactions and blocks in order to obtain a financial gain, for example double-spending or creating coins out of thin air. Since mining is not free and a consensus mechanism is in place, miners that have less than 50% of all hash rate power know that they would lose precious hash time if they tried to sign fake transactions and blocks, because those would not eventually be part of the consensus.

What happens if a participant or a team or participants gets ahold of more than 50% of the hash rate and is therefore capable of signing an alternative and fake chain? While it would still be a dangerous situation and one the community wants to avoid, we can still theorize about what would happen in that case as in reality this has never happened (except perhaps for the first few weeks the protocol was running when the price of bitcoin was irrelevant). In theory, two things prevent that scenario from materializing: a) As soon as the rumor of Bitcoin being manipulated surfaced to the public, the price of Bitcoin would sink, making the entire investment in machinery worthless. b) If the participant or team of participants holding 50%+ of the hash rate don’t want to cause Bitcoin price to suddenly drop, the best thing they can do with their hashing power is, in fact, to abide by the rules and sign legitimate transactions only.

When there are two parallel chains running, Bitcoin is designed to go for the longer one. This happens frequently for small parallel block chains, as it takes some time for the nodes to coordinate and broadcast the status of their new block chain to the other nodes while two nodes can potentially come up with the solution to the same mathematical problem independently. The further back in blocks you want to go, the more difficult it is because you have to prove that you have a solution to the mathematical problems that have to be solved at every point in time since the fork happened. Unless you control a majority of the nodes, this becomes harder and harder.

Quoting again Antonopoulos, the “target is set so that the current mining power will result in a 10-minute block interval”. The target is the parameter that is used by Bitcoin to regulate how much time it would take, with the current network hash rate, to solve the mathematical problem that is required. The target is reviewed and adjusted every 2016 blocks which should take about 2 weeks if the target used last time was correctly adjusted and the network conditions are the same. That of course is never exact and we basically have a moving target.

So how does this target look like and how can it regulate the computation problem so precisely?

In bitcoin explorer tools like mempool.space, you can see all the information that makes up a block:

Particularly, there is this field called “bits”, which is a compressed version of the actual target. In the example from the image, bits is 0x1903a30c which is the same as saying that the target value should be 0x0000000000000003A30C00000000000000000000000000000000000000000000 (in hex). If you want to know how to go from bits to target you can again check Chapter 10 of Antonopoulos’ book. Target numbers in binary are always a combination of N leading zeros followed by 256-N digits. In total, the target is 256 bits long. In order to be the one collecting the mining reward and writing the transaction in the blockchain, the node has to find a nonce (basically it is a number that is used just once) that is added to the blockchain header so that when the block is hashed it returns a value that is less than the target. By using probabilities and thanks to the fact hat the target is designed in such a way that the binary representation has N zeros to the left, one can calculate in advance how many hash calculations it would take fo find a nonce that meets that condition and make statements like the one in the book “It will take on average more than 1.8 zeta-hashes (thousand billion billion hashes) for the network to discover the next block. That seems like an impossible task, but fortunately the network is bringing 3 exa-hashes per second (EH/sec) of processing power to bear, which will be able to find a block in about 10 minutes on average”.

On the next chunk of 2016 blocks, the target is recalculated with the following formula:

New Target = Old Target * (Actual Time of Last 2016 Blocks / 20160 minutes)

2 Likes
  1. Why is it important to make sure that miners spend money (on electricity) while mining?
    So that they don’t break the rules

  2. Why would it be very difficult for someone to go back change a previously added block?
    Because then they would have to mine all the blocks after that one all over again

  3. How does the network regulate mining difficulty?
    The more miners on the network, the lower the target is set to keep the block times close to 10mins

1 Like

Why is it important to make sure that miners spend money on electricity while mining?
when they are spending money on electricity, they have a bigger incentive to play by the rules while they are mining.
Why would it be very difficult for someone to go back change a previously added block?
Because when you change one thing on a thing of a block, you will make that all previous blocks will change also
How does the network regulate mining difficulty?
How more miners are looking to solve the target, the lower the target and that will increase the difficulty

1 Like
  1. Because it will incentivize miners to be honest. If they weren’t, then they’ll miss out on the block rewards and transaction fees.
  2. It would be difficult to change a previously added block because it will invalidate the links to subsequent blocks, which would have to be re-mined but to do that alone would take too long thus making it infeasible.
  3. The network regulates mining difficulty by lowering the target value. The more miners competing, the more difficult it is to guess the nonce.
1 Like
  1. Why is it important to make sure that miners spend money (on electricity) while mining?
  • This is to ensure that they play by the rules to get incentivized. The idea of paying upfront to get the reward otherwise if they try to go against the network process they not only lose the reward but also lose energy or money in the process.
  1. Why would it be very difficult for someone to go back change a previously added block?
  • Mathematically it does not make sense or is impossible to achieve. If you change a previous block it will affect all other succeeding blocks and the network will detect that and the transaction will get rejected so to say.
  1. How does the network regulate mining difficulty?
  • The more miners there is the more lower the target will be meaning it will be more difficult. In reverse, the less miners there is the higher the hash target will be.
1 Like
  1. Because it forces them not to cheat with block producing
  2. It will take a tremendous amount of computing power to do so, because it requires to mine all the next blocks (and currently producing) again.
  3. More miners in the network - higher the difficulty (lower target hash number)
1 Like
  1. They actually pay upfront to potentially get a reward. They’re incentivised to work and follow the rules. It’s genious :slight_smile:
  2. The hashes of all blocks after the block change and need to be remined
  3. By changing the target and increasing or decreasing the difficulty to guess a nonce lower than the target. The difficulty self-adjusts based on the amount of miners mining and their hashpower
1 Like

If electricity didn’t have to be spent then the system would be vulnerable. If it didn’t require energy and processing power someone could be creating a block every second using a Chromebook and a 51% hack would be far more feasible. This system ensures there are expenses to mining and regulates the market including its fees, hash rate, and other things. Additionally, no-one wants to waste money and if you don’t play by the rules your expenses are for nothing, it’s a good incentive.

Because all the blocks ahead would have to be corrected and any new blocks mined while that is happening would not fit onto the chain, you would be infinitely fighting the hash rate, having your computer compete against all other computers on the network. 1 vs several million is poor odds and would mean that for every time you correct a block the system is miles ahead of you.

Putting a limit on the maximum size of the hash number (basically a number with each digit being base 16) reduces the nonces that could make the block viable. This works because the size of the nonce has no relation to the size of the hash number.

1 Like
  1. Why is it important to make sure that miners spend money (on electricity) while mining?
    The sunk cost of paying for the electricity for mining is an incentive for miners to be good actors and to follow the correct process in order to mine the next block and be rewarded for doing so.

  2. Why would it be very difficult for someone to go back change a previously added block?
    To change a previous block, one would have then alter all blocks in the blockchain which is nearly impossible.

  3. How does the network regulate mining difficulty?
    The higher number of miners the higher the difficulty, this is due to target being set lower which makes the probability of the hash being lower that the target lower as well.

1 Like
  1. The reason that its important is cause it incentivizes the miners to follow the rules and invest more into the mining process to earn more.
  2. This is due to the fact that as long as their are many individuals mining it causes the puzzle to get your block into the chain to be that much harder since you must now go back and remine the blocks that were broken in the chain as well as new ones to become the longest chain in that node.
  3. it regulates mining difficulty by the means that if their are more miners mining the difficultly of finding the nonce to become higher while the number for the nonce for the next block to become very low making it more difficult to find.
1 Like
  1. It is an incentive for the miners to follow the rules or else they have the sunk cost of spending money on electricity without gaining anything.

  2. If you change a block you change the according hash and thus the following blocks would need to be remined in order for them to accept the changed block. Basically you would need to mine all the following blocks, which is impossible.

  3. The target changes depending on the computing capacity of the active miners within a timeframe. The more mining power is on the network, the lower the target will be

1 Like
  1. To create competition between other miners and to earn incentives. The more electricity they use the more powerful they are and faster to solve very difficult cryptographic puzzles.

  2. A miner would have to go back and try to solve many puzzles by themselves and try to recreate and restore links to the blockchain. Which would take too much energy and too much time.

  3. By having more miners the hash rate naturally increases, if the hash rate increases the puzzles the solve become more difficult to solve.

1 Like
  1. to make the process fair and secure
  2. because then you have to solve all the hashing puzzles from that block again until you catch up and the computing power to do so is almost impossible to get, plus it gets exponentially harder
  3. Difficulty makes the target lower so that miners have to spend more time guessing before getting a correct value
1 Like
  • So the reward makes sense to them, to pay for their costs and to ensure some profit.

  • Because when an added block is changed, every subsequent block and link will be invalidated, because this data change represents a change to be done in every subsequent block and link, and not only this but it will be necessary to re-hash every block until get the new nonce to this block and to the subsequent ones…

  • The more people are mining (or the higher the computational power of the network) the higher is the difficult and consequently the lower is the target

1 Like
  1. Why is it important to make sure that miners spend money (on electricity) while mining?
  • to incentivize them to complete the mining process. only by mining honestly will they be rewarded and profit on the process
  1. Why would it be very difficult for someone to go back change a previously added block?
  • because they will have to re-mine that block and all the following blocks on the chain, making it impossible to catch up
  1. How does the network regulate mining difficulty?
  • more miners lowers the target foir mining, making it more difficult
1 Like
  1. Why is it important to make sure that miners spend money (on electricity) while mining?
    They have to spend money on electricity as an incentive, to avoid cheating the network. It make sure that the miners fellow the rules, otherwise there would be no consequence to cheat.

  2. Why would it be very difficult for someone to go back change a previously added block?
    Because if you change a block from the past it would have the consequence to change all the blocks after, it would alter all the hash of the blocks after. It would need some extrodinary computing power and its pretty much impossible.

  3. How does the network regulate mining difficulty?
    The higher the hashrate on the network, the more diffucult it is to mine.

1 Like

1.- To incentivize them to follow the rules to get the reward and thus, to recover what they have already invested in electricity.
2.- Because all the blocks formed after the block that is meant for change would have to be reconstructed as all their hash information will be altered. Therefore it will be very hard to guess all the hashes for the subsequent blocks formed including those formed during the time it took to change the previous block.
3.- The more miners there are, the harder it does become since the target number of the nonce lowers. The protocol estimates the difficulty, maintaining a block creation separation of 10 minutes.

1 Like
Why is it important to make sure that miners spend money (on electricity) while mining?

So they are inclined to follow the rules. If they try to manipulate or alter their data they end up losing money.

Why would it be very difficult for someone to go back change a previously added block?

If anyone changes anything on the previous block it changes the hash on that block which in turn rejects all the blocks that came after.

How does the network regulate mining difficulty?

The network alternates the difficulty by ease of mining. The target block time is 10 minutes if miners are mining faster than the time it increases difficulty, if miners are mining slower than that time it decreases difficulty.

1 Like