站在巨人的肩膀上:分层设计在 Nervos 生态系统中的 layer 2 区块链上的实际应用
如果无法正常显示,请先停止浏览器的去广告插件。
1.
2. Layer 2 on Nervos CKB
肖雪洁 @ 秘猿科技
3. Or
站在巨人的肩膀上:分层设计在 Nervos 生态系统中的 layer 2 区块
链上的实际应用
4. About me
• 肖雪洁
• https://xuejie.space/
• CTO @ 秘猿科技
5. 秘猿科技
6. Nervos
7. Blockchains are gaining popularity
8. Scaling Problem in Blockchains
Source: https://howmuch.net/articles/crypto-transaction-speeds-compared
9. Sharding: a popular choice
Source: https://vitalik.ca/general/2021/04/07/sharding.html
10. Sounds familiar?
Source: https://www.logicbig.com/tutorials/core-java-tutorial/java-multi-threading/java-intrinsic-locks.html
11. Sounds familiar?
Source: https://kgrvamsi.wordpress.com/2013/05/28/riak-in-depth/
12. Is sharding the best solution?
13. TCP/IP
Source: https://fiberbit.com.tw/tcpip-model-vs-osi-model/
14. NewSQL
Source: https://medium.com/rabiprasadpadhy/google-spanner-a-newsql-journey-or-beginning-of-the-end-of-the-nosql-era-
3785be8e5c38
15. Layers in NewSQL
Source: https://www.cockroachlabs.com/docs/v21.1/architecture/overview#layers
16. Layers in NewSQL
Source: https://docs.pingcap.com/tidb/stable/tidb-architecture
17. Linux
Source: http://www.versolibre.org/versus/lookatlinux
18. We didn’t choose layered design to be
different. Layers long exist in the
software industry.
19. Layered blockchain design
dapp
Layer 2
dapp
Layer 1
20. CKB: layer 1 blockchain built for layer 2
• Proof of Work
• Custom designed P2P propagation network
• CKB VM
• Cell(generalized UTXO) based model
21. P2P component is also a layered design
Source: https://talk.nervos.org/t/p2p/1742
22. CKB VM
• RISC-V ISA
• A thin, secure layer on top of native hardware
• Performant implementation to support crypto algorithms
• Vector programming is on the way
23. Custom cryptographic primitives
24. UTXOs
Source: https://academy.horizen.io/technology/expert/utxo-vs-account-model/
25. Accounts
Source: https://academy.horizen.io/technology/expert/utxo-vs-account-model/
26. UTXOs vs accounts
Source: https://academy.horizen.io/technology/expert/utxo-vs-account-model/
27. UTXOs are naturally paralleled
Source: https://en.wikipedia.org/wiki/Thread_pool
28. Programming on UTXOs is
HARD!
29. Layer 2 for the rescue
30. Introducing Godwoken
A generic rollup framework on CKB
31. Godwoken
32. Optimistic Rollup
33. Optimistic Rollup (reverts)
34. polyjuice
• An Ethereum compatible layer runs on Godwoken
• Compiles evmone, an EVM implementation directly into CKB VM
runnable code
• Maximum compatibility can be achieved:
• Official EVM implementation is used, no unsupported EVM opcodes
• The exact signing scheme from EVM is supported, Metamask can be used
with no changes
• Other VMs are also possible, such as Move from libra
35. Things we don’t need in layer 2
• No hassles dealing with UTXOs
• No forks
• No P2P network for block propagation
• No disputes
• Layer 1 VM works as the final judge
• Minimal consensus needed
36. And there’s more on CKB
• Axon: CKB’s sidechain/parachain design
• CKB’s channel network for user defined tokens
• State channels for games
37. Aim at higher performance with layer 2
• CKB: ~100 TPS
• Godwoken: ~600 TPS
• Godwoken with BLS: ~2000 TPS
• Axon: >100000 TPS
38. Latency is also a metric
• CKB: 15 seconds * 4 blocks
• Godwoken: 90 seconds
• Channel network: 0 seconds
39. The Blockchain Trilemma
Source: https://www.quora.com/What-is-the-blockchain-scalability-trilemma
40. The Blockchain Trilemma, layered edition
✔ Layer 2
✔ Layer 1
Source: https://www.quora.com/What-is-the-blockchain-scalability-trilemma
41. Looking into the future
• Software are more and more complex, blockchains are no
exceptions
• The only viable solution for the future, is to encapsulate
complexities via abstractions/layers
• We firmly believe more blockchains will take the pill of layers in
the future
42. Computer Science is a science of abstraction -creating the
right model for a problem and devising the appropriate
mechanizable techniques to solve it.
- A. Aho and J. Ullman
43.