6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_VBKPOPTX_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_VBKPOPTX_HPP_
14#include <veriblock/pop/hashutil.hpp>
15#include <veriblock/pop/serde.hpp>
16#include <veriblock/pop/slice.hpp>
19#include "btcblock.hpp"
21#include "merkle_path.hpp"
22#include "vbkblock.hpp"
23#include "veriblock/pop/blob.hpp"
24#include "veriblock/pop/entities/network_byte_pair.hpp"
25#include "veriblock/pop/json.hpp"
26#include "veriblock/pop/strutil.hpp"
27#include "veriblock/pop/uint.hpp"
33template <
class ElementType>
48 BtcTx bitcoinTransaction{};
51 std::vector<BtcBlock> blockOfProofContext{};
52 std::vector<uint8_t> signature{};
53 std::vector<uint8_t> publicKey{};
61 size_t estimateSize()
const;
69 std::string toPrettyString()
const;
85 void toRaw(WriteStream& stream)
const;
89template <
typename JsonValue>
91 JsonValue obj = json::makeEmptyObject<JsonValue>();
92 tx.networkOrType.
networkType.template putJson<JsonValue>(obj);
93 json::putStringKV(obj,
"hash", tx.
getHash().toHex());
94 json::putIntKV(obj,
"type", tx.networkOrType.typeId);
95 json::putStringKV(obj,
"address", tx.address.
toString());
96 json::putKV(obj,
"publishedBlock", ToJSON<JsonValue>(tx.publishedBlock));
99 json::putKV(obj,
"merklePath", ToJSON<JsonValue>(tx.merklePath));
100 json::putKV(obj,
"blockOfProof", ToJSON<JsonValue>(tx.blockOfProof));
101 json::putArrayKV(obj,
"blockOfProofContext", tx.blockOfProofContext);
102 json::putStringKV(obj,
"signature",
HexStr(tx.signature));
103 json::putStringKV(obj,
"publicKey",
HexStr(tx.publicKey));
Class that is used for storing validation state.
Binary writer that is useful for binary serialization.
All constants in alt-cpp.
bool DeserializeFromRaw(ReadStream &stream, AltBlock &out, ValidationState &state, const AltBlock::hash_t &=AltBlock::hash_t{})
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool DeserializeFromVbkEncoding(ReadStream &stream, AltBlockAddon &out, ValidationState &state)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::string HexStr(const T itbegin, const T itend)
Convert bytes to hex.
std::string SerializeToRawHex(const T &obj)
Serialize to HEX RAW encoding.
Blob< SHA256_HASH_SIZE > uint256
This is an overloaded member function, provided for convenience. It differs from the above function o...
VbkNetworkType networkType
< works as std::optional. if hasNetworkByte is true, networkByte is set
Stores pair of TxType and VBK network byte.
Represents address on VBK chain.
std::string toString() const noexcept
Convert VBK address to text representation.
Bitcoin transaction representation.
Path in Merkle tree which proves that subject is inside this tree.
Binary reading stream, that is useful during binary deserialization.
Non-owning contiguous array.
Veriblock POP transaction, which endorses VBK block in BTC blockchain.
hash_t getHash() const
Calculate the hash of the vbk pop transaction.
void toVbkEncoding(WriteStream &stream) const
Convert VbkPopTx to data stream using VbkPopTx VBK byte format.