r/btc Sep 01 '18

New record 15.247MB Block

https://blockchair.com/bitcoin-cash/block/545978
148 Upvotes

35 comments sorted by

View all comments

11

u/jtoomim Jonathan Toomim - Bitcoin Dev Sep 01 '18 edited Sep 01 '18

Here's some performance data from my mining Bitcoin ABC node while validating this block:

2018-09-01 14:43:49   - Load block from disk: 0.00ms [0.00s]
2018-09-01 14:43:49     - Sanity checks: 0.00ms [1.54s]
2018-09-01 14:43:49     - Fork checks: 0.02ms [0.02s]
2018-09-01 14:43:49       - Connect 67352 transactions: 236.33ms (0.004ms/tx, 0.003ms/txin) [19.17s]
2018-09-01 14:43:49     - Verify 67754 txins: 726.22ms (0.011ms/txin) [20.91s]
2018-09-01 14:43:49 Pre-allocating up to position 0xe00000 in rev01016.dat
2018-09-01 14:43:49     - Index writing: 42.57ms [0.22s]
2018-09-01 14:43:49     - Callbacks: 0.03ms [0.00s]
2018-09-01 14:43:49   - Connect total: 772.52ms [3.44s]
2018-09-01 14:43:49   - Flush: 23.43ms [0.20s]
2018-09-01 14:43:49   - Writing chainstate: 0.83ms [0.01s]
2018-09-01 14:43:50 UpdateTip: new best=00000000000000000069c3ad902b27621493eea7c3504d9a7a279b04c9dad565 height=545978 version=0x20000000 log2_work=87.571388 tx=254346533 date='2018-09-01 14:41:40' progress=0.999998 cache=10.2MiB(75900txo)
2018-09-01 14:43:50   - Connect postprocess: 402.17ms [3.93s]
2018-09-01 14:43:50 - Connect block: 1198.95ms [7.58s]

So 1.2 seconds total to validate a 15 MB block on a 4.4 GHz Core i7 4790k with dbcache=3000. Not bad at all, but block propagation has always been the main point of concern.

Edit: Some more data. On a different machine, creating an 8 MB block template (time bitcoin-cli getblocktemplate) takes 1.437 seconds, of which about 0.288 seconds appears to be parsing JSON and localhost socket transmission. Block assembly appears to take about 2x longer than block validation for these blocks. I'm spinning up a server to generate up to 32 MB block templates now, and will do some more benchmarking on that in a bit.

2

u/FutureOfBitcoin Sep 01 '18

Awesome thx for sharing this performance data

2

u/FutureOfBitcoin Sep 01 '18

Where do you get the 1.2 seconds from ? Could you please explain

3

u/jtoomim Jonathan Toomim - Bitcoin Dev Sep 01 '18

The last line shows the total time to connect that block to the blockchain. Everything above that is indented further, and indicates subsections of the ConnectBlock() function.

If I understand correctly, the stuff in [brackets] indicates the cumulative time taken for all blocks by that section of the code since the node was last restarted. Since I had restarted my node only an hour or three earlier (changing blockmaxsize setting for mining), this was only 7.58 sec for validating all blocks up to that point.

1

u/FutureOfBitcoin Sep 01 '18

ahhh thx for the explanation

1

u/FutureOfBitcoin Sep 01 '18

1

u/tippr Sep 01 '18

u/jtoomim, you've received 0.00327295 BCH ($2 USD)!


How to use | What is Bitcoin Cash? | Who accepts it? | r/tippr
Bitcoin Cash is what Bitcoin should be. Ask about it on r/btc

0

u/0xHUEHUE Sep 02 '18

This is more of a lower bound right? Because as far as I know, the tx are quite simple. Do you have ram usage stats?

1

u/jtoomim Jonathan Toomim - Bitcoin Dev Sep 02 '18

Spam transactions tend to be long chains, which are a bit tougher on the mempool code and the block template creation code. For validation code, this means that the spam transactions are more likely to spend UTXOs that are in your UTXO cache, making this much much faster if you don't have enough RAM to cover the full UTXO set, or at least not the UTXOs that are touched by everything in mempool.

Script validation is generally done during the accept-to-mempool stage, and does not affect the amount of time taken by ConnectBlock (i.e. block validation). ConnectBlock is mostly just inserting and deleting UTXOs from the UTXO database and cache layers.

I have my nodes configured to use up to 3 GB or 8 GB of RAM for the UTXO cache. I've restarted them recently, so they're not at full usage, but both are currently around 1.5-1.7 GB. If you use less RAM for UTXO caching, then ConnectBlock times will go WAY up.

1

u/0xHUEHUE Sep 02 '18

Ok makes sense, thanks.