<blockquote>
<p>How to use RPC of bitcoind or bitcoin-cli?</p>
</blockquote>
<ol>
<li>bitcoind - bitcoin deamon = core value of the software (bitcoind -printtoconsole -debug=1)</li>
<li>bitcoin-cli - bitcoin command line interface = allows you to &quot;query' the blockchain that you had download previously with bitcoind. (bitcoin-cli -getinfo previously <code>getinfo</code> which was removed from v0.16, not sure why.)<br></li>
</ol>
<p>So bitcoind provide the RPC &quot;interface&quot; in which you can query with bitcoin-cli <br>(or a library in c++ you will find...).<br>
You must run bitcoind before using bitcoin-cli.<br></p>
<p>Basically bitcoin-cli communicate with your node bitcoind so in other words your current blockchain state.<br></p>
<p>bitcoin-qt - Graphical bitcoin software = bitcoind + graphical interface
<br>(You can find a graphical console embedded in which you will use bitcoin-cli command)</p>

CC BY-SA 4.0
2016-05-01T10:43:41.163Z
2024-12-04T18:11:08.930Z
2024-12-04T18:11:08.930Z
onepix
<p>I am not sure why you chose C++<br>
If you are going to build something where you need the speed of C++ then understandably stick with it.<br>
Otherwise to simply perform some RPC calls use something simpler like python or PHP.   </p>

<p>Here is a tutorial on how to do RPC calls via python:<br>
<a href="http://blog.cryptoiq.ca/?p=347" rel="nofollow">Bitcoin &amp; Blockchain Programming #007 – RPCs via Python</a>   </p>

<p>And via PHP:<br>
<a href="http://blog.cryptoiq.ca/?p=261" rel="nofollow">Bitcoin &amp; Blockchain Programming #005 – RPCs via PHP</a></p>

CC BY-SA 3.0
2016-08-31T02:22:01.660Z
2016-08-31T02:22:01.660Z
Albert S
<p>Even though it is a C library, you could use <a href="https://jansson.readthedocs.org/en/latest/" rel="nofollow">Jansson</a> in C++ apps, too. See: <a href="https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#C" rel="nofollow">https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#C</a></p>

CC BY-SA 3.0
2016-07-30T18:43:01.977Z
2016-07-30T18:43:01.977Z
Geremia
<p>Your direct question is about a fine JSON-RPC library in C++, and the direct answer to it is:</p>

<ul>
<li><a href="https://github.com/open-source-parsers/jsoncpp" rel="nofollow noreferrer">libjson-cpp</a> &amp;</li>
<li><a href="https://github.com/cinemast/libjson-rpc-cpp" rel="nofollow noreferrer">libjson-rpc-cpp</a></li>
</ul>

<p>But if I wanna target your intention, there is a well-developed wrapper for Bitcoind-json/rpc interface <a href="https://github.com/minium/bitcoin-api-cpp" rel="nofollow noreferrer">here</a>. It will save you massive time!</p>

CC BY-SA 4.0
2019-05-28T07:08:13.340Z
2019-05-28T07:08:13.340Z
behkod
<p>Which library I must use for JSON? Where is RPC call example ?
How to use RPC of bitcoind or bitcoin-cli? or better <strong>Electrum</strong> API to get all new (maybe pending) transactions which appears in Bitcoin net?</p>

CC BY-SA 3.0
2016-05-02T19:46:50.537Z
Like popen()? Or system()?
KJ O
CC BY-SA 4.0
2018-08-16T21:45:15.823Z
Possible duplicate of [How to interact with bitcoind using C++?](https://bitcoin.stackexchange.com/questions/21770/how-to-interact-with-bitcoind-using-c)
JBaczuk
<transactions><json-rpc>
How to use JSON-RPC in C++ in Linux?
Saku
# How to use JSON-RPC in C++ in Linux?

(Asked by: username_0 on 2016-05-01)

Which library I must use for JSON? Where is RPC call example ?
How to use RPC of bitcoind or bitcoin-cli? or better **Electrum** API to get all new (maybe pending) transactions which appears in Bitcoin net?

**Tags:** transactions, json-rpc

> **Comments:**
> **username_1**: Like popen()? Or system()?  
> **username_2**: Possible duplicate of [How to interact with bitcoind using C++?](https://bitcoin.stackexchange.com/questions/21770/how-to-interact-with-bitcoind-using-c)  

---

## 4 answers

### Answer by username_3 on 2016-05-01. Score: 1

> How to use RPC of bitcoind or bitcoin-cli?

1. bitcoind - bitcoin deamon = core value of the software (bitcoind -printtoconsole -debug=1)
2. bitcoin-cli - bitcoin command line interface = allows you to "query' the blockchain that you had download previously with bitcoind. (bitcoin-cli -getinfo previously `getinfo` which was removed from v0.16, not sure why.)

So bitcoind provide the RPC "interface" in which you can query with bitcoin-cli   
(or a library in c++ you will find...).  
You must run bitcoind before using bitcoin-cli.

Basically bitcoin-cli communicate with your node bitcoind so in other words your current blockchain state.

bitcoin-qt - Graphical bitcoin software = bitcoind + graphical interface
  
(You can find a graphical console embedded in which you will use bitcoin-cli command)


---

### Answer by username_4 on 2016-08-31. Score: 1

I am not sure why you chose C++  
If you are going to build something where you need the speed of C++ then understandably stick with it.  
Otherwise to simply perform some RPC calls use something simpler like python or PHP.

Here is a tutorial on how to do RPC calls via python:  
[Bitcoin & Blockchain Programming #007 – RPCs via Python](http://blog.cryptoiq.ca/?p=347)

And via PHP:  
[Bitcoin & Blockchain Programming #005 – RPCs via PHP](http://blog.cryptoiq.ca/?p=261)


---

### Answer by username_5 on 2016-07-30. Score: 1

Even though it is a C library, you could use [Jansson](https://jansson.readthedocs.org/en/latest/) in C++ apps, too. See: <https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#C>


---

### Answer by username_6 on 2019-05-28. Score: 1

Your direct question is about a fine JSON-RPC library in C++, and the direct answer to it is:

* [libjson-cpp](https://github.com/open-source-parsers/jsoncpp) &
* [libjson-rpc-cpp](https://github.com/cinemast/libjson-rpc-cpp)

But if I wanna target your intention, there is a well-developed wrapper for Bitcoind-json/rpc interface [here](https://github.com/minium/bitcoin-api-cpp). It will save you massive time!


---

