Blockchain จะต้องอ่านอีกกี่เวบถึงจะเข้าใจเนี่ย
March 2, 2019
คิดง่ายๆก่อนนะ blockchain มันก็คือ database นั่นเอง แล้วลองมองว่า one record of data or one transaction is a block นะ database ที่ว่านี้ เก็บข้อมูลของ multiple records of data หรือ transactions ที่มันเชื่อมต่อกัน เลยเป็น chain
ลักษณะของ Database ของ blockchain นี่มันเป็นยังไงกัน
สำหรับ blockchain นะ มันต้อง Distributed Database บางทีเราก็จะได้ยินเขาเรียกว่า
Blockchain Database, Distributed Ledger, Shared Ledger, หรือว่า Distributed Ledger Database
ที่มัน distributed นะเพราะหนึ่งในหัวใจของ blockchain คือ มันต้อง decentralized แปลว่ามันไม่ centralized. เพราะงั้นนะ มันจะไม่มี central administrator computer หรือ node ที่จะเก็บ database/ledger ไว้คนเดียว แต่มันจะเป็นแบบ peer-to-peer network คือ เจ้าคอมหรือโหนดแต่ละตัวมีบทบาทเท่าๆกัน คอมทุกตัว จะมี copy ของ database/ledger
เวลามี new transaction initiates; user of computerA จ่ายเงินให้ user of computerB เจ้า computerB หรือ node ที่อยู่ใกล้ๆก็จะรู้และจะ update database/ledger และกระซิบบอกเพื่อนคอมตัวอื่นที่อยู่ใกล้ๆว่ามีคนจ่ายเงินอีกแล้ว มาช่วยกัน confirm transaction หน่อยเร้ว เพื่อนคอมตัวอื่นก็จะต้อง update database/ledger ของตัวเองและ ช่วย confirm transaction บอกต่อกันไปเรื่อยๆใน network เดียวกัน สำหรับ network ใหญ่ๆนะ บางทีเขาจะตั้ง leader computers/nodes ในการ confirm transaction เพื่อให้มันเร็วขึ้น
เอ แล้วข้อมูลที่เก็บใน database หรือ ledger เนี่ยมันเป็นไงเหรอ
มันก็ต้องผ่านกระบวนการ complex cryptography ก่อน อย่างเช่น ไม่มีใครรู้ identity ของกันและกันใน database จะรู้ก็แต่ public address ของ identity นั้นๆ
"Well… a person’s identity is hidden via complex cryptography and represented only by their public address. So, if you were to look up a person’s transaction history, you will not see “Bob sent 1 BTC” instead you will see “1MF1bhsFLkBzzz9vpFYEmvwT2TbyCt7NZJ sent 1 BTC”.
รูปข้างล่างนี้เป็นตัวอย่างของ Ethereum Cryptocurrency Transactions เห็นไม๊ เราจะไม่รู้ว่า From or To เนี่ยเป็นใคร
แล้วที่บอกว่า Blockchain is IMMUTABLE ล่ะ แปลว่ายังไง
ก็แปลว่า Completed Transaction แต่ละ block อะ มันเปลี่ยนแปลงไม่ได้ ที่เปลี่ยนไม่ได้แล้วก็เพราะไม่มีใครจะ hack มันได้ เพราะ Blockchain ใช้ระบบ cryptographic hash function
ตัวอย่างเช่น Bitcoin ใช้ระบบ SHA-256 (Secure Hashing Algorithm 256)
SHA-256 จะแปลงภาษาที่เราเข้าใจกันเป็น 256-bit length
ความหมายของมันก็คือ ไม่ว่า input จะเข้ามามากหรือน้อย output จะเป็น fixed 256-bit length เสมอ
ต่อมาดูนี่นะ แค่เปลี่ยน T เป็น t ผลที่ได้ก็ต่างกันลิบลับ
Blockchain นี่ แต่ละ block เขาจะมี hash pointer เป็นตัวเชื่อม blocks เข้าด้วยกัน เจ้า hash pointer นอกจากจะเก็บ address ของ block ที่มาก่อนแล้ว ก็ยังเก็บข้อมูลของ block ที่มาก่อนด้วย
ทีนี้ลองจินตนาการดูนะ ถ้ามี hacker เข้ามาแก้ไขข้อมูลใน transaction ที่อยู่ใน block 1 คราวนี้ ข้อมูลใน block 2 เก็บจาก block 1 ก็ต้องเปลี่ยนไปด้วย แล้วข้องมูลของ block 3 ที่เก็บจาก block 2 ก็เปลี่ยนไปด้วย เป็นไปทั้ง chain ซึ่งเขาบอกว่าเป็นไปไม่ได้ เพราะฉะนั้น blockchain is immutable
ตกลงเขียนมาถึงตรงนี้ เราเองเข้าใจมากขึ้นหรือเปล่านะ
งงอยู่ตั้งนาน หาอ่านอยู่หลายเวบ ที่แท้ มันเป็นอย่างนี้เอง
ที่เราอยากรู้ต่อไปคือ Hyperledger Fabric blockchain framework platform ที่ developer เขาเอามาใช้สร้าง blockchain network กัน
Credit:
https://blockgeeks.com/guides/what-is-blockchain-technology/
https://hackernoon.com/the-blockchain-its-not-what-you-think-it-is-2601f243babd
https://www.ibm.com/blockchain/what-is-blockchain
https://en.wikipedia.org/wiki/Distributed_ledger
https://www.hyperledger.org/projects/fabric