6 log "github.com/sirupsen/logrus"
8 "github.com/bytom/consensus"
9 "github.com/bytom/protocol/bc"
10 "github.com/bytom/protocol/bc/types"
13 func genesisTx() *types.Tx {
14 contract, err := hex.DecodeString("00148c9d063ff74ee6d9ffa88d83aeb038068366c4c4")
16 log.Panicf("fail on decode genesis tx output control program")
19 txData := types.TxData{
21 Inputs: []*types.TxInput{
22 types.NewCoinbaseInput([]byte("Information is power. -- Jan/11/2013. Computing is power. -- Apr/24/2018.")),
24 Outputs: []*types.TxOutput{
25 types.NewTxOutput(*consensus.BTMAssetID, consensus.InitialBlockSubsidy, contract),
28 return types.NewTx(txData)
31 // GenesisBlock will return genesis block
32 func GenesisBlock() *types.Block {
34 txStatus := bc.NewTransactionStatus()
35 txStatus.SetStatus(0, false)
36 txStatusHash, err := bc.TxStatusMerkleRoot(txStatus.VerifyStatus)
38 log.Panicf("fail on calc genesis tx status merkle root")
41 merkleRoot, err := bc.TxMerkleRoot([]*bc.Tx{tx.Tx})
43 log.Panicf("fail on calc genesis tx merkel root")
46 block := &types.Block{
47 BlockHeader: types.BlockHeader{
51 Timestamp: 1524549600,
52 Bits: 2161727821137910632,
53 BlockCommitment: types.BlockCommitment{
54 TransactionsMerkleRoot: merkleRoot,
55 TransactionStatusHash: txStatusHash,
58 Transactions: []*types.Tx{tx},