I am attempting to construct a mini full node in order that I can perceive precisely how they function. I’ve managed to get a number of elements of the P2P api working nevertheless I’m caught with basic items like ‘getblocks’ and ‘getheaders’
For instance I’ve the next block hashes I’m fascinated with:
block_hash = "000000000000592589e55cda6e8a093998e8356ea770d4aaeb7c0f5439b147d7" block_stop = "000000000000017a09017d52db538d7a9ddcc48311866d7e5fdbbbec7d0faad5" Command: getblocks Request: 0b110907676574626c6f636b73000000450000002a0af9950100000001000000000000592589e55cda6e8a093998e8356ea770d4aaeb7c0f5439b147d7000000000000017a09017d52db538d7a9ddcc48311866d7e5fdbbbec7d0faad5
My query is: Why am I getting again 500 inv objects when the cease hash is only one block away from the block locator ? (Btw the identical factor occurs to me once I’m utilizing getheaders as a substitute of getblocks)
Okay so I’ve swapped the endian-ness of the information I am sending. I additionally needed to swap the block locator and cease round as a way to get a response (so the cease hash is at a block top decrease than the locator) which makes me really feel like I am making extra errors right here.
When doing this I nonetheless obtain 500 inv on the instance above, nevertheless if I take advantage of these two as a substitute:
block_stop = "0000000000000049a7ce260de7fcf63f34acf3fe1c5b2040ae77b9bdaf1abb38" block_hash = "000000000000013d8a77f222805b1dca31d0fb48d60b29098c77609de5f93811 ACTUAL MESSAGE: 0b110907676574626c6f636b7300000045000000a83c12f901000000011138f9e59d60778c09290bd648fbd031ca1d5b8022f2778a3d0100000000000038bb1aafbdb977ae40205b1cfef3ac343ff6fce70d26cea74900000000000000
it accurately returns from the peak I require, nevertheless it returns all the blocks till the most recent block as a substitute of the one which I am after. Am I misunderstanding the purpose of this API ? I used to be below the impression it returns block particulars however as a substitute it simply returns lacking block hashes. How do I then discover out what transactions occurred in that block?