You are on page 1of 43

Cryptocurrency and Blockchain

Technologies Course

Lecture 3
Cryptography & Blockchain Basics
Prof. Tumennast Erdenebold

Spring 2022
Disclaimer:

❑ The Cryptocurrency and Blockchain Technology course is


designed for educational purpose only. Therefore, course
related contents, lectures, research, tools, demonstration,
information, materials and discussions SHOULD NOT BE
CONSIDERED TO BE FINANCIAL ADVICE OR
INVESTMENT RECOMMENDATION.
❑ Investing in Cryptocurrency is highly risky, and any decision to
do so is at one’s own risk.
❑ Course Instructor and Institution (SolBridge, Woosong) will not
accept any responsibility and will not be liable for the
investment decisions anyone may make based on the course
materials.
❑ Duration: This Disclaimer is valid throughout the Spring 2022
Semester (Weeks 1~15) and indefinitely thereafter.
2
Learning Objectives:

❑ Part 1: Cryptography

❑ About Cryptography
❑ Encryption & Decryption
❑ Public Key Cryptography
❑ PGP, Lab Demo
❑ Hashing
❑ Digital Signature

❑ Part 2: Blockchain

❑ Hype cycle
❑ Blockchain Evolution
❑ Different Networks
❑ Ledger
❑ Brief overview
❑ How it works
Image Source: [4] 3
Part 1: Cryptography
About Cryptography

Threat over internet

5
Source [1, 2]
About Cryptography

❑ Cryptography term originated from Greek


word “Kryptos” meaning of “Hidden Secret”
❑ Cryptography is sending secret message
that can read only by the intended recipient.
❑ Cryptography is science, mathematics and
art of secret or hidden writing
❑ Common stuff that spies use.

6
Source [2]
About Cryptography
Example:

7
Source [2, 3]
About Cryptography
Also, protects data that travels over internet.

8
Source [2, 5]
About Cryptography
Example: https -> Stands for secure

9
Source [6]
Encryption and Decryption

❑Encryption
❑Converting human readable Plaintext to Cyphertext
❑Decryption
❑Converting coded Cyphertext to Plaintext human
readable

Snoopers can’t
understand it 10
Source [2], Image Source: [7]
Encryption and Decryption
Example:
Symmetric encryption
(Same key)

Sender: A Receiver: B

Solbridge e08001c632c Solbridge


“Cryptocurrency 334ac555273 “Cryptocurrency
& Blockchain & Blockchain
d49989ad0b
Technologies Encrypt Decrypt Technologies
Course” 77f7dea7 Course”

PlainText CipherText PlainText

Encrypt Decrypt
11
Public Key Cryptography
Example:
Asymmetric cypher
(Different keys)

Sender: A Receiver: B

Solbridge e08001c632c Solbridge


“Cryptocurrency 334ac555273 “Cryptocurrency
& Blockchain & Blockchain
d49989ad0b
Technologies Encrypt Decrypt Technologies
Course” 77f7dea7 Course”

PlainText CipherText PlainText

Encrypt Decrypt
12
Public Key Cryptography: PGP
One Scheme: PGP – Pretty Good Privacy (1990s)

Sender: A Receiver: B

Solbridge e08001c632c Solbridge


“Cryptocurrency 334ac555273 “Cryptocurrency
& Blockchain & Blockchain
d49989ad0b
Technologies Encrypt Decrypt Technologies
Course” 77f7dea7 Course”
(Receiver B’s (Receiver B’s
Public Key) Private Key)

PlainText CipherText PlainText

Shared Key Public Private


Key Key
Key pair
(Asymmetric) Receiver: B 13
Public Key Cryptography: PGP
PGP: Public Key Example

-----BEGIN PGP PUBLIC KEY BLOCK-----


Version: Keybase OpenPGP v2.0.9Comment: https://keybase.io/crypto

xm8EYFK+kBMFK4EEACIDAwQMtmrELqrSan/92RfjPMJ9vwdLt8mnuM/Z4QswtHddIEAl5Z8QrzUOHVtCiCdhvhIzz6f7qY5
g9v81R9spUczPYN6i2vV2iAyRJ8+tzyGwd52F86kcD/hrtqvrMi3zcP/NE2Zzc2QgPGZzZEBmZHNmLmNvbT7CkgQTEwoAGg
UCYFK+kAIbLwMLCQcDFQoIAh4BAheAAhkBAAoJEDxhHOtdRSd0x0wBfiwDQZZ1zEH06qaQNiZ5GbazkY6gvOcrN8ROVPZ
XKiV5E0k1LJcs/MqD3uTAW6kErgF/XsjxOqH0Kq2vZITdtUJh5VVkKGt8FHPTR0M66DOkhBt6M+LxwzLbnN+E2y7l6AJxzlIEY
FK+kBMIKoZIzj0DAQcCAwQQA1xzrIQ+1jLFBpNFBbYM4pn5Tz3Yixx0XZ3XtUsANrA5buDLFYeWYBJqkJRBkqbIH6Ccq2y2w
RnMB7NTCsSdwsAnBBgTCgAPBQJgUr6QBQkPCZwAAhsuAGoJEDxhHOtdRSd0XyAEGRMKAAYFAmBSvpAACgkQTvR0eCO
qr3x8kQEAzNEtQScwq4Ac07iTRKGSRnavRD/bCedqUR54rfFMunwBAL2uhBJzQCNRLe9F8NMIUyG/tFnrB/cwx2pP28+5o
RcsK2YBgN15i5ZxRuma7ChkqxpL4WvNp8/JIvLBA74+tcZl3GDWvvpVKOtZ3U+5HFJVJV721gGA7+RDP5hmrRe5jMGeS2Lg
Yzouq+8PQLl7eiEoHGc1FY7Fj6I14ivMJ5Sq1wj1/6qwzlIEYFK+kBMIKoZIzj0DAQcCAwQQkvWwgfbu6lHZWHlxV++RwC2f3
qSuWsEW6ICr0NLLB3EjQg5lcONU8QeN3kT3jPxUNrru8NXg+W65g5uVcTm9wsAnBBgTCgAPBQJgUr6QBQkPCZwAAhsuA
GoJEDxhHOtdRSd0XyAEGRMKAAYFAmBSvpAACgkQWDl5PqUYq8SsTQD/RUDHeuRuEbzJVjw44bLd5antOfJmd4ccXzdt/jL
kA0UBAKy92Dfmd9XbmjD8yF7nEvIoETPfpExRSi8a0iDRpoliadEBfRhDUYhKPUdWiIh7YMzSndoUZVboOQXNGtVJuOB2Ay
uUIo5GsUGT9bggfg0Fit9qPAF9EOX+KoYETYO8ShMoyV/LDO4nSiuNwnv60DskNWtS3Ewxn0Xhtrd1VjUg
DLn9D6sJ
=MiU+
-----END PGP PUBLIC KEY BLOCK-----
Public Key Cryptography: PGP
PGP: Private Key Example
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: Keybase OpenPGP v2.0.9
Comment:https://keybase.io/crypto

xcFGBGBSupUBBADHsUH/iSSFk2QL4ZARG6cJ3wswLs48bgk32gGr0uWx2AUEaS/FoE+NhAdiOP8JfQbpsm1lIUvWHeus4t5GItG4qORCXZwErePYsmupr9on2+Ymjw
Yq6WAuWns3ph45KmQV74k4Um9J5Zw9QbZtzFjO6BTWJsOFWwL0AQzWGSW92wARAQAB/gkDCAWxeIHkSd78YG147S2x4bbqhxsk9Cq6MLIOuEg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G3h7AGMkt/DfFI0YlTYe+bp
RiZkMyV/MVDa2ksk9S1JAPdG0BVDqsl0YZDxIRomuJlbQLjam66vl6PS1maDhqbJPZ7PoDkHvgW+sAZ/Bj2006aHpTFieAjxcRjCNaKMVyfLxDpBZQ8fpifpHB74+QiE6
641qx5aCSG6MDTU4sym7RUpXC6ZRNwF00/lC6vXXigLI5GY1D3CZ94OnBTjh8u+fbaf3Crp+9IQc4vKpbxKYpKzNMWU/QdM8BffJbg6WIk21xlFdYLm2AzaBNd8Td2
gnEq1dw7mlq4N1foiaLjvcuRMpbwjKZihrc7+8KYXe4Iop4Ij+PTnrdMpJ+7zQJlC/9czwPiqpK/jWnsvG77vJpnTuGn9wEbU7ORY1GBP0bdgP8RAbxXFs9X800T/Z1bWa
1CXzI6588bm+z8wjCwIMEGAEKAA8FAmBSupUFCQ8JnAACGy4AqAkQW5OpZsxDeUydIAQZAQoABgUCYFK6lQAKCRBvQp6nUpK2yphwBACWLeWvYAd7mrlzES+
6CQDhnK5hTPLqe7wjR1L4mNsiACyoBN98weD81U0SyJZDX0j+S7NMYJWwVudrD2lF4bErEMXeTgeNx0Nj36OmB/vi4+/su6iC81TnJg5PTg1BmeGZYdKcFDwmvYN/
Nz1F4t19cbtokDAsSBh2Jw5qjjHgRfYUA/4pU2CIhbRYt2YE5PSe45SalJNFcDrfeGjfRbDBLm1AHzFqWSqDChxKfSuMxUK7vWBG9I6u8j2ScdtgDtXn6j+xXOkZ/XCQBp
kPwKh8rtAA30h04cPhQSI35rpuivD6UGSLOOTr5f60HxMRp9R07zb0wSd/ZSoK8cgESL3B56vW5A
===wnLr
-----END PGP PRIVATE KEY BLOCK-----
Public Key Cryptography: PGP
PGP: Encoded Message (Cyphertext) Example
Message: Cryptocurrency Class

-----BEGIN PGP MESSAGE-----


Version: Keybase OpenPGP v2.0.9
Comment: https://keybase.io/crypto

wYwDfuHyI/1UlHwBA/45rAgpKtmkh6kQ5b5+AE/eYP
H00769r6HKQc1Gz+Va717k
yqDVU6Ex6JbGLRe+hdsxodKIsvFcTnEYXltqqJ+ygM2n
nVt3KeyKr1CboEVd9Wyw
C4fXQ21Q4qgUucdZeBO/JLPyCrwza1Ez0PtWuYQ4LX
BrV4MokOynTVegm7lJC9JQ
AblTTMeZLjDHgb8PpRV8MT4p5k4CFjrj0u9sQ82Zs/Gl
kX5ovDlx5FIEjddyv7vB
v1VKoJMaoSFEHPFgelVyu0zC8xZHKwvMHG9FtEUqtu
0=
=2CSO
-----END PGP MESSAGE-----
Public Key Cryptography: PGP Demo
Lab Practice Exercise: PGP – Pretty Good Privacy (Open PGP
standard) https://smartninja-pgp.appspot.com/#
Public Key Cryptography: Cryptocurrency
Example: Bitcoin uses schema called ECDSA – Elliptic Curve Digital
Signature Algorithm
❑ Pick Random number between 0 and 2265-1, (Private Key)
❑ Do some ECDSA math conversion (algorithm), and generate a Public
Key

Public Key Private Key


Public Key Cryptography: Cryptocurrency
Lab Practice: Bitcoin address generation
❑ Bitcoin Address (Account), Wallet

Create Bitcoin Address: https://www.bitaddress.org/

To verify using private key: https://www.bitaddress.org/ -> click on menu Wallet Detail

To verify using public key: https://www.blockchain.com/explorer?utm_campaign=expnav_explorer


Hashing
Hash function is
❑ Series of mathematical steps or algorithms that you can convert input
data, to digest or fingerprint or simply called hash.
❑ Hash function used for proving that two things (data) are the same
without revealing the two things (data).
❑ Input message size (giga, tera data …) does not influence size of Hash
value result
❑ Types of Hash
❑ Basic hash (not used in blockchain)

❑ Cryptographic hash (used in blockchain)

Source [2, 8]
Hashing
Lab Tool Practice:

https://www.fileformat.info/tool/hash.htm

Test & Try:


1) String hash -> Text -> type Solbridge -> click Hash

2) File hash -> click Choose file -> select any file on your
computer -> click Hash

Check result:

SHA-1 21912d3dc4356e4f4db1ced3683411288ccb16d2
Hashing: Blockchain
Hash function, example: in Bitcoin
❑ In the mining process
❑ As identifiers for transaction
❑ As identifiers for blocks, in order to link them in a chain
❑ Ensuring that data tampering is immediately evident

Source [2, 9]
Digital Signature

Signature/Seal
is code

Source [2, 10]


Digital Signature

Simply
❑ Message + Private Key -> Digital Signature
❑ Message + Digital signature + Public key -> Valid/Invalid

Source [2, 11]


Digital Signature

Source [2, 11]


Digital Signature

VS

Paper-Ink Signature Digital Signature

1. No proof tampered paper after 1. Only valid for that exact piece of
signature data, Cannot copy or re-use it
2. Signature can easily be copied, and 2. Any tampering with message will be
re-used with other document, result invalidated
without your knowledge
3. One time proof with private key

Source [2, 11]


Digital Signature

Why Cryptography & Digital signature in Cryptocurrency & Blockchain?

❑ Craig the password cracker


❑ Eve the eavesdropper
❑ Grace the government
❑ Malloy the malicious man in the middle
❑ Sybil the attacker who uses a lot of pseudonyms to overwhelm
Sender A and Receiver B

Source [2, 11]


Part 2: Blockchain Basics
Computing paradigms
Disruptive Computing Paradigms: Mainframe, PC, Internet, Social-Mobile,
Connected World.

Source: Expanded from O’Reilly Radar (by Mark Sigal)


Blockchain Hype Cycle

Source [12]
Cryptocurrency & Blockchain Same?

Source [13]
Blockchain Evolution: Market Adoption

Source [14]
Blockchain Evolution: Technology

Source [14]
Different Networks

Source [15]
Centralized vs Decentralized

Source [16]
Ledger

A ledger is a book (note) containing accounts in which the classified and


summarized information from the journals is posted as debits and credits.

Source [19, 20]


Blockchain

Source: Pwc, https://www.digitalpulse.pwc.com.au/pwc-blockchain-infographic/

Photo source: https://www.youtube.com/watch?v=zSCHw1X-cq4

Source [14]
Blockchain

Source [18]
Blockchain

Notebook =
Blockchain

Page
Laminate Page =
Content/Record =
Hashing Block
Data <transaction
data>

Page Number
Order 1,2,3.. =
Hash #, Previous
block Hash #
address
Page# = Block#

Source [18] Source: https://www.livehoppy.com/laminated-baby-book-page-ideas-fun-cute/


Blockchain

Source: Pwc, https://www.digitalpulse.pwc.com.au/pwc-blockchain-infographic/

Source [17]
Q&A (Cryptography)

❑ What is Cryptography?
❑ What is Encryption & Decryption?
❑ What is plaintext, cyphertext?
❑ What is difference between Symmetric & Asymmetric?
❑ What is Hash?
❑ What is electronic signature?
❑ What is digital signature?
❑ Ink-paper signature vs Digital signature?
❑ Why Cryptography & Digital signature in Cryptocurrency &
Blockchain important?
41
Q&A (Blockchain)

❑ What is ledger?
❑ What are different network architectures?
❑ What is difference between centralized vs decentralized
network?
❑ What is P2P?
❑ What is Blockchain?
❑ What is node?
❑ How does blockchain works?

42
References
[1] Lewis, A. (2018). The basics of bitcoins and blockchains: an introduction to cryptocurrencies and the technology
that powers them. Mango Media Inc..
[2] Image source: https://www.edureka.co/blog/what-is-cryptography/
[3] Image source: https://www.inviul.com/cryptosystem-and-its-types/
[4] This Photo by Unknown Author is licensed under CC BY-SA-NC
[5] Image source: https://www.aureon.com/services/it-management/it-services/security/data-encryption-why-you-
should-protect-your-business/
[6] Image source: https://www.truegossiper.com/internet-security-secure-websites-with-ssl-and-https/
[7] Image source: https://www.thesslstore.com/blog/difference-encryption-hashing-salting/
[8] Image source: https://sectigostore.com/blog/hash-function-in-cryptography-how-does-it-work/
[9] Image source: https://medium.com/swlh/blockchain-characteristics-and-its-suitability-as-a-technical-solution-
bd65fc2c1ad1
[10] Image source: https://triforce92.wordpress.com/2014/03/16/
[11] Image source: https://wizardforcel.gitbooks.io/practical-cryptography-for-developers-book/content/digital-
signatures.html
[12] https://pages.chainstack.com/hype-cycle-for-blockchain-technologies-2020
[13] Image source: https://lawyer4u.ca/the-unpleasant-truth/
[14] Image source: https://twitter.com/chugunov_igor80/status/1159542561276649472?lang=da
[15] Image source: https://twitter.com/cyrus_moody/status/1033026906856271877
[16] Image source: https://data-flair.training/blogs/basics-of-blockchain-technology/
[17] Image source: https://www.digitalpulse.pwc.com.au/pwc-blockchain-infographic/
[18] Image source: https://www.livehoppy.com/laminated-baby-book-page-ideas-fun-cute/
[19] Image source: https://en.wikipedia.org/wiki/File:Ledger.png
[20] https://www.freshbooks.com/hub/accounting/what-is-a-ledger
[21] https://www.researchgate.net/figure/Mined-blocks-in-a-blockchain-Hash-in-each-block-now-starts-with-five-
zeros_fig2_332139853

43

You might also like