Messages, Payloads, and Transactions
The IOTA network is based on messages and payloads. This section will explain the relationship between messages and payloads and how you can create value transactions.
A message is a data structure broadcast in the IOTA network and represents a node (vertex) in
the Tangle graph. It can refer to up to 8 previous messages, and once a
message is attached to the Tangle and approved by a milestone, the Tangle structure ensures the content of the message
will remain unaltered. Each message has a unique
message_id, which is based on a hash algorithm of the binary content
of the message. A message is an atomic unit that is confirmed by the network as a whole.
A message is broadcast using a binary format, has an arbitrary size of up to 35 kB, and can hold variable sets of information called payloads. A message can encapsulate any number of payloads, and even a message without a payload is perfectly valid.
A payload represents a layer of concern. Some payloads may change a state of the ledger (ex.
transactions), and some
may provide extra features to some specific applications and business use cases (ex.
There are already implemented core payloads, such as
IndexationPayload. However, the message and payload definitions are generic enough to incorporate any future
payload(s) the community agrees upon.
The IOTA network ensures the outer structure of any message is valid and aligned with a network consensus protocol. However, the message’s inner structure is very flexible, future-proof, and offers an unmatched network extensibility.
The current IOTA network incorporates the following core payloads:
A payload that describes
UTXO transactions that are the cornerstone of value-based
transfers in the IOTA network. You can use this payload to sign a message cryptographically. This payload changes the
ledger state as old
outputs are spent (replaced) and new
outputs are created.
Example of a message with a
transaction includes the following information:
inputs: A list of valid
outputsthat should be used to fund the given message. Those
outputswill be spent and once the message is confirmed, those outputs are not valid anymore. Outputs are uniquely referenced via
index. At least one output has to be given with enough balance to source all
outputsof the given message.
outputs: A list of IOTA address(es) and related amount(s) that the input
outputsshould be split among. Based on this information, new
UTXOentities (outputs) will be being created.
unlockBlocks: Includes a transaction signature(s) (currently based on
Ed25519scheme) that prooves token ownership based on a valid seed. Only the valid seed owner is able to correctly sign the given transaction and proove ownership of the tokens under the given output(s). Each input
outputhas to have a corresponding
unblockBlocksentry in case more
outputsare used to fund the operation, either using the given signature or as a reference to the existing signature
SignedTransaction(payload type 0) can include additional payload(s) such as an
IndexationPayload(payload type 1) for example. This means any value-based messages can also contain arbitrary data and its key index. It is also an example how individual payloads can be encapsulated on different levels of concern
A payload that is emitted by the Coordinator.
A payload that enables adding an index to the encapsulating message, as well as arbitrary data. You can use the index to search for the message(s).
Unspent Transaction Output (UTXO)
IOTA uses an
unspent transaction output model called
UTXO is based on an idea to track the unspent amount of
tokens using a data structure called
output. This model can be explained using a simple example:
- There are 100 tokens recorded in the ledger as
Output A, which belongs to Alice. So initial state of ledger:
Output A= 100 tokens.
- Alice sends 20 tokens to Paul, 30 tokens to Linda, and keeps 50 tokens at her disposal.
- Her 100 tokens are currently stored as
Output A. This means she has to divide (spend) her tokens to create three new outputs:
Output Bwith 20 tokens that go to Paul.
Output Cwith 30 tokens that go to Linda.
Output Dwith the remaining 50 tokens that she keeps for herself.
- The original
Output Awas spent entirely and can not be used anymore. As it is spent, it becomes irrelevant to the ledger state. The new state of ledger is:
Output B= 20 tokens.
Output C= 30 tokens.
Output D= 50 tokens.
- The total supply remains the same. However, the number of outputs differs, and some were replaced by other outputs in the process.
The key takeaway of the outlined process is that each unique
output can only be spent once. Once an output is
spent, it can not be used anymore and is irrelevant regarding the ledger state.
So even if Alice still wants to keep the remaining tokens at her fingertips, those tokens have to be moved to completely
output that can still be tied to the same IOTA address Alice used before.
output also stores information about an IOTA address it is coupled with. This means addresses and tokens are
indirectly coupled via outputs. So basically, the sum of outputs and their amounts under a given address is a balance of
the given address, i.e., the number of tokens the address can spend. And the sum of all unspent outputs and their
amounts is equal to the total supply.
Outputs are encapsulated in a message as a part of the