Hey SN!
Yesterday, I experimented a bit with the bitcoin protocol and thought it would be cool to speak the bitcoin protocol with my node.
A node immediately advertises it's version when it creates an outgoing connection.
See:
When a node creates an outgoing connection, it will immediately advertise its version. The remote node will respond with its version. No further communication is possible until both peers have exchanged their version.
Therefore, I used the version payload provided in the wiki
0000 f9 be b4 d9 76 65 72 73 69 6f 6e 00 00 00 00 00 ....version..... 0010 64 00 00 00 35 8d 49 32 62 ea 00 00 01 00 00 00 d...5.I2b....... 0020 00 00 00 00 11 b2 d0 50 00 00 00 00 01 00 00 00 .......P........ 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ................ 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0050 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 ................ 0060 3b 2e b3 5d 8c e6 17 65 0f 2f 53 61 74 6f 73 68 ;..]...e./Satosh 0070 69 3a 30 2e 37 2e 32 2f c0 3e 03 00 i:0.7.2/.>..
and sent it to my node using
$ xxd -r version_001.txt | nc 192.168.178.55 8333 -o version_001_recv.txt > /dev/null
(you can test this out yourself by copying the above message into a file
version_001.txt
and using the command with the IP and port replaced)Response:
"version" message:
0000: f9be b4d9 7665 7273 696f 6e00 0000 0000 ....version..... 0010: 6600 0000 bdca d498 8011 0100 0d04 0000 f............... 0020: 0000 0000 5083 5063 0000 0000 0000 0000 ....P.Pc........ 0030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0040: 0000 0000 0000 0d04 0000 0000 0000 0000 ................ 0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0060: ff0a e912 84bd d3e2 102f 5361 746f 7368 ........./Satosh 0070: 693a 3233 2e30 2e30 2f8e 960b 0001 i:23.0.0/.....
"verack" message:
0000: f9be b4d9 7665 7261 636b 0000 0000 0000 ....verack...... 0010: 0000 0000 5df6 e0e2 ....]...
"alert" message:
0000: f9be b4d9 616c 6572 7400 0000 0000 0000 ....alert....... 0010: a800 0000 1bf9 aaea 6001 0000 0000 0000 ........`....... 0020: 0000 0000 00ff ffff 7f00 0000 00ff ffff ................ 0030: 7ffe ffff 7f01 ffff ff7f 0000 0000 ffff ................ 0040: ff7f 00ff ffff 7f00 2f55 5247 454e 543a ......../URGENT: 0050: 2041 6c65 7274 206b 6579 2063 6f6d 7072 Alert key compr 0060: 6f6d 6973 6564 2c20 7570 6772 6164 6520 omised, upgrade 0070: 7265 7175 6972 6564 0046 3044 0220 653f required.F0D. e? 0080: ebd6 410f 470f 6bae 11ca d19c 4841 3bec ..A.G.k.....HA;. 0090: b1ac 2c17 f908 fd0f d53b dc3a bd52 0220 ..,......;.:.R. 00a0: 6d0e 9c96 fe88 d4a0 f01e d9de dae2 b6f9 m............... 00b0: e00d a94c ad0f ecaa e66e cf68 9bf7 1b50 ...L.....n.h...P
Now I was wondering if there already exists a tool where sending such manual messages to your node is possible; similar to Swagger which is limited to REST APIs.
The tool could visualize the response data (similar to the JWT debugger) to help people learn about the bitcoin protocol who are interested in it.
If there is none, would you be interested in one?