Documentation ¶
Index ¶
Constants ¶
View Source
const MAX_NONCE = ^uint64(0)
Variables ¶
View Source
var BC = NewBlockchain()
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Difficulty *big.Int `json:"difficulty"` Hash string `json:"hash"` PreviousHash string `json:"previous_hash"` MerkleRoot string `json:"merkle_root"` Txs []Tx `json:"tx"` Index uint `json:"index"` Timestamp uint `json:"timestamp"` Nonce uint64 `json:"nonce"` }
func GenesisBlock ¶
func GenesisBlock() *Block
func (*Block) CalculateHash ¶
func (*Block) CalculateMerkleRoot ¶
type Blockchain ¶
type Blockchain struct { Difficulty *big.Int `json:"difficulty"` Chain []Block `json:"chain"` PendingBlock Block `json:"pending_block"` MiningReward uint `json:"mining_reward"` }
func NewBlockchain ¶
func NewBlockchain() *Blockchain
func (*Blockchain) GetLatestBlock ¶
func (bc *Blockchain) GetLatestBlock() Block
func (*Blockchain) Print ¶
func (bc *Blockchain) Print()
Click to show internal directories.
Click to hide internal directories.