veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::VbkBlock Struct Reference

Veriblock block. More...

Detailed Description

Definition at line 32 of file vbkblock.hpp.

#include <vbkblock.hpp>

+ Collaboration diagram for altintegration::VbkBlock:

Public Types

using hash_t = uint192
 
using short_hash_t = uint96
 
using id_t = short_hash_t
 
using prev_hash_t = short_hash_t
 
using height_t = int32_t
 
using nonce_t = int32_t
 
using keystone_t = uint72
 
using merkle_t = uint128
 
using protecting_block_t = BtcBlock
 
using addon_t = StoredVbkBlockAddon::addon_t
 
using stored_addon_t = StoredVbkBlockAddon
 

Public Member Functions

std::string toPrettyString () const
 
std::string toShortPrettyString () const
 
void toRaw (WriteStream &stream) const
 Convert VbkBlock to data stream using VbkBlock basic byte format. More...
 
std::vector< uint8_t > toVbkEncoding () const
 Convert VbkBlock to raw bytes data using VbkBlock byte format. More...
 
std::vector< uint8_t > toRaw () const
 Convert VbkBlock to bytes data using VbkBlock basic byte format. More...
 
void toVbkEncoding (WriteStream &stream) const
 Convert VbkBlock to data stream using VbkBlock VBK byte format. More...
 
size_t estimateSize () const
 
uint32_t getBlockTime () const
 
hash_t calculateHash () const
 
const hash_tgetHash () const
 Get current block hash. More...
 
short_hash_t getShortHash () const
 Calculate the hash of the vbk block. More...
 
short_hash_t getId () const
 
 VbkBlock (int32_t h, int16_t v, uint96 prevBlock, keystone_t prev1, keystone_t prev2, uint128 mroot, int32_t ts, int32_t diff, uint64_t nonce)
 
int32_t getDifficulty () const
 
int32_t getHeight () const
 
int16_t getVersion () const
 
uint96 getPreviousBlock () const
 
keystone_t getPreviousKeystone () const
 
keystone_t getSecondPreviousKeystone () const
 
uint128 getMerkleRoot () const
 
uint32_t getTimestamp () const
 
uint64_t getNonce () const
 
void setHeight (int32_t h)
 
void setVersion (int16_t v)
 
void setPreviousBlock (const uint96 &prev)
 
void setPreviousKeystone (const keystone_t &ks)
 
void setSecondPreviousKeystone (const keystone_t &ks)
 
void setMerkleRoot (const uint128 &mroot)
 
void setTimestamp (uint32_t ts)
 
void setDifficulty (int32_t diff)
 
void setNonce (uint64_t nnc)
 

Static Public Member Functions

static const std::string & name ()
 

Friends

bool operator< (const VbkBlock &a, const VbkBlock &b)
 
bool operator== (const VbkBlock &a, const VbkBlock &b)
 
bool operator!= (const VbkBlock &a, const VbkBlock &b)
 
bool DeserializeFromRaw (ReadStream &stream, VbkBlock &out, ValidationState &state, const VbkBlock::hash_t &precalculatedHash)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setPrecalculatedHash (VbkBlock &block, const VbkBlock::hash_t &precalculatedHash)
 

Member Typedef Documentation

◆ addon_t

using altintegration::VbkBlock::addon_t = StoredVbkBlockAddon::addon_t

Definition at line 42 of file vbkblock.hpp.

◆ hash_t

Definition at line 33 of file vbkblock.hpp.

◆ height_t

using altintegration::VbkBlock::height_t = int32_t

Definition at line 37 of file vbkblock.hpp.

◆ id_t

Definition at line 35 of file vbkblock.hpp.

◆ keystone_t

Definition at line 39 of file vbkblock.hpp.

◆ merkle_t

Definition at line 40 of file vbkblock.hpp.

◆ nonce_t

using altintegration::VbkBlock::nonce_t = int32_t

Definition at line 38 of file vbkblock.hpp.

◆ prev_hash_t

◆ protecting_block_t

◆ short_hash_t

Definition at line 34 of file vbkblock.hpp.

◆ stored_addon_t

using altintegration::VbkBlock::stored_addon_t = StoredVbkBlockAddon

Definition at line 43 of file vbkblock.hpp.

Member Function Documentation

◆ getDifficulty()

int32_t altintegration::VbkBlock::getDifficulty ( ) const
inline

Definition at line 116 of file vbkblock.hpp.

116{ return difficulty; }

◆ getHash()

const hash_t & altintegration::VbkBlock::getHash ( ) const
Returns
hash block hash

◆ getHeight()

int32_t altintegration::VbkBlock::getHeight ( ) const
inline

Definition at line 117 of file vbkblock.hpp.

117{ return height; }

◆ getId()

short_hash_t altintegration::VbkBlock::getId ( ) const
inline

Definition at line 101 of file vbkblock.hpp.

101{ return getShortHash(); }
short_hash_t getShortHash() const
Calculate the hash of the vbk block.

◆ getMerkleRoot()

uint128 altintegration::VbkBlock::getMerkleRoot ( ) const
inline

Definition at line 124 of file vbkblock.hpp.

124{ return merkleRoot; }

◆ getNonce()

uint64_t altintegration::VbkBlock::getNonce ( ) const
inline

Definition at line 126 of file vbkblock.hpp.

126{ return nonce; }

◆ getPreviousBlock()

uint96 altintegration::VbkBlock::getPreviousBlock ( ) const
inline

Definition at line 119 of file vbkblock.hpp.

119{ return previousBlock; }

◆ getPreviousKeystone()

keystone_t altintegration::VbkBlock::getPreviousKeystone ( ) const
inline

Definition at line 120 of file vbkblock.hpp.

120{ return previousKeystone; }

◆ getSecondPreviousKeystone()

keystone_t altintegration::VbkBlock::getSecondPreviousKeystone ( ) const
inline

Definition at line 121 of file vbkblock.hpp.

121 {
122 return secondPreviousKeystone;
123 }

◆ getShortHash()

short_hash_t altintegration::VbkBlock::getShortHash ( ) const
Returns
hash block hash

◆ getTimestamp()

uint32_t altintegration::VbkBlock::getTimestamp ( ) const
inline

Definition at line 125 of file vbkblock.hpp.

125{ return timestamp; }

◆ getVersion()

int16_t altintegration::VbkBlock::getVersion ( ) const
inline

Definition at line 118 of file vbkblock.hpp.

118{ return version; }

◆ name()

static const std::string & altintegration::VbkBlock::name ( )
inlinestatic

Definition at line 103 of file vbkblock.hpp.

103{ return _name; }

◆ toRaw() [1/2]

std::vector< uint8_t > altintegration::VbkBlock::toRaw ( ) const
Returns
string represantation of the data

◆ toRaw() [2/2]

void altintegration::VbkBlock::toRaw ( WriteStream stream) const
Parameters
streamdata stream to write into

◆ toVbkEncoding() [1/2]

std::vector< uint8_t > altintegration::VbkBlock::toVbkEncoding ( ) const
Returns
bytes data

◆ toVbkEncoding() [2/2]

void altintegration::VbkBlock::toVbkEncoding ( WriteStream stream) const
Parameters
streamdata stream to write into

Friends And Related Function Documentation

◆ operator<

bool operator< ( const VbkBlock a,
const VbkBlock b 
)
friend

Definition at line 72 of file vbkblock.hpp.

72 {
73 return a.getHeight() < b.getHeight();
74 }

The documentation for this struct was generated from the following file: