<p>It doesn't seems to be a better solution than waiting. The original transaction (the 4 inputs 2 outputs one) has been relayed by the Electrum node that received it and spread over the network, therefore, it's in the mempool of the network nodes. Every transaction that tries to spend the same UTXO referred by the first transaction will be marked as double-spending until the first transaction is pruned from the mempool. Hence, waiting is unfortunately the only solution that comes to my mind.</p>

<p>Edit: Answering another question I came across a thing that could also be useful for you. You can use a <a href="https://www.reddit.com/r/Bitcoin/comments/5g1ge3/your_trasaction_stuck_as_unconfirmed_use_a/" rel="nofollow noreferrer">CPFP</a> approach. To do so, try to spend from the transaction that is pending to be confirmed with a new one with high fee. This new transaction will be like a candy for miners, and in order to include it in a block, they must include the previous also.</p>

<p>Edit2: Regarding the error message provided, there is a problem in how the transaction that the author wants to send (T1 from now on) has been build. The scriptSig of the transaction is not properly set.</p>

<p>The serialised T1 is:</p>

<p>01000000018964907116f6245417b9d9aea1d226e46486c5d485d6b947c95c794e032df612010000001976a9140043be27e16b93c275413e9b4411f08f2cd8bef088acffffffff0120082f08000000001976a9140b01599fd09ef602d71827601871e5a1081459f688ac00000000</p>

<p>Is we decode T1 we will get something like:</p>

<pre><code>version: 01000000
number of inputs: 01 (1)
input 0
     previous txid (little endian): 8964907116f6245417b9d9aea1d226e46486c5d485d6b947c95c794e032df612 (12f62d034e795cc947b9d685d4c58664e426d2a1aed9b9175424f61671906489)
     previous tx output (little endian): 01000000 (1)
     input script (scriptSig) length: 19 (25)
     input script (scriptSig): 76a9140043be27e16b93c275413e9b4411f08f2cd8bef088ac
     nSequence: ffffffff
number of outputs: 01 (1)
output 0
     Satoshis to be spent (little endian): 20082f0800000000 (137300000)
     output script (scriptPubKey) length: 19 (25)
     output script (scriptPubKey): 76a9140b01599fd09ef602d71827601871e5a1081459f688ac
nLockTime: 00000000
</code></pre>

<p>At this point, we can notice that the scriptSig is incorrect. Analysing it carefully, we can notice that it has the structure of a P2PKH scriptPubKey instead of the corresponding signature that should complement the scriptPubKey of the previous transaction (T0 from now on):</p>

<pre><code>76a9140043be27e16b93c275413e9b4411f08f2cd8bef088ac =
OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG
</code></pre>

<p>If we want to be definitely sure about this, we can check the scriptPubKey of the UTXO from T0 we are trying to spend, and analyse both scripts.</p>

<p>The UTXO from T0 we are interested in can be identified by (id:index):</p>

<pre><code>12f62d034e795cc947b9d685d4c58664e426d2a1aed9b9175424f61671906489:1
</code></pre>

<p>If we look for the specific scriptPubKey that contains that UTXO, we will find:</p>

<pre><code>OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG
</code></pre>

<p>That curiously matches with the scriptSig that we have found in T1.</p>

<h2>Conclusion</h2>

<p>T1 scriptSig (input 0) and T0 scriptPubKey (output 1) shared the sames script. T1 scriptSig must provide the signature required in T0 scriptPubKey in order to pass the validation:</p>

<pre><code>scriptSig:  [signature]    
sciptPubKey: OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG
</code></pre>

CC BY-SA 3.0
2017-02-22T12:29:27.480Z
That approach, unfortunately, won't work. I thought about doing CPFP, too, but the one output I control is too small to make a difference.
UTF-8
CC BY-SA 3.0
2017-02-22T12:35:33.187Z
Can't you use it together with another UTXO you own, not necessarily associate with the same address, to build a transaction in which include a fee that does the trick?
sr_gi
CC BY-SA 3.0
2017-02-22T12:57:04.693Z
Ah, thanks! I have no idea why I didn't think of this. Do you know what `bitcion-qt`'s message means, though? Knowing this could be useful for the future when I want to send raw transactions.
UTF-8
CC BY-SA 3.0
2017-02-22T13:42:16.443Z
Not exactly, but it seems to be, indeed, that an input is missing.

https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/qa/rpc-tests/rawtransactions.py#L67

However, the error code corresponds to a generic error when submitting a block/transaction.

https://github.com/bitcoin/bitcoin/blob/62f2d769e45043c1f262ed45babb70fe237ad2bb/src/rpc/protocol.h#L49
sr_gi
CC BY-SA 3.0
2017-02-22T17:33:52.567Z
But in that case, the input actually doesn't exist. In my case, the inputs do exist. They only aren't downloaded. At [this point](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/rpc/rawtransaction.cpp#L899), the coins' existence is checked. `view.AccessCoins` should point to (I haven't checked in an IDE, just read through it on GitHub) [this method](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/coins.cpp#L135) where
UTF-8
CC BY-SA 3.0
2017-02-22T17:36:38.357Z
[`FetchCoins`](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/coins.cpp#L72) is called which in turn calls [`GetCoins`](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/coins.cpp#L90). I don't see how that method gets the coins, though. But if it does, it looks like you can send raw transactions even if you yourself haven't downloaded the blockchain to the point where the coins are introduced.
UTF-8
CC BY-SA 3.0
2017-02-22T17:58:48.140Z
It is strange though, do yo mind providing the full serialized tx? That way I would try to check it field by field.
sr_gi
CC BY-SA 3.0
2017-02-22T18:15:21.140Z
It's this: http://pastebin.com/Qef0YU2k
UTF-8
CC BY-SA 3.0
2017-02-23T09:19:46.353Z
Alright, now I see. The input script of the transaction (scriptSig) is not correct. How have you built the transaction? I leave you why its wrong editing the answer, have no space here.
sr_gi
CC BY-SA 3.0
2017-02-23T22:28:46.737Z
How did you build the transaction by the way, I'm quite curious about how that scriptSig ended up being there.
sr_gi
CC BY-SA 3.0
2017-02-24T02:12:56.770Z
I used https://coinb.in to create the transaction. I entered the address the money is stuck in to identify the UTXO. It then looked for it and found it.
UTF-8
CC BY-SA 3.0
2017-02-24T09:17:14.510Z
Ok, I see. Once you created the transaction, did you signed it using the signing function from the coinb.in web, if not, that could be the reason why the sigScript was containing incorrect data. Anyway, looks like the transaction finally got confirmed. Maybe we should close this.
sr_gi
CC BY-SA 3.0
2017-02-22T08:44:37.620Z
2017-02-23T11:02:28.583Z
2017-02-23T11:02:28.583Z
sr_gi
<p>Short answer; you will have to wait. It will end up resolving, but may take a day or more. There's a longer answer I could provide; but it won't change the fact that waiting is all you can do. </p>

CC BY-SA 3.0
2017-02-21T19:55:01.153Z
The transaction's fee is 0.15 mBTC (around 17 ¢, right now), whereas transactions which go through currently have at least 3 times that as a fee. It won't confirm for quite some time and possibly will have been removed from many mempools way before it goes through. Is there a way to make `bitcoin-qt` send the raw transaction I prepared? It could propagate after enough nodes removed the first transaction from their mempools. Is there an alternative Bitcoin software which can do this? (Send it directly via my IP, not via an external service.)
UTF-8
CC BY-SA 3.0
2017-02-22T16:08:38.813Z
You can do nothing but wait. If the transaction has already been seen by (N) nodes, those nodes will need to eventually timeout and drop the transaction, which is when it will be returned to you. Rebroadcasting it, or having more nodes "see" it will not increase it's chance of a block accepting it; because the node which finds a block already knows about it; it's out there; been broadcast (and based off of the fee the block finding node will include or not include it based off their own settings of fees they accept). That said; your transaction is in the mempool. All you can do is wait.
McFlySoHigh
CC BY-SA 3.0
2017-02-21T19:31:02.170Z
2017-02-21T19:31:02.170Z
McFlySoHigh
<p>I sent money from 4 inputs to 2 outputs, one of which I don't control. The transaction's fee is too small (didn't change my settings and the transaction fees got a lot higher, recently) and will not confirm anytime soon.</p>

<p>I then created a new transaction spending 2 of the 4 inputs of the original transaction to 1 output. This transaction is obviously doubple-spending.</p>

<p>After trying to breadcast the second transaction via Electrum and with several online services, still not a single one broadcasted it. They all know it's a double-spend and won't broadcast double-spends.</p>

<p>Subsequently, I installed <code>bitcoin-qt</code>, hoping to be able to send the transaction directly to my peers.</p>

<p>I never used the <code>bitcoin-qt</code> console before, so I hope this is correct:</p>

<pre><code>sendrawtransaction 010000000189
</code></pre>

<p>I cut the string off after 12 characters. The entire signed transaction is 382 hexadecimal digits long. Do I need to use quotes, some kind of brackets, a semicolon, something else?</p>

<p>The error message it returned is this:</p>

<blockquote>
  <p>Missing inputs (code -25)</p>
</blockquote>

<p>I don't know what this error message means exactly but in case it means that the inputs were not found in the UTXO set generated from the part of the blockchain that was already downloaded:</p>

<p><code>bitcoin-qt</code> doesn't know my inputs as they are only between a few months and a few weeks old but it shouldn't have to to send a signed transaction.</p>

<p>It doesn't know my private keys either, but again, it shouldn't have to.</p>

<p>Can I force it to do so even if it can't check whether the inputs exist? The reason is that I'm on a super slow internet connection and downloading the blockchain would take several days, even if nothing else went over the connection during that time.</p>

CC BY-SA 3.0
2017-02-21T16:19:13.947Z
I think the best you can do is, unfortunately, wait. Your transaction with low fees will not likely be included into a block, but it is in the mempool of the Bitcoin nodes, since, according to what you said, several online services do not forward your doble-spending transaction, that is, there is a conflict with the new one you want to create a then old one they already have. Eventually the old transaction will be deleted from them mempool, and you will be able to spend then output again.
sr_gi
CC BY-SA 3.0
2017-02-21T16:48:11.357Z
@sr_gi Unfortunately, I think I will still have to send a conflicting transaction via a client as online services seem to have really big mempools and keep transactions for a long time. I don't know how big the mempools of Electrum's servers are. Do you know of any different wallet which will let me broadcast raw transactions? (Possibly in the future.)
UTF-8
CC BY-SA 3.0
2017-02-21T16:56:11.993Z
Not really, I've normally used bitcoind or online API like blockr's or blockexplorer's. However, even though Electrum may keep transactions in their nodes' mempool for a longer time than others (I do not know about this), this do not mean that you could not use other services to broadcast the "double-spend transaction". As long as other nodes start relaying the new transaction (once they purge the old one from their mempool), it will end in the blockchain.
sr_gi
CC BY-SA 3.0
2017-02-22T11:40:56.690Z
I came across a new solution that may be useful. Check it out!
sr_gi
<bitcoin-core><doublespend><broadcast>
Broadcast a signed transaction
UTF-8
# Broadcast a signed transaction

(Asked by: username_0 on 2017-02-21)

I sent money from 4 inputs to 2 outputs, one of which I don't control. The transaction's fee is too small (didn't change my settings and the transaction fees got a lot higher, recently) and will not confirm anytime soon.

I then created a new transaction spending 2 of the 4 inputs of the original transaction to 1 output. This transaction is obviously doubple-spending.

After trying to breadcast the second transaction via Electrum and with several online services, still not a single one broadcasted it. They all know it's a double-spend and won't broadcast double-spends.

Subsequently, I installed `bitcoin-qt`, hoping to be able to send the transaction directly to my peers.

I never used the `bitcoin-qt` console before, so I hope this is correct:

```
sendrawtransaction 010000000189

```

I cut the string off after 12 characters. The entire signed transaction is 382 hexadecimal digits long. Do I need to use quotes, some kind of brackets, a semicolon, something else?

The error message it returned is this:

> Missing inputs (code -25)

I don't know what this error message means exactly but in case it means that the inputs were not found in the UTXO set generated from the part of the blockchain that was already downloaded:

`bitcoin-qt` doesn't know my inputs as they are only between a few months and a few weeks old but it shouldn't have to to send a signed transaction.

It doesn't know my private keys either, but again, it shouldn't have to.

Can I force it to do so even if it can't check whether the inputs exist? The reason is that I'm on a super slow internet connection and downloading the blockchain would take several days, even if nothing else went over the connection during that time.

**Tags:** bitcoin-core, doublespend, broadcast

> **Comments:**
> **username_1**: I think the best you can do is, unfortunately, wait. Your transaction with low fees will not likely be included into a block, but it is in the mempool of the Bitcoin nodes, since, according to what you said, several online services do not forward your doble-spending transaction, that is, there is a conflict with the new one you want to create a then old one they already have. Eventually the old transaction will be deleted from them mempool, and you will be able to spend then output again.  
> **username_0**: @username_1 Unfortunately, I think I will still have to send a conflicting transaction via a client as online services seem to have really big mempools and keep transactions for a long time. I don't know how big the mempools of Electrum's servers are. Do you know of any different wallet which will let me broadcast raw transactions? (Possibly in the future.)  
> **username_1**: Not really, I've normally used bitcoind or online API like blockr's or blockexplorer's. However, even though Electrum may keep transactions in their nodes' mempool for a longer time than others (I do not know about this), this do not mean that you could not use other services to broadcast the "double-spend transaction". As long as other nodes start relaying the new transaction (once they purge the old one from their mempool), it will end in the blockchain.  
> **username_1**: I came across a new solution that may be useful. Check it out!  

---

## 2 answers

### Answer by username_1 on 2017-02-22. Score: 3 | Accepted answer

It doesn't seems to be a better solution than waiting. The original transaction (the 4 inputs 2 outputs one) has been relayed by the Electrum node that received it and spread over the network, therefore, it's in the mempool of the network nodes. Every transaction that tries to spend the same UTXO referred by the first transaction will be marked as double-spending until the first transaction is pruned from the mempool. Hence, waiting is unfortunately the only solution that comes to my mind.

Edit: Answering another question I came across a thing that could also be useful for you. You can use a [CPFP](https://www.reddit.com/r/Bitcoin/comments/5g1ge3/your_trasaction_stuck_as_unconfirmed_use_a/) approach. To do so, try to spend from the transaction that is pending to be confirmed with a new one with high fee. This new transaction will be like a candy for miners, and in order to include it in a block, they must include the previous also.

Edit2: Regarding the error message provided, there is a problem in how the transaction that the author wants to send (T1 from now on) has been build. The scriptSig of the transaction is not properly set.

The serialised T1 is:

01000000018964907116f6245417b9d9aea1d226e46486c5d485d6b947c95c794e032df612010000001976a9140043be27e16b93c275413e9b4411f08f2cd8bef088acffffffff0120082f08000000001976a9140b01599fd09ef602d71827601871e5a1081459f688ac00000000

Is we decode T1 we will get something like:

```
version: 01000000
number of inputs: 01 (1)
input 0
     previous txid (little endian): 8964907116f6245417b9d9aea1d226e46486c5d485d6b947c95c794e032df612 (12f62d034e795cc947b9d685d4c58664e426d2a1aed9b9175424f61671906489)
     previous tx output (little endian): 01000000 (1)
     input script (scriptSig) length: 19 (25)
     input script (scriptSig): 76a9140043be27e16b93c275413e9b4411f08f2cd8bef088ac
     nSequence: ffffffff
number of outputs: 01 (1)
output 0
     Satoshis to be spent (little endian): 20082f0800000000 (137300000)
     output script (scriptPubKey) length: 19 (25)
     output script (scriptPubKey): 76a9140b01599fd09ef602d71827601871e5a1081459f688ac
nLockTime: 00000000

```

At this point, we can notice that the scriptSig is incorrect. Analysing it carefully, we can notice that it has the structure of a P2PKH scriptPubKey instead of the corresponding signature that should complement the scriptPubKey of the previous transaction (T0 from now on):

```
76a9140043be27e16b93c275413e9b4411f08f2cd8bef088ac =
OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG

```

If we want to be definitely sure about this, we can check the scriptPubKey of the UTXO from T0 we are trying to spend, and analyse both scripts.

The UTXO from T0 we are interested in can be identified by (id:index):

```
12f62d034e795cc947b9d685d4c58664e426d2a1aed9b9175424f61671906489:1

```

If we look for the specific scriptPubKey that contains that UTXO, we will find:

```
OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG

```

That curiously matches with the scriptSig that we have found in T1.

## Conclusion

T1 scriptSig (input 0) and T0 scriptPubKey (output 1) shared the sames script. T1 scriptSig must provide the signature required in T0 scriptPubKey in order to pass the validation:

```
scriptSig:  [signature]    
sciptPubKey: OP_DUP OP_HASH160 0043be27e16b93c275413e9b4411f08f2cd8bef0 OP_EQUALVERIFY OP_CHECKSIG

```

> **Comments:**
> **username_0**: That approach, unfortunately, won't work. I thought about doing CPFP, too, but the one output I control is too small to make a difference.  
> **username_1**: Can't you use it together with another UTXO you own, not necessarily associate with the same address, to build a transaction in which include a fee that does the trick?  
> **username_0**: Ah, thanks! I have no idea why I didn't think of this. Do you know what `bitcion-qt`'s message means, though? Knowing this could be useful for the future when I want to send raw transactions.  
> **username_1**: Not exactly, but it seems to be, indeed, that an input is missing.  https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/qa/rpc-tests/rawtransactions.py#L67  However, the error code corresponds to a generic error when submitting a block/transaction.  https://github.com/bitcoin/bitcoin/blob/62f2d769e45043c1f262ed45babb70fe237ad2bb/src/rpc/protocol.h#L49  
> **username_0**: But in that case, the input actually doesn't exist. In my case, the inputs do exist. They only aren't downloaded. At [this point](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/rpc/rawtransaction.cpp#L899), the coins' existence is checked. `view.AccessCoins` should point to (I haven't checked in an IDE, just read through it on GitHub) [this method](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/coins.cpp#L135) where  
> **username_0**: [`FetchCoins`](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/coins.cpp#L72) is called which in turn calls [`GetCoins`](https://github.com/bitcoin/bitcoin/blob/4d8558a2871ec70b9d09028c49fa39e4911435f5/src/coins.cpp#L90). I don't see how that method gets the coins, though. But if it does, it looks like you can send raw transactions even if you yourself haven't downloaded the blockchain to the point where the coins are introduced.  
> **username_1**: It is strange though, do yo mind providing the full serialized tx? That way I would try to check it field by field.  
> **username_0**: It's this: http://pastebin.com/Qef0YU2k  
> **username_1**: Alright, now I see. The input script of the transaction (scriptSig) is not correct. How have you built the transaction? I leave you why its wrong editing the answer, have no space here.  
> **username_1**: How did you build the transaction by the way, I'm quite curious about how that scriptSig ended up being there.  
> **username_0**: I used https://coinb.in to create the transaction. I entered the address the money is stuck in to identify the UTXO. It then looked for it and found it.  
> **username_1**: Ok, I see. Once you created the transaction, did you signed it using the signing function from the coinb.in web, if not, that could be the reason why the sigScript was containing incorrect data. Anyway, looks like the transaction finally got confirmed. Maybe we should close this.  

---

### Answer by username_2 on 2017-02-21. Score: 0

Short answer; you will have to wait. It will end up resolving, but may take a day or more. There's a longer answer I could provide; but it won't change the fact that waiting is all you can do.

> **Comments:**
> **username_0**: The transaction's fee is 0.15 mBTC (around 17 ¢, right now), whereas transactions which go through currently have at least 3 times that as a fee. It won't confirm for quite some time and possibly will have been removed from many mempools way before it goes through. Is there a way to make `bitcoin-qt` send the raw transaction I prepared? It could propagate after enough nodes removed the first transaction from their mempools. Is there an alternative Bitcoin software which can do this? (Send it directly via my IP, not via an external service.)  
> **username_2**: You can do nothing but wait. If the transaction has already been seen by (N) nodes, those nodes will need to eventually timeout and drop the transaction, which is when it will be returned to you. Rebroadcasting it, or having more nodes "see" it will not increase it's chance of a block accepting it; because the node which finds a block already knows about it; it's out there; been broadcast (and based off of the fee the block finding node will include or not include it based off their own settings of fees they accept). That said; your transaction is in the mempool. All you can do is wait.  

---

