50 sats \ 3 replies \ @0260378aef 20 Oct 2022 \ on: Is there an interactive bitcoin protocol tool similar to Swagger? bitcoin
May not be of interest, but I remember being shocked to see that there was actually a Wireshark parser of Bitcoin network traffic even as early as like 2014-15.
(See https://bitcoin.stackexchange.com/questions/91938/bitcoin-protocol-and-wireshark ).
So: there's the network level traffic in bitcoin (think like the VER, VERACK, TX messages and whatnot that are gossiped between peers), and then there's the RPC-API that a bitcoind node offers, which would be more analogous/a better fit for what is usually done with Swagger.
Anyway, I think I get what you're asking; the wireshark parser doesn't quite fit since it's not designed for education, nor is it interactively participating. I'm not sure if any such thing exists, like 'a toy node that can just talk the protocol but isn't a real node' (or more exactly: I bet it does exist but not sure if anyone's published such a thing).
Thanks for replying.
but I remember being shocked to see that there was actually a Wireshark parser of Bitcoin network traffic even as early as like 2014-15.
Haha, yeah, me too even though I noticed it just a few months ago. Shows that the bitcoin protocol is indeed very relevant even though most people don't care about bitcoin (yet) :)
then there's the RPC-API that a bitcoind node offers, which would be more analogous/a better fit for what is usually done with Swagger.
Yes, but I am not interested in the RPC-API. I want to see the raw bytes and not some frontend showing me already parsed JSON.
I want to see the data resulting in this JSON to get a deep understanding.
Anyway, I think I get what you're asking; the wireshark parser doesn't quite fit since it's not designed for education, nor is it interactively participating.
Yeah, that was also my experience.
I will see if I can get a quick PoC of this going in the next days :)
reply
I will see if I can get a quick PoC of this going in the next days :)
I think it would be a valuable learning tool to be able to communicate directly with a node like this in a human-readable way. Great idea!
It is almost as if what you want is a REPL, in some programming language that behaves somewhat like telnet. When it first loads up you will be "greeted" with a version message, and your job now is to reply with a message of your own.
Because this whole thing is happening in a REPL, you should be able to define functions to make your life easier when constructing/parsing messages, but initially there would be only a small library of simple functions and datatypes available to you.
You can then build up your own library of functions and datatypes.
The whole thing could be turned into a game (or contest?). An initial goal of the game is to not be banned by the node. The next goal might be to ask for data, and eventually more complex goals could be achieved including constructing and broadcasting a transaction.
It is fun to think about. Though I wonder how many people would actually play such a game?
Maybe if the node paid you some sats as you progress, people would be interested?
reply
I would play such a game!
The comparison with a REPL sounds very interesting, thank you!
However, I think making a game or contest with sats involved would lead to bad incentives. Preventing that someone just pipes the output of the other node to a node of their own (MITM) sounds hard.
So I think this would only be useful for education. But should be enough :)
Thanks for your reply! Very inspiring :)
reply