1

Why are transactions grouped into blocks (PART 2)?

  1. Let's say we have just put a block on a chain. At that moment does a protocol create a new unique puzzle to be solved? Is the new puzzle known before that moment? Can different puzzles coexist at the same time (so that users solve different puzzles in parallel)?

EDIT: Puzzle in this sense means a combination of target (that changes every 2016 blocks), a hashing function, and other protocol imposed requirements miners use to guess the solution.

  • 3
    As a minor rant, my personal opinion is that "informal" Bitcoin texts, although well meant, are responsible for a vast amount of confusion and misunderstanding. Metaphors like "puzzle" invariably give a mistaken impression about something crucial. People whose goal is to get a precise understanding should go straight to the formal technical documentation. – Nate Eldredge Oct 21 '17 at 17:40
  • Well, for me word "puzzle" was very clear :). – croraf Oct 21 '17 at 17:49
6

The "puzzle" metaphor may not be helpful. The goal is always the same: create a block whose header has a sufficiently small hash value, less than the current target.

So every miner can create a block any way she wants, as long as it meets the general requirements of the protocol (all transactions are validly signed, block reward is no larger than the current standard value, etc), and then start varying the nonce value in hopes of finding one which makes the hash sufficiently small. There is no single centralized authority or protocol that hands out blocks for people to work on.

In practice, this means that no two miners are ever working on exactly the same block. Two different solo miners will have different blocks, because each will have a coinbase transaction that pays the reward to his own address. Two different members of the same pool will be assigned different variants of the same block, in order to avoid duplication of work (perhaps each will put his own identifier somewhere in the block).

The target is, in some sense, uniquely determined by the protocol. The Bitcoin protocol specifies how the target is to be computed, based on the timestamps of prior blocks; this is what ensures that it adjusts with the total mining power of the network to keep the block time approximately constant at 10 minutes. It should be the case that all miners on the network are using the same target value to compare with their blocks.

So in that sense, everyone is trying to solve the same "puzzle" (aiming for the same target), but everyone is trying a different approach to do so (a different candidate block).

The target only changes every 2016 blocks (approximately every two weeks). So most of the time, you can know what the target will be after the next block: same as the current target. If the next block would be a multiple of 2016, then you will need to wait until it is mined, because its timestamp will be involved in the computation of the next target.

  • I understand that protocol does not give block to mine, but I thought it gives the new puzzle when some block is put on the chain. That users create blocks and try to solve this puzzle. Well, can't it be said that the puzzle (to guess a valid hash) is given by the protocol? – croraf Oct 21 '17 at 17:19
  • Are you talking about the target? The "puzzle" is to create a block whose header has a hash value which is less than the target. It's true that the protocol defines the algorithm by which the target shall be calculated, based on the times at which prior blocks were mined, and so in that sense the protocol "gives" the puzzle, but the way you're saying it is rather confusing. – Nate Eldredge Oct 21 '17 at 17:23
  • 1
    @croraf There really is no puzzle or anything analogous. There is not anything which the protocol gives to miners to do; miners make the blocks themselves to mine it. The protocol gives miners a goal: to create a block which has a hash less than a give target. The protocol gives the target. – Andrew Chow Oct 21 '17 at 17:31
  • 3
    @croraf: True, in some sense the hash function is part of the puzzle, but it never changes. The hash function is always SHA256D. Also part of the "puzzle", in that sense, are the protocol's requirements for what makes a valid block, including the fact that it shall contain the hash of the previous block. – Nate Eldredge Oct 21 '17 at 17:43
  • 1
    I don't think that's a correct way to put it. SHA256D is a single particular function which takes an input of arbitrary length and outputs a 256-bit hash. We always use this function. But the protocol does impose particular requirements for how the input ought to look, and the values do change from one block to the next (most obviously, the hash of the previous block). As such you cannot use the same block twice in the chain. – Nate Eldredge Oct 21 '17 at 17:45
0

Lets say we have just put a block on a chain and there are no blocks at the moment that users mine. At that moment does a protocol create a new unique puzzle to be solved? Is the new puzzle known before that moment? Can different puzzles coexist at the same time (so that users solve different puzzles)?

As I said in my previous answer, this is not how mining works. There is no central authority or protocol which hands out blocks to miners for them to work on. Rather each miner creates their own blocks and works on them. Each miner works on a unique block that is created independently of other miners.

  • Yes I understand that. I just thought that a new puzzle is created by protocol when a block is put on the chain. And then the miners try to solve that puzzle by creating their own blocks (with a value that can possibly solve the hash puzzle). – croraf Oct 21 '17 at 17:17

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.