Bitcoinjs-lib: Missing inputs. Code:-25

Created on 7 Dec 2017  路  5Comments  路  Source: bitcoinjs/bitcoinjs-lib

I tried to broadcast a Litecoin transaction that build with bitcoinjs-lib, but SOMETIMES it gets an error Missing inputs. Code:-25

Here is the raw transaction. I check if it is signed correctly with here and here, and it seems to me it is fine.
Can anyone help me?

0100000001a85b6dfa713f55ca31cb143c6dc9b87ebd65bfa10944d7653afca22460a51c8f000000006b483045022100aa73b5eca7e0de31747ce417087411ca501f4b3831ad9a269a7053c074c2605b02202f950647faabb08b9c6f9d69f8ec51a2a830862cbd8b7e76e58d6200edd1ffc901210376c2430c5f191aeb65f03f1c129d80bfa902fc9949d855eb044ff29fbc2e37a4ffffffff02ac010f00000000001976a91490ab25fdff5f233a108a09509a42464edd0f2b4788aca4630000000000001976a914d6e95f48b6526c0aaf149f5acbbf2eacf721750d88ac00000000
how to / question / docs

All 5 comments

@yuyaogawa The transaction is properly formed, but references an invalid (spent) input:

Error validating transaction: Transaction 8f1ca56024a2fc3a65d74409a1bf65bd7eb8c96d3c14cb31ca553f71fa6d5ba8 referenced by input 0 of a29a1fb5361576887219e754057c5fd5beb37eb7933c3f7af924cfcd6b0aaf7a has already been spent.

The transaction's signature is perfectly fine.

@atshawn Thank you for your reply and I have spent that utxo for testing so the error is double spent for the transaction, sorry for about that.

Could you please check this transaction again? This input is not spent yet.

01000000011c60cba5e93e8494d55f2bc95ffc83a1a0257aaf90889018269ea114fb3787af010000006a473044022071016b33187966b2238652755589d1affc6d642a8eae677b7e74783bedaac32902200817f3797761c4466cf70e583e39825026e8d49725afea48342bc6eaa1c30f7401210323d0a54183617054a565f5cbac92e6047a1820e01e32466549aa3060777189dcffffffff0294060100000000001976a914d6e95f48b6526c0aaf149f5acbbf2eacf721750d88ac645e0000000000001976a91490ab25fdff5f233a108a09509a42464edd0f2b4788ac00000000

From @CodersBrothers in https://github.com/bitcoinjs/bitcoinjs-lib/issues/955

some transaction input come from a orphan transaction or orphan block. I'm not sure if I'm true, because I'm a little bit lost. This is my conclusion after hours checking.

My question is: there are any way to filter unspents that are not be in a orphan block with this library?

I suppose that this check process not is responsabillity of this library, because require network status data, so, in this case: How can I avoid this problem or what I need to do? Some clue?

Right now, as a quick trick, I get the neccesary unspents inputs, after a random select. With this I can be lucky and take not orphan unspents.

I kind of found out that one of the outputs' value does not match the DustThreshold which is currently 54600. The above transaction has 2 outputs which are out[0] is 67220 and out[1] is 24164. Out[1] is supposed to be for the change. Can't I set under DustThreshold for change? If not, it is impossible to divide an UTXO to less than 54600 litoshis.
Can anyone explain about this?

I will close here once I get the answer. Please educate me.

Can't I set under DustThreshold for change?

Nope.

it is impossible to divide an UTXO to less than 54600 litoshis.

What do you mean?
If you can't add an output for change that is less than the dust threshold set by the network, then throw it away (aka, add it to the mining fee), or don't spend it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rbndg picture rbndg  路  3Comments

Mr-Mondragon picture Mr-Mondragon  路  3Comments

zhaozhiming picture zhaozhiming  路  3Comments

dcousens picture dcousens  路  3Comments

namnv04 picture namnv04  路  3Comments