Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Timestamp int64 Nonce int64 Transactions []*Transaction PrevBlockHash []byte Hash []byte }
Main blockchain element, The Block
func DecodeBlock ¶
Deserializing the block to use it after its retrieval.
func NewBlock ¶
func NewBlock(transactions []*Transaction, prevBlockHash []byte) *Block
Constructor method for the Block
func NewGenesisBlock ¶
func NewGenesisBlock(coinbase *Transaction) *Block
Constructor method for Genesis Block
func (*Block) HashTransactions ¶
Method that joins and hases every trabsaction id stored in the block.
type Blockchain ¶
List of Blocks, The Blockchain
func CreateBlockchain ¶
func CreateBlockchain(address, nodeID string) *Blockchain
Method that instatiates a totally new blockchain for some given address and nodeID.
func NewBlockchain ¶
func NewBlockchain(nodeID string) *Blockchain
Constructor function for The Blockchain.
func (*Blockchain) AddBlock ¶
func (blockchain *Blockchain) AddBlock(newBlock *Block)
Method that adds a new block to The Blockchain
func (*Blockchain) Print ¶
func (blockchain *Blockchain) Print()
Method that prints every block within the chain.
type ProofOfWork ¶
type ProofOfWork struct {
// contains filtered or unexported fields
}
Proof of Work using Hascash
func NewProofOfWork ¶
func NewProofOfWork(block *Block) *ProofOfWork
Constructor of PoW for a given block
func (*ProofOfWork) Validate ¶
func (pow *ProofOfWork) Validate() bool
Validate the proof of work using the bolck's nonce
type TXOutput ¶
func NewTXOutput ¶
type Transaction ¶
func NewCoinbaseTX ¶
func NewCoinbaseTX(to, data string) *Transaction
Click to show internal directories.
Click to hide internal directories.