Exemplo n.º 1
0
func createWalletEntry(filename string) (*visor.ReadableWalletEntry, error) {
	pub, sec := coin.GenerateKeyPair()
	addr := coin.AddressFromPubKey(pub)

	w := visor.WalletEntry{
		Address: addr,
		Public:  pub,
		Secret:  sec,
	}

	rw := visor.NewReadableWalletEntry(&w)
	if err := rw.Save(filename); err == nil {
		fmt.Printf("Wrote wallet entry to \"%s\"\n", filename)
		return &rw, nil
	} else {
		fmt.Fprintf(os.Stderr, "Failed to write wallet entry to \"%s\"\n",
			filename)
		return nil, err
	}
}
Exemplo n.º 2
0
// Writes a wallet entry to disk at filename
func writeMasterKeysFile() (visor.WalletEntry, error) {
	we := visor.NewWalletEntry()
	rwe := visor.NewReadableWalletEntry(&we)
	err := rwe.Save(testMasterKeysFile)
	return we, err
}