Upcoming SlideShare
×

# Bitcoins Math

5,813

Published on

A short seminar presentation on the technical background of Bitcoins. Some basic concepts behind bitcoin addresses are discussed. An overview on the concepts of transactions and blocks is given.

Published in: Technology
5 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total Views
5,813
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
168
0
Likes
5
Embeds 0
No embeds

No notes for slide

### Bitcoins Math

1. 1. Introduction Bitcoin addresses Transactions Block chain Bitcoins Mathematical Background Akram El-Korashy1 1 Computer Science and Engineering German University in CairoCSEN 1033 Seminar in Topics and Applications in Cryptography, 2013 Akram El-Korashy Bitcoins Math
2. 2. Introduction Bitcoin addresses Transactions Block chainOutline 1 Introduction Bitcoins network properties 2 Bitcoin addresses BTC address generation overview BTC address cryptography 3 Transactions 4 Block chain Akram El-Korashy Bitcoins Math
3. 3. Introduction Bitcoin addresses Bitcoins network properties Transactions Block chainOutline 1 Introduction Bitcoins network properties 2 Bitcoin addresses BTC address generation overview BTC address cryptography 3 Transactions 4 Block chain Akram El-Korashy Bitcoins Math
4. 4. Introduction Bitcoin addresses Bitcoins network properties Transactions Block chainMain features Bitcoins can be transferred between arbitrary nodes. Transactions can be received at any time. Transactions are broadcast within seconds. Akram El-Korashy Bitcoins Math
5. 5. Introduction Bitcoin addresses Bitcoins network properties Transactions Block chainMain features Bitcoins can be transferred between arbitrary nodes. Transactions can be received at any time. Transactions are broadcast within seconds. Transactions are veriﬁed within 10 to 60 minutes. Transactions are irreversible. Double spending is prevented by using a block chain. Akram El-Korashy Bitcoins Math
6. 6. Introduction Bitcoin addresses Bitcoins network properties Transactions Block chainMain features Bitcoin addresses Bitcoins can be transferred between arbitrary nodes. Transactions can be received at any time. Transactions are broadcast within seconds. Transactions are veriﬁed within 10 to 60 minutes. Transactions are irreversible. Double spending is prevented by using a block chain. Akram El-Korashy Bitcoins Math
7. 7. Introduction Bitcoin addresses Bitcoins network properties Transactions Block chainMain features Bitcoin addresses Bitcoins can be transferred between arbitrary nodes. Transactions can be received at any time. Transactions are broadcast within seconds. Bitcoin blockchains Transactions are veriﬁed within 10 to 60 minutes. Transactions are irreversible. Double spending is prevented by using a block chain. Akram El-Korashy Bitcoins Math
8. 8. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainOutline 1 Introduction Bitcoins network properties 2 Bitcoin addresses BTC address generation overview BTC address cryptography 3 Transactions 4 Block chain Akram El-Korashy Bitcoins Math
9. 9. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressDeﬁnition Deﬁnition Bicoin address is an identiﬁer of 27-34 alphanumeric characters, that represents a possible destination for a Bitcoin payment. Akram El-Korashy Bitcoins Math
10. 10. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressDeﬁnition Deﬁnition Bicoin address is an identiﬁer of 27-34 alphanumeric characters, that represents a possible destination for a Bitcoin payment. Address Generation A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair. Akram El-Korashy Bitcoins Math
11. 11. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressAddress Generation Choose a random Elliptic-Curve key-pair. The public part is converted into a BTC address Akram El-Korashy Bitcoins Math
12. 12. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressAddress Generation The 20 bytes Message Digest from RIPEMD-160.. Akram El-Korashy Bitcoins Math
13. 13. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainOutline 1 Introduction Bitcoins network properties 2 Bitcoin addresses BTC address generation overview BTC address cryptography 3 Transactions 4 Block chain Akram El-Korashy Bitcoins Math
14. 14. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressDeﬁnitions and some Math Deﬁnition Base58 Akram El-Korashy Bitcoins Math
15. 15. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressDeﬁnitions and some Math Deﬁnition Base58 encoding is a binary-to-text encoding, that uses only the alphanumeric characters Akram El-Korashy Bitcoins Math
16. 16. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressDeﬁnitions and some Math Deﬁnition Base58 encoding is a binary-to-text encoding, that uses only the alphanumeric characters (except 0,O,I, and l.) Akram El-Korashy Bitcoins Math
17. 17. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressDeﬁnitions and some Math Deﬁnition Base58 encoding is a binary-to-text encoding, that uses only the alphanumeric characters (except 0,O,I, and l.) Deﬁnition RIPEMD-160 is a cryptographic hash function that generates a 160-bit digest of an arbitrary size block of data. Example RIPEMD-160("The quick brown fox jumps over the lazy dog") = 37f332f68db77bd9d7edd4969571ad671cf9dd3b RIPEMD-160("The quick brown fox jumps over the lazy cog") = 132072df690933835eb8b6ad0b77e7b6f14acad7 Akram El-Korashy Bitcoins Math
18. 18. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressSecure Hash Algorithm-256 Input: arbitrary length data, Output: 256-bit digest Merkle-Damgard Construction (one-way compression function, block ciphers) Akram El-Korashy Bitcoins Math
19. 19. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainDeﬁnitionElliptic curve over a ﬁeld Fp can be deﬁned as the set of points (x,y)satisfying the equation y 2 mod p = (x 3 + ax + b) mod p Akram El-Korashy Bitcoins Math
20. 20. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainDeﬁnitionElliptic curve over a ﬁeld Fp can be deﬁned as the set of points (x,y)satisfying the equation y 2 mod p = (x 3 + ax + b) mod pExample The set of afﬁne points of the elliptic curve y 2 = x 3 − x over F61 . Akram El-Korashy Bitcoins Math
21. 21. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Akram El-Korashy Bitcoins Math
22. 22. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size Akram El-Korashy Bitcoins Math
23. 23. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size 2 FR the basis used - can assume a ﬁxed basis Akram El-Korashy Bitcoins Math
24. 24. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size 2 FR the basis used - can assume a ﬁxed basis 3 a, b parameters of the equation Akram El-Korashy Bitcoins Math
25. 25. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size 2 FR the basis used - can assume a ﬁxed basis 3 a, b parameters of the equation (ﬁeld elements) Akram El-Korashy Bitcoins Math
26. 26. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size 2 FR the basis used - can assume a ﬁxed basis 3 a, b parameters of the equation (ﬁeld elements) 4 G base point, and 5 n its order - group element order, point addition, point doubling Akram El-Korashy Bitcoins Math
27. 27. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size 2 FR the basis used - can assume a ﬁxed basis 3 a, b parameters of the equation (ﬁeld elements) 4 G base point, and 5 n its order - group element order, point addition, point doubling (can be calculated from G!) Akram El-Korashy Bitcoins Math
28. 28. Introduction Bitcoin addresses BTC address generation overview Transactions BTC address cryptography Block chainBitcoin AddressElliptic Curve Digital Signature Algorithm Any signature algorithm has a Sign phase and a Verify phase. Some parameters agreed upon between sender and receiver: 1 q ﬁeld size 2 FR the basis used - can assume a ﬁxed basis 3 a, b parameters of the equation (ﬁeld elements) 4 G base point, and 5 n its order - group element order, point addition, point doubling (can be calculated from G!) 6 h cofactor - order of the curve divided by n Akram El-Korashy Bitcoins Math
29. 29. Introduction Bitcoin addresses Transactions Block chainTransactionsDeﬁnitions Deﬁnition A transaction is a signed section of data that is broadcast to the network and collected into blocks. It typically references previous transaction(s) and dedicates a certain number of bitcoins from it to one or more new public key(s) (Bitcoin address). It is not encrypted (nothing in Bitcoin is encrypted). Akram El-Korashy Bitcoins Math
30. 30. Introduction Bitcoin addresses Transactions Block chainTransactionsDeﬁnitions Deﬁnition A transaction is a signed section of data that is broadcast to the network and collected into blocks. It typically references previous transaction(s) and dedicates a certain number of bitcoins from it to one or more new public key(s) (Bitcoin address). It is not encrypted (nothing in Bitcoin is encrypted). Transactions and Blocks are the main data structures. A Block is composed of a header and a group of transactions. Transactions are identiﬁed by their hash (SHA-256). Blocks are identiﬁed by a hash of the header. Akram El-Korashy Bitcoins Math
31. 31. Introduction Bitcoin addresses Transactions Block chainTransactionsExample Example Principle example of a transaction Script is a set of instructions for the receiver to follow in order to be able to spend the Bitcoins. An input is a reference to the output of a different transaction. Previous tx is the pointer to (hash value of) the transaction from which the bitcoin Value will be transferred. Akram El-Korashy Bitcoins Math
32. 32. Introduction Bitcoin addresses Transactions Block chainTransactionsExample The main script instructions are: The hash of the public key should match the bitcoin address speciﬁed in the transaction. The signature on the sent data should be veriﬁable by the public key. Instructions are executed from the Output ﬁeld of the referenced transaction Previous tx scriptSig is an ECDSA signature on small data (part of the transaction). It serves as a proof that the transaction in which it exists was created by the real owner of the public address which the Previous tx was intended to. Akram El-Korashy Bitcoins Math
33. 33. Introduction Bitcoin addresses Transactions Block chainBlock ChainDeﬁnition Deﬁnition Block chain is a transaction database shared by all nodes participating in a system based on the Bitcoin protocol. Every block contains a hash of the previous block BitCoin uses the SHA-256 hash algorithm to generate veriﬁably "random" numbers in a way that requires a predictable amount of CPU effort. Akram El-Korashy Bitcoins Math
34. 34. Introduction Bitcoin addresses Transactions Block chainBlock ChainConcept Block chain: Because a block can only reference one previous block, it is impossible for two forked chains to merge. (Tree goes bottom-up) Akram El-Korashy Bitcoins Math
35. 35. AppendixReferences I https://en.bitcoin.it/wiki/Address Accessed March, 2013 Simple Tutorial on Elliptic Curve Cryptography Accessed March, 2013 https://en.bitcoin.it/w/images/en/9/9b/PubKeyToAddr.png Accessed March, 2013 Bitcoin wiki: Technical background of bitcoin addresses Accessed March, 2013 rnks.informatik.tu-cottbus.de - A tutorial on elliptic curve cryptography Accessed March, 2013 https://en.bitcoin.it/wiki/Category:Technical Accessed March, 2013 Akram El-Korashy Bitcoins Math
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.