I'm interested to know how long does it take to validate a Bitcoin block on average home pc. I'm less interested in a precise number. I'm fully aware that it can be different between different machines. I'm more interested in an estimation. Previous answers didn't provide a number or even rough calculation.
1 Answer
Your question doesn't actually provide enough context even with the proviso that you don't care about which machine specifically.
Do you mean cold-cache during initial block download or do you mean at the tip of the chain on a running node? The difference on this point is probably two orders of magnitude in speed.
Usually, at the tip almost no transaction validation is done at all except for double-spend consistency at the time a block is accepted: all the transactions have already been received and validated.
Do you want a time for processing just a single block without the necessary database writing that is usually batched across many blocks? The difference here is perhaps a factor of two in speed in the uncached case, much more in the cached case.
You can run bitcoin core with -debug=bench to cause it to log detailed timings for the various parts of validation to see validation on your own system.
Order of magnitude numbers are on the order of a couple milliseconds for the common at-tip fully cached case to a couple seconds for cold caches and flushing. Potentially minutes if the block were adversarially constructed.
-
Thank you for the answer, I will be more specific: I'm running a rough simulation that calculates the time it takes to propagate a block. For simplicity reasons, I would like to make all nodes identical. Meaning equal bandwidth and equal propagation delay between every two nodes. I would also want to use a rough estimation for the time it takes to validate a block. I know that some of the transactions were already approved, but others were not. That's why I'm interested in the estimation, which takes into account: average new transactions per block, computational power etc.– MORTAL9Commented Nov 7, 2018 at 15:58
-
In Bitcoin blocks aren't validated before being propagated the vast majority of the time. (With BIP152 they're propagated before validation if all the data is known in advance, with FIBRE they're always propagated before validation) In a recent range of 288 blocks, I see 11 blocks where there was 1 or more unknown transaction with an average rate of 0.059 unknown transactions per-block. As an aside, the Bitcoin network exploits unequal delays to get faster propagation. Commented Nov 7, 2018 at 23:01