Ejemplo n.º 1
0
func collectPrivateKeys(coin string, payments []*bitcoin.Payment, privKeys map[string]string) {
	for _, payment := range payments {
		if privKeys[payment.Address] != "" {
			continue
		} else {
			addr := bitcoin.LoadAddress(payment.Address)
			privKey := ComputePrivateKeyForAddress(addr)
			privKeyWIF := bitcoin.ComputeWIF(coin, privKey, true)
			privKeys[payment.Address] = privKeyWIF
			continue
		}
	}
}
Ejemplo n.º 2
0
func makeWIF() {
	privKey := "0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D"
	wif := bitcoin.ComputeWIF("BTC", privKey, true)
	Info("WIF: %v", wif)

	addr := bitcoin.ComputeAddressForPrivKey("BTC", privKey)
	Info("addr: %v", addr)

	pubKey := bitcoin.PubKeyBytesFromPrivKeyBytes(hexDecode(privKey), false)
	Info("pubKey: %v", hexEncode(pubKey))

	addr = bitcoin.AddrFromPubKeyBytes("BTC", pubKey)
	Info("addr2: %v", addr)

	message := "this is a message"
	signature := bitcoin.SignMessage(privKey, message, true)
	Info("signature: %v", signature)
}