Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: No_2 on December 07, 2015, 01:09:46 PM



Title: Is a transaction legal if it just sends funds back to itself?
Post by: No_2 on December 07, 2015, 01:09:46 PM
I'm sure this has been asked before but I can't find an answer on-line.

Is a bitcoin transaction valid if:

    1. It has one input and output with the same address which send the same amount funds to one another, i.e. no miners fee?
    2. It has one input and output with the same address which send a reduced amount of funds to one another, i.e. there is a miners fee?


Title: Re: Is a transaction legal if it just sends funds back to itself?
Post by: ranochigo on December 07, 2015, 01:20:25 PM
I'm sure this has been asked before but I can't find an answer on-line.

Is a bitcoin transaction valid if:

    1. It has one input and output with the same address which send the same amount funds to one another, i.e. no miners fee?
    2. It has one input and output with the same address which send a reduced amount of funds to one another, i.e. there is a miners fee?

1. Yes. There is no miners fee.
2. There is miners fee. Bitcoins cannot disappear like this.

In general input must = output.

CMIIW, this is how I understood it.


Title: Re: Is a transaction legal if it just sends funds back to itself?
Post by: mezzomix on December 07, 2015, 01:25:12 PM
The input amount that is not claimed by the outputs is the fee. Both transactions are valid.


Title: Re: Is a transaction legal if it just sends funds back to itself?
Post by: DannyHamilton on December 07, 2015, 05:23:16 PM
1. It has one input and output with the same address which send the same amount funds to one another, i.e. no miners fee?
2. It has one input and output with the same address which send a reduced amount of funds to one another, i.e. there is a miners fee?

Transactions don't actually use addresses.  Therefore, it is impossible for an input and an output to have the same address.

The input of a transaction is just a reference to a previously unspent output. It includes the transaction ID of the transaction that created the output, and an offset that indicates which of the outputs from that previous transaction are being spent in the new transaction.  It also includes a script that is used to satisfy any conditions that the previous transaction encumbered the output with (typically this is an ECDSA signature). As long as the outputs that are supplying value to the transaction are valid and not yet spent, and the script satisfies the encumbrance, then the input can be used to supply value to the transaction.

The outputs of a transaction are each an integer value (expressed in satoshis) and a script that encumbers the output with certain requirements that must be met in order to use the output as the input of some future transaction.  Typically the script encumbers the output with a need for a signature that can be verified with a public key that hashes (using RIPEMD160) to a given value.  As long as the sum of the values from all the outputs doesn't exceed the sum of the value provided to the transaction from the inputs, and the script is a valid script, then the output can be used by the transaction.

The output script doesn't need to know anything about the input script or anything about the previous output which the input references, so it really doesn't matter what "address" is used to represent either of those output scripts.