Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block struct represents a chain's block
func (*Block) ComputeBlockHash ¶
ComputeBlockHash calculates the base-64 encoding of the SHA-256 block checksum
func (*Block) ComputeDigitalSignature ¶
func (block *Block) ComputeDigitalSignature(ks keyStore.KeyStore) (*DigitalSignature, error)
ComputeDigitalSignature computes the digital signature of a block, given a KeyStore
func (*Block) LinkToPreviousBlock ¶
func (block *Block) LinkToPreviousBlock()
LinkToPreviousBlock takes the block's predecessor, and links it to the current block
func (*Block) SetBlockHash ¶
SetBlockHash is a simple setter
type BlockChain ¶
type BlockChain struct {
// contains filtered or unexported fields
}
BlockChain struct represent a basic BlockChain model
func (*BlockChain) CreateGenesisBlock ¶
func (blockChain *BlockChain) CreateGenesisBlock(data string) Block
CreateGenesisBlock starts the chain by creating its header block
func (*BlockChain) IsValid ¶
func (blockChain *BlockChain) IsValid(block *Block) bool
IsValid checks, given a block in the chain, its expected hash against its current hash then carries on the check for its successors to assert the chain's integrity
func (*BlockChain) SaveBlock ¶
func (blockChain *BlockChain) SaveBlock(block *Block)
SaveBlock calculates a block hash given its previous block, creates the link between the two and inserts it in the chain
type DigitalSignature ¶
type DigitalSignature struct {
// contains filtered or unexported fields
}