I am confused about how getdata() is actually implemented at full nodes.

Suppose a full node receives a getdata() request with MSG_BLOCK flag and a hash H of some block B. Then would it simply look up H into its levelDB database to fetch B from its disk and return it to the caller (in constt time) or something more expensive is done?

Can I also get some references to read about it?

1 Answer 1


There isn't even a database lookup in Bitcoin Core. All blocks and mempool transactions are indexed by hash in memory. It's typically just serializing from memory, or one disk read directly sending disk data to the network.

Your Answer

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

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