I am trying to script automatic payments without hosting a full node (my server doesn't have enough harddrive space). To do this I'm using electrum's python interface, and I have created a transaction, but when I try to send it, I get the error message: "TX rejected", "code: -22". Looking that up here, it appears that's an error either parsing or validating the transaction. It appears the error was thrown here.

But I cannot determine why. The transaction contains 2 inputs, 2 outputs, and the outputs + fee of 0.0001 = the size of the inputs (as of now) as verified via blockchain.info. The size of the transaction is under 1kb, so the fee is as I understand .0001. I sent an earlier transaction of .0001 with a .0001 fee through the electrum UI and it went through fine. So why is this transaction failing?

The raw transaction is:


and I uploaded the decoded version (using electrum decoderawtransaction ... or https://coinb.in/decode-raw-transaction.html - both give the same output) here


1 Answer 1


The transaction wasn't going through because of the newly implemented "dust transaction" policy that makes it so that no output of a transaction may total less than 54.3 micro-bitcoins. One of my outputs was below this threshold. So I fixed that, but then the output to the "change" address was pulled below 54.3 uBTC and it still failed. I haven't found a way to ensure electrum doesn't try to deposit less than 54.3 uBTC into the change address, so for now I'm sticking with a single, large input to avoid small amounts of change.

  • 1
    You are correct. Normally clients clients avoid this by just paying any input smaller than the dust limit into the fee.
    – Anonymous
    Sep 21, 2013 at 5:32
  • 1
    // , Thanks much for posting the answer to this, even though you found it out on your own the next day. Feb 27, 2018 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.