I’m making an attempt to run a easy python script to synchronise the Bitcoin block headers for an SPV shopper, utilizing the python-bitcoinlib. That is the code that I’m operating, after doing the handshake:

msg = msg_getheaders()
locator = CBlockLocator()
hash_b = '000000000000000000003e2f9b46d6394450ee3e4bf4bc04ce77a9b3118d5933' 
locator.vHave = [lx((hash_b))]
msg.locator = locator

print(msg.to_bytes())
s.sendall(msg.to_bytes())

f = open('D:/headers_output.txt', 'wb')
whereas True:
    response = s.recv(buffer_size)
    f.write((response))
    if not response:
        break
    print(binascii.hexlify(response))
f.shut()

Nonetheless, the response I get appears extra like nonsense to me, as I obtain a whole lot of information even when I’ve a locator containing the hash of a block having simply 10 confirmations. For instance, the response for the above:

b'f9beb4d973656e646865616465727300000000005df6e0e2'
b'f9beb4d973656e64636d70637400000009000000e92f5ef8'
b'000200000000000000f9beb4d973656e64636d70637400000009000000ccfe104a000100000000000000f9beb4d970696e6700000000000000000800000041379cf3228f9ff9ae8fa1f0f9beb4d967657468656164657273000005040000cdd875d27f1101001f457c0b83bea98736461d32eb8d58d4ce4c06e368093206000000000000000000dd40e1960729f30e71a3b843a8868a675cc589eacc570d0000000000000000002a43f8654a3fcd530f122e8479c952cf3fac9af64f4503000000000000000000780aadf79db7b3283b6102156871eca59abe5a1a73910b000000000000000000a431ebfebd4b80f0b96f9d4fb7dffbc583120a0e6f25080000000000000000001461561148de3061008847118eab0a6f81d69ca6832e05000000000000000000908ed8d8b44787b138f643f243db03358af4ac077fbc02000000000000000000cd470d211ac2a690d2a49ba948eab78a11880f1479fb0b000000000000000000656390ab7b8c0f3d2a07d36e1f01732244d2ea775e4702000000000000000000fc22582ff69f28d54a4319ae7ed75a928b00562ecb160c00000000000000000053d6f343bb86d10530f3b138b40781dbc820e38681c70d00000000000000000033598d11b3a977ce04bcf44b3eee504439d6469b2f3e00000000000000000000c2742e0c72fa8a8b1eefbddb34f8cae8c4aceeace4450e000000000000000000d4f054c9d3a25b05a0c79fdecbe01763559ce997e1f40a000000000000000000f54f2e09e8dd129950db52advert54d147620317ef507df405000000000000000000acc2d9b4c951f3179a79961dac8af78e7aa31f621af80400000000000000000098329e8ce7baaf9fb119504f42a6ac3123483da913df00000000000000000000ef12d6178318b10c274318dc9e303dc9aa9b662494590e0000000000000000007a7ee2fb98a8b6ecd7f7e24d78c2969edee95fb0aacd0800000000000000000085f93867be12626a7be53cefd9e9e8da7b57da6a12c60300000000000000000031a8e33f5bf1f9deed95029dde48c7324dde1cd1642c0f000000000000000000db479aeac2be9981bd22b2436bacdb2811c0f471406802000000000000000000702b2d5e0c45c4b1850455b3d9609b73747e7c5639cd00000000000000000000b2d2719db5f17a403f1698fa47fb16ada2b4b0678ac80a0000000000000000007ceaf9ff7dee5dc85ce1f1882bc5c1c678293a63a3510c000000000000000000944c815c2da479c7c8fbb4f12da2e130e42a9fc60855040000000000000000004d83fbb184eb735c839ce5fe7c807776245b93e70e3f22000000000000000000cd9d5e4e11be5fea216bb1a71aae6c3ba2d380f37e883a000000000000000000f9e3c466d2012edbc663715ce7fa35c8bf1119ae6a7428080000000000000000749ecf02a77272fe91aa36791fcc363cc1895f2c999f50d4b1680000000000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900000000000000000000000000000000000000000000000000000000000000000000000000f9beb4d966656566696c74657200000008000000e80fd19fe803000000000000'
b'f9beb4d9686561646572730000000000cd0300005507964a0c00e0ff2733598d11b3a977ce04bcf44b3eee504439d6469b2f3e00000000000000000000f5d5f75d1e81109ae6cd4627db83dd697d2ad134f79dba373f335cd2ec9d8a1e80e55d5f123a10174a39acce0000e0ff3753d6f343bb86d10530f3b138b40781dbc820e38681c70d00000000000000000027fb4aff7fcaa7707b19aa24faa3412ac0630ea2a99dc84cac8e21502674288835e65d5f123a101729dd0cc60000000020fc22582ff69f28d54a4319ae7ed75a928b00562ecb160c000000000000000000c8eb0123ccad32424781960e050a60b92b22f750256357683bf5ef3080eb09ac5ce75d5f123a101733aeed290000000020656390ab7b8c0f3d2a07d36e1f01732244d2ea775e470200000000000000000054d9f8b4d1671991ee3fbd933bbf32af69125c70e5bba7dd1a6bd632962fe80b07ea5d5f123a1017056466f40000008020cd470d211ac2a690d2a49ba948eab78a11880f1479fb0b00000000000000000095e802678966ea11658bc202825aba0357d47e2440874da19f798adbdb1df5c6eeea5d5f123a10174113ec27000000c020908ed8d8b44787b138f643f243db03358af4ac077fbc02000000000000000000b5fb9bf828d5d5bb214811d4f0ea8421acebc10b9d24758e0ff9beb15dcf4dc7f9ea5d5f123a101703613ae500000040201461561148de3061008847118eab0a6f81d69ca6832e0500000000000000000026efa0810691d7810ace5436c38bc914623c3fab38bd0c8efd70ee6cb36e84eb45f05d5f123a1017c889741d0000e0ff3fa431ebfebd4b80f0b96f9d4fb7dffbc583120a0e6f2508000000000000000000495f92c0683f2d4ee8b05ca51620eae75ee4d459e3980b90db59f7301065352bc3f05d5f123a1017d9c99d8d0000000020780aadf79db7b3283b6102156871eca59abe5a1a73910b0000000000000000007788734fa0ed19344bdf4a71c052ea8babc0c4d4edefef36e57c6de3c3e11323c8f45d5f123a10170925c5870000e0ff272a43f8654a3fcd530f122e8479c952cf3fac9af64f45030000000000000000003d4f05fcc73b06c94210685cf32c9d2c2cf03a404be26fb024a86e0a39457a2f29f55d5f123a10178c0266280000e00020dd40e1960729f30e71a3b843a8868a675cc589eacc570d000000000000000000d4230fdc6e02de756e5a318cd00b03311c98aacaa07cad5d80ea710cba1a7f9c7ef65d5f123a1017cc84f5df0000000020457c0b83bea98736461d32eb8d58d4ce4c06e368093206000000000000000000f279b59cb7772ea7b8cb893d9e057e232ff09425f31d27ebdc07d6a4ceea7890bdf75d5f123a1017f5b4459300'
b'f9beb4d9696e76000000000000000000f9010000483ae1a8'
b'0e01000000d6dadcce4bafafb3a564f06d8832da9090ec8ca2654aae9e30dea07005cfc73d010000000d4e2c2206af878d95d927346790831f1d077f8afaf9089349cfe6a4cb9c15a2010000000f61559e0b40a6ea0ba2e8d3c90b5766585729c702898671af6c404ccfa78d56010000004bdce0391ad8f2ec980e002f6e6056addc8f37f13e032915148823b5262e308601000000a6f1c5c190e7e553e49c20b730eb1e48871bf72d548dbe54484cdf7fe279bb20010000004acf1459f6943f814d78b910de0bde9843a5245a8591dc42a3ed2cb12dbbc81e01000000c5289d076634977c3bf1a124468deff95cd3b3876cb951c9e2251f1a8cf9b2be0100000090b3851822456b53f72f8eb2992f7f57dfc6a3329edefa154dff6375bed5cd9401000000bf41abb2e1655193d0e03d6e85cd6445b978cdd8ad213220611e5df259e48d9f010000007a50f9ee09996ce87359921d5e982f03fe66c0ea10f4a04fad8151d8c0c7905f010000009c4f9d5cbe78b0f87779a15337058fe12ea2c75ba3ad4604ecb1df199097ffa3010000006456da237c4a8eb5a62b12f40c1437fede7364fb870f2f92566883658f7f069901000000d8169e9870e60d1ddc24106d26ecfd54cbadb2404cea9fac57f5298f5e9834c7010000003a17aaf2587a20c84005006c1a4c46f172f2832f79c9c85e81b42642d8cd6783'
b'f9beb4d9696e7600000000000000000089020000c6acc401120100000062721262346323feb383a75260b4a8714d9a94005f52d97ac8ca421299ea02f301000000fbfa744121f2154a20d302c2172ce426920ce57734e9e8ec58b2283a4e4510190100000014542e7c93cab067c7f53169fab9efcfcb1a9b06179dc5f26f405f09ba4fe8bc0100000093340bc689fc43612dff7ca0d21336be5cd85b32882cd0abb7b270ecef39b5b9010000001e7f91563391e0b3da570cb760361624a5466db7fd232beee96849a069515eb60100000018ed65c5edb5117ec833f84f79adafaab61a5c48087efaa4143029154439dacd01000000d80b02da26bf1fe66953dea5a87dc684a5e9553c33c0c9a0e41d21a2c994cce50100000086bd52613eba0d6ccc9b01593a0a9dc933f0a56e2e332288f5b778444da39b09010000003af44e8dbc5cd2ee6edd2dc90671ee821f1905a31f8585a898723eff2bb5802f0100000050advert486aeac46b455f6932363f98d622d9b834f5a95260e0916daec8fe7920220100000052dc79057ccda2bc8a9b53778bd47fdbf3d437c56910f122005d0267e45283010100000050e29258cb0d29b59c16fb825c7bc97affea339e852db14f350192b05b76856f01000000b72c839c5a0983b2a96c431a87fdaa3d7d2d713756c68018658ff1792bb19906010000005f875c394ab60164202361945416a6ace14141fdf1de3271b052c4252fc7b5ab010000006d00c77d9c7c73b81798e68ba9c04e07de0f77239e551b22c777f79ca6bcb79c01000000f4d6ffe97b1d5e751fc1fae90b7c8f8c85508c4d7075f3c453adca1628e5b9d70100000082061ff9ee2d04d0815a92ef3e9ca24ba8bd844874087a988a5fe4133c84aeb8010000009db75ae728e45a1ce38b238f93144c26382bad0c24b7f99915fda0c3be76f4a7'
b'f9beb4d9696e760000000000000000006d000000df078eb50301000000fd4da08f727cea2265cde107b11bd75db0382420f2dc9a2876dc33880294e32f010000000ffa33ebed54c2d5c78890744a05ea5ff843c80fdcd8e149cef8c6394b79730401000000343f9725fa73a45c4d1839cbf4c47dd6102bcf6b1daf5f88549825aeaa3b8429'
b'f9beb4d9696e7600000000000000000065020000973430b5'
b'1101000000f96f79fdd085d9b168d3364ee0db1cc8f8fef796f086aecaf6ce0e7333c0f001010000008d314e3e8948cced0a66b491d76393ab3dd6cecaf40669d6f09ba47ed4b6631e01000000ff165682fcb0a48c185b14e36b35869d5da403100d3059464506ef4e97077c6601000000f4703db9f06ef93969b1e6a207f13f2c77ce28323e6860b4889e89127088f9ac01000000dd4569b9727f2aeb5c2e92115b7f47878b713a6ba21b3b0344c03f78eca0a4c201000000f2ade7da028bac32870ef5108d77d2d1d1bd6ea3d790f0054aa7934507e5c89a01000000c8dbdb8dc70644d62b681009a7b6208e862cf4148c517d092fafde5a3f0f47ca01000000ef13e08565d2406574165c8007db480d68dd53af6ebc5a6eaab357490942b4d0010000000512bb3c3090cd6f895393eaf449694c4378f3b3c198ca2a9e37c481bad1cf920100000068a419284d9dee6c066d6d0a38c8bff9d7d0d796003e6ab9dc6cd771e95f2beb01000000ce649aede80e32e2b1daabbe7f08c68f6b5b085d3b92628278d099e561f3255601000000724ef29358816c068a7172a2c8088825102becbb7e5b6724252427a92994835e0100000063e75f2c0fbb5f02d990deed212b71792b98b641952145f4ae6e07a05c5d60d901000000189f82b78f4bb3d143bda248ff2158eefc8cac78d2726b5cb06cc6d9cda5712201000000a46c5bb566fa85aea0e8dd72b4cc3c9e918b1f8c9110advert848a61739beb5e9e2d010000003598fef657271328a7a734bb7a3ce4de25e1067e9b9ad040f5c663f9d4cd525a01000000794c687dc88d3ef68d75e7567044846ecfeabfb45ff28805314e8b03d14b4c9c'
b'f9beb4d9696e76000000000000000000690100007af8a09b'
b'0a0100000009b5d91227a7fe1c43af827b3b796ccde9848a15820e1c7b74a6a7c434a873d0010000004fc35242b004036d2a72a32e7b5d6196495d60bb88846f26b04e83202970d2ab01000000294616c9c0b5deebcd07f572c59ff3f8452d5fd5b5c90f5d842advert0888ebf93af0100000091008606ec352d6fac293156b72122f271a1161759ce6f9a1ad80dfef0935ec2010000002dde8a51c30da0342b4d500aa0ae2c795ddf91af6a9fe962d072179152ec90e601000000c0841ced17e71131186179da428c7612b67f5fdf6ed53128d91cb43eeac0084801000000023cd115a5429274140dade5288b53c950d4d635d56e227698c28251075fb1ec01000000555cd7b3026edb33ca89aede44ce3659162d05bd702a035e9cf540b7628536ed01000000c4fea5bf0ec5915bc513d8768c6f1fd2c1cecf7f8f798b9bf497364d6d177e08010000004e2538aab5b207ea550556cb6d8ae6e8319e53a4b0468b1ff8a88781c8cd866e'
b'f9beb4d9696e760000000000000000001d0200001e262071'
b'0f0100000069f9f41cb457b67ff610cfe357e6ede84314dadd36fbd265603bbe88a0c9c55401000000437fc7bdff862021bda94d667497e7e2d7a04f8353e4d13870b5a0c73d94273701000000f1524a5b895b0bc368389feb8c381e21206e2d91f6b7c2b5521257c30856461d0100000086105cb3bcca153b3fc30b6b63f1f132d414f56b937840a455d1e465d76af6fc01000000f41c916aaea88f127172df6ba7e654071fb8508112b42f97b6242d0143c3e7db010000005d11f3963728499d8230b3fb2c563366474307bb160fd0d64353290advert6387d1c01000000bd1d3c091722b0f6f6e0ab360dad0a7452033b24a85748cd2b085c8321090127010000006d84f2a956485f5504ab7f9cb825004d70045e9553aa2387bda7272a28e256bf010000002a789b1b2804e9c36f13e92940918a74de07534cb9265b46613d51337826e24a01000000853b7a6dc109f9225bccace08a4ff96547d6161e3c16f42212cc558e870b2afb01000000bae44cb9c6d4fcca4141ef58fd5598ce3f85e304f67c77cb07a45aa7e8ded204010000009aa963afac5f4bf0a517ae4d26f1605f01a53fe3b1434c2233advert26785fd8208c010000003e7ce60be10179c0a9a0a0812308e6497f0c84db5541c04870ddce7a03edded501000000107d04215616ba7de71d9029153441bdd432b6a55a8b8dc73f2cdcef9a711523010000008559e5ba83a8b309a36ece665dc3f7c8dc84d79eddd8df6371a89dc07d60de67'

And the nonsense continues if I don’t kill this system. I do know the response must be a header message, nevertheless, I don’t perceive if I don’t obtain what I’m purported to, or I don’t perceive how one can parse the info.

Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here