How my RPi4 handles 1M tx blocks

9 1186
Avatar for mtrycz
Written by
2 years ago

中文

Following my other article from 2 months ago, I decided to get the new shiny v23.0.0 of BCHN for a ride on my favorite Raspberry Pi. Credit goes to Bitcoin Cash Node for their amazing work. If you want to know more about Scalenet, head to the awesome article by Mr Toomim. Also, check out the other articles in this series: 1, 3, 4.

The new v23 is very important, because it removes a legacy technology called child-pays-for-parent, which has no use in a big block chain. This enables unbounded transaction chains, for which there are already several usecases; this will be enabled on May 15th. The fine people at BCHN took this opportunity to rework how the mempool works, so I was very curious to take if for a ride.

Methodology

Just like the last time, here is my setup:

  • BCH's Scalenet

  • RaspberryPi4 (8GB version, with a 64bit OS), with a nice passive cooling case (keeps temeprature below 60C and helps with throttling)

  • an 8GB Sd card I had lying around

  • A spare 256GB NVMe SSD attached through an USB3 adapter (I upgraded my laptop to 1TB, so I found a use for this one).

  • BCHN node software (release version 23.0.0 with no particular patches)

  • RPi Monitor software

Total cost: 12 tx fees on the BTC network (as of time of writing - subject to change).

The RPi4 is particularly great for this kind of tests. It's the very minimum to run a node on Scalenet, but it's still a capable system. Tests are very consistent (no processor throttling - low variance). It's readily available all around the world so the results are very reproducible - just grab one yourself.

Results

Transaction acceptance

First of all, I checked how many transactions per second the mempool rework allows. I have fired up the awesome txunami tool by Mr Stone, and sent transactions at a rate of 20.000 tx/s.

  • v22 accepted transactions at a rate of 1050 tx/s

  • v23 accepted transactions at a rate of 1350 tx/s

That's 28% speedup. Cool!

I'll also note that if there were long transaction chains, v22 would slow down to half of its maximum, while v23 would not.

1M transactions in long chains

Next, I generated a lot of transactions with maximum chain length and tried to generate a block template. This functionality is very important to miners, and having the very best performance here will earn you money.

As a result I had one million transactions in 20.000 chains of length 50. How did my RPi4 deal with it?

  • v22 generated a block template in 271 seconds

  • v23 generated a block template in 31 seconds

What!? That's almost 1/10th of the time! An 88% improvement!

To put things in context, in performance optimization a 3% improvement is very nice, and 10% is earth shattering. An 88% improvement is a huge win.

1M transactions with no chains

"But mtrycz", I hear you say, "you've synthetized that block for the very worst case for v22". Well then, let's make it easy on the old mempool.

I generated one million of independent transactions, there were no chains. How did the two versions handle it?

  • v22 generated a block template in 36,5 seconds

  • v23 generated a block template in 23,5 seconds

So still at least 35% improvement !

Conclusions

BCHN v23.0.0 brings a whole lot of performance improvement. And not just in the extreme cases - it offers a very cool boost in all cases! If you wanted, you could try to mine full 256MB Scalenet blocks on a Raspberry Pi directly.

And it will bring us, along with all the other nodes, unbounded transaction chains on May 15th. Cheers!

Bare in mind that these numbers are for the very bare minimum system that can handle Scalenet. Your laptop from 3 years ago will do at least an order of magnitude better.

What's Next?

What!? 35%+ is not enough for you?

Well, I had the opportunity to try out a pre-release of the next version of BCHN, and it sports a further 6% boost on top of that for generating block templates. More on that in a month (or two) ;)

22
$ 57.13
$ 13.00 from @emergent_reasons
$ 12.28 from @TheRandomRewarder
$ 5.00 from @im_uname
+ 18
Avatar for mtrycz
Written by
2 years ago

Comments

Total cost: 12 tx fees on the BTC network (as of time of writing - subject to change).

😂

$ 0.00
2 years ago

It would be interesting to see block validation times too. There have been some big changes in block validation (specifically in removeForBlock(...) in v23.0 and more in the to-be-released v23.1, so it would be interesting to see how that is progressing on the Pi.

$ 0.00
2 years ago

Fantastic and informative article, visiting this series for the first time

$ 0.00
2 years ago

Thanks for testing on the RPi. The speed increase is pretty amazing. One think I haven't seen anyone do so far is benchmark the different BCH nodes against each other to see which is faster in which areas. If you're up for it, that is something I'd love to see.

$ 0.00
2 years ago

Hey, thanks! I have had little success with running the other node implementations, specifically because of bigger RAM requirements, and that's something I cannot alter on the RPi (the 8GB version just came out and for now it's the biggest).

I did try to run mainnet with other distros, and I found the flowee was the fastest to process transactions. But yeah, I generally stick with BCHN.

$ 0.00
2 years ago

That's also good to know!

$ 0.00
2 years ago

Great article! I love this series! :)

$ 0.10
2 years ago

Am I correct in assuming the 1m tx is roughly ~200mb of transactions?

$ 0.00
2 years ago

Yes, roundabout that. In the previous article, the OP generated 255.9 MB blocks with around 1.3 million tx in them, which suggests an average transaction size of around 190-200 bytes from txunami with his configuration. That would suggest 190-200 MB block sizes from 1M tx.

$ 0.00
2 years ago