<p>Next to the provided answers I’d like to point to the protocol rules, especially for transactions. I used this as a reference for my codings:</p>

<p><a href="https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages</a></p>

CC BY-SA 4.0
2018-05-24T06:08:57.167Z
2018-05-24T06:08:57.167Z
pebwindkraft
<p>There are a lot of things that can make a transaction invalid. Note that an invalid transaction cannot be confirmed as the block that contains it would also be invalid, thus there is no such thing as a confirmed or unconfirmed invalid transaction.</p>

<p>Things that make a transaction invalid:</p>

<ul>
<li>Spending an input spent by another transaction that is confirmed</li>
<li>Spending an input that does not exist</li>
<li>If signatures are required and must be valid, providing an invalid signature</li>
<li>If some data must hash to something provided (e.g. pubkey hash, scripthash), providing a piece of data that does not hash to the correct hash.</li>
<li>In general, any input script not validating to <code>true</code></li>
<li>Negative output values</li>
<li>Sum of the output values is greater than the sum of the input values</li>
<li>A coinbase transaction outside of a block</li>
<li>A coinbase transaction that is not the first transaction of a block</li>
<li>A coinbase transaction where the sum of the output values exceeds the block reward</li>
</ul>

<p>There's probably a few more that I missed, those are just a few that I can think of off of the top of my head.</p>

<blockquote>
  <p>can the recipient be insured that even 0-conf tx will be eventually valid and processes?</p>
</blockquote>

<p>No. There is no guarantee that an unconfirmed transaction will eventually confirm, even if it is valid. Note that transactions do not become valid; they are either valid or invalid upon creation.</p>

CC BY-SA 4.0
2018-05-23T19:29:13.623Z
If a transaction attempts to spend an output that doesn't exist and later that output does exist, doesn't the transaction become valid?
David Schwartz
CC BY-SA 4.0
2018-05-23T21:01:07.073Z
@DavidSchwartz It would seem so wouldn't it but, how would the utxo be referenced in the first transaction if it did not exist?
Willtech
CC BY-SA 4.0
2018-05-23T21:32:21.567Z
The most obvious way -- the person making the transaction already saw the block that included the first transaction but you didn't. Also, this question doesn't seem to be bitcoin specific, so would include systems that don't require you to know specifics of the funding source. (Stellar, for example, doesn't.)
David Schwartz
CC BY-SA 4.0
2018-05-24T16:15:18.720Z
Thanks for the detailed answer. Though, I believe @pebwindkraft's answer is more correct and answers my question more directly with all rules that can make tx invalid and eventually not include into a block. So I'll mark his answer.
Elya Livshitz
CC BY-SA 4.0
2018-05-23T18:40:29.813Z
2018-05-23T18:40:29.813Z
Ava Chow
<blockquote>
  <p>but is there's anything else that could make a tx invalid?</p>
</blockquote>

<p>consensus rules can be changed via soft- or hard-fork while the transaction is in memory pool :)</p>

CC BY-SA 4.0
2018-05-24T06:42:43.027Z
2018-05-24T06:42:43.027Z
amaclin
<blockquote>
  <p>Invalid inputs? Invalid signature or other data?</p>
</blockquote>

<p>First of all if any of the above parameter is invalid then the transaction wont be created on first place. The transaction will be discarded. </p>

<p>To create transaction :</p>

<blockquote>
  <p>1) Valid Vin and Vout that will be determined by algorithm itself </p>
  
  <p>2) Creating raw transction using txid</p>
  
  <p>3)Signning the transcation (which will be needing your pvt key)</p>
  
  <p>4)Sending the transaction to mempool for verification.</p>
</blockquote>

<p>If you manage to reach step 4 then your transaction will possibly get confirmed but for sure  it will be sent to mempool. Now its over the miner to confirm or not confirm your transaction.</p>

<p><strong>If you want to make your unconformed transaction as conformed:</strong>
one can redo the same transcation with little more transaction fee. If miner is to mine your particular transaction and make it confirm than he needs to confirm all of your earlier tranasctions as well.</p>

<p><strong>Now to answer your question about making your unconformed transaction as invlaid</strong> you dont need to do anything for that, after some period of time for your transaction in being in mempool, still  unconformed, get revert back to your wallet address</p>

CC BY-SA 4.0
2018-05-23T17:02:59.977Z
This is wrong. There is never a guarantee an unconfirmed transaction will make it into the chain.
Pieter Wuille
CC BY-SA 4.0
2018-05-23T17:28:22.623Z
Can't this be one possible attempt to make unconfirmed transaction confirmed?
Parishilan Rayamajhi
CC BY-SA 4.0
2018-05-23T17:37:28.993Z
I don't understand your question. You claim that if you reach step 4, the transaction will be confirmed for sure. This is not correct; you can never be sure a transaction will confirm. Also, in the next line you require that the sender address has enough balances. Bitcoin does not have any concept of address balances, but uses UTXOs.
Pieter Wuille
CC BY-SA 4.0
2018-05-23T14:40:47.433Z
2018-05-24T06:15:48.293Z
2018-05-24T06:15:48.293Z
Parishilan Rayamajhi
<p>It's obvious that inputs that already been spent will make the transaction invalid (pure double-spend scenario), but is there's anything else that could make a tx invalid?</p>

<p>Invalid inputs?
Invalid signature or other data?</p>

<p>For example, if I have a program that manages a wallet (keypairs are exclusively managed by it, and not by any human, and it's source is public) and it sends payments, can the recipient be insured that even 0-conf tx will be eventually valid and processes?</p>

<transactions><doublespend>
What can make an unconfirmed transaction (0-conf) an invalid one other than Double-spend?
Elya Livshitz
# What can make an unconfirmed transaction (0-conf) an invalid one other than Double-spend?

(Asked by: username_0 on 2018-05-23)

It's obvious that inputs that already been spent will make the transaction invalid (pure double-spend scenario), but is there's anything else that could make a tx invalid?

Invalid inputs?
Invalid signature or other data?

For example, if I have a program that manages a wallet (keypairs are exclusively managed by it, and not by any human, and it's source is public) and it sends payments, can the recipient be insured that even 0-conf tx will be eventually valid and processes?

**Tags:** transactions, doublespend


---

## 4 answers

### Answer by username_1 on 2018-05-24. Score: 1 | Accepted answer

Next to the provided answers I’d like to point to the protocol rules, especially for transactions. I used this as a reference for my codings:

<https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages>


---

### Answer by username_2 on 2018-05-23. Score: 3

There are a lot of things that can make a transaction invalid. Note that an invalid transaction cannot be confirmed as the block that contains it would also be invalid, thus there is no such thing as a confirmed or unconfirmed invalid transaction.

Things that make a transaction invalid:

* Spending an input spent by another transaction that is confirmed
* Spending an input that does not exist
* If signatures are required and must be valid, providing an invalid signature
* If some data must hash to something provided (e.g. pubkey hash, scripthash), providing a piece of data that does not hash to the correct hash.
* In general, any input script not validating to `true`
* Negative output values
* Sum of the output values is greater than the sum of the input values
* A coinbase transaction outside of a block
* A coinbase transaction that is not the first transaction of a block
* A coinbase transaction where the sum of the output values exceeds the block reward

There's probably a few more that I missed, those are just a few that I can think of off of the top of my head.

> can the recipient be insured that even 0-conf tx will be eventually valid and processes?

No. There is no guarantee that an unconfirmed transaction will eventually confirm, even if it is valid. Note that transactions do not become valid; they are either valid or invalid upon creation.

> **Comments:**
> **username_3**: If a transaction attempts to spend an output that doesn't exist and later that output does exist, doesn't the transaction become valid?  
> **username_4**: @username_3 It would seem so wouldn't it but, how would the utxo be referenced in the first transaction if it did not exist?  
> **username_3**: The most obvious way -- the person making the transaction already saw the block that included the first transaction but you didn't. Also, this question doesn't seem to be bitcoin specific, so would include systems that don't require you to know specifics of the funding source. (Stellar, for example, doesn't.)  
> **username_0**: Thanks for the detailed answer. Though, I believe @username_1's answer is more correct and answers my question more directly with all rules that can make tx invalid and eventually not include into a block. So I'll mark his answer.  

---

### Answer by username_5 on 2018-05-24. Score: 1

> but is there's anything else that could make a tx invalid?

consensus rules can be changed via soft- or hard-fork while the transaction is in memory pool :)


---

### Answer by username_6 on 2018-05-23. Score: -3

> Invalid inputs? Invalid signature or other data?

First of all if any of the above parameter is invalid then the transaction wont be created on first place. The transaction will be discarded.

To create transaction :

> 1) Valid Vin and Vout that will be determined by algorithm itself
>
> 2) Creating raw transction using txid
>
> 3)Signning the transcation (which will be needing your pvt key)
>
> 4)Sending the transaction to mempool for verification.

If you manage to reach step 4 then your transaction will possibly get confirmed but for sure it will be sent to mempool. Now its over the miner to confirm or not confirm your transaction.

**If you want to make your unconformed transaction as conformed:**
one can redo the same transcation with little more transaction fee. If miner is to mine your particular transaction and make it confirm than he needs to confirm all of your earlier tranasctions as well.

**Now to answer your question about making your unconformed transaction as invlaid** you dont need to do anything for that, after some period of time for your transaction in being in mempool, still unconformed, get revert back to your wallet address

> **Comments:**
> **username_7**: This is wrong. There is never a guarantee an unconfirmed transaction will make it into the chain.  
> **username_6**: Can't this be one possible attempt to make unconfirmed transaction confirmed?  
> **username_7**: I don't understand your question. You claim that if you reach step 4, the transaction will be confirmed for sure. This is not correct; you can never be sure a transaction will confirm. Also, in the next line you require that the sender address has enough balances. Bitcoin does not have any concept of address balances, but uses UTXOs.  

---

