Why are transactions grouped into blocks?(puzzle creation)

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.

croraf

Posted 2017-10-21T16:54:14.213

Reputation: 1 112

3As 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 2017-10-21T17:40:46.177

Well, for me word "puzzle" was very clear :).croraf 2017-10-21T17:49:25.373

Answers

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.

Nate Eldredge

Posted 2017-10-21T16:54:14.213

Reputation: 21 420

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 2017-10-21T17:19:59.033

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 2017-10-21T17:23:40.877

I explained myself in the edit of comment, and we are at the same page I think.croraf 2017-10-21T17:25:20.803

@croraf: I kind of wish you would stop using the word "puzzle". It's not a standard technical term in the Bitcoin community, so people are not going to clearly understand what you mean by it, and confusion will result. If you're reading some source that uses this term, I would suggest you look for something that uses more standard and precise language, since obviously you are looking for precise explanations.Nate Eldredge 2017-10-21T17:25:24.340

Give me better term and I'll use it :). So my original question with "puzzle" changed with "target", can you answer that?croraf 2017-10-21T17:29:25.343

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 2017-10-21T17:31:09.350

I consider this a "puzzle" to be solved: "to create a block which has a hash less than a give target"croraf 2017-10-21T17:31:53.410

@croraf: I am not quite sure what your question would mean if you replace "puzzle" with "target", but I edited my answer to try to address it.Nate Eldredge 2017-10-21T17:35:07.273

One comment on your updated answer. I don't think the target is the only thing that defines the "puzzle" but also a hashing function. (Maybe I'm saying something stupid :D). And that after each mined block a new hashing function is given miners use to achive the target?croraf 2017-10-21T17:42:18.173

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 2017-10-21T17:43:04.710

This is hashing family of functions I would say. But the actual functions change each block? Could this be correct? If not, solution of this block gives me the solution of every next block. Maybe I'm mixing terms - but something like that.croraf 2017-10-21T17:44:10.653

1I 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 2017-10-21T17:45:43.293

Cool, thx! For more details I will check in documentation if needed.croraf 2017-10-21T17:47:49.860

I just posted third part of the series of questions :).croraf 2017-10-21T17:55:31.020

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.

Andrew Chow

Posted 2017-10-21T16:54:14.213

Reputation: 40 910

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 2017-10-21T17:17:21.737