Documentation ¶
Index ¶
Constants ¶
View Source
const Difficulty = 5
Difficulty describes the difficulty of the algorithm
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockChain ¶
type BlockChain []Block
BlockChain represents a BlockChain
func NewBlockChain ¶
func NewBlockChain() (blockchain BlockChain)
NewBlockChain creates an empty BlockChain with a Genesis block
func UnMarshal ¶
func UnMarshal(data []byte) (blockchain BlockChain, err error)
UnMarshal deserializes a slice of bytes into a BlockChain data the array of bytes to deserialize
func (*BlockChain) IsEmpty ¶
func (bc *BlockChain) IsEmpty() bool
IsEmpty checks to see if the blockchain is empty
func (*BlockChain) Iterator ¶
func (bc *BlockChain) Iterator() *BlockChainIterator
func (*BlockChain) Last ¶
func (bc *BlockChain) Last() (block Block, err error)
Pop removes and returns the last element of blockchain
func (*BlockChain) Marshal ¶
func (bc *BlockChain) Marshal() (data []byte, err error)
Marshal will marshal a BlockChain into an slice of bytes
func (*BlockChain) Push ¶
func (bc *BlockChain) Push(data []byte) (err error)
Push pushes new data onto the blockchain
type BlockChainIterator ¶
type BlockChainIterator struct {
// contains filtered or unexported fields
}
func (*BlockChainIterator) Next ¶
func (iter *BlockChainIterator) Next() (block Block, err error)
Next walks through the blockchain history from latest to the genesis block
Click to show internal directories.
Click to hide internal directories.