by Michele D'Aliessi
Imagine you and I bet $50 on tomorrow's weather in San Francisco. I bet it will be sunny, you that it will rain.
Today we have three options to manage this transaction:
Neither trust nor contract is an optimal solution:
The blockchain technology
is interesting because it offers us a third option which is secure,
quick, and cheap.
Sunny or rainy, it will
automatically transfer the whole amount to the winner. Each party
can check the contract logic, and once it's running on the
blockchain it can't be changed or stopped. This may be too much
effort for a $50 bet, but imagine selling a house or a company.
Let's use this first application of the blockchain technology to learn how it works.
One bitcoin is a single unit of the Bitcoin (BTC) digital currency.
Just like a dollar, a
bitcoin has no value by itself; it has value only because we agree
to trade goods and services to bring more of the currency under our
control, and we believe others will do the same.
Bitcoin ledger digital
It is distributed across
the world via a network of private computers that are both storing
data and executing computations. Each of these computers represents
a "node" of the blockchain network and has a copy of the ledger
We can define the blockchain as a system that allows a group of connected computers to maintain a single updated and secure ledger.
In order to perform transactions on the blockchain, you need a wallet, a program that allows you to store and exchange your bitcoins.
Since only you should be able to spend your bitcoins, each wallet is protected by a special cryptographic method that uses a unique pair of distinct but connected keys:
If a message is encrypted with a specific public key, only the owner of the paired private key can decrypt and read the message.
The reverse is also true:
When David wants to send bitcoins, he needs to broadcast a message encrypted with the private key of his wallet.
As David is the only one
who knows the private key necessary to unlock his wallet, he is the
only one who can spend his bitcoins. Each node in the network can
cross-check that the transaction request is coming from David by
decrypting the message with the public key of his wallet.
The digital signature is a string of text resulting from your transaction request and your private key; therefore it cannot be used for other transactions.
If you change a single
character in the transaction request message, the digital signature
will change, so no potential attacker can change your transaction
requests or alter the amount of bitcoin you are sending.
Digital Signature transaction
Since you broadcast the message only after it has been encrypted, you never have to reveal your private key.
So, how does a node know your account balance? The blockchain system doesn't keep track of account balances at all; it only records each and every transaction that is verified and approved. The ledger in fact does not keep track of balances, it only keeps track of every transaction broadcasted within the bitcoin network (Fig. 4).
To determine your wallet balance, you need to analyze and verify all the transactions that ever took place on the whole network connected to your wallet.
These links are called "inputs." Nodes in the network verify the amount and ensure that these inputs haven't been spent yet. In fact, each time you reference inputs in a transaction, they are deemed invalid for any future transaction.
This is all performed
automatically in Mary's wallet and double-checked by the bitcoin
network nodes; she only sends a 10 BTC transaction to John's wallet
using his public key.
It checks all the previous transactions correlated to the wallet you use to send bitcoins via the input references. To speed up the verification process, a special record of unspent transactions is kept by the network nodes.
Thanks to this security
check, it is not possible to double-spend bitcoins.
However, should there be
a mistake in the code used to broadcast a transaction request
message, the associated bitcoins will be permanently lost.
For this reason, if you are interested in transacting on the bitcoin network, it's a good idea to use the open source and official version of bitcoin wallet software (such as Bitcoin Core), and to store your wallet's password or private key in a very safe repository.
However if someone uses the same public key over and over, it's possible to connect all the transactions to the same owner.
The bitcoin network
allows you to generate as many wallets as you like, each with its
own private and public keys. This allows you to receive payments on
different wallets, and there is no way for anyone to know that you
own all these wallets' private keys, unless you send all the
received bitcoins to a single wallet.
possible bitcoin addresses
An attacker could send a transaction, wait for the counterpart to ship a product, and then send a reverse transaction back to his own account. In this case, some nodes could receive the second transaction before the first and therefore consider the initial payment transaction invalid, as the transaction inputs would be marked as already spent.
How do you know which transaction has been requested first?
It's not secure to order
the transactions by
timestamp because it could easily be
counterfeit. Therefore, there is no way to tell if a transaction
happened before another, and this opens up the potential for fraud.
Blocks are therefore organized into a time-related chain (Fig. 6) that gives the name to the whole system:
The block chain
sequence structure simplified
Each node can group
transactions into a block and broadcast it to the network as a
suggestion for which block should be next. Since any node can
suggest a new block, how does the system agree on which block should
be the next?
The only way to solve such a mathematical problem is to guess random numbers that, combined with the previous block content, generate a defined result. It could take about a year for a typical computer to guess the right number and solve the mathematical problem.
However, due to the large
number of computers in the network that are guessing numbers, a
block is solved on average every 10 minutes. The node that solves
the mathematical problem acquires the right to place the next block
on the chain and broadcast it to the network.
In this case, both blocks are broadcast and each node builds on the block that it received first. However, the blockchain system requires each node to build immediately on the longest blockchain available.
So if there is ambiguity about which is the last block, as soon as the next block is solved, each node will adopt the longest chain as the only option.
chain ambiguity logic
If a transaction happens
to be in a block that belongs to a shorter tail (like block B in
Fig. 7), once the next block is solved, this transaction, along with
all others in its block, will go back to the unconfirmed
Bitcoin blockchain system
are protected by a mathematical race:
Any attacker is competing
Since nodes always adopt
the longer tail as the confirmed transactions, if Mary could
generate a longer tail that contains a reverse transaction with the
same input references, John would be out of both his money and his
Mary's double-spending attack
Each block contains a reference to the previous block (see Fig. 6). That reference is part of the mathematical problem that needs to be solved in order to spread the following block to the network.
So, it's extremely hard to pre-compute a series of blocks due to the high number of random guesses needed to solve a block and place it on the blockchain.
Mary is in a race against
the rest of the network to solve the math problem that allows her to
place the next block on the chain. Even if she solves it before
anyone else, it's very unlikely she could solve two, three, or more
blocks in a row, since each time she is competing against the whole
Yes, but even with a
very, very fast computer, due to the large number of members in the
network, it's highly unlikely Mary could solve several blocks in a
row at the exact time needed to perform a double-spending attack.
The more blocks to be solves in a row, the lower the probability of her success. Transactions in the bitcoin blockchain system are protected by a mathematical race:
Therefore, transactions grow more secure with time. Those included in a block confirmed one hour ago, for example, are more secure than those in a block confirmed in the last 10 minutes.
Since a block is added to the chain every 10 minutes on average, a transaction included in a block for the first time an hour ago has most likely been processed and is now irreversible.
Blockchain transactions security
So, where do bitcoins
come from in the first place?
These groups are called
Even if one of these
pools could potentially gain 50 percent of the network computing
power, the further back along the chain a block goes, the more
secure the transactions within it become.
This ensures the
network's stability and overall security.
Due to this mechanism, transactions associated with a higher reward are usually processed faster than those associated with a low reward. What this means is that, when sending a transaction, you can decide if you'd like to process it faster (more expensive) or cheaper (takes more time).
Transaction fees in the bitcoin network are currently very small compared with what banks charge, and they're not associated with the transaction amount.
However, there are a few challenges that need to be addressed:
Overall, the blockchain technology has the potential to revolutionize several industries, from advertising to energy distribution.
Its main power lies in its
decentralized nature and ability to eliminate the need for trust.
New tools are being
developed every day to improve blockchain security while offering a
broader range of features, tools, and services.