Step-by-Step through an blockchain transaction
Fig. 1:Transaction steps [1]
Figure 1 shows the main steps of a blockchain transaction on a high abstraction level. The aim is to introduce the reader step by step into the extensive topic of blockchain.
A scenario is used in which Alice wants to send a bitcoin to Bob using the blockchain technology. The scenario is based on Michael Nielsen's article "How the Bitcoin protocol actually works"[2].
Scenario: Alice sends Bob a Bitcoin
Alice owes Bob money. Now that Bob is in dire need of money, Alice wants to settle her debts. Since Alice lives in America and Bob lives in Belgium, Alice is looking for a way to send Bob the money he owes as quickly and cheaply as possible. For this reason, Bob is to receive a bitcoin from Alice.
How does such a transaction work?
Alice triggered a transaction containing the instruction to transfer a bitcoin to Bob. In order to make sure that the job has actually come from Alice, Alice signs the statement with her digital signature (Private Key). In addition, it also logs that Alice actually wanted to transfer the Bitcoin, so that she can't later claim the opposite.
How does Bob know that the Bitcoin sent from Alice, actually belonged to Alice and didn't spend it otherwise?
A unique identifiable serial number prevents a Bitcoin from being used more than once. To do this, however, we need a trusted unit to issue the serial numbers, keep a record of them and confirm that the transaction has been carried out correctly - as a bank does. However, blockchain technology is trying to circumvent a central location like a bank.
Bob will not just accept the bitcoin, but would like to verify that the bitcoin to be transferred actually belongs to Alice and is not already spend.
Everyone in the Bitcoin network is turned into a common bank
In the blockchain, each participant becomes a part of the "common bank". This is achieved by ensuring that each person in the network keeps a complete record of who owns which bitcoins in the network. What belongs to whom and which transactions are carried out and when is recorded in a virtual cash book ("shared ledger"), also known as the public ledger (the so-called blockchain). This also allows Bob to check if the bitcoin he is supposed to receive from Alice really belongs to her and has not already been issued. He checks the transaction with his copy of the general ledger and informs the other participants in the system that he accepts the transaction and that they should update their local copy of the general ledger.
The process of updating all the ledgers takes some time until all participants in the network have updated their ledger. Even if this time of the update is only very short, misuse can be carried out. Alice could send a bitcoin to Bob and Matthias at the same time. If Bob and Matthias confirm the transaction almost simultaneously and pass it on to the network for updating, a so-called double-spending would occur.
How can the problem of double-spending be solved?
The problem can be solved when Bob no longer scans the transaction alone, and the network collectively decides whether the transaction is valid. Only when Bob receives feedback from enough participants in the network that the transaction is OK will Bob accept the transaction and tell the network participants to accept the transaction and update all their ledgers.
But how much positive feedback is sufficient?
Alice could take over 51% of the network, for example by setting up 1 billion entities in the network. If Bob and Matthias ask the network whether they can confirm the transaction, both entities created by Alice would receive a confirmation that the transaction is valid. This would result in a double-spending.
The solution to this is the so-called proof-of-work.
Proof-of-work (PoW)
The proof of work has two objectives:
- on the one hand, the costs for the validation of transactions can be artificially increased by high computing power,
- on the other hand, those who have helped with the transaction are supposed to be rewarded with bitcoins.
This no longer determines the number of entities in the network to validate transactions, but the computing power available.
Mining
Lukas wants to help validate the transactions. He has to solve a puzzle (proof-of-work). The blockchain is set up in such a way that the other participants in the network do not accept the validation of the transaction without solving the puzzle. The task of the proof-of-work puzzle is to find the nonce. You can define how difficult it should be to solve the puzzle / nonce.
As soon as Lukas has found the nonce, he sends the block with the transactions (one block contains several transactions) and the value (nonce) to the other participants of the network, which in turn verify whether the solution is correct. If this is the case, participants update their general ledger. This adds another block to the existing blockchain. Participation in validating transactions based on the computing power provided to solve the proof of work is called mining. In the case of Bitcoin, the Miner is rewarded for its efforts with new Bitcoins. An alternative incentive would be to charge a transaction fee for the proof-of-work.
Sources:
[1] S. Roßbach, “Blockchain in wenigen Worten erklärt,” Frankfurt/Main, Sep. 7 2016.
[2] M. Nielson, How the Bitcoin protocol actually works. [Online] Available: http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/.
The original contribution is in German found on www.blockchainbasics.ch which was a school project for the MSc Business Information Systems at ZHAW School of Management and Law Program.