github.com/annchain/OG@v0.0.9/core/local_private_info_provider.go (about) 1 package core 2 3 import ( 4 "encoding/json" 5 "github.com/annchain/OG/account" 6 "github.com/annchain/OG/arefactor/common/io" 7 "github.com/spf13/viper" 8 "io/ioutil" 9 ) 10 11 type LocalPrivateInfoProvider struct { 12 } 13 14 func (l LocalPrivateInfoProvider) PrivateInfo() *account.PrivateInfo { 15 // read key file 16 bytes, err := ioutil.ReadFile(io.FixPrefixPath(viper.GetString("iddir"), "nodekey.json")) 17 if err != nil { 18 panic(err) 19 } 20 21 pi := &account.PrivateInfo{} 22 err = json.Unmarshal(bytes, pi) 23 if err != nil { 24 panic(err) 25 } 26 return pi 27 }