How Fund Transfer is Done in IOTA

1. Overview

This write-up is to show how Iota wallets transfer iotas. We will first examine how wallet works and get some idea on how fee-free transaction looks like. Finally we will take a look on the transaction and how it is stored in the distributed ledger (IOTA Tangle).

IOTA Testnet is being used in this setup, and IOTA Light Wallet is setup for IOTA Testnet access. A node console is used for accessing IOTA API for further exploration.

There is a sister article “How Transaction is Done in Bitcoin”. Ideally open that file as well, and read both in parallel for a better comparison.

2. Setup

In this setup two computers are used, each of which is installed with IOTA Light Wallet. By configuring different seeds on both wallets, we designate them as Wallet A and Wallet B.

Note that in IOTA, addresses are deterministically generated from the seed.

3. Fund Transfer

3.1 Before Fund Transfer

Fund (1000 iotas) is deposited on Wallet A and we keep empty on Wallet B. Here is what we see in the Light Wallets.

If we go more detail inside Wallet A, we see how this amount of iotas is composed.

As mentioned above, each wallet has a list of deterministic addresses. To calculate the amount of iotas, each wallet searches the ledger and collects the balance from the records on these addresses. Here we see in Wallet A, four records (input) with a balance. Summing the balances, the total is 1,000 iotas in Wallet A.

We keep Wallet B empty.

Here is the summary of both wallets currently.

3.2 Fund Transfer

On Wallet A, we input one of the Wallet B address (here it is B0), and send 650 iotas.

3.3 Transaction Pending for Confirmation

After sending the amount on Wallet A, we see the fund transfer (transaction) appear in both wallets (see History portion). And this transaction is pending for approval. Also the Balance is not updated as the transaction is still pending for confirmation.

3.4 Transaction Confirmed

Once this transaction is confirmed (approved), as seen in History, the Balance is updated as well.

4. Transation in Detail

4.1 Account Data in both Wallet After Transaction

In Wallet A, we now only see one entry, 350 iotas in a new address (other than what we see before).

In Wallet B, we now see a new entry (was empty before) with 650 iotas.

Here is the summary after the transaction.

4.2 How to Fund this Transaction

As we see before, prior to transaction, Wallet A has four inputs, each of which has an address and a balance. It is obvious that all four inputs are consumed (set to zero) and a new entry keeps the balance. This is how IOTA handles transaction.

We first take a look in the detail of the Bundle in Wallet A (same as in Wallet B). Click the Show bundle link in the History.

Now we have a rather clear picture on what has happened.

  • An entry of 650 iotas to the address B0.
  • Four entries are negative, which means being consumed. We begin from 100, 200, etc. and it takes all four entries to fund the 650 iotas. We can verify the addresses on Wallet A above.
  • On each negative entry another one more entry of zero value for each address. It is the signature part. We omit this in detail, but this can be considered as “part of” the negative entry.
  • Finally we have a new entry of 350 iotas to a new address. This is a new address in Wallet A (in it is A4 according to our denotation). This is the change after paying 650 iotas to Wallet B.
  • So this bundle is in balance, i.e., positive and negative value are equal.
  • And what is more important, there is NO transaction fee in this transaction. If we are familiar to blockchain-based distributed ledger technologies, such as Bitcoin and Ethereum, IOTA’s approach (called DAG) can achieve fee-less fund transfer.

4.3 Inside the Bundle

We can get more detail inside the bundle, exploring each entry. In this bundle, there are total 10 entries. In IOTA, the terminology for the entry is “transaction”, which I find it a bit confused as we may consider the transfer as “transaction”. Below I keep using “bundle” for the fund transfer, and “entry” showing each inside the bundle.

Keep an eye on the currentIndex, showing the index of the entry. Note that index 0 (#0) is the tail of the bundle, and index 9 (#9) is the head of the bundle. And there are total 10 entries (from #0 to #9) in this bundle.

This is the entry #0.

Here we see from the output,

  • The hash of this entry (HIIFXH…) is also the hash of this bundle.
  • The address and value align to what we see in the bundle screenshot.
  • The signatureMessageFragment has different meaning. For positive value without a message, it is all 9, which means empty.

This is the entry #1.

From the output of entry,

  • The address and value align to what we see in the bundle screenshot.
  • For a negative value, the signatureMessageFragment is where the signature is stored. Signature is how the wallet can spend that amount of money. Unless a correct and verified signature is provided, no one can use this amount of money (100 iotas). In our case, only Wallet A can create this signature.
  • Note that this is only the first part of signature. See entry #2 below.

We see one more entry, #2.

From the output of entry,

  • The address and value align to what we see in the bundle screenshot. In particular, address is same as the entry #1, and the value is zero.
  • For a zero value, the signatureMessageFragment is the remaining part of signature of previous entry (#1). The combined signatureMessageFragment is the full signature to use this amount (100 iotas).

Other entries are following the similar logic to the first three, that is,

  • (#3, #4), (#5, #6), (#7, #8) similar to (#1, #2)
  • #9 similar to #0

4.4 Where is the Bundle Kept?

Here we touch a bit on the Tangle, the data structure used in IOTA. It is a Directed Acyclic Graph (DAG) approach, unlike common blockchain implementation (e.g. Bitcoin). Each bundle (a square) is to approve two unapproved bundles (called Tips) before this bundle is attached on Tangle. And this bundle is later approved by other new coming bundles, and this is how the Tangle grows.

Here is an illustration of Tangle.

The grey square represents the unapproved bundle (Tip).

If we take a look on the head of bundle, that is, the last entry (#9), we see two items here, trunkTransaction (KLVRDC…) and branchTransaction (NEYTTF…). They are the tips this bundle approves.

Without going into detail on how trunkTransaction and branchTransaction points within a bundle, here is the position of my bundle inside the Tangle.

5 Summary

We have explored how fund is transferred between wallets in IOTA, and what happens behind this transfer. We also touched some very basic structure of the bundle of transactions, and how it is positioned in the Tangle. A lot of detail is skipped, but this should be good enough for understanding more about IOTA.

Written by

Happy to share what I learn on blockchain. Visit http://www.ledgertech.biz/kcarticles.html for my works. or reach me on https://www.linkedin.com/in/ktam1/.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store