How Do BTC Transactions Actually Work?
The advent of bitcoin has revolutionized the payment arena by removing centralized systems and the need for expensive and often convoluted intermediaries. To illustrate, let’s take a look at payments via traditional centralized systems and contrast them to bitcoin.
Payments via traditional finance channels are done though the help of intermediaries (financial institutions with certain roles and level of trust).
What are the features of such a system? In short:
- reversible transactions
- intermediaries take a percentage, which increases the cost of transactions and sets their minimum price, making it impractical to carry out infrequent and small transactions
- the reversibility of transactions increases the cost of services whose services are irrevocable (the transaction was canceled. but we have already paid% of it)
- since the payment can be canceled, the seller is insured, requiring more information from the buyer than is necessary
- a certain percentage of fraud is inevitable
But what if there would be a payment system that allows any two participants to transfer funds directly, without an intermediary? The computational cost of canceling transactions will make fraud unprofitable, and escrow mechanisms will protect customers.
This is exactly what does Bitcoin based on the blockchain technology.
How Does it Work?
Information (block info, counter, and list of transactions) is recorded in blocks. When a block (its size is up to 1 MB) is full, a new block appears. The blocks are interconnected linearly, one after another in order, and each block contains information (hash) about the previous one. Therefore, if you wish, you can see the story down to the very first block.
We define electronic coin as a sequence of digital signatures. Person A sends the coin to person B, signing the hash of the previous transaction and Person B’s public key, attaching this information to the coin. However, how does Person B determine how many times Person A spent this coin? He should know that none of the previous owners signed the transaction before the one that is in the chain of the coin sent to him. For this, a time stamp is written in the block hash. It shows that at the moment specific data existed and therefore fell into the block hash. It turns out that only the first transaction is valid, so you can not worry about late attempts at double spending, the information about the first transaction was already there and, since it is recorded for all system participants, the false (later) will be rejected.
From the user’s side, the operation looks like this: Person A opens his wallet, enters the recipient’s address and the amount of 2.5 (for example) Bitcoin, executes the signature using the private key (the public key or bitcoin address is a unique personal address that is used in the chain, and everyone can see it, and the private key works as a password).
Inside the system, a transaction will have three pieces of information:
- Input. Record with details about where Person A has bitcoins.
- Amount. The number of transferred coins. In this case, 2.5 BTC.
- Output. Person B bitcoin wallet address.
Input and Output
As you probably understand, Bitcoins exist only in the form of transaction records in the electronic repository. For example, Person A’s balance consists of 1 BTC from Person C, and 3 BTC from Person D. All these are different transactions that were carried out at different times. In Person A’s wallet, the records do not merge into a single file with 4 BTC but continue to be stored separately.
For Person A to send Person B 2.5 BTC, the repository is trying to find a file with such a sum or combination of data to make 2.5 BTC. In our example, there is no operation with such amount, and they are not cumulative to get the required amount. Person A cannot break 3 BTC received from Person D (the sum of the input) since the system does not allow such division. Therefore, Person A has to send 3 BTC instead of 2.5 (output amount) for two transactions or two outputs: 2.5 BTC for Person B and 0.5 BTC back in the form of change. Of course, the user won’t see the difference and this is just a way of explaining how this works overall.
Featured image courtesy of Shutterstock.