Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright 2014 BitPay Inc.2// Copyright (c) 2017-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or https://opensource.org/license/mit.6// Test program that can be called by the JSON test suite at7// https://github.com/nst/JSONTestSuite.8//9// It reads JSON input from stdin and exits with code 0 if it can be parsed10// successfully. It also pretty prints the parsed JSON value to stdout.12#include <univalue.h>14#include <iostream>15#include <iterator>16#include <string>18using namespace std;20int main (int argc, char *argv[])21{22UniValue val;23if (val.read(string(istreambuf_iterator<char>(cin),24istreambuf_iterator<char>()))) {25cout << val.write(1 /* prettyIndent */, 4 /* indentLevel */) << endl;26return 0;27} else {28cerr << "JSON Parse Error." << endl;29return 1;30}31}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.