6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_VTB_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_VTB_HPP_
13#include <veriblock/pop/fmt.hpp>
14#include <veriblock/pop/json.hpp>
15#include <veriblock/pop/serde.hpp>
16#include <veriblock/pop/uint.hpp>
18#include "vbk_merkle_path.hpp"
19#include "vbkblock.hpp"
20#include "vbkpoptx.hpp"
21#include "veriblock/pop/blob.hpp"
49 std::string toPrettyString()
const;
50 std::string toShortPrettyString()
const;
64 size_t estimateSize()
const;
72 static const std::string& name() {
return _name; }
74 friend bool operator==(
const VTB& a,
const VTB& b) {
78 friend bool operator!=(
const VTB& a,
const VTB& b) {
return !(a == b); }
80 friend bool operator<(
const VTB& a,
const VTB& b) {
81 return a.containingBlock.getHeight() < b.containingBlock.getHeight();
85 static const std::string _name;
90struct IsPopPayload<VTB> {
91 static const bool value =
true;
95template <
typename JsonValue>
96JsonValue ToJSON(
const VTB& v) {
97 JsonValue obj = json::makeEmptyObject<JsonValue>();
98 json::putIntKV(obj,
"version", v.version);
99 json::putKV(obj,
"transaction", ToJSON<JsonValue>(v.transaction));
100 json::putKV(obj,
"merklePath", ToJSON<JsonValue>(v.merklePath));
101 json::putKV(obj,
"containingBlock", ToJSON<JsonValue>(v.containingBlock));
105 json::putStringKV(obj,
"id", v.
getId().toHex());
Class that is used for storing validation state.
Binary writer that is useful for binary serialization.
bool DeserializeFromVbkEncoding(ReadStream &stream, AltBlockAddon &out, ValidationState &state)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Blob< SHA256_HASH_SIZE > uint256
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::string SerializeToHex(const T &obj)
Serialize to HEX VBK encoding.
Binary reading stream, that is useful during binary deserialization.
Veriblock to Bitcoin publication, committed to Veriblock blockchain in containingBlock.
bool checked
(memory only) indicates whether we already did 'checkPayloads' on this VTB
void toVbkEncoding(WriteStream &stream) const
Convert VTB to data stream using Vbk byte format.
std::vector< uint8_t > toVbkEncoding() const
Convert VTB to raw bytes data using Vbk byte format.
id_t getId() const
Calculate a VTB id that is the sha256 hash of the VTB rawBytes.
Path in Merkle tree, which proves that subject exists in the tree.
Veriblock POP transaction, which endorses VBK block in BTC blockchain.