朝夕Go高端全栈架构师(Golang微服务区块链)
创建genesisblock函数-NewGenesisBlock
//genesisblock//todo,通过文件形式传入genesisblockfunc NewGenesisBlock() *Block {
header := &Header{}
body := &Body{}
b := &Block{header: header, body: body}
b.header.Extradata = []byte("Genesis Block")
b.header.Coinbase = nil
b.header.Number = 0
b.header.ParentHash = nil
b.header.Timestamp = 1535706356
b.header.Blockhash = b.SetHash()
Logger.Infoln("block", b)
return b}