Documentation ¶
Index ¶
Constants ¶
const GenesisDesc = "GenesisBlock Fri Aug 17 23:16:12 MDT 2018"
GenesisDesc is the constant that marks that a block is a genesis block.
Variables ¶
This section is empty.
Functions ¶
func IndentJSON ¶
func IndentJSON(v interface{}) string
IndentJSON converts data to JSON format and returns it as a string.
func IsGenesisBlock ¶
IsGenesisBlock returns true if this is a genisis block.
func SerializeBlock ¶
SearalizeBlock searializes into bytes the fields that will be hashed the hash of the block. This is the hash that the next block will use to point to this block and the hash that this block will be saved as.
func SerializeForSeal ¶
SearalizeForSeal searializes into bytes the fields that will be hashed for the mining seal.
func WriteBlock ¶
WriteBlock read i;n a block from a file.
Types ¶
type BlockType ¶
type BlockType struct { Index int // position of this block in the chain, 0, 1, 2, ... Desc string // if "genesis" string then this is a genesis block. ThisBlockHash hash.BlockHashType // PrevBlockHash hash.BlockHashType // This is 0 length if this is a "genesis" block Nonce uint64 // Seal hash.SealType // MerkleHash hash.MerkleHashType // AS-03 Tx []*transactions.TransactionType // Add Transactions to Block Later, (AS-04 will do this) }
BlockType is a single block in the block chain.
func InitBlock ¶
func InitBlock(ii int, dd string, prev hash.BlockHashType) (bk *BlockType)
InitBlock creates and returns a block.
func InitGenesisBlock ¶
func InitGenesisBlock() (gb *BlockType)
InitGenesisBlock create and return a genesis block. This is a special block at the beginning of a chain.