Bitcoin ABC  0.22.13
P2P Digital Currency
core_io.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2016 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 <attributes.h>
9 #include <script/sighashtype.h>
10 
11 #include <string>
12 #include <vector>
13 
14 struct Amount;
15 class CBlock;
16 class CBlockHeader;
18 class CScript;
19 class CTransaction;
20 class uint256;
21 class UniValue;
22 
23 // core_read.cpp
24 CScript ParseScript(const std::string &s);
25 std::string ScriptToAsmStr(const CScript &script,
26  const bool fAttemptSighashDecode = false);
28  const std::string &strHexTx);
29 NODISCARD bool DecodeHexBlk(CBlock &, const std::string &strHexBlk);
30 bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header);
31 
40 bool ParseHashStr(const std::string &strHex, uint256 &result);
41 std::vector<uint8_t> ParseHexUV(const UniValue &v, const std::string &strName);
43 
44 // core_write.cpp
45 UniValue ValueFromAmount(const Amount &amount);
46 std::string FormatScript(const CScript &script);
47 std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags = 0);
48 std::string SighashToStr(uint8_t sighash_type);
49 void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out,
50  bool fIncludeHex);
51 void ScriptToUniv(const CScript &script, UniValue &out, bool include_address);
52 void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry,
53  bool include_hex = true, int serialize_flags = 0);
54 
55 #endif // BITCOIN_CORE_IO_H
NODISCARD bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
Definition: core_read.cpp:191
std::string FormatScript(const CScript &script)
Definition: core_write.cpp:29
Definition: block.h:62
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address)
Definition: core_write.cpp:178
std::string SighashToStr(uint8_t sighash_type)
Definition: core_write.cpp:90
Definition: amount.h:17
SigHashType ParseSighashString(const UniValue &sighash)
Definition: core_read.cpp:265
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
Definition: core_read.cpp:211
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
Definition: core_write.cpp:107
#define NODISCARD
Definition: attributes.h:18
NODISCARD bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
Definition: core_read.cpp:226
256-bit opaque blob.
Definition: uint256.h:120
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:430
std::vector< uint8_t > ParseHexUV(const UniValue &v, const std::string &strName)
Definition: core_read.cpp:251
A mutable version of CTransaction.
Definition: transaction.h:297
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
Definition: core_write.cpp:172
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
Definition: core_write.cpp:193
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, bool include_hex=true, int serialize_flags=0)
Definition: core_write.cpp:220
bool ParseHashStr(const std::string &strHex, uint256 &result)
Parse a hex string into 256 bits.
Definition: core_read.cpp:242
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:211
CScript ParseScript(const std::string &s)
Definition: core_read.cpp:26
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition: block.h:22
Signature hash type wrapper class.
Definition: sighashtype.h:37
UniValue ValueFromAmount(const Amount &amount)
Definition: core_write.cpp:20