> The PoW is suffice if the hash begins with a certain number of 0s This is a common explanation of PoW, but is actually incorrect. If you think about it, this would mean that the PoW difficulty could only increase (or decrease) by a factor of two. In reality, the block hash is simply interpreted as a (very large) number, and this number must be less than some other very large number (the "target"). So you do end up…
Bitcoin From Scratch – Part 1
21–30 of 77 posts
Re: Bitcoin From Scratch – Part 1
#22Re: Bitcoin From Scratch – Part 1
#23Re: Bitcoin From Scratch – Part 1
#24Clear, concise and to the point. Looking forward to reading the rest. If you finish the whole series and fix/improve the posts in this sequence using the feedback from here, I think it might serve as one of the go-to pages for technically inclined people who are interested to learn about Bitcoin and blockchains.
Except they’re polarising as hell. Expect someone to chime in and state how they are a complete waste of time and energy.
Re: Bitcoin From Scratch – Part 1
#25Earlier quoted context omitted.
TIL. I wonder why that myth is so commonly perpetuated.
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
#26Clear, concise and to the point. Looking forward to reading the rest. If you finish the whole series and fix/improve the posts in this sequence using the feedback from here, I think it might serve as one of the go-to pages for technically inclined people who are interested to learn about Bitcoin and blockchains.
Except they’re polarising as hell. Expect someone to chime in and state how they are a complete waste of time and energy.
Re: Bitcoin From Scratch – Part 1
#27Earlier quoted context omitted.
> 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…
I did not read the sentence you are responding to as implying it was changed after final network launch, only that it was changed.
No bitcoin software was ever released that worked another way.
Re: Bitcoin From Scratch – Part 1
#28[0] https://youtu.be/3CMucDjJQ4E
(+) For the people with background in CS: it might be that the video at some point talks about the number of zeros instead of the comparison, but really, it does not detract a 'bit' from its value.
edit: formatting
Re: Bitcoin From Scratch – Part 1
#29Earlier quoted context omitted.
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
There’s a difference between mining bitcoins, and mining for network fees.
Re: Bitcoin From Scratch – Part 1
#30The main logic is a few hundred lines of code: https://github.com/tlrobinson/tomcoin/blob/master/src/node.j...
A somewhat unique aspect is since it's written in JavaScript a node can run on the server or the browser, which makes for easy demos:
1. Open https://tomcoin.herokuapp.com/ and https://tomcoin1.herokuapp.com/ in two browser windows (the private key is stored in localStorage so using different domains ensures each gets a different wallet)
2. Click "Start Mining" on one or both nodes
3. Once you've mined some TomCoin (should just take a few seconds unless more people start mining) copy the public key from one node to the other's "publicKey" field, enter an amount, and click "Transfer"
4. Wait for another block to be mined and you should see the balances transfer
(There's no persistence so the chain will reset when all the Heroku nodes idle out and other nodes close)
(It also just uses WebSockets to connect to the instances on Heroku, or in theory other server instances people are running. I meant to implement WebRTC for P2P between browser nodes but never got around to it)