You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have some code to send BTC to one address, can some one help me send to 2 different addresses with different amounts, thank you so much.
` wif, err := btcutil.DecodeWIF(secret)
if err != nil {
return "", err
}
pkHex := hex.EncodeToString(wif.PrivKey.Serialize())
tx := gobcy.TempNewTX(from, destination, *big.NewInt(int64(amount)))
if fee != -1 {
tx.Fees = *big.NewInt(int64(fee))
}
//Post New TXSkeleton
skel, err := bs.chain.NewTX(tx, false)
if err != nil {
log.Println("bs.chain.NewTX err: ", err, tx)
return "", err
}
prikHexs := []string{}
for i := 0; i < len(skel.ToSign); i++ {
prikHexs = append(prikHexs, pkHex)
}
//Sign it locally
err = skel.Sign(prikHexs)
if err != nil {
log.Println("skel.Sign error: ", err)
return "", err
}
// add this one with segwit address:
for i, _ := range skel.Signatures {
skel.Signatures[i] = skel.Signatures[i] + "01"
}
skel, err = bs.chain.SendTX(skel)
if err != nil {
log.Println("bs.chain.SendTX err:", err)
return "", err
}
return skel.Trans.Hash, nil`
The text was updated successfully, but these errors were encountered:
You have to create and initialise a TX object manually.
tx := gobcy.TX{//fields}
Hi, so my address have 10 btc, I need to send all to 2 address. 5 eth for per address.
How to est fee?
I got an error:
"HTTP 400 Bad Request, Message(s): Not enough funds after fees in 1 inputs to pay for 2 outputs, missing -2772."
code:
Hi, I have some code to send BTC to one address, can some one help me send to 2 different addresses with different amounts, thank you so much.
` wif, err := btcutil.DecodeWIF(secret)
if err != nil {
return "", err
}
The text was updated successfully, but these errors were encountered: