It is not clear to me if the bitcoin p2p protocol actually allows this. I want to connect to the p2p network and then ask the peers to send me all blocks of the last 10 days. In my impression it may even require using BIP37, bloom filtering, but I am not sure about that.
Does anybody have an idea how I can use bitcoin-p2p to achieve this?
Assuming that you can find the hashes of the blocks for the last ten days, it should be possible by sending “getdata” messages. Bloom filtering may not help in this case, unless you want to receive merkle blocks (with only relevant transaction hashes) instead. It should be possible to determine the last ten days of blocks by building a chain of headers, similar to the new headers-first syncing it Bitcoin Core.
Using the insight-api or bitcore-node may also be helpful, as you can query by ranges of dates.