Question:

What is an input transaction, and what does its "address" field represent?

Oliver: 21 May 2022

In the IOTA guide's The Anatomy of a Transaction (https://domschiener.gitbooks.io/iota-guide/content/chapter1/transactions-and-bundles.html) the address field of the transaction is described as:

address: String 81-trytes address. In case this is an output, then this is the address of the recipient. In case it is an input, then it is the address of the input which is used to send the tokens from (i.e. address generated from the private key)

I understand that the transaction may be an output (i.e. sending information). What is an input transaction? and how is the address different in this case?

Answer:
Noah: 21 May 2022

It's important to understand that IOTA use UTXO scheme (like bitcoin (https://www.cryptocoinsnews.com/bitcoin-transaction-really-works/) and probably many other cryptocurrencies).

UTXO means Unspent Transaction Output.

To understand from where the UTXO concept comes from I will first describe it "in theory" and in the end I describe how it is really implemented in IOTA.

How it works ?

Assume that Alice owns an address and Alice receive IOTAs from various friends on this address :

+ 1000 iotas from his friend X
+ 3000 iotas from his friend Y
+ 20000 iotas from his friend Z

Alice now has 24000 iotas on her address. But the Tangle doesn't store that sum. (the wallet will compute the sum). The Tangle only keeps track of the 3 incoming transactions (from X, Y and Z).

Now Alice needs to send 2000 IOTAs to Bob. To do that she must submit an appropriate Bundle to the Tangle. A Bundle is a set of transactions. The Bundle describing the transfer of 2000 IOTA will look like this (see also remark at the end) :

  • 3 input transactions that we saw before:
    • "+ 1000i from his friend X"
    • "+ 3000i from his friend Y"
    • "+ 20000i from his friend Z"
  • 2 output transactions:
    • "-2000i to an address owned by Bob"
    • "-22000i to another address owned by Alice"
      (this is the Unspent Transaction Output = UTXO)

As you can see in a Bundle: the sum of all input transactions must be exactly equal to the sum of all output transactions.

So the term "input transaction" refers to a previous transaction that was a deposit on the address currently sending the IOTAs.

What is confusing is that the term "transaction" sometimes refers to the whole bundle, sometimes refers to a single element in a bundle.


Remark regarding the real layout of the bundle on IOTA network.

The bundle layout, is in reality a bit different that I wrote previously.

Because, in IOTA you shouldn't re-use address after spending from it, all funds must move to another place (and there is no need to repeat the origin of the funds because the Tangle knows that already) the part listing all original input transactions is replaced by a single logical entry with :

  • the source address spending the iotas
  • the signature of Alice
  • the total amount stored on the source address (in the example : 1000+3000+20000=24000).

In practice, the single logical entry with the input transaction will be expanded on multiple physical entries just to be able to store the complete signature of Alice (or even more signatures in case of multi-signature address).

source (https://iota.readme.io/v1.2.0/docs/the-anatomy-of-a-transaction)