Documentation ¶
Index ¶
Constants ¶
View Source
const Difficulty = 12
Difficulty is a number. The hire the number, the harder the difficulty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
Block is the struct for each block in the blockchain.
func CreateBlock ¶
CreateBlock creates a new block in the blockchain.
func Deserialize ¶
Deserialize takes in encoded data and returns an un-encoded block.
type Blockchain ¶
Blockchain is a list of blocks in the blockchain.
func (*Blockchain) AddBlock ¶
func (chain *Blockchain) AddBlock(data string)
AddBlock adds a block to the blockchain.
func (*Blockchain) Iterator ¶
func (chain *Blockchain) Iterator() *Iterator
Iterator converts a blockchain to a blockchain iterator.
type ProofOfWork ¶
ProofOfWork is the struct fot our proof of work algorithm.
func (*ProofOfWork) InitData ¶
func (pow *ProofOfWork) InitData(nonce int) []byte
InitData initialized the data.
func (*ProofOfWork) Run ¶
func (pow *ProofOfWork) Run() (int, []byte)
Run initiates the proof of work algorithm.
func (*ProofOfWork) Validate ¶
func (pow *ProofOfWork) Validate() bool
Validate makes sure the proof of work is valid.
Click to show internal directories.
Click to hide internal directories.