示例#1
0
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
}
示例#2
0
func NewDeterministicWallet() Wallet {
	seed := NewDeterministicWalletSeed()
	pub, sec := coin.GenerateDeterministicKeyPair(seed[:])
	return &DeterministicWallet{
		Filename: NewWalletFilename(seed.toWalletID()),
		Seed:     seed,
		Entry:    NewWalletEntryFromKeypair(pub, sec),
	}
}
示例#3
0
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)
	   }
	*/

}