7 "github.com/tendermint/go-wire/data"
8 cmn "github.com/tendermint/tmlibs/common"
11 //------------------------------------------------------------
12 // we store the gendoc in the db
14 var GenDocKey = []byte("GenDocKey")
16 //------------------------------------------------------------
17 // core types for a genesis definition
18 type GenesisDoc struct {
19 GenesisTime time.Time `json:"genesis_time"`
20 ChainID string `json:"chain_id"`
21 PrivateKey string `json:"private_key"`
22 AppHash data.Bytes `json:"app_hash"`
25 // Utility method for saving GenensisDoc as JSON file.
26 func (genDoc *GenesisDoc) SaveAs(file string) error {
27 genDocBytes, err := json.Marshal(genDoc)
31 return cmn.WriteFile(file, genDocBytes, 0644)
34 //------------------------------------------------------------
35 // Make genesis state from file
37 func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error) {
38 genDoc := GenesisDoc{}
39 err := json.Unmarshal(jsonBlob, &genDoc)