MAPO Developer Docs
LearnDevelopRunWhitePaperBRC-201
繁體中文
繁體中文
  • 概述
  • 學習
    • 關於 MAP 協議
      • 背景
      • 介紹 MAP 協議
      • MAP 協議的發展歷程
    • 與其他跨鏈模型進行比較
      • MAP 協議與Cosmos& Pokadot
      • MAP vs. 其他無中繼鏈的跨鏈解決方案
    • 技術機制
      • MAP協議'的技術機制
      • 三層結構
      • MAP協議層
      • MAP中繼鏈
        • 概念
        • 與所有鏈的同構性
        • 驗證& 維護網絡
      • MAPO服務(MOS)層
      • MAPO應用層
      • ZK 支持下的輕節點
    • 燃氣費收費模式
    • DAO
    • MAP協議的構建
      • 開發者
      • 驗證者
      • 維護者
      • 信使
      • 流動資金提供者
      • 終端用戶
    • Tokenomics
    • 購買$MAP
  • 開發
    • MAP Relay Chain
      • 入門
        • 構建
        • 製作私有鏈
        • 如何投票
        • 如何取出質押
        • 集成到交易所
        • EVM 兼容鏈接入MAP 中繼鏈
      • 共識
        • 概述
        • Proof-of-Stake
        • 驗證器
          • 驗證器
          • 鎖定的MAP
        • 選舉
        • 獎勵
        • 聚合印章
      • 合約
        • 預編譯合約
        • 創世紀合約
          • ABI
            • AccountsABI
            • ElectionABI
            • EpochRewardsABI
            • LockedGoldABI
            • ValidatorsABI
          • Deploy
      • Marker
        • Genesis
        • 驗證器
        • Vote
        • ContractOwner
        • Common
    • 輕型客戶端
      • 基於輕型客戶端的驗證
      • MAPO輕型客戶端
        • EVM鏈
        • Near
      • 輕客戶端
        • 客戶端管理器
        • BNB 鏈
        • NEAR 協議
        • Polygon(Matic)
        • Ethereum 2.0
        • 維護者
    • MOS 全鏈服務
      • MOS消息指南
        • How It Works
      • MOS 指南
        • 運行原理
        • 如何使用
          • 在Evm鏈的方法
          • 在NEAR協議上
        • 中繼鏈合約
        • EVM鏈合約
        • NEAR 協議合約
      • 信使
      • API
    • OmniChain實例
      • Omni App
      • OmniDictionary
    • API & SDK
      • Butter SDK
      • Atlas JSON RPC
      • Atlas Consensus API
      • MAP掃描API
    • 最新接鏈進展以及對應地址
  • 運行
    • 如何成爲一個新的驗證者
    • 如何成爲一個新的驗證者[進階版]
    • 取出或撤回
Powered by GitBook
On this page
  • 如何運行
  • 如何驗證
  • 證明
  • 以下為證明的數據結構

Was this helpful?

  1. 開發
  2. 輕型客戶端
  3. MAPO輕型客戶端

EVM鏈

PreviousMAPO輕型客戶端NextNear

Last updated 1 year ago

Was this helpful?

合約地址

如何運行

MAPO 輕客戶端可以部署在與 EVM 區塊鏈兼容的合約上。 定期更新和保存MAPO區塊鏈的驗證者信息,用於驗證MAPO區塊鏈生成的證明。 以下是有關其工作原理的主要工作流程:

  1. 輕客戶端合約使用 MAPO 區塊鏈信息進行部署和初始化,例如紀元大小、驗證者閾值和特定紀元(我們稱此紀元為當前紀元)的可信驗證者信息。

  2. 輕客戶端從一個名為 maintainer 的鏈下程序接收 current epoch 的最後一個區塊頭。 塊頭可以由存儲的驗證器進行驗證。 驗證成功後,輕客戶端從區塊頭中獲取下一個 epoch 的驗證者信息。 輕客戶端然後存儲驗證器並將當前紀元更新到下一個紀元。 這個步驟每個 epoch 觸發一次,輕客戶端最多可以存儲最近 20 個 epoch 的驗證者。 3.輕客戶端只有存儲了對應epoch的validators信息,才能驗證某個MAPO區塊中receipt的有效性。 因此,如果一個應用程序想要使用 MAPO 輕客戶端來驗證證明,它可以首先通過從 MAPO 輕客戶端獲取可驗證的標頭範圍來檢查是否存儲了相應的驗證器。

如何驗證

證明數據的內容包括:

1.收據所在的MAPO區塊頭 2.簽名驗證者的聚合 G2 公鑰 3.收據證明 4.收據在區塊中的索引 5.證明上述收據存在的證明

輕客戶端按照以下步驟驗證證明數據:

  1. 計算出區塊頭的epoch number,根據epoch number獲取驗證者記錄; 如果不存在記錄,則返回錯誤。 2、使用驗證器驗證區塊頭的ecdsa簽名,使用驗證器和聚合的G2公鑰驗證區塊頭的BLS簽名。 這證明了區塊頭的有效性。;如果驗證失敗,則返回錯誤。

  2. 一個 MAPO 區塊中的所有收據哈希構建一個 Merkle Patricia Tree,樹根記錄在區塊頭中。 輕客戶端從塊頭、密鑰索引和證明數據中的證明中通過樹根檢索樹葉。 然後它檢查樹葉是否等於證明數據中包含的收據的哈希值。 如果不是,則返回錯誤。

如果以上驗證均通過,證明數據有效。

證明

以下為證明的數據結構


struct TxReceiptRlp {
	// Transaction Type
    uint256 receiptType;
    // Logs RLP encoding
    bytes receiptRlp;
}

//Committee change information corresponds to extraData in blockheader
struct istanbulExtra {
    //Addresses of added committee members
    address[] validators;
    //The public key of the added committee member
    bytes[] addedPubKey;
    //G1 public key of the added committee member
    bytes[] addedG1PubKey;
    //Members removed from the previous committee are removed by bit 1 after binary encoding
    uint256 removeList;
    //The signature of the previous committee on the current header
    //Reference for specific signature and encoding rules
    bytes seal;
    //Information on current committees
    istanbulAggregatedSeal aggregatedSeal;
    //Information on the previous committee
    istanbulAggregatedSeal parentAggregatedSeal;
}

struct receiptProof {
	// the block header where the receipt exists
    blockHeader header;
    //the istanbulExtra struct
    istanbulExtra ist;
    // the aggregated G2 public key of the signed validators
    G2 aggPk;
    // the TxReceiptRlp struct
    TxReceiptRlp txReceiptRlp;
    // the index of the receipt in the block
    bytes keyIndex;
    // the proof to prove the existance of the above receipt
    bytes[] proof;
}
點此獲取MAPO主網和測試網輕客戶端合約地址