The term "transaction" has many meanings, most of which are related to finance. The most generalized meaning of a TX is a minimal logical operation that can only be accomplished completely and not partially. Transactions are typically associated with banking, databases, and cryptocurrencies.
What Is a Transaction (TX)?
In a blockchain, a TX refers to the minimum addressable element of a block, which in its turn is an addressable element of a blockchain.
There are two types of blockchain transactions:
Standard, which codes the transfer of funds between the system users.
Generating, which transfers the funds to the miner as a reward for generating a blockchain.
All funds that are the result of a transaction are treated as a single amount, which can only be divided by another transaction. In fact, a standard transaction does not register a single transfer from one client to another but rather represents the sum that must be balanced. The transferred amount (possibly collected from different senders) must match the amount intended for one or several recipients.
For example, the transfer of miner's fee (transaction fee) cannot be carried out in advance, because the recipient will be known only after receiving the best chain of blocks. Therefore, these fees are a part of the transaction amount, but they do not directly participate in this.
The specification requires an addressing system that includes the sender, recipient, and miner (that is, ultimately, each system node).
Moreover, the transactions should have the following characteristics:
Authenticity, i.e. transactions must be uniquely associated with the sender in such a way that no party can identify itself in the TX as the sender.
Non-repudiation, i.e. the sender cannot abandon the already completed transaction.
The ultimate goal of the transaction mechanism is that any node in the system can find out the TX details. This is achieved with electronic signatures. Thus, system participants can easily track the movement of funds in the system and monitor the integrity of the service.
These mechanisms, first used in Bitcoin, were subsequently applied to other cryptocurrency systems. Moreover, this approach is valid for all blockchain-based systems.
Transaction Input and Output
The purpose of a TX is to track the movement of funds within the system. To achieve this, the transaction includes information about the funds transferred - the input and output.
The TX input contains information about the sender and confirmation for each system node that the sender is really going to perform the operation.
The TX output includes information about the recipient, the amount assigned to it, and confirmation for each system node that the funds are really intended for this recipient.
In the simplest case, each TX input must be associated with the output of any previous transaction located in the confirmed block. The correspondence between the current input and previous output proves that all the funds transferred to the recipient are available for the sender, so only one output can correspond to each input.
The situation is different with transactions where several inputs can be associated with several outputs. Transactions without inputs are used in "generating" transactions to transfer newly received funds to one or more recipients.
Multiple inputs and output transactions are used to transfer funds from all senders to all recipients. The basic rule for these transactions is that the total amount sent should correspond with the total amount received.
Several inputs can be combined into one output, and vice versa, one input can be branched into several outputs. In Bitcoin, each TX is a transfer of a certain amount, and each input must refer to one of the outputs of previously approved transactions.