Bitcoin ABC  0.28.12
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 <script/sighashtype.h>
9 
10 #include <string>
11 #include <vector>
12 
13 struct Amount;
14 struct BlockHash;
15 class CBlock;
16 class CBlockHeader;
18 class CScript;
19 class CTransaction;
20 class uint256;
21 class UniValue;
22 class CTxUndo;
23 
24 // core_read.cpp
25 CScript ParseScript(const std::string &s);
26 std::string ScriptToAsmStr(const CScript &script,
27  const bool fAttemptSighashDecode = false);
28 [[nodiscard]] bool DecodeHexTx(CMutableTransaction &tx,
29  const std::string &strHexTx);
30 [[nodiscard]] bool DecodeHexBlk(CBlock &, const std::string &strHexBlk);
31 bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header);
32 
41 bool ParseHashStr(const std::string &strHex, uint256 &result);
42 std::vector<uint8_t> ParseHexUV(const UniValue &v, const std::string &strName);
44 
45 // core_write.cpp
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 BlockHash &hashBlock,
53  UniValue &entry, bool include_hex = true, int serialize_flags = 0,
54  const CTxUndo *txundo = nullptr);
55 
56 #endif // BITCOIN_CORE_IO_H
Nodes collect new transactions into a block, hash them into a hash tree, and scan through nonce value...
Definition: block.h:23
Definition: block.h:60
A mutable version of CTransaction.
Definition: transaction.h:274
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:431
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:192
Restore the UTXO in a Coin at a given COutPoint.
Definition: undo.h:62
Signature hash type wrapper class.
Definition: sighashtype.h:37
256-bit opaque blob.
Definition: uint256.h:127
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address)
Definition: core_write.cpp:175
void TxToUniv(const CTransaction &tx, const BlockHash &hashBlock, UniValue &entry, bool include_hex=true, int serialize_flags=0, const CTxUndo *txundo=nullptr)
Definition: core_write.cpp:217
std::string SighashToStr(uint8_t sighash_type)
Definition: core_write.cpp:89
CScript ParseScript(const std::string &s)
Definition: core_read.cpp:60
std::string FormatScript(const CScript &script)
Definition: core_write.cpp:24
std::vector< uint8_t > ParseHexUV(const UniValue &v, const std::string &strName)
Definition: core_read.cpp:257
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
Definition: core_write.cpp:190
bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
Definition: core_read.cpp:197
bool DecodeHexBlk(CBlock &, const std::string &strHexBlk)
Definition: core_read.cpp:232
bool ParseHashStr(const std::string &strHex, uint256 &result)
Parse a hex string into 256 bits.
Definition: core_read.cpp:248
bool DecodeHexBlockHeader(CBlockHeader &, const std::string &hex_header)
Definition: core_read.cpp:217
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
Definition: core_write.cpp:106
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
Definition: core_write.cpp:169
SigHashType ParseSighashString(const UniValue &sighash)
Definition: core_read.cpp:271
Definition: amount.h:19
A BlockHash is a unqiue identifier for a block.
Definition: blockhash.h:13