func (self *Blockchain) SetBlockchainSecKey(seed string) { pub, sec := coin.GenerateDeterministicKeyPair([]byte(seed)) if pub != self.Genesis.PubKey { log.Panic("ERROR: pubkey does not correspond to loaded pubkey") } self.SecKey = sec }
func NewDeterministicWallet() Wallet { seed := NewDeterministicWalletSeed() pub, sec := coin.GenerateDeterministicKeyPair(seed[:]) return &DeterministicWallet{ Filename: NewWalletFilename(seed.toWalletID()), Seed: seed, Entry: NewWalletEntryFromKeypair(pub, sec), } }
func main() { registerFlags() parseFlags() if seed == "" { for i := 0; i < genCount; i++ { pub, sec := coin.GenerateKeyPair() fmt.Printf("%s\n", tstring(pub, sec)) } } if seed != "" { if genCount != 1 { log.Panic("multiple deterministic addresses not implemented yet") } pub, sec := coin.GenerateDeterministicKeyPair([]byte(seed)) fmt.Printf("%s\n", tstring(pub, sec)) } /* if outFile != "" { w := createWalletEntry(outFile, testNetwork) if w != nil { printWalletEntry(w, labelStdout, PrintAddress, printPublic, printSecret) } } if inFile != "" { printWalletEntryFromFile(inFile, labelStdout, PrintAddress, printPublic, printSecret) } */ }