Documentation ¶
Overview ¶
proof of work algorithm
Index ¶
Constants ¶
View Source
const Difficulty = 12 // means how many zeros we want in the beginning of the hash byte, the difficulty will dynamically increase in reallity
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockChain ¶
func InitBlockChain ¶
func InitBlockChain() *BlockChain
func (*BlockChain) AddBlock ¶
func (chain *BlockChain) AddBlock(data string)
func (*BlockChain) Iterator ¶
func (chain *BlockChain) Iterator() *BlockChainIterator
type BlockChainIterator ¶
func (*BlockChainIterator) Next ¶
func (iter *BlockChainIterator) Next() *Block
type ProofOfWork ¶
func NewProof ¶
func NewProof(b *Block) *ProofOfWork
func (*ProofOfWork) InitData ¶
func (pow *ProofOfWork) InitData(nonce int) []byte
func (*ProofOfWork) Run ¶
func (pow *ProofOfWork) Run() (int, []byte)
func (*ProofOfWork) Validate ¶
func (pow *ProofOfWork) Validate() bool
Click to show internal directories.
Click to hide internal directories.