Blockchain Security

Report 10 Downloads 138 Views
Blockchain Security

Blockchain Security

Bryan Ford

Mohammad Oday Darwich

DEDIS research group leader Associated professor at EPFL @brynosaurus

Computer Science Researcher

[email protected]

at University of Geneva @zeer0day /

dowday

[email protected]

Blockchain & Ethereum 1. Bitcoin & Ethereum • • •

What is Blockchain ? How does Blockchain work ? What are smart contracts ?

2. Hard fork • What is Hard fork ? • Hard fork trade-offs • What it means to hard fork ?

3. Conclusion 4. Discussion Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

3

Introduction to blockchain What is Bitcoin ? ❖ Digital money you can send through the internet ❖ Transferred directly from peer to peer via the net, without going through a bank or clearing house (Decentralization, Disintermediation) ❖ Fees are much lower, usable wherever there is internet account cannot be frozen ❖ Sending BTC is similar to sending an email ❖ Purchase (mostly) anything with Bitcoin Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

4

Introduction to blockchain Core Technologies : ❖ Public/Private key cryptography ❖ Cryptographic Hash Function ❖ Peer to Peer Networking ❖ The Blockchain ❖ Proof of Work (How to solve Byzantine Genera’s problem)

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

5

How blockchain works ? Identified only by their private key

Private key: KJASDAasded..dfe wewWER

Private key: KJASDAsdIEKE…E WdkeJKIQllwo

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

6

How blockchain works ? And Public address of their wallet Address: Qwsaasa… aQWEWR32

Address: 1IKEr5SA$… 24FAQZklkA

Private key: KJASDAasded..dfew ewWER

Private key: KJASDAsdIEKE…E WdkeJKIQllwo

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

7

How blockchain works ? Blockchain is a ledger, it knows the balance of those wallets

Address: Qwsaasa… aQWEWR32

Address: 1IKEr5SA$… 24FAQZklkA

5

0

Private key: KJASDAasded..dfew ewWER

Private key: KJASDAsdIEKE…E WdkeJKIQllwo

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

8

How blockchain works ? Alice constructs a transaction to send 5 BTC to Bob

Address: Qwsaasa… aQWEWR32

Send 5 BTC from Qwsaasa… aQWEWR32 To 1IKEr5SA$… 24FAQZklkA

5

Address: 1IKEr5SA$… 24FAQZklkA

0

Private key: KJASDAasded..dfew ewWER

Private key: KJASDAsdIEKE…E WdkeJKIQllwo

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

9

How blockchain works ? And signs with here private key

Address: Qwsaasa… aQWEWR32

Send 5 BTC from Qwsaasa… aQWEWR32 To 1IKEr5SA$… 24FAQZklkA

5

Address: 1IKEr5SA$… 24FAQZklkA

0

Private key: KJASDAasded..dfe wewWER

Private key: KJASDAsdIEKE…E WdkeJKIQllwo

Blockchain Security

Presented by Bryan Ford 10 Mohammad Oday Darwich

How blockchain works ? The transaction is sent to the network and propagates into the transaction pool of each node

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

11

How blockchain works ? Miners start to create a candidate block Validate and sort the transactions into a candidate block, no larger than the maximum blocksize

Candidate block

Transaction pool

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

12

How blockchain works ? A block contains the transactions, plus the Merkel root Merkle root ~ hash all transactions in the block

Candidate block

Transaction pool

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

13

How blockchain works ? And includes the hash of the previous block to chain them together Merkle root ~ hash all transactions in the block

Candidate block

Transaction pool Hash of the previous block

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

14

How blockchain works ? And miners will solve the proof of work puzzle, finding the nonce Candidate block

Transaction pool

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

15

How blockchain works ? Miners drop of all the stuff and start again… Candidate block

Proof of work

Transaction pool

Transmit the block to the network Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

16

The Bitcoin Challenge A fork in the making 10:20:05 New block found on of red

10:20:06 New block found on of green

Block

Block

Blockchain

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

17

The Bitcoin Challenge The chain has forked 10:20:05 New block found on of red

10:20:06 New block found on of green

Block

Block

Block

Block

Block

Block

Blockchain

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

18

The Bitcoin Challenge Miners are mining on top of Red and Green 10:20:05 New block found on of red

10:20:06 New block on of green

Block

Block

Block

Block

Blockchain

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

19

The Bitcoin Challenge A new block has been mined! 10:20:05 New block found on of red

10:20:06 New block found on of green

Block Block

Block Block

Blockc hain

Block 10:30:15 New block found on of red

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

20

The Bitcoin Challenge Order has been restored ☺ 10:20:05 New block found on of red

10:20:06 New block found on of green Block

Blockc hain

Block

Block

Block

10:30:15Ne w block found on of red

Forking over one/two blocks is extremely rare. Transactions are considered secure after 6 blocks

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

21

Ethereum and smart contract ? Alice now using the crypto currency of Ethereum fuel, Ether

Address: Qwsaasa… aQWEWR32

Private key: KJASDAasded..dfew ewWER

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

22

Ethereum and smart contract ? Interaction with a few line of code in the blockchain and pays for the processing power using “gas” (BTC/Bitcoin ~ ETH/Ethereum) Address: 1GSFDKJ… aQWEWRK2

Address: Qwsaasa… aQWEWR32

Turing complete programming language

Private key: KJASDAasded..dfew ewWER

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

23

Ethereum and smart contract ? Interaction with a few line of code in the blockchain and pays for the processing power using “gas” (BTC/Bitcoin ~ ETH/Ethereum) Address: Qwsaasa… aQWEWR32

gas

Address: 1GSFDKJ… aQWEWRK2

Turing complete programming language

Private key: KJASDAasded..dfew ewWER

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

24

Ethereum VS Bitcoin • It offer more powerful scripting language to define contract. • Limited in term of scripting

• It offers a “bytecode” type language which can be created by compiling contracts in >= 2 languages • Lets you define contract in the equivalent of assembly code, with no higher level languages available

• No direct or fixed limit neither for transaction sizes nor for block sizes. This is a strength of the Ethereum network, it does scale • Blocks are limited to 1MB in size (block larger than 1MB is invalid)

• Turing completeness, no restrictions on which type of code can be published and executed on the blockchain. • Not Turing completeness by purpose.. No dealing with Halting problem (e.g. infinite loop) Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

25

Ethereum VS Bitcoin in terms of security • Compromises on security • Its core protocol does everything to maximize security so it can be used as ‘digital gold’, a decentralized store of value.

• Designed to be adaptable and flexible • Limitations required to maintain consistency with the security confines of the Nakamoto framework

• Radical openness, multiple consensus implementations , Flexibility comes with large attack surface, code can contain unintentional loopholes and other vulnerabilities. • I don’t believe a second, compatible implementation of Bitcoin will ever be a good idea. So much of the design depends on all nodes getting exactly identical results in lockstep that a second implementation would be a menace to the network. - Satoshi Nakamoto Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

26

The Decentralized Autonomous Organization (DAO) hack • The DAO is built on Ethereum, a system designed for building decentralized applications. Its creators hoped to prove you can build a more democratic financial institution, one without centralized control or human fallibility. • The DAO is a piece of software known as a “smart contract”–essentially an agreement that enforces itself via code rather than courts. But like all software, smart contracts do exactly what their makers program them to do—and sometimes those programs have unintended consequences. • A $60 Million Hack Just Showed That the DAO Was All Too Human Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

27

Fork or not to fork ? Two proposal to fix the issue: • Soft fork Structures that were valid under the old rules are no longer valid under the new rules. Structures that were invalid under the old rules continue to be invalid under the new rules (Rejected).

• Hard fork • Structures that were invalid under the old rules become valid under the new rules. • Hard fork changes to the consensus rules without consensus could -- in a worst-case scenario -split the Bitcoin network.

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

28

Fork or not to fork ? ❖ “The foundation has committed to support the community consensus on the admittedly difficult hard fork decision.” -- Vitalik Buterin ❖ Forking result two separate realities :

❖ ETH (Ethereum after forking) ❖ ETC (Ethereum before forking) Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

29

Conclusion ▪ “A ‘world computer’ which will replace all the major online services like facebook, uber, etc... even though that makes basically no sense from the perspective of what the technology could actually do” –Greg Maxwell ▪ Ethereum before forking is not as it’s after forking. ▪ It is far too unstable to be used as a major settlement currency and payment method, and its record of bugs and errors makes its use for legal contracts questionable. ▪ To return the funds they fork Ethereum and they violate the core principles of not just Ethereum but all blockchain : neutrality, openness and immutability. Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

30

What Is next about Ethereum ? Going from “The DAO is based on Unstoppable Code” to “if we screw up badly enough, WE WILL FORK YOU”

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

31

Thank you !

Blockchain Security

Presented by Bryan Ford Mohammad Oday Darwich

32

Recommend Documents