8

In the IOTA guide's The Anatomy of a Transaction 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?

9

It's important to understand that IOTA use UTXO scheme (like bitcoin 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

  • So really every transaction has two sides? An output transaction from the sender and an input transaction for the receiver? – hsbsid Dec 2 '17 at 20:06
  • Every bundle consume all iotas stored on one address. One part of those iota will be send to an address owned by the receiver, and the remaining part will be send to anther address owned by the sender. – ben75 Dec 3 '17 at 1:27
  • Okay I see, that makes sense. The transaction in the bundle which returns the remaining iota to the sender, does this need to be added manually by someone developing software in iota? – hsbsid Dec 3 '17 at 3:01
  • Yes the software crafting the transaction must take care of that. (Nothing is magic... everything is code at some point) – ben75 Dec 3 '17 at 3:27
  • If I didn't do this would users of the software lose any balance they don't spend? The iota library functions don't do this automatically? – hsbsid Dec 3 '17 at 6:23

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.