How to interact with bitcoind using C++?

4

1

I know that bitcoind is written in C++, but I cannot figure out how to use its API within my program. I have been using a Python wrapper effectively, but I need another process running that is as quick as possible. Is there a library somewhere for bitcoind? Thanks.

Or could you just point me to a good Json-rpc library?

Matthew Darnell

Posted 2014-02-07T05:26:19.417

Reputation: 508

http://jsonrpc-cpp.sourceforge.net/ unless you are going to take some MAJOR time to look into how bitcoin really works just use the jsonrpc lib which works perfectly. You will also likely not achieve much more speed as the json calls are so much slower than python or C it will not make a difference.mschuett 2014-02-07T06:23:16.613

Thanks a lot. Really, I thought it would run faster in C++ than Python?Matthew Darnell 2014-02-07T06:35:42.003

1Unless you have a very specific use case it is not worth the time to rewrite or pick up a new language.mschuett 2014-02-07T06:38:42.187

1I already know C++ fairly well, so I wouldn't really be picking it up. I'm needing to log every transaction using walletnotify in bitcoin.conf and insert them into a database. Would you recommend doing this every time a new transaction is received, or doing it in batches every so often?Matthew Darnell 2014-02-07T06:44:31.643

why? This is already done in the blockchain.T9b 2014-02-07T11:13:36.310

@T9b for example modeling blockchain datajangorecki 2015-07-23T22:36:51.497

Answers

4

Here's a JSON-RPC C++ library.

Loourr

Posted 2014-02-07T05:26:19.417

Reputation: 3 022

0

[A Newer Library]

There is a wrapper for Bitcoind JSON/RPC interface written in C++ here. It has tests & full coverage for calls.

Behrad Khodayar

Posted 2014-02-07T05:26:19.417

Reputation: 213