Bitcoin Core 28.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
core_io.h
Go to the documentation of this file.
1// Copyright (c) 2009-2022 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_CORE_IO_H
6#define BITCOIN_CORE_IO_H
7
8#include <consensus/amount.h>
9#include <util/result.h>
10
11#include <string>
12#include <vector>
13
14class CBlock;
15class CBlockHeader;
16class CScript;
17class CTransaction;
19class SigningProvider;
20class uint256;
21class UniValue;
22class CTxUndo;
23
32
33// core_read.cpp
34CScript ParseScript(const std::string& s);
35std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
36[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);
37[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
38bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
39
40[[nodiscard]] util::Result<int> SighashFromStr(const std::string& sighash);
41
42// core_write.cpp
43UniValue ValueFromAmount(const CAmount amount);
44std::string FormatScript(const CScript& script);
45std::string EncodeHexTx(const CTransaction& tx);
46std::string SighashToStr(unsigned char 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);
49
50#endif // BITCOIN_CORE_IO_H
int64_t CAmount
Amount in satoshis (Can be negative)
Definition amount.h:12
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition block.h:22
Definition block.h:69
Serialized script, used inside transaction inputs and outputs.
Definition script.h:414
The basic transaction that is broadcasted on the network and contained in blocks.
Undo information for a CTransaction.
Definition undo.h:53
An interface to be implemented by keystores that support signing.
256-bit opaque blob.
Definition uint256.h:178
std::string EncodeHexTx(const CTransaction &tx)
std::string SighashToStr(unsigned char sighash_type)
void TxToUniv(const CTransaction &tx, const uint256 &block_hash, UniValue &entry, bool include_hex=true, const CTxUndo *txundo=nullptr, TxVerbosity verbosity=TxVerbosity::SHOW_DETAILS)
CScript ParseScript(const std::string &s)
Definition core_read.cpp:63
std::string FormatScript(const CScript &script)
util::Result< int > SighashFromStr(const std::string &sighash)
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
TxVerbosity
Verbose level for block's transaction.
Definition core_io.h:27
@ SHOW_DETAILS_AND_PREVOUT
The same as previous option with information about prevouts if available.
@ SHOW_TXID
Only TXID for each block's transaction.
@ SHOW_DETAILS
Include TXID, inputs, outputs, and other common block's transaction information.
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
void ScriptToUniv(const CScript &script, UniValue &out, bool include_hex=true, bool include_address=false, const SigningProvider *provider=nullptr)
UniValue ValueFromAmount(const CAmount amount)
bool DecodeHexTx(CMutableTransaction &tx, const std::string &hex_tx, bool try_no_witness=false, bool try_witness=true)
A mutable version of CTransaction.