朝夕Go高端全棧架構(gòu)師(Golang微服務(wù)區(qū)塊鏈)
2023-02-22 17:40 作者:塵埃夢(mèng)落定 | 我要投稿
創(chuàng)建genesisblock函數(shù)-NewGenesisBlock
//genesisblock//todo,通過(guò)文件形式傳入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}
??
標(biāo)簽: