The Bitcoin Core RPC interface is implicitly versioned on the major version of Bitcoin Core. Some downstream RPC consumers and clients, for example rust-bitcoincore-rpc, need to know about the underlying node version to determine the available RPC calls and how to interpret the RPC responses (e.g. https://github.com/rust-bitcoin/rust-bitcoincore-rpc/issues/355).
The current recommendation is to use the version
field from the getnetworkinfo
RPC call. However, this RPC call also returns, for example, the IP addresses of the node, which makes it unsuitable for ‘public’ access to a semi-trusted RPC consumer. With the current recommendation, getnetworkinfo
needs to be whitelisted for all RPC users.
To allow RPC consumers to determine the node version and the available RPC commands and fields, a getversion
RPC is introduced.
0$ bitcoin-cli getversion
1{
2 "short": "27.99.0",
3 "long": "v27.99.0-7adfdfca190b",
4 "numeric": 279900,
5 "client": "Satoshi",
6 "release_candidate": 0,
7 "is_release": false
8}
0{
1 "short": "27.0.0",
2 "long": "v27.0.0",
3 "numeric": 270000,
4 "client": "Satoshi",
5 "release_candidate": 0,
6 "is_release": true
7}
0{
1 "short": "27.0.0",
2 "long": "v27.0.0rc1",
3 "numeric": 270000,
4 "client": "Satoshi",
5 "release_candidate": 1,
6 "is_release": true
7}