For user32260: Bill sells Sally some apples for £2.50

Bill is a fruit vendor. Sally wants to buy some apples for £2.50. Sally wishes to use Bitcoin to pay Bill for the apples. Bill presents Sally his payment address, for example as a quickresponse code:

Bill's address

Sally uses a Bitcoin wallet on her smartphone to scan the code. She is presented a screen where she can enter an amount to send to Bill’s address. She types ‘£2.50’ and presses send. A moment later Bill’s tablet notifies him that there is an incoming payment pending, which is not confirmed yet. About ten minutes later, the payment is finalized when it gets confirmed.

Under the hood

1) The payment order (Transaction):
The software on Sally’s smartphone checks whether Sally has a sufficient balance and then creates a payment order, which we’ll call a transaction. This transaction is composed of three pieces of information: which “coins” get spend, the payment to the recipient, and a signature.
Sally’s wallet is connected to other participants in the network. The wallet passes the transaction to all of them, who in turn forward it to all of their connections. Within a few seconds, every participant in the network has received notification of Sally’s payment order. Each and every participant checks whether the referenced “coins” exist, and whether the signature matches the owner’s.

2) Confirmation:
So far, Sally’s payment is only a promise, because the transaction is still unconfirmed.
To change that, some network participants, which we’ll call miners, work on confirming these transactions. The miners grab all the unconfirmed transactions and try to pack them into a set. When this set doesn’t fulfill the difficulty requirement, they reshuffle it and try again. Miners all over the planet are performing this work until at some point, somebody finds a set with the right properties: a valid block. Because finding a valid block is such an unlikely event, the announcement of the new block proves that the network has expended work to find it.
Just as with the transactions before, the miner sends the block to all their connections, who in turn forward it. Every participant checks the work (to confirm that the block follows the rules) and when satisfied, applies the included transactions to their own ledger: the transactions get executed and the “coins” that were used by the senders get marked as spent, whereas the recipients gain new “coins” as instructed by the transactions. Sally’s transaction (and all the others) is now confirmed. Bill can now spend the “coins” he received from Sally.

3) The Blockchain
Let’s take a step back. Before Sally paid Bill, Sally got her bitcoins from Alice. The order of transactions is crucial as transactions can only spend “coins” that have already been created. Sally can’t pay Bill if she didn’t get the money from Alice first. The transactions have an explicit position in the block that confirms them and each block has a fixed position in the block chain by referencing its direct predecessor. E.g. Block 90 links to Block 89 as its predecessor, in turn Block 89 builds on Block 88, and so forth, until Block 1 points at the 0th block, the Genesis Block.

Genesis Block ← 1 ← … ← 88 ← 89 ← 90

The eponymous blockchain has useful properties:

  • Deterministic results: Everyone can start from the Genesis Block and apply each block consecutively to arrive at the same result.
  • Synchronization & Consensus: When you have applied the latest block, the balances in your ledger have the exact same state as in all the other participants’ ledgers.
  • Unchangeable History: As each block builds upon its predecessor, each new block buries the history under more work (see graphic below):

enter image description here
Illustration: Mark Montgomery/IEEE Spectrum


Source link

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *