Documentation ¶
Index ¶
Constants ¶
View Source
const Difficulty = 12
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
type Block struct { Hash []byte Transactions []*Transaction PrevHash []byte Nonce int }
func CreateBlock ¶
func CreateBlock(txs []*Transaction, prevHash []byte) *Block
func Deserialize ¶
func Genesis ¶
func Genesis(coinbase *Transaction) *Block
func (*Block) HashTransactions ¶
type Blockchain ¶
func ContinueBlockchain ¶
func ContinueBlockchain(address string) *Blockchain
func InitBlockchain ¶
func InitBlockchain(address string) *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
type Transaction ¶
func CoinbaseTx ¶
func CoinbaseTx(to, data string) *Transaction
func (*Transaction) IsCoinbase ¶
func (tx *Transaction) IsCoinbase() bool
func (*Transaction) SetID ¶
func (tx *Transaction) SetID()
Click to show internal directories.
Click to hide internal directories.