I'm trying to build a mini full node so that I can understand exactly how they operate. I've managed to get a few parts of the P2P api working however I am stuck with basic things like 'getblocks' and 'getheaders'
For example I have the following block hashes I am interested in:
block_hash = "000000000000592589e55cda6e8a093998e8356ea770d4aaeb7c0f5439b147d7" block_stop = "000000000000017a09017d52db538d7a9ddcc48311866d7e5fdbbbec7d0faad5" Command: getblocks Request: 0b110907676574626c6f636b73000000450000002a0af9950100000001000000000000592589e55cda6e8a093998e8356ea770d4aaeb7c0f5439b147d7000000000000017a09017d52db538d7a9ddcc48311866d7e5fdbbbec7d0faad5
My question is: Why am I getting back 500 inv items when the stop hash is only 1 block away from the block locator ? (Btw the same thing happens to me when I'm using getheaders instead of getblocks)
Ok so I have swapped the endian-ness of the data I'm sending. I also had to swap the block locator and stop around in order to get a response (so the stop hash is at a block height lower than the locator) which makes me feel like I'm making more mistakes here.
When doing this I still receive 500 inv on the example above, however if I use these two instead:
block_stop = "0000000000000049a7ce260de7fcf63f34acf3fe1c5b2040ae77b9bdaf1abb38" block_hash = "000000000000013d8a77f222805b1dca31d0fb48d60b29098c77609de5f93811 ACTUAL MESSAGE: 0b110907676574626c6f636b7300000045000000a83c12f901000000011138f9e59d60778c09290bd648fbd031ca1d5b8022f2778a3d0100000000000038bb1aafbdb977ae40205b1cfef3ac343ff6fce70d26cea74900000000000000
it correctly returns from the height I require, however it returns all of the blocks until the latest block instead of the one that I'm after. Am I misunderstanding the point of this API ? I was under the impression it returns block details but instead it just returns missing block hashes. How do I then find out what transactions happened in that block?