Ricky Shi
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 协调者文档 协调者为DeGate DAO指派的角色。该角色将负责协调并验证整个Trusted Setup按照预定流程正确执行,并输出最终的执行结果。 ## 执行 Pre Phase 2 的工作 ### Enviorment prepareation #### 1)运行环境配置 推荐配置: 128C/1024G/4T(两块2T磁盘) 推荐机型: AWS r6i.metal 其中将一个2T磁盘作为根目录,另一个2T磁盘作swap,设置1.8Tswap即可,参考[这里](https://linuxize.com/post/create-a-linux-swap-file/) #### 2)操作系统 推荐使用Ubuntu20.04 #### 3)安装必要软件 ``` Python3 #系统默认已经安装 Git #系统默认已经安装 gcc #Install Script: apt update -y && apt-get install -y gcc Rust和Cargo 参考https://www.rust-lang.org/learn/get-started ``` #### 4)下载 Phase 1 的最新response文件 Download the response of the latest participant from [phase 1](https://github.com/weijiekoh/perpetualpowersoftau/blob/master/0071_edward_response/README.md) into `phase2-bn254/loopring`. Rename the file to `response`. #### 5)部署sftp服务器 sftp用于参与者脚本对执行过程中所生产的文件自动进行传输和备份。 ### 其他相关准备工作 #### 1)建立keybase team 群组 该群组将用于在Trusted Setup过程中所需要的参数的传输渠道,也将用于协调者对参与者在整个过程中遇到的问题提供协助。 #### 2)公示并获取未来比特币Hash用于Beacon Contribution执行 协调者需要在Trsuted Setup过程开始之前,在DeGate的Twitter账号进行公示,以目标高度的比特币Hash值作为参数用于`phase2-bn254` 执行的 random beacon ### 执行步骤 #### 初始化部分 #### 步骤一:源代码下载编译 ##### 1)在同一个文件夹下载下面两个项目 ``` git clone https://github.com/degatedev/protocols --branch degate_mainnet_beta git clone https://github.com/degatedev/phase2-bn254 ``` ##### 2)编译phase2-bn254 在phase2-bn254目录,执行下面命令: ``` cd powersoftau && cargo build --release && \ cd ../phase2 && cargo build --release && \ cd ../loopring ```` ##### 3)拷贝最新response文件 将准备阶段一最新response文件拷贝到`phase2-bn254/loopring`目录 ##### 4)Beacon Contribution 将准备阶段公示的Bitcoin block hash更新到`phase2-bn254/powersoftau/src/bin/beacon_constrained.rs`文件中`cur_hash`参数值里,然后在`phase2-bn254/powersoftau`下执行编译 ` cargo build --release` #### 步骤二:prepare_phase2 前置操作 在`phase2-bn254/loopring`目录下依次执行下面命令 ``` ../powersoftau/target/release/verify_transform_constrained -skipverification #此步生成new_challenge文件,执行时长约35min mv new_challenge challenge && mv response old_response #文件重命名,为后面程序作准备 ../powersoftau/target/release/beacon_constrained #此步生成新的response文件,耗时52min ../powersoftau/target/release/prepare_phase2 #此步会生成一些phase1radix2m[数字编号]文件,分两台并行执行前27和第28个文件生成然后合并,执行耗时约5天) ``` 备注:为了并行生成phase1radix2m[编号]文件,第二台机器要跳过前面文件只生成最后一个文件(编号28的文件),第二台机器需要做如下配置: phase2-bn254/powersoftau/src/bin/prepare_phase2.rs 中的main()中: 将for m in 0..max_degree+1 { 改成 for m in max_degree..max_degree+1 { 然后重新编译,在phase2-bn254目录,执行下面命令: ``` cd powersoftau && cargo build --release && \ cd ../phase2 && cargo build --release && \ cd ../loopring ```` #### 步骤三:编译电路 在`protocols/packages/loopring_v3`目录执行 ``` ./install LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib/ make ``` #### 步骤四:生成用于Phase2的 Contribution 文件 在`phase2-bn254/loopring`目录执行下面命令 `nohup python3 setup.py &` 此步将生成`loopring_mpc_0000.zip`,文件大小约160GB,执行时长约70.5小时,将其上传到sftp服务器的`sftpuser0`目录,以便第一个参与者下载它使用 ## 引导参与者开始 Phase 2 ### 在参与者执行操作前进行沟通 1)提前将参与者须知文档链接发给参与者,让参与者了解过程,按照文档进行相关操作 2)通过keybase告知所有参与者的编号,确保参与者知晓自己是第几位参与者 3)通过keybase私聊将每位参与者对应的sftp私钥发给对方 4)生成初始文件`loopring_mpc_0000.zip`后,将`attestation.txt`中的`SHA256 hash`在keybase群组中向参与者同步,供第一位参与者使用 ### 协调者进行验证 参与者完成其步骤后,需拷贝`signed_attestation.txt` 内容到keybase群组中,协调者需要执行验证工作,下一位参与者从中可得到hash值 #### 1)使用keybase网站对参与者的signed_attestation.txt进行验证 浏览器打开[https://keybase.io/verify](https://keybase.io/verify),将参与者的`signed_attestation.txt`内容复制到`Message to verify`文本框,然后点击下面的Verify按钮,会返回`Signed by UserName`的信息 #### 2)上传参与者签名后的signed_attestation文件 将每个参与者的 `signed_attestation_000[x].txt` 上传至[github ](https://github.com/degatedev/trusted_setup/signed_attestation/) 重复上面于参与者的沟通和验证工作,一直到最后一位参与者完成计算 *备注: 因contribution verification耗时70小时,因并行执行每位参与者的文件耗时太久,将在最后一位参与者完成后,使用多台机器并行执行 contribution verification* ### 检查每位参与者的contribution文件 #### 准备验证机器 当最后一位参与者完成计算后,根据参与者数量准备相应数量的机器并行验证所有参与者生成的文件 ##### 1)运行环境配置 推荐配置: 128C/1024G/4T(两块2T磁盘) 推荐机型: AWS r6i.metal 其中将一个2T磁盘作为根目录,另一个2T磁盘作swap,设置1.8Tswap即可,参考[这里](https://linuxize.com/post/create-a-linux-swap-file/) ##### 2)操作系统 推荐Ubuntu20.04 ##### 3)安装必要软件 ``` Python3 #系统默认已经安装 Git #系统默认已经安装 gcc #安装命令apt update -y && apt-get install -y gcc Rust和Cargo 参考https://www.rust-lang.org/learn/get-started ``` #### 准备验证环境 ##### 1)在同一个文件夹下载下面两个项目 ``` git clone https://github.com/degatedev/protocols --branch degate_mainnet_beta git clone https://github.com/degatedev/phase2-bn254 ``` ##### 2)编译phase2-bn254 在`phase2-bn254`目录,执行下面命令: ``` cd powersoftau && cargo build --release && \ cd ../phase2 && cargo build --release && \ cd ../loopring ``` ##### 3)编译电路 在`protocols/packages/loopring_v3`目录执行 ``` ./install LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib/ make ``` #### 验证环境文件传输 ##### 1)传输初始化时生成的phase1radix2m0 ~ phase1radix2m28(共计29个文件)到每个验证机器的phase2-bn254/loopring项目目录下 ##### 2)传输待验证参与者和上一位参与者的contribution文件到每个验证机器phase2-bn254/loopring目录下 每个服务器只需传输对应的参与者和上一位参与者文件即可。 > 举例: > > 验证第一位参与者文件的服务器,需要传输loopring_mpc_0001.zip和loopring_mpc_0000.zip > > 验证第二位参与者文件的服务器,需要传输loopring_mpc_0002.zip和loopring_mpc_0001.zip > > 以此类推 > > 验证第六位(最后一位)参与者文件的服务器,需要传输loopring_mpc_0005.zip和loopring_mpc_0006.zip ##### 3)确保验证参与者和上一位参与者电路代码版本是一致的(即整个trusted-setup过程,不要更新电路对应分支代码) #### 执行验证 进入`phase2-bn254/loopring/`目录,执行命令: `nohup python3 verify_contribution.py 参与者序列号 & ` > 举例: > > 验证第一位参与者,命令为nohup python3 verify_contribution.py 1 & > > 验证第二位参与者,命令为nohup python3 verify_contribution.py 2 & > > 以此类推到 > > 验证第六位参与者,命令为nohup python3 verify_contribution.py 6 & > > 验证成功后将输出类似下面日志信息: > > SHA256 hash of contribution: <current hash> > > SHA256 hash of previous contribution: <previous hash> > > Circuit 1/6: > Circuit 2/6: > Circuit 3/6: > Circuit 4/6: > Circuit 5/6: > Circuit 6/6: > Circuit 7/7: > Done! Contribution x is valid! #其中x是验证的参与者编号 > > ### 执行Beacon Contribution 说明:在执行最后一位参与者验证的机器上执行Beacon Contribution和Export pk and vk步骤 在最后一位参与者的contribution文件基础上,需要执行一次beacon contribution(与初始化过程的beacon执行类似)。 协调者需要提前几个小时,在DeGate的Twitter账号进行公示,以目标高度的比特币Hash值作为参数用于`phase2-bn254` 执行的 random beacon。 一旦区块被开采,将区块的哈希值放入`phase2-bn254/phase2/src/bin/beacon.rs`的`cur_hash`参数里 在`phase2-bn254/phase2`目录编译 `cargo build --release` 在`phase2-bn254/loopring`目录执行下面命令 `mkdir /opt/trustmount` `python3 contribute.py beacon` 此步生成最终的`loopring_mpc_000x.zip`,其中 x = 最后一位参与者序列号 + 1, 此过程执行时间约3小时。 ### Export pk and vk 执行导出操作(执行时长约12小时) 在`phase2-bn254/loopring`目录执行下面命令 ``` nohup python3 export_keys.py & (此步在目录protocols/packages/loopring_v3/keys 下生成一批文件,命名方式为:all_[电路size]_vk.json ,all_[电路size]_pk.raw) ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully