3

I am just wondering if the devp2p protocol, which is used for node to node communication, has support for data compression?

I am asking this, because it could be useful for faster block propagation within the network. Especially, when the tx count / block increases in the future.

So far, I haven't found a hint for it in:

2 Answers 2

3

Yes - this came with snappy compression via EIP 706 (https://github.com/ethereum/EIPs/pull/706) - implementation in go-ethereum via https://github.com/ethereum/go-ethereum/pull/15106

3

I had to dig around to find the hint that I was pretty sure existed :-)

It's in the Design Rationale document, under Compression algorithm.

The wire protocol and the database both use a custom compression algorithm to store data. The algorithm can best be described as run-length-encoding zeroes and leaving other values as they are, with the exception of a few special cases for common values like sha3('').

The relevant code is in the go-ethereum/p2p directory on GitHub.

I can't immediately see how the Wire Protocol code calls into where I assume the custom compression is implemented (which is either common/bitutil/compress.go or compression/rle/read_write.go?), and there are actually some calls in the RLP code to Snappy (Google's compression library).

Perhaps further investigation is required to be sure...

3
  • 2
    Okay, @ligi's answer gives you the hard facts :-) Mine just waffles on. Apr 8, 2018 at 20:31
  • 2
    I wish, I could mark both as a valid answer, but since ligi was faster, he's getting the +15 bonus. :-).
    – ivicaa
    Apr 8, 2018 at 20:32
  • Actually AFAIK RLP and Snappy are the only compressions algorithms used in devp2p/rlpx. Any clues on what the Compression Algorithm section in your find is referring to?
    – Sentinel
    Jul 9, 2018 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.