
A Deep Dive into Mysticeti: The New Consensus Powering Sui
Written by Fieldlnwza007, infographics by EarthMysticetiIn July, Sui announced a shift from using Narwhal and Bullshark as their consensus protocol to Mysticeti[1]. In this article, I will do my best to simplify the Mysticeti paper and explain how Mysticeti works and why it was chosen from my perspective, while preserving the core ideas.Narwhal and Bullshark RecapTo understand the need for Mysticeti, let’s first review Narwhal and Bullshark. If you’re familiar with these protocols, feel free ...
Celestia: A Summary of How Fraud Proofs and Data Availability Proofs Work
1 OverviewData availability (DA) is crucial to the functionality and security of blockchains. In traditional monolithic blockchain structures, full nodes retrieve blocks from peers to verify the integrity of the entire history of their chain based on predefined rules. This process relies on the assumption that data on the blockchain remains consistently "available" for access by all nodes in the network. This principle holds not just for layer-1 blockchains but also for layer-2 blockchains, w...

Introduction to Walrus: A Note on How the Red Stuff Protocol Works
1. IntroductionSo far, we’ve discussed two decentralized storage networks: Celestia [1] and Espresso [2]. Unlike traditional decentralized storage systems that rely on full replication, where every node stores a complete copy of the original data, Celestia and Espresso use erasure coding. This method splits data into encoded fragments, allowing reconstruction from only a subset of these fragments. By requiring nodes to store only a small fraction of the encoded data (much smaller than the ful...

ในวันที่ 8 มิถุนายน 2022 ทาง Contribution DAO ได้มีการจัด Workshop เพื่อให้ทุกคนสามารถพัฒนา dApps บน StarkNet ได้ โดยผู้สอนจะเป็น พี่อ๋อ (@RATi_MOn) ซึ่งเป็นผู้มีประสบการณ์ด้านการพัฒนา smart contract มาหลายปี
บทความนี้จะสรุปเนื้อหาที่พี่อ๋อได้พูดถึงไว้ในวีดีโอ workshop ครับ หากผู้อ่านต้องการรับชมวีดีโอเต็ม สามารถดูย้อนหลังได้ที่นี่
StarkNet นั้นอะไรที่ค่อนข้างใหม่จึงทำให้มีการเปลี่ยนแปลงตลอดเวลา Syntax หรือ rules ต่างๆของ StarNet ก็ยังไม่คงที่ จึงจะมีการเปลี่ยนแปลงได้ตลอดเวลา ซึ่งใน Workshop ครั้งนี้จะมาแนะนำ Tools และ Flameworks ต่างๆที่มีประโยชน์ของ StarkNet และจะมีการสอน Compile, Deploy และการ Running test ลงบน StarkNet
ทางที่ดีที่สุดในการเรียนภาษา Cairo คือการที่ศึกษาโค้ดจากผู้ที่เชี่ยวชาญหรือการอ่าน test suites ในอนาคตนั้นจะไม่มี Programmer คนไหนเขียน Smart Contact Code ของตัวเองแต่พวกเค้าจะใช้ Industry-Standard libraries ที่เขียนโดยผู้เชี่ยวชาญแทน แต่เนื่องจากภาษา Cairo เป็นภาษาที่ใหม่มากทำให้ Developer แต่ละคนนั้นมีสไตล์การเขียน code, frameworks หรือ tools ที่แตกต่างกัน
ซึ่งรูปด้านล่างนี้ก็จะเป็น tools ต่างๆที่สามารถใช้ได้ใน StarkNet ณ ตอนนี้

ยกตัวอย่าง tools ที่น่าสนใจสำหรับการ Develop ภาษา Cairo ที่ชื่อว่า Warp ที่สร้างโดย Nethermind โดย tool นี้จะสามารถ Compile จากภาษา Solidity มาเป็น ภาษา Cairo ได้ แต่ก็จะมีข้อจำกัด ตรงที่จะทำได้เฉพาะการเขียน Smart Contact เพียงเท่านั้น นอกจากนี้ การที่เรา Compile จาก Solidity มาเป็นภาษา Cairo เราจะไม่มีทางรู้เลยว่า Compiler จะมี Bug ตรงไหนบ้าง
Frameworks ในการ Develop ภาษา Cairo จะมีหลักอยู่ 3 อย่างดังรูป:

แต่สำหรับวันนี้ เราจะมาโฟกัสกันที่ Starknet-hardhat-plugin
เนื่องจากเป้าหมายของ workshop นี้คือการ setup Cairo environment ให้ได้ไวที่สุด และเนื่องจาก EVM กับ Hardhat นั้นมีการใช้ในการ Develop ค่อนข้างมากสำหรับ Blockchain developer ใน community ของประเทศไทย และอีกเหตุผลนึงนั้นก็คือ Hardhat นั้นจะใช้ภาษา JavaScript ในการเขียน test หรือ TypeScript ซึ่งภาษา JavaScript นั้นเป็น High Level Language ที่ค่อนข้างง่าย
สิ่งที่แตกต่างกันกับ Nile และ Protostar คือทั้งสองอย่างนี้จะใช้ Python ในการเขียน Test

หลังจากการที่เราเขียน Cairo code เสร็จเรียบร้อยเราจะนำไปเข้า Compiler และจะได้ออกมาสองอย่างคือ
Bytecode (starknet OS instructions)
ABI definition
StarkNet OS (หรือ Bytecode) นั้นคือ StarkNet transaction Execution environment กล่าวคือ transaction ที่ถูก executed ทุกๆครั้ง จะมีการ Modify Storage และจะต้องเสียค่าธรรมเนียม (ที่เรียกว่า gas) ซึ่ง concept ของ gas นั้นก็จะเหมือนกับทาง EVM (Ethereum Virtual Machine) สิ่งที่แตกต่างกันกับ EVM นั้นคือ เวลาเรา store core data ไม่ว่าจะเป็นบวกหรือลบเราจะเสียค่า gas แต่ภาษา Cairo ในส่วนของการ store core data จะถูกคำนวณ Off-chain ทำให้ไม่ต้องเสียค่า gas
Application Binary Interface (ABI) คือการอธิบาย Contract’s interface ของ Public method, Input arguments, return values และ contract events

หลังจากการ Compile จะได้ออกมาเป็น Bytecode และ ABI จากนั้นจะ deploy ในส่วนของ Bytecode ไป แต่การที่จะเข้าถึง Smart contact นั้นจะต้อง invoke ผ่าน ABI definition
ก่อนอื่นมาทำความรู้จักกับทาง Hardhat กันก่อน
Hardhat คือ Ethereum development environment สำหรับ Professionals ถูกออกแบบมาเพื่อให้ run ภาษา Solidity มีจุดเด่นที่ทำให้ Hashhat เกิดขึ้นมาและแย่งส่วนแบ่งจากตลาดได้เนื่องจากมี feature ที่มีจุดเด่นมากอย่าง Plugins ซึ่งตัว Plugins นี้จะทำให้ Developer หรือ community อื่นๆ สามารถทำ Plugins ของตัวเองและสามารถเพิ่ม features ของ Hardhat เพิ่มขึ้นไป ซึ่งทาง Shard labs จะทำให้เรา dev ภาษา Cairo ได้โดยใช้ framework ตัวเดิมนั้นก็คือ Hardhat
ให้ไปที่ Ratimon Repo: Cairo Smart Contact ก่อน
ให้ทำการ Clone Cairo Smart Contact template จาก Github ( สำหรับ Plugin ที่ใช้ จะใช้ Vscode และสำหรับ Plugin ที่ใช้ highlight จะใช้ของ Starkware Industry ที่ชื่อว่า Cairo)
ทำการติดตั้ง yarn install (จะเกิด error ที่ hardhat-deploy-ethers)
ให้ทำการรัน yarn add -D @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers
จะมี 3 อย่างหลักๆที่ต้องทำนั่นคือ
Compile
รัน yarn starknet-compile
Deploy
รัน yarn hardhat run scripts/ ( จะสังเกตุว่าเราไม่ต้องจ่ายค่า Gas เนื่องจากว่ายังเป็นเวอร์ชั่น 0.8 แต่จะเสียค่า Gas ในเวอร์ชั่น 0.9)
Running test
รัน yarn starknet-test
discord: https://discord.gg/FcBNpz7g6U
twitter: https://twitter.com/StarkWareLtd
website: https://starkware.co/
Facebook: https://www.facebook.com/contributiondao
Discord: https://discord.gg/contributiondao
Twitter : https://twitter.com/contributedao
สวัสดีครับทุกคน เรียกผมว่าอิงแลนด์ก็ได้นะครับ ผมค่อนข้างเป็น Crypto Enthusiast เลยก็ว่าได้ครับและตื่นเต้นกับโลกการเงินในอนาคตมากๆ โดยการเขียนพวกนี้เหมือนเป็นการที่ผมได้ทบทวนความรู้ต่างๆ จึงอยากจะมาแชร์ให้กับทุกคนด้วยเหมือนกันครับ
เป็น proofreader และคนคอยอ่านและเรียบเรียงบทความอีกรอบ ทำงานด้าน AI เป็นงานประจำและศึกษา crypto เป็นอาชีพเสริม มีความสนใจทั้งในด้าน AI และ blockchain และยังหลงไหลในแนวเพลง math rock เป็นพิเศษ งานอดิเรกคือการเล่นกีต้าร์ วิ่ง ฟังเพลง และ ทำงาน ทำงาน ทำงาน

ในวันที่ 8 มิถุนายน 2022 ทาง Contribution DAO ได้มีการจัด Workshop เพื่อให้ทุกคนสามารถพัฒนา dApps บน StarkNet ได้ โดยผู้สอนจะเป็น พี่อ๋อ (@RATi_MOn) ซึ่งเป็นผู้มีประสบการณ์ด้านการพัฒนา smart contract มาหลายปี
บทความนี้จะสรุปเนื้อหาที่พี่อ๋อได้พูดถึงไว้ในวีดีโอ workshop ครับ หากผู้อ่านต้องการรับชมวีดีโอเต็ม สามารถดูย้อนหลังได้ที่นี่
StarkNet นั้นอะไรที่ค่อนข้างใหม่จึงทำให้มีการเปลี่ยนแปลงตลอดเวลา Syntax หรือ rules ต่างๆของ StarNet ก็ยังไม่คงที่ จึงจะมีการเปลี่ยนแปลงได้ตลอดเวลา ซึ่งใน Workshop ครั้งนี้จะมาแนะนำ Tools และ Flameworks ต่างๆที่มีประโยชน์ของ StarkNet และจะมีการสอน Compile, Deploy และการ Running test ลงบน StarkNet
ทางที่ดีที่สุดในการเรียนภาษา Cairo คือการที่ศึกษาโค้ดจากผู้ที่เชี่ยวชาญหรือการอ่าน test suites ในอนาคตนั้นจะไม่มี Programmer คนไหนเขียน Smart Contact Code ของตัวเองแต่พวกเค้าจะใช้ Industry-Standard libraries ที่เขียนโดยผู้เชี่ยวชาญแทน แต่เนื่องจากภาษา Cairo เป็นภาษาที่ใหม่มากทำให้ Developer แต่ละคนนั้นมีสไตล์การเขียน code, frameworks หรือ tools ที่แตกต่างกัน
ซึ่งรูปด้านล่างนี้ก็จะเป็น tools ต่างๆที่สามารถใช้ได้ใน StarkNet ณ ตอนนี้

ยกตัวอย่าง tools ที่น่าสนใจสำหรับการ Develop ภาษา Cairo ที่ชื่อว่า Warp ที่สร้างโดย Nethermind โดย tool นี้จะสามารถ Compile จากภาษา Solidity มาเป็น ภาษา Cairo ได้ แต่ก็จะมีข้อจำกัด ตรงที่จะทำได้เฉพาะการเขียน Smart Contact เพียงเท่านั้น นอกจากนี้ การที่เรา Compile จาก Solidity มาเป็นภาษา Cairo เราจะไม่มีทางรู้เลยว่า Compiler จะมี Bug ตรงไหนบ้าง
Frameworks ในการ Develop ภาษา Cairo จะมีหลักอยู่ 3 อย่างดังรูป:

แต่สำหรับวันนี้ เราจะมาโฟกัสกันที่ Starknet-hardhat-plugin
เนื่องจากเป้าหมายของ workshop นี้คือการ setup Cairo environment ให้ได้ไวที่สุด และเนื่องจาก EVM กับ Hardhat นั้นมีการใช้ในการ Develop ค่อนข้างมากสำหรับ Blockchain developer ใน community ของประเทศไทย และอีกเหตุผลนึงนั้นก็คือ Hardhat นั้นจะใช้ภาษา JavaScript ในการเขียน test หรือ TypeScript ซึ่งภาษา JavaScript นั้นเป็น High Level Language ที่ค่อนข้างง่าย
สิ่งที่แตกต่างกันกับ Nile และ Protostar คือทั้งสองอย่างนี้จะใช้ Python ในการเขียน Test

หลังจากการที่เราเขียน Cairo code เสร็จเรียบร้อยเราจะนำไปเข้า Compiler และจะได้ออกมาสองอย่างคือ
Bytecode (starknet OS instructions)
ABI definition
StarkNet OS (หรือ Bytecode) นั้นคือ StarkNet transaction Execution environment กล่าวคือ transaction ที่ถูก executed ทุกๆครั้ง จะมีการ Modify Storage และจะต้องเสียค่าธรรมเนียม (ที่เรียกว่า gas) ซึ่ง concept ของ gas นั้นก็จะเหมือนกับทาง EVM (Ethereum Virtual Machine) สิ่งที่แตกต่างกันกับ EVM นั้นคือ เวลาเรา store core data ไม่ว่าจะเป็นบวกหรือลบเราจะเสียค่า gas แต่ภาษา Cairo ในส่วนของการ store core data จะถูกคำนวณ Off-chain ทำให้ไม่ต้องเสียค่า gas
Application Binary Interface (ABI) คือการอธิบาย Contract’s interface ของ Public method, Input arguments, return values และ contract events

หลังจากการ Compile จะได้ออกมาเป็น Bytecode และ ABI จากนั้นจะ deploy ในส่วนของ Bytecode ไป แต่การที่จะเข้าถึง Smart contact นั้นจะต้อง invoke ผ่าน ABI definition
ก่อนอื่นมาทำความรู้จักกับทาง Hardhat กันก่อน
Hardhat คือ Ethereum development environment สำหรับ Professionals ถูกออกแบบมาเพื่อให้ run ภาษา Solidity มีจุดเด่นที่ทำให้ Hashhat เกิดขึ้นมาและแย่งส่วนแบ่งจากตลาดได้เนื่องจากมี feature ที่มีจุดเด่นมากอย่าง Plugins ซึ่งตัว Plugins นี้จะทำให้ Developer หรือ community อื่นๆ สามารถทำ Plugins ของตัวเองและสามารถเพิ่ม features ของ Hardhat เพิ่มขึ้นไป ซึ่งทาง Shard labs จะทำให้เรา dev ภาษา Cairo ได้โดยใช้ framework ตัวเดิมนั้นก็คือ Hardhat
ให้ไปที่ Ratimon Repo: Cairo Smart Contact ก่อน
ให้ทำการ Clone Cairo Smart Contact template จาก Github ( สำหรับ Plugin ที่ใช้ จะใช้ Vscode และสำหรับ Plugin ที่ใช้ highlight จะใช้ของ Starkware Industry ที่ชื่อว่า Cairo)
ทำการติดตั้ง yarn install (จะเกิด error ที่ hardhat-deploy-ethers)
ให้ทำการรัน yarn add -D @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers
จะมี 3 อย่างหลักๆที่ต้องทำนั่นคือ
Compile
รัน yarn starknet-compile
Deploy
รัน yarn hardhat run scripts/ ( จะสังเกตุว่าเราไม่ต้องจ่ายค่า Gas เนื่องจากว่ายังเป็นเวอร์ชั่น 0.8 แต่จะเสียค่า Gas ในเวอร์ชั่น 0.9)
Running test
รัน yarn starknet-test
discord: https://discord.gg/FcBNpz7g6U
twitter: https://twitter.com/StarkWareLtd
website: https://starkware.co/
Facebook: https://www.facebook.com/contributiondao
Discord: https://discord.gg/contributiondao
Twitter : https://twitter.com/contributedao
สวัสดีครับทุกคน เรียกผมว่าอิงแลนด์ก็ได้นะครับ ผมค่อนข้างเป็น Crypto Enthusiast เลยก็ว่าได้ครับและตื่นเต้นกับโลกการเงินในอนาคตมากๆ โดยการเขียนพวกนี้เหมือนเป็นการที่ผมได้ทบทวนความรู้ต่างๆ จึงอยากจะมาแชร์ให้กับทุกคนด้วยเหมือนกันครับ
เป็น proofreader และคนคอยอ่านและเรียบเรียงบทความอีกรอบ ทำงานด้าน AI เป็นงานประจำและศึกษา crypto เป็นอาชีพเสริม มีความสนใจทั้งในด้าน AI และ blockchain และยังหลงไหลในแนวเพลง math rock เป็นพิเศษ งานอดิเรกคือการเล่นกีต้าร์ วิ่ง ฟังเพลง และ ทำงาน ทำงาน ทำงาน

A Deep Dive into Mysticeti: The New Consensus Powering Sui
Written by Fieldlnwza007, infographics by EarthMysticetiIn July, Sui announced a shift from using Narwhal and Bullshark as their consensus protocol to Mysticeti[1]. In this article, I will do my best to simplify the Mysticeti paper and explain how Mysticeti works and why it was chosen from my perspective, while preserving the core ideas.Narwhal and Bullshark RecapTo understand the need for Mysticeti, let’s first review Narwhal and Bullshark. If you’re familiar with these protocols, feel free ...
Celestia: A Summary of How Fraud Proofs and Data Availability Proofs Work
1 OverviewData availability (DA) is crucial to the functionality and security of blockchains. In traditional monolithic blockchain structures, full nodes retrieve blocks from peers to verify the integrity of the entire history of their chain based on predefined rules. This process relies on the assumption that data on the blockchain remains consistently "available" for access by all nodes in the network. This principle holds not just for layer-1 blockchains but also for layer-2 blockchains, w...

Introduction to Walrus: A Note on How the Red Stuff Protocol Works
1. IntroductionSo far, we’ve discussed two decentralized storage networks: Celestia [1] and Espresso [2]. Unlike traditional decentralized storage systems that rely on full replication, where every node stores a complete copy of the original data, Celestia and Espresso use erasure coding. This method splits data into encoded fragments, allowing reconstruction from only a subset of these fragments. By requiring nodes to store only a small fraction of the encoded data (much smaller than the ful...
Share Dialog
Share Dialog

Subscribe to ContributionDAO

Subscribe to ContributionDAO
>100 subscribers
>100 subscribers
No activity yet