How strict are the time validation rules?
If the next block is mined more than 2 hours after the current block, would this not stall the blockchain?
It doesn't break the rule "Full nodes will not accept blocks with headers more than two hours in the future according to their clock."
Nor does it break the rule "Must be strictly ...
I think you have a misconception about what this clause means:
Full nodes will not accept blocks with headers more than two hours in the future according to their clock.
You appear to be interpreting this as, if a new block is more than two hours later than the previous block, then do not accept it. That is incorrect. This clause is not about gaps in time ...
Once the mining pool has the list of all of the transactions they are including in that block, they calculate the merkle root for this list of transactions, then they distribute the block header, that includes the merkle root, to miners to work on.
So, no, it's not constantly being updated, unless for some reason a new transaction was being added or removed ...
The getheaders message allows you to list multiple block hashes. So instead of just putting the current chain tip, you can insert multiple block hashes. Responding nodes will see if any of those hashes are in its main chain and start sending headers from there. Since reorgs tend to be small, you could put the most recent 10 block hashes and it should be ...
In Mastering Bitcoin there is this diagram which shows the data included:
Previous Block Header Hash
Other sources indicate that the version number from the block header is also included in the data hashed.
The difficulty, which is loosely an inverse of the target, is in a compact representation known as "bits&...
Concatenation means the joining of the second sequence at the end of the first sequence. For example, with strings, the concatenation of "hello, " and "world" produces the string "hello, world".
For TXIDs, they are taken as a 32-byte array. The concatenation of the two TXIDs produces an array of 64 bytes, which then becomes the ...
The SHA256 hash algorithm produces what looks exactly like a random number in the range 0 to 2256-1 (1.1579208923731619542357098500869e+77). Each of those values should be equally likely.
So if you produce a large number of these by altering the data to be hashed, you cannot steer the results and most of the results will be a large number.
Some of the ...
Bitcoin difficulty is not determined by the "number of zeros", but none the less the Bitcoin genesis block would satisfy a difficulty target substantially higher than might be expected. This doesn't really mean anything in the scheme of how the system operates, it's just a curiosity.
They don't, actually.
The protocol for finding the best headers chain is fairly simple: a single peer is asked for the 2000 headers following the last known block header the node knows it and the peer have in common. When these headers arrive, it is asked for more. This process repeats until either a timeout is hit, or a point in time close to the present is ...
Firstly, you have a name conflict; hash is both the std::string argument passed to calcHash(), and also the name of your CryptoPP::SHA256 object. This code won't even compile, so are you sure this is the code you're using?
The code itself is somewhat difficult to read, too, because you pass around anonymous objects to nested constructors in an attempt to be ...
You can take advantage of Blockchain.com's API (formerly Blockchain.info).
You can access BTC blocks based on their block height via a URL of the form https://blockchain.info/rawblock/<height+1>. We use <height+1> because 1 is used as the index of the genesis block, which is instead usually referred to as block 0, as it is defined to have a ...
Update: There is some discussion about timestamps here- https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-October/018251.html
When a Bitcoin block is produced there are essentially two times involved:
The timestamp in the block header, put there by the miner
The actual time the block was produced.
Bitcoin has two mechanisms to protect against ...