This program can be used to verify transactions using Merkle root of a block over the Bitcoin blockchain using C++. The program fetches block information from an API over the Bitcoin blockchain in JSON format. Then parses through it and calculates the Merkle Root of the block. Later, the information is compared with the derived value to check for inconsistencies.
The program utilizes the following external libraries:
This program has only been tested using the insight API and Block Explorer API. In the long term, the Block Explorer API has turned out to be more stable out of the two. This program is dependent on the JSON format response of the block information from the API such that the appropriate libraries can calculate the Merkle Root. A sample format has been provided above for the block.json file.
The program compiles with the following flags:
-ljsoncpp -lcrypto -lcurl
The program allows debugging and view of under the hood SHA-256 and Merkle Trees in the Bitcoin implementation. In order to debug, set the debug variable to true.
\\ debug
bool print = true;
This project is licensed under the MIT License - see the LICENSE.md file for more details