1 of 39

By APAICHON PUNOPAS

2 of 39

Blockchain คืออะไร ?

“Blockchain” คือรูปแบบการส่งข้อมูลโดยไม่ผ่านคนกลาง โดยเก็บมากกว่าหนึ่งที่ มีความปลอดภัยสูง และสามารถตรวจสอบได้มากกว่าหนึ่งคนหรือทุกคนใน Chain มีสิทธิช่วยตรวจสอบ

Blockchain คือการให้ทุกคนถือเอกสารชุดเดียวกัน เมื่อมีการแก้ไข ตามหลักแล้วจะไม่สามารถเปลี่ยนแปลงเอกสารชุดเดิมได้ หากต้องการเปลี่ยนจะต้องเป็นการคัดลอกใหม่ แล้วสำเนาชุดใหม่ให้ทุกคนที่มีสิทธิตรวจสอบ ทำการตรวจสอบและประกาศให้ทุกคนที่เกี่ยวข้องทราบ โดยมั่นใจได้ว่าเอกสารเหล่านั้นเชื่อถือได้แน่นอนไม่มีการปลอมแปลง

3 of 39

Story

จุดเริ่มต้นของ Blockchain มาจากความต้องการแก้ปัญหาการส่งข้อมูลไปเก็บในระบบส่วนกลาง ที่ไม่สามารถให้คนทั่วไปเข้าไปตรวจสอบได้ แล้วระบบการจัดเก็บข้อมูลแบบส่วนกลาง คืออะไร มีข้อดี ข้อเสีย อย่างไรบ้าง ทำไมเราถึงอยากเปลี่ยน หรือไม่เชื่อถือมันละ

4 of 39

Centralized system

ข้อดี

ข้อเสีย

  • มีมาตรฐานเดียว
  • ลดขั้นตอนและข้อมูลซ้ำซ้อน
  • ดูแลที่เดียว
  • โอกาสผิดพลาดต่ำ
  • ตรวจสอบได้จากคนนอกยาก
  • ค่าดูแลสูง
  • ต้องตามกฎเจ้าของระบบ
  • ฝากชีวิตไว้กับเจ้าของระบบ เช่นถ้าเงินฝากหาย ต้องฟ้องร้องเอง

5 of 39

Decentralized System

จากข้อเสียเรื่องความโปร่งใส่และไม่สามารถให้คนทั่วไปตรวจสอบได้ง่ายของระบบ Centralized System ดังนั้น จึงเกิดแนวคิดการจัดเก็บข้อมูลแบบ Decentalized System ขึ้น

การจัดเก็บข้อมูลแบบ Decentralized System กระจายการเก็บข้อมูลไปทุก Nodes

6 of 39

Blockchain เหมาะกับไปใช้ในเรื่องอะไร

Data Governance  ระบบที่ต้องการให้มีการตรวจสอบซึ่งกันและกัน เพื่อสร้างความน่าเชื่อถือ โดยผลโหวตของผู้ตัดสินจะถือเป็นมติเอกฉันท์ และทุกคนจะถือข้อมูลชุดเดียวกัน

ตัวอย่างงานที่ใช้ใน Blockchain

  • Finance
  • Insurance
  • Hospital
  • Supply Chain
  • Vote
  • etc�https://hackernoon.com/popular-use-cases-of-blockchain-technology-you-need-to-know-df4e1905d373

7 of 39

Bitcoin

สกุลเงินดิจิตอลรูปแบบ ใหม่ที่นำหลักการของ Blockchain มาพัฒนา และได้รับความน่าเชื่อถือ ในเรื่องความปลอดภัย

8 of 39

กระบวนการทำงานของ Bitcoin

Genesis Block

  1. เมื่อมีการซื้อขาย Bitcoin ครั้งแรกจากผู้ขายโดยตรง สัญญาซื้อขายจะเก็บไว้ให้ผู้ซื้อและขายคนละหนึ่งชุด สัญญาครั้งแรกเรียกว่า Genesis Block หรือ กล่องต้นกำเนิด
  1. Genesis Block ประกอบด้วย
  2. Digital Signature
  3. Address
  4. Transaction

$1,000,000

B100

9 of 39

ส่วนประกอบของ Block

20170909000001

Address - เก็บเลขที่อยู่แต่ละ Block ไม่ซ้ำกัน เป็นเลขที่เปิดเผยได้

#1|David |Buy Coin|$100

Transaction - ข้อมูลรายการความเคลื่อนไหว

Digital Signature - ลายเซ็นอิเล็กทรอนิกส์ ที่ไม่ซ้ำกัน แม้เป็นลายเซ็นต์คนเดียวกัน แต่การเซ็นแต่ละครั้งก็ไม่เหมือนกัน 100%

10 of 39

กระบวนการทำงานของ Bitcoin (ต่อ)

David

Marry

B200

Transfer

  • David ทำการโอน Bit coin ให้กับ Marry จำนวน B200

แล้วจะเชื่อถือได้อย่างไรว่า ข้อมูลถูกต้อง ในเมื่อ David มีจำนวน Bitcoin อยู่เพียง B100 ?

11 of 39

กระบวนการทำงานของ Bitcoin (ต่อ) Consensus หรือ Miner

David

Marry

B200

Transfer

Bob

I’m a miner.

?

?

?

  • ในเครือข่ายจะต้องมีผู้ถูกแต่งตั้งให้เป็นผู้ตรวจ สอบอย่างน้อย หนึ่งคน เรียกว่า Miner ในระบบอย่าง Bitcoin มีคนตั้งตัวเป็นผู้ตรวจสอบมากมาย เพราะได้ค่าธรรมเนียมในการตรวจสอบ เรียกว่า transaction fee หรือ Reward

12 of 39

กระบวนการตรวจสอบของ Miner

David

Marry

B200

Transfer

Bob

I’m a miner.

?

?

?

  • เมื่อมีความเคลื่อนไหวการเปลี่ยนแปลงของ transaction เกิดขึ้น สถานะของ transaction จะอยู่ในสถานะที่เรียกว่า Unconfirmed ทุก nodes จะรู้ว่ากำลังมีการเปลี่ยนแปลง transaction ส่วนผู้เป็น Miner อย่าง Bob จะทำการตรวจสอบ Transaction ที่กำลังเปลี่ยน กับข้อมูลใน Ledger ของตัวเอง ซึ่ง Bob จะต้องทำการปฎิเสธ การเปลี่ยนเแปลงนี้ เพราะ David มี Bitcoin อยู่แค่ B100 แต่ทำการโอนไป B200
  • Ledger คือ บัญชีที่เก็บข้อมูลรายการ transaction ใน Block นั้น

X

13 of 39

กระบวนการตรวจสอบของ Miner

David

Marry

B100

Transfer

Bob

I’m a miner.

?

?

?

  1. David ทำการโอนยอดไป B100 ในเวลาเดียวกัน เรียกว่า Double Spending

Bob ทำการรวบ transaction ทั้งจาก Marry และ John มาตรวจสอบใน

Ledger ของตัวเอง พบว่ายอดรวมเกิน Bitcoin ที่ David มี จึงทำการปฎิเสธ

X

John

B100

?

X

14 of 39

กระบวนการตรวจสอบของ Miner

David

Marry

B50

Transfer

Bob

I’m a miner.

?

?

?

  • ใน ฺBitcoin จะมี Miner มากมายมาช่วยตรวจสอบ เรียกว่า แย่งกันดีกว่า เพราะได้รางวัล Reward
  • ใน Blockchain จะมีกระบวนการที่เรียกว่า Proof of Work เพื่อให้ Miner แข่งขันกันหาคำตอบที่ไม่สามารถแก้โจทย์ได้ด้วยสมการคณิตศาสตร์ เช่น ทำการ random hash ค่า ซึ่งการจะหาคำตอบได้ต้องใช้พลังและเวลาในการประมวลผลสูง

John

I’m a miner.

15 of 39

กระบวนการตรวจสอบของ Miner

  • เมื่อ Miner ทำการรวบ transaction ทั้งหมด มาตรวจสอบ และหาคำตอบได้แล้ว จะทำการสร้างกล่องใหม่ขึ้นมา และปืด Block ยืนยันสถานะไปให้ทุกคนทีอยู่ใน Chain รับรู้

16 of 39

กระบวนการตรวจสอบของ Miner

David

Marry

Bob

I’m a miner.

John

I’m a miner.

I’m found.

  • ยืนยันสถานะไปให้ทุกคนทีอยู่ใน Chain รับรู้

17 of 39

กระบวนการตรวจสอบของ Miner

David

Marry

Bob

John

  • เมื่อยืนยันสถานะเสร็จ ทุกคนจะได้รับสำเนา Block ผูก Chain ต่อๆกันไป ในกล่องใหม่จะอ้างถึงกล่องก่อนหน้าเสมอ เรียกว่า Previous Block

OK

OK

OK

OK

18 of 39

Blockchain ปลอดภัยแค่ไหน ?

เมื่อมีคนพยามขโมย Block หรือแก้ไขข้อมูล

ความสัมพันธ์ระหว่างกล่องจะเปลี่ยนไป ทำให้อยู่ในสถานะ ใช้งานไม่ได้ Hacker จะต้องงมหาคำตอบใหม่ ซึ่งหากมีการเปลี่ยนแปลง transaction เกิดขึ้นใน chain ก็จะเกิดกระบวนตรวจสอบใหม่จาก Miner วนอยู่อย่างนี้ ทำให้โอกาศที่จะแก้ไขข้อมูลโดยที่ไม่มีใครรู้เป็นเรื่องที่ทำได้ยาก

19 of 39

Blockchain เปรียบเสมือนเหมือนอะไรในชีวิตจริง ?

Blockchain เปรียนเสมือนตู้นิรภัยที่ติดสัญญาณกันขโมย

20 of 39

Blockchain ในเชิงเทคนิค

Users / Nodes

Blockchain

Applications (smart contracts)

State machine

Consensus

Blocks

Transactions

Peer to Peer Network

Internet

SMTP

HTTP

FTP

Web Socket

21 of 39

Generic elements of a blockchain.

  • Nodes
  • Smart Contracts
  • State machine
  • Consensus
  • Blocks
  • Transactions
  • Peer to Peer network

22 of 39

Users / Nodes

A node in a blockchain network performs various functions depending on the role it takes.

  • Propose
  • Validate transactions
  • Perform mining to facilitate consensus
  • Secure the blockchain

23 of 39

Smart Contracts

These programs run on top of the blockchain and encapsulate the business logic to be executed when certain conditions are met.

24 of 39

State machine

A blockchain can be viewed as a state transition mechanism whereby a state is modified from its initial form to the next and eventually to a final form as a result of a transaction execution and validation process by nodes.

25 of 39

Consensus

Consensus is basically a distributed computing concept that has been used in blockchain in order to provide a means of agreeing to a single version of truth by all peers on the blockchain network.

26 of 39

Blocks

A block is composed of multiple transactions and some other elements such as the previous block hash (hash pointer), timestamp, and nonce

27 of 39

Transactions

A transaction represents a transfer of value from one address to another.

28 of 39

Feature of blockchain

  • Distributed consensus
  • Transaction verification
  • Platforms for smart contracts
  • Transferring value between peers
  • Generating cryptocurrency
  • Smart property
  • Provider of security
  • Immutability
  • Uniqueness
  • Smart contracts

29 of 39

Types of blockchain

  • Public
  • Private
  • Semi-private
  • Sidechains
  • Permission ledger
  • Distributed ledger
  • Shared ledger
  • Fully private and proprietary
  • Tokenized
  • Tokenless

30 of 39

Types of Consensus

  • Proof of Work
  • Proof of Stake
  • Delegate Proof of Stake
  • Proof of Elapsed Time
  • Deposit-based
  • Proof of importance
  • Federated of Byzantine
  • Reputation-base machanisms
  • Practical Byzantine Fault Tolerance

31 of 39

CAP Theorem

  • Consistency
  • Availability
  • Partition Tolerance

32 of 39

Benefit of Blockchain

  • Decentralization
  • Transparency and trust
  • Immutability
  • High availability
  • Highly secure
  • Simplification of current paradigms
  • Faster dealings

33 of 39

Cryptography and Technical Foundations

  • Confidentiality
  • Integrity
  • Authentication
  • Non-repudiation

34 of 39

Smart Contracts

Summary, a smart contract has the following four properties:

  • Automatically executable
  • Enforceable
  • Semantically sound Secure
  • Unstoppable

35 of 39

Challenges and limitations of blockchain technology

  • Scalability
  • Adaptability
  • Regulation Relatively immature technology
  • Privacy

36 of 39

Blockchain-Outside of Currencies

  • Internet of Things
  • Government
  • Health
  • Finance
  • Media

37 of 39

Blockchain platform

  • Ethereum
  • Hyperledger
  • Kadena
  • Ripple
  • Stellar
  • Rootstock
  • Quorum
  • Tezos
  • Storj
  • Maidsafe
  • BigChainDB
  • Multichain
  • Tendermint

38 of 39

Many Resources to learn

39 of 39

Thank you