Transactions move value from transaction inputs to transaction outputs.
- An input is a reference to a previous transaction's output, showing where the value is coming from.
- An output is a specific value to a new owner's bitcoin address. Output of a transaction can be an input in a new transaction.
There are three types of transaction.
#1. Simple payment from one address to another, including some "change" returned to the original owner.
#2. Aggregating inputs from multiple nodes to a single large node.
#3. Multiple recipients, it's like the company processes payroll payments to multiple employees.
The wallets should keep track of all the available outputs belongs to addresses in the wallet (full-node client, takes up a lot of disk space). Hence, if we want to make a lightweight node, we should provide APIs for retrieving this information from a full-node.
Let's have a look on this transaction: https://www.blockchain.com/btc/tx/0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2
Any system joins to bitcoin network will be a bitcoin node which knows bitcoin protocol. Any node that receives a valid transaction it has not seen before will immediately forward (broadcast) it to all other nodes. We call this technique "flooding". Thus, the transaction will be propagated out across the peer-to-peer network (like chat app).
Transaction contains all the information necessary to process so it does not matter how or where it is transmitted to the bitcoin network.
A transaction should be verified by all nodes in network.