1

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?

Saku
  • 151
  • 5
  • Like popen()? Or system()? – KJ O May 02 '16 at 19:46
  • 1
    Possible duplicate of [How to interact with bitcoind using C++?](https://bitcoin.stackexchange.com/questions/21770/how-to-interact-with-bitcoind-using-c) – JBaczuk Aug 16 '18 at 21:45

4 Answers4

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 = allow you to "query' the blockchain that you had download previously with bitcoind. (bitcoin-cli getinfo)

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 word 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)

onepix
  • 400
  • 2
  • 13
1

Even though it is a C library, you could use Jansson in C++ apps, too. See: https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#C

Geremia
  • 4,469
  • 4
  • 37
  • 75
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

And via PHP:
Bitcoin & Blockchain Programming #005 – RPCs via PHP

Albert S
  • 1,600
  • 10
  • 21
1

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

But if I wanna target your intention, there is a well-developed wrapper for Bitcoind-json/rpc interface here. It will save you massive time!

behkod
  • 303
  • 1
  • 12