Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #-25: Missing inputs, code=-25 #930

Closed
EasonWang01 opened this issue Nov 22, 2017 · 7 comments
Closed

Error #-25: Missing inputs, code=-25 #930

EasonWang01 opened this issue Nov 22, 2017 · 7 comments

Comments

@EasonWang01
Copy link

EasonWang01 commented Nov 22, 2017

When broadcast transaction using bitcoinjs signed transaction will result the error code

Validation Error: BitcoindException(super=com.neemre.btcdcli4j.core.BitcoindException: Error #-25: Missing inputs, code=-25)
var bitcoin = require('bitcoinjs-lib')
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVw1')
var tx = new bitcoin.TransactionBuilder()

tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0)
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
tx.sign(0, keyPair)
txHEX = tx.build().toHex()
console.log(txHEX);

var tx = bitcoin.Transaction.fromHex(txHEX);
console.log(tx)

but if I using some exist TXhex from blockchain.info it can success broadcast.
I thought it's about the version?

@afk11
Copy link
Contributor

afk11 commented Nov 22, 2017

That output was already spent in 2014:

https://btc.com/105eeeb9c448872c2257f93d5e2b14248c4a800cd69641911aa7e964cf570872#in_0

Even still, you should blank out that private key though ASAP..

@EasonWang01
Copy link
Author

EasonWang01 commented Nov 22, 2017

It just an key from other example.
If it already spend it will says already spend not response code:-25.
Because 6 month ago I was doing the same thing,it will response already spend message to me.
But now only give some exception.I also notice new TXhex now have more bytes in hex,guess it was cause by node version?

@EasonWang01
Copy link
Author

EasonWang01 commented Nov 23, 2017

You can also using the example from your bitcoinjs website.

var bitcoin = require('bitcoinjs-lib')
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy')
var tx = new bitcoin.TransactionBuilder()

var tx = new bitcoin.TransactionBuilder()

// Add the input (who is paying):
// [previous transaction hash, index of the output to use]
var txId = 'aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31'
tx.addInput(txId, 0)

// Add the output (who to pay to):
// [payee's address, amount in satoshis]
tx.addOutput("1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK", 15000)

// Initialize a private key using WIF
var privateKeyWIF = 'L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy'
var keyPair = bitcoin.ECPair.fromWIF(privateKeyWIF)

// Sign the first input with the new key
tx.sign(0, keyPair)

// Print transaction serialized as hex
console.log(tx.build().toHex())

then broadcast using https://blockchain.info/pushtx or bitpay,you will see the error

@dcousens
Copy link
Contributor

@EasonWang01 can you post the txHex that you have, so we can compare?

@EasonWang01
Copy link
Author

EasonWang01 commented Nov 28, 2017

Just run the code above as same as on bitcoinjs website example,will got the following hex.

0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000

https://blockchain.info/pushtx will cause error.

@dcousens
Copy link
Contributor

dcousens commented Nov 28, 2017

I get Missing inputs as the Error from bitcoind.

The inputs aren't in the UTXO, so it makes sense as an error.

Maybe your previous error was using a different backend and they therefore had more information?

I don't think this is an unexpected result.

@EasonWang01
Copy link
Author

I found the error only happened when using blockchain.info,so not related to bitcoinjs lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants