Bitcoin Core  0.19.99
P2P Digital Currency
core_io.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2018 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 <amount.h>
9 #include <attributes.h>
10 
11 #include <string>
12 #include <vector>
13 
14 class CBlock;
15 class CBlockHeader;
16 class CScript;
17 class CTransaction;
18 struct CMutableTransaction;
19 class uint256;
20 class UniValue;
21 
22 // core_read.cpp
23 CScript ParseScript(const std::string& s);
24 std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
25 NODISCARD bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness = false, bool try_witness = true);
26 NODISCARD bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
27 bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
28 
37 bool ParseHashStr(const std::string& strHex, uint256& result);
38 std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName);
39 int ParseSighashString(const UniValue& sighash);
40 
41 // core_write.cpp
42 UniValue ValueFromAmount(const CAmount& amount);
43 std::string FormatScript(const CScript& script);
44 std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
45 std::string SighashToStr(unsigned char sighash_type);
46 void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
47 void ScriptToUniv(const CScript& script, UniValue& out, bool include_address);
48 void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0);
49 
50 #endif // BITCOIN_CORE_IO_H
std::vector< unsigned char > ParseHexUV(const UniValue &v, const std::string &strName)
Definition: core_read.cpp:187
std::string FormatScript(const CScript &script)
Definition: core_write.cpp:28
Definition: block.h:72
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address)
Definition: core_write.cpp:137
UniValue ValueFromAmount(const CAmount &amount)
Definition: core_write.cpp:18
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
Definition: core_read.cpp:147
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
Definition: core_write.cpp:86
int ParseSighashString(const UniValue &sighash)
Definition: core_read.cpp:197
#define NODISCARD
Definition: attributes.h:18
NODISCARD bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
Definition: core_read.cpp:161
std::string SighashToStr(unsigned char sighash_type)
Definition: core_write.cpp:72
256-bit opaque blob.
Definition: uint256.h:121
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:390
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
Definition: core_write.cpp:130
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
Definition: core_write.cpp:152
A mutable version of CTransaction.
Definition: transaction.h:366
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, bool include_hex=true, int serialize_flags=0)
Definition: core_write.cpp:178
bool ParseHashStr(const std::string &strHex, uint256 &result)
Parse a hex string into 256 bits.
Definition: core_read.cpp:178
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:270
CScript ParseScript(const std::string &s)
Definition: core_read.cpp:23
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition: block.h:20
NODISCARD bool DecodeHexTx(CMutableTransaction &tx, const std::string &hex_tx, bool try_no_witness=false, bool try_witness=true)
Definition: core_read.cpp:112