blockchain

Blockchain

区块链当前是六层架构:数据层,网络层,共识层,激励层,合约层,应用层

区块链的不可能三角是: 去中心化,安全性和可扩展性

Layer0, 1, 2

  • Lyaer0

    使不同的区块链网络组件能够交流和交换数据。其中代表layerZero

    • LayerZero

      LayerZero是一个omnichain interoperability protocol 设计为light message pass across chains. LayerZero提供 authetic and guaranteed message delivery and 可配置的去信任化.

      通过layerZero,直接与网络上的任何其他链执行跨链交易。用户可以自由在链之间移动流动性,允许单个池参与多种去中心化金融的流动性跨不同链和生态系统的应用程序。

      • LayerZero Endpoint

        LayerZero Endpoint是一个面向用户interface, implemented as a series of on-chain smart contracts. An endpoint’s purpose is to allow the user to send a message using LayerZero protocol backend, guranteeing for valid delivery.

        A LayerZero Endpoint is split into four modules:Communicator, Validator, Network, and Libraries. LayerZeor每支持一条新链需要添加一个额外的library. This design allows us to add support for new chains without modifying the three core modules

      • Oracle

        Oracle是一个第三方服务,read a block header from one chain and send it to another chain

      • Relayer

        Relayer是一个off-chain服务,功能类似Oracle。它拉取一个特定交易的证明

      • A single LayerZero message

        • Step1: App A send a request to the LayerZero Communicator containning the following information
          • t: The unique transaction identifier for T
          • dst: A global identifier pointing to a smart contract on chain B
          • payload: Any data that App A wishes to send to App B
          • relayer_args: Arguments describing payment information in the event that App A wishes to use the reference Relayer
        • Step2: The Communicator constructs a LayerZero packet containing dst and payload, referred to as Packet(dst, payload), and sends it along with t and relayer_args, to the Validator.
        • Step3: The Validator sends t and dst to Network. This step notifies Network that the block header for the current block on chainA needs to be sent to chain B
        • Step4: Validator forwards Packet(dst, payload), t and relayer_args to the Relayer, notifying the Relayer that the transaction proof for T needs to be prefetched and eventually sent to chain B. This happends concurrently with Step3
        • Step5: Network sends dst and the block ID of the current transaction(cur_blk_id) to the Oracle. This notifies the Oracle to fetch the block header for the current block on chain A and send it to chain B. In the event that multiple LayerZero transactions occured in the same block, Step5 is only executed once
        • Step6: Oracle reads the block header(blk_hdr) from chain A = Step7: The Relayer reads the transaction proof associated with transaction T(proof(t)) from chain A, and stores if off-chain. Step6 and Step7 occur asynchronously to each other
        • Step8: The Oracle confirms that the block corresponding to blk_hdr is stably committed on chain A and then sends blk_hdr to Network on chain B.不同的链等待的区块时间不一样
        • Step9: Network sends the block hash, specified as blk_hdr_hash, to the Validator
        • Step10: The Validator forwards blk_hdr_hash to the Relayer
        • Step11: After receiving blk_hdr_hash, the Relayer sends a list of any Packet(dst, payload), t, proof(t) tuples that match the current block.
        • Step12: The Validator use the received transaction proofs in conjunction with block headers stored by Network to validate whether the associated transaction T is valid and committed. If the do match, then Packet(dst, payload) is sent to the Communicator
        • Step13: The Communicator emits Packet(dst, payload) to App B
      • whitepapaer: https://layerzero.network/pdf/LayerZero_Whitepaper_Release.pdf

  • Layer1

    Layer1是一个去中心化的分布式账本. 它使用一个网络节点来维护,验证和记录transactions on the ledger.包含共识机制。

    • Ethereum

  • Layer2

    Layer2是一个在已存在的区块链上构建的二层框架或协议,主要目标是解决交易可扩展性

    由主链提供安全性和去中心化,二层提供可扩展性

    Layer2解决方案大致可分为两个部分:一个是负责处理交易的网络;另一个是部署在底层区块链上的智能合约,负责解决任何分歧并将Layer2网络达成的共识传输到底层区块链进行验证

    • Bitcoin Lighting Network

      闪电网络基于状态通道

    • Polygon

      Polygon的前身是Matic Network,它使用侧链进行可扩展,安全和即时的区块链交易,同时使用Plasma框架和分散的权益证明(PoS)验证器网络确保资产安全

Resources