1

I am using bitcoincashjs (Bitcore fork) library to make BCH transaction (actually it is an exchange with ChangeNow API). Source wallet has only one UTXO:

[
  {
    "address":"bitcoincash:qpde96gh8j9hd9jewzdu6rfme725vpm0mqc2wzyque",
    "txid":"422defba3dce33a55bf84650848a2fa971907ec6b6ce156fa414254d2e5b45a4",
    "vout":1,
    "scriptPubKey":"76a9145b92e9173c8b769659709bcd0d3bcf9546076fd888ac",
    "amount":0.02880688,
    "satoshis":2880688,
    "height":531325,
    "confirmations":3
  }
]

So, then I build the transaction

const bitcoreTransaction = new Bitcore.Transaction()
  .from(unspentOutputs)
  .to(toAddress, fromFunction(data.amount)[toFunction]())
  .fee(fromFunction(fee)[toFunction]())
  .feePerKb(this.getFeePerKb()) // 4000
  .change(fromAddress)
  .sign(privateKeyForSign);

and check for serialization error, which says: Dust amount detected in one output. When I debug resulting tx object, I see two outputs and one of them has 0 amount. Skipping of dust check on client does not help as it is checked on API side while publishing the transaction and error is returned.

Any ideas how to avoid this?

  • Try if it also happens with bitcore-lib. If not, report it. – MCCCS May 22 '18 at 14:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.