Beispiel #1
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 != "" {

		seckeys := coin.GenerateDeterministicKeyPairs([]byte(seed), genCount)
		for _, sec := range seckeys {
			pub := coin.PubKeyFromSecKey(sec)
			fmt.Printf("%s\n", tstring(pub, sec))
		}
		//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)
	   }
	*/

}
Beispiel #2
0
// Checks that the public key is derivable from the secret key,
// and that the public key is associated with the address
func (self *WalletEntry) Verify() error {
	if coin.PubKeyFromSecKey(self.Secret) != self.Public {
		return errors.New("Invalid public key for secret key")
	}
	return self.VerifyPublic()
}