1

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?

1

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

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.

  • 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 May 23 '18 at 19:29
  • @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 May 23 '18 at 21:01
  • 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 May 23 '18 at 21:32
  • 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. – Eli Livshitz May 24 '18 at 16:15
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 :)

-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

  • This is wrong. There is never a guarantee an unconfirmed transaction will make it into the chain. – Pieter Wuille May 23 '18 at 17:02
  • Can't this be one possible attempt to make unconfirmed transaction confirmed? – cryptoKTM May 23 '18 at 17:28
  • 1
    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 May 23 '18 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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