News for hackers. Stuff that matters.
Re:Bitcoin From Scratch – Part 1 by Jasper_ on Friday July 03, 2020 @08:47PM (#23729024)
It used to work this way, but got changed to a less-than check for performance reasons. The Bitcoin whitepaper [0] even has the original approach:

> The proof-of-work involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits.

[0] https://bitcoin.org/bitcoin.pdf

Re:Bitcoin From Scratch – Part 1 by garmaine on Friday July 03, 2020 @09:50PM (#23729329)
Bitcoin never worked that way. However the original hashcash proposal was specified as leading zeroes. I presume that’s what you are mixing up with.
Re:Bitcoin From Scratch – Part 1 by nemo1618 on Friday July 03, 2020 @08:57PM (#23729065)
> but got changed to a less-than check for performance reasons.

Performance as in "it takes less time to verify the PoW," or something else? Because the "leading zeros" and "less than target" approaches would both take a negligible amount of time.

Re:Bitcoin From Scratch – Part 1 by Jasper_ on Friday July 03, 2020 @09:02PM (#23729095)
The story I was told from Bitcoin developers was that it was done for code performance reasons. However, since the less-than check goes back all the way to the code's "Initial commit" [0], I'm not sure if that's fully accurate -- it might have been based on correspondence from the original author. At the very least, the misconception comes from Bitcoin's own whitepaper.

[0] https://github.com/bitcoin/bitcoin/blob/e071a3f6c06f41068ad1...

Re:Bitcoin From Scratch – Part 1 by nemo1618 on Friday July 03, 2020 @09:26PM (#23729209)
Weird. That doesn't make any sense to me.

btw, the whitepaper probably used "number of leading zeros" because that's what Hashcash does.

Re:Bitcoin From Scratch – Part 1 by monokh on Friday July 03, 2020 @09:33PM (#23729247)
The article mentions the hash is required to begin with a certain number of 0s in hex digits (half byte) whereas the Bitcoin whitepaper refers to it as number of bits. I'm unsure about the comparison (== or >) but the whitepaper seems accurate with regards to the target.
Re:Bitcoin From Scratch – Part 1 by nullc on Friday July 03, 2020 @09:49PM (#23729322)
> It used to work this way, but got changed to a less-than check for performance reasons.

I don't know who told you that, but they were weirdly confused.

It not unlikely the case that sometime early in development (long before publication) that it was bits-based, not only is this how the standard hashcash code works-- but the Bitcoin code calls the relevant field that encods the difficulty "bits".

But Bitcoin itself never worked that way, not from the first instant. Changing it would have been a consensus incompatible change, and Bitcoin is still more or less consensus compatible all the way back. (There are outright bugs that make the old software get stuck, but if you fix those, it follows along).

Re:Bitcoin From Scratch – Part 1 by joosters on Saturday July 04, 2020 @05:34AM (#23731215)
I don't know who told you that, but they were weirdly confused.

The bitcoin whitepaper told them that, in more than one place too, so it's not a simple typo, e.g.

...we implement the proof-of-work by incrementing a nonce in the block until a value is found that gives the block's hash the required zero bits.

Re:Bitcoin From Scratch – Part 1 by saurik on Friday July 03, 2020 @10:39PM (#23729583)
I did not read the sentence you are responding to as implying it was changed after final network launch, only that it was changed.
Re:Bitcoin From Scratch – Part 1 by nullc on Saturday July 04, 2020 @01:43AM (#23730401)
Well there is no evidence of that other than "bits" and that's how hashcash worked. Sounds like an invitation on the meaning of the word "changed".

No bitcoin software was ever released that worked another way.

Re:Bitcoin From Scratch – Part 1 by sodascripts on Friday July 03, 2020 @08:49PM (#23729037)
Gotcha, thanks for the explanation.
Re:Bitcoin From Scratch – Part 1 by jbverschoor on Saturday July 04, 2020 @01:04AM (#23730265)
There’s a difference between mining bitcoins, and mining for network fees.
Re:Bitcoin From Scratch – Part 1 by trickstra on Saturday July 04, 2020 @01:52AM (#23730442)
What difference would that be? Both the fees and the block reward go to the miner who first published a valid block with hash lower than the current difficulty. The only difference is where those bitcoins came from, but that has no impact on how easy it was to mine.
Re:Bitcoin From Scratch – Part 1 by exdsq on Saturday July 04, 2020 @03:46AM (#23730822)
Yeah as a miner you add the fee and the earned coins to the single coinbase transaction, so it’s a single mining action to get both.