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?

closed as off-topic by Andrew Chow Jul 17 at 17:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about cryptocurrencies or projects that are not Bitcoin, and are not applicable to Bitcoin, are off-topic. For more information, see this meta-discussion." – Andrew Chow
If this question can be reworded to fit the rules in the help center, please edit the question.

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