Open edilmedeiros opened 6 months ago
I believe the Bitcoin Core uses a json format RESTResponseFormat::JSON get results from REST service defined in the rest.cpp file.
On the other hand, bitcoincore_cli, utilizes json to interact with core but returns rust types as in this example here
It uses the UniValue class to represent values internally. Since this is compatible with JSON values, I believe it gets translated somewhere in the process.
Putting this info here since we are interested in learning more about Core. I didn't know if we would use this information ourselves.
The RPC methods are defined using the
RPCHelpMan
class. For every method there's a call to the constructorwhich includes the
description
andexamples
returned by thehelp
command in thebitcoin-cli
and the actual method implementation (usually passed as a lambda function. Seedecoderawtransaction
for an example of its usage.The interface is organized using a CTable class (this is where the methods are registered in the table which call this function that calls the others until the individual methods).
I still did not understand what the RPC methods actually return (and how, JSON?), but since we are going to change the user interface and this class manages part of the user interface, it seemed useful to put this info here.