Blockchain is one of the most innovative discoveries of the past century.
The first cryptocurrency, Bitcoin, was proposed in 2008 by Satoshi Nakamoto with a white paper.
1. 1
A Quick Start To Blockchain
Seval ÇAPRAZ
ASELSAN Inc.
November 2021 TURKEY
2. WHAT IS BLOCKCHAIN?
• Blockchain is one of the most innovative discoveries of
the past century.
• The first cryptocurrency, Bitcoin, was proposed in 2008
by Satoshi Nakamoto with a white paper.
• Initially, the first Bitcoin was used in 2009. After ten
years, this electronic coin is used by millions of people
every day. Nowadays, there are dozens of
cryptocurrencies such as Bitcoin, Ethereum, Tether,
Binance Coin, XRP etc.
• Initially, blockchain was designed specifically for
cryptocurrencies but it can be utilized for endless other
use cases thanks to its beneficial features.
2
3. • The infrastructure of blockchain is based on a peer-to-peer (p2p) network.
• All nodes on the network have a copy of the chain. Once anyone sends a Bitcoin to another, it
becomes permanent and verifiable. It is an excellent chain with linked blocks. It is nearly
impossible to counterfeit or double-spend.
3
Peer-to-Peer (p2p)
4. Distributed Ledger Technology
• The blocks are linked and become a chain. Then the chain is stored by all users in the network.
This design is called distributed ledger technology.
• Ledger is a record of any transaction or data. If a ledger is distributed, there is no need for a
central authority or middleman. Also distributed systems reduce the costs of transactions. In
addition to this, it is more secure and robust than central systems.
• Blockchain is one type of distributed ledger technology. It has more features.
4
8. How we hold data?
• Blockchain is a new kind of database. We can hold the data in blocks or outside of the block. If we
store the data outside of the blockchain, we can hide only the address in the blockchain. This is
called off-blockchain.
8
DB Address Address Address
Off-Blockchain
9. Hashing Algorithms
9
• To link the blocks, simple cryptography is used: hashing
algorithms such as SHA-256, Keccak-256 etc.
• The hashing means taking an input string of any length
and giving out an output of a fixed length.
• SHA-256 always produces an output with 256 bits
length hash value.
• Some hash algorithms are not collision resistant such as
MD-5 or SHA-1.
• On the other hand, SHA-256 and Keccak-256 have
strong collision resistance.
• SHA-256 is currently being used by Bitcoin.
• Keccak-256 is currently being used by Ethereum.
SHA-256
“The quick brown fox did some crypto”
410312395834291203…
SHA-256
“The quick brown Fox did some crypto”
983249120432492340…
10. Block Mining
10
• The blocks can be created after a procedure called mining. Mining is used for transactions’
validity. If a transaction is valid, the mining operation creates a block with this transaction record.
• After a block is created, the miner announces it to the network. The peers on the network verifies
this block, and it joins the chain permanently. Mining protects the chain from the double-
spending problem.
• Bitcoin uses a very difficult mathematical problem to mine a block because everyone wants to
mine blocks and get rewards. Solving this difficult mathematical problem is called proof-of-work.
• Miners try different nonce values more than billions of times. It takes approximately 10 minutes
to successfully mine a block.
• Mining requires a lot of computational power.
11. Hash-based Proof of Work
11
• Can’t compute an input from an output.
• To find a hash with N zeros at the start of the input, requires 2N computations…proves
computational work.
• If we hash an incrementing “nonce” as the hash input, we can go looking for zeros:
in 3e-05 seconds, nonce = 0 yielded 0 zeros. value = 4c8f1205f49e70248939df9c7b704ace62c2245aba9e81641edf…
in 0.000138 seconds, nonce = 12 yielded 1 zeros. value = 05017256be77ad2985b36e75e486af325a620a9f29c54…
in 0.000482 seconds, nonce = 112 yielded 2 zeros. value = 00ae7e0956382f55567d0ed9311cfd41dd2cf5f0a7137…
in 0.014505 seconds, nonce = 3728 yielded 3 zeros. value = 000b5a6cfc0f076cd81ed3a60682063887cf055e47b…
in 0.595024 seconds, nonce = 181747 yielded 4 zeros. value = 0000af058b74703b55e27437b89b1ebcc46f45ce55d6….
in 3.491151 seconds, nonce = 1037701 yielded 5 zeros. value = 00000e55bd0d2027f3024c378e0cc511548c94fbeed0e….
in 32.006105 seconds, nonce = 9913520 yielded 6 zeros. value = 00000077a77854ee39dc0dc996dea72dad8852afbde6….
in 590.89462 seconds, nonce = 186867248 yielded 7 zeros. value = 0000000225060b16117b23dbea9ce6be86ac439d….
in 4686.171007 seconds, nonce = 1424462909 yielded 8 zeros. value = 000000002dd743724609a9f57260e2492908d….
12. PGP (Pretty Good Privacy)
Private Key: A secret key that you don’t share
Public Key: Key that you share with others
12
14. Transactions
14
“If you don’t own your
private key, you don’t
own your bitcoins.”
• This is how the Bitcoin private key looks:
E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262
15. Consensus Mechanism
15
• Bitcoin and Ethereum use classical proof of work mechanisms as we mentioned above. Other than
proof of work (PoW), there are a few popular methods for consensus mechanisms: proof of
authority, proof of personhood, proof of space, proof of stake etc. Which one is better than the
other?
16. Consensus Mechanism
16
• If someone has more than half of the computational resources of all peers on the network, he
starts to control the blockchain. This is known as 51% attack.
• Mining has to be competitive to provide a reliable and sustainable chain. To sum up, creating a
block should be difficult, however verifying it should be very easy. To verify a new block, there
should be a consensus like the majority of the network should verify and agree that the block is
valid.
• Byzantine Fault Tolerant (BFT) is one of the features of consensus mechanisms. It reaches
consensus as long as the majority (like two-thirds of the network) agree without any central
authority. The solution could fail only if the malicious party captures 50% of the network power.
17. Smart Contracts
17
• Blockchain is a new kind of database. In classical relational databases, we can create stored
procedures to run whenever we want. This feature exists in blockchain via smart contracts.
• Smart contracts can be used for creating a protocol or program on blockchain. Once it is deployed,
it is automatically executed by the blockchain and it cannot be changed.
• It is an agreement between users. Ethereum is the most popular blockchain to run smart
contracts by the help of Solidity programming language.
• In order to create smart contracts, Bitcoin provides a Turing-incomplete script language.
• In current proposed designs, smart contracts are used for access control for the data on the
blockchain.
18. Cryptography
18
• Blockchain has a cryptography to provide authentication and verification for network users on p2p
system.
• Kerckhoffs’s principle states that
• “a cryptosystem should be secure even if everything about
the system, except the key, is public knowledge.”
• The blockchain’s asymmetric cryptosystem relies on public and private keys. The main issue in this
cryptosystem is recovering lost private keys. It is nearly impossible.
• Wallet systems store the user’s private keys. This may cause the private keys to be lost or stolen.
• For instance, every Bitcoin address is based on a secret key, from which the public key (associated
to a Bitcoin address) is calculated.
• Once you have the bitcoin private key for an address, you have the control of that address and can
use it to transfer funds.