Transactions work by spending outputs from previous transactions as inputs. A transaction contains inputs which reference the specific outputs being spent, and outputs which send funds to new addresses. If the input amount is greater than the output amount, the difference is considered a transaction fee paid to miners. Transactions often include a change output that returns unspent funds back to an address controlled by the sender. Wallets track unspent transaction outputs and can combine multiple UTXOs as inputs to a new transaction if a single UTXO does not cover the full amount being sent. Signatures in the transaction prove the sender owns the inputs and authorize spending them.
3. Terms
tx – transaction
txid – id of a transaction. Is used to search a transaction in
blockchain
Script – the name of the script language that describes
how a client should validate transactions
UTXO - Unspent Transaction Output – transactions output
Wallet – key pair
Address – public key
4. Transaction format
Transaction – a signed piece of data that authorizes
the sending of funds from one account to another
Service information – identifies the transaction and
allows implementing it correctly
Input – information about where the sender got
money from and proof that sender owns this money
Output – information about where money is flowing to
6. identifier of transaction
amount of inputs and
outputs
hash of transaction
that is spent here
signature of the sender
and their public key
amount of money that
is transferred
address where money
goes
Most important fields
7. Input
Account has no “balance”
There is a list of not spent transactions (cheques)
Input indicates which previous transaction
should be spent
Input contains also a signature of the sender
9. Change and fee
All the money from previous transaction (you can find
this amount if you look up previous transaction) is
spent in the current one
Difference between money that input has and output
spends is considered a fee and is taken by miners
If you don’t want to pay high fee :) you have to create
output that returns change for you (thats why
transactions with many outputs are needed)
Change money is sent to address that you control
11. Combining your unspent transactions
If none of the unspent transactions that you have
(UTXO) contains enough money to pay - you have to
combine a few
Here transactions with a few inputs are needed
Money are summed up (and fee paid to miners is
calculated in the same way - difference between
total input and total output)
Your wallet (a piece of software) contains key pairs -
that is money that you control
13. Summary
Every balance which is received or sent should be tied to the
address
Every address may be associated with the wallet. All the rest –
non-spendable, the coins that are sent to them – are lost
The balance that can be spent was always received from the wallet
The coins received to the address are not mixed – they are used
separately (or in a combination) in the moment when they are
spent
If the sum of all inputs is more, than the sum of outputs, the
change is considered to be a commission