Inside Bitcoin
Opening the selected file…
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 (c) 2009-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_CORE_IO_H6#define BITCOIN_CORE_IO_H8#include <consensus/amount.h>9#include <util/result.h>11#include <cstdint>12#include <functional>13#include <string>15class CBlock;16class CBlockHeader;17class CScript;18class CTransaction;19struct CMutableTransaction;20class SigningProvider;21class uint256;22class UniValue;23class CTxUndo;24class CTxOut;26/**27* Verbose level for block's transaction28*/29enum class TxVerbosity {30SHOW_TXID, //!< Only TXID for each block's transaction31SHOW_DETAILS, //!< Include TXID, inputs, outputs, and other common block's transaction information32SHOW_DETAILS_AND_PREVOUT //!< The same as previous option with information about prevouts if available33};35CScript ParseScript(const std::string& s);36std::string ScriptToAsmStr(const CScript& script, bool fAttemptSighashDecode = false);37[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);38[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);39bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);41[[nodiscard]] util::Result<int> SighashFromStr(const std::string& sighash);43UniValue ValueFromAmount(CAmount amount);44std::string FormatScript(const CScript& script);45std::string EncodeHexTx(const CTransaction& tx);46std::string SighashToStr(int32_t sighash_type);47void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex = true, bool include_address = false, const SigningProvider* provider = nullptr);48void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex = true, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS, std::function<bool(const CTxOut&)> is_change_func = {});50#endif // BITCOIN_CORE_IO_H
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.