1

I'd like to use Bitcoin source code(only RPC part) to manipulate with programmatically.

I have bitcoind and bitcoin-cli installed in my local computer but I don't know how to write code for my purpose.

What I want to get senario is Writing the code that works like bitcoin-cli getblock <hash>

Actually, I got same result by calling shell script code like below.

#include <iostream>
#include <stdlib.h>

int main() {
    system("bitcoin-cli getblock 000000000000000082ccf8f1557c5d40b21edabb18d2d691cfbf87118bac7254"); // Get 300000th block
    while(1);
}

However, I want to write c++ code using pure Bitcoin source code.

To achieve the my goal,

  1. I should know how to call getblock() function.
  2. I should know how to compile it.

getblock function is defined here : https://github.com/bitcoin/bitcoin/blob/ae6943620ab369e8e0865c3ec2d2848ba9389325/src/rpc/blockchain.cpp#L828

If you have experience on my question, can you give some guide?

Sorry for my English.

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.