Example #1
0
func getKeyEntry(pub cipher.PubKey, sec cipher.SecKey) KeyEntry {

	var e KeyEntry

	//skycoin address
	if BitcoinAddress == false {
		e = KeyEntry{
			Address: cipher.AddressFromPubKey(pub).String(),
			Public:  pub.Hex(),
			Secret:  sec.Hex(),
		}
	}

	//bitcoin address
	if BitcoinAddress == true {
		e = KeyEntry{
			Address: cipher.BitcoinAddressFromPubkey(pub),
			Public:  pub.Hex(),
			Secret:  cipher.BitcoinWalletImportFormatFromSeckey(sec),
		}
	}

	//hide the secret key
	if HideSeckey == true {
		e.Secret = ""
	}

	return e
}
Example #2
0
// GenerateAddresses generates bitcoin addresses.
func GenerateAddresses(seed []byte, num int) (string, []coin.AddressEntry) {
	sd, seckeys := cipher.GenerateDeterministicKeyPairsSeed(seed, num)
	entries := make([]coin.AddressEntry, num)
	for i, sec := range seckeys {
		pub := cipher.PubKeyFromSecKey(sec)
		entries[i].Address = cipher.BitcoinAddressFromPubkey(pub)
		entries[i].Public = pub.Hex()
		if !HideSeckey {
			entries[i].Secret = cipher.BitcoinWalletImportFormatFromSeckey(sec)
		}
	}
	return fmt.Sprintf("%2x", sd), entries
}