Mithril
  • Hướng dẫn sử dụng
    • Lời chào
    • Bắt đầu
      • Khởi động một node
      • Chạy một node Mithril Signer (SPO)
      • Chạy một mạng riêng Mithril
    • Tài liệu Dev
      • Các node mạng Mithril
        • Mithril Aggregator Node
        • Mithril Signer Node
        • Mithril Client Node
      • Tham chiếu API
  • Giới thiệu về Mithril
  • Giao thức Mithril
    • Giao thức chuyên sâu
    • Chuỗi chứng chỉ - Certificate Chain
    • Mô phỏng
  • Mạng Mithril
    • Kiến trúc
    • Mithril Aggregator
    • Mithril Signer
    • Mithril Client
  • Tài liệu hỗ trợ
    • Mithril Explorer
    • Chú thích
    • Node
Powered by GitBook
On this page
  • Mô phỏng giao thức Mithril
  • Những gì bạn sẽ cần
  • Nguồn tải xuống
  • Xây dựng bản nhị phân
  • Xác minh bản dựng
  • Chạy mô phỏng
  1. Giao thức Mithril

Mô phỏng

PreviousChuỗi chứng chỉ - Certificate ChainNextKiến trúc

Last updated 2 years ago

Mô phỏng giao thức Mithril

THÔNG TIN

  • Nhờ bản demo này, bạn sẽ hiểu rõ hơn về Giao thức Mithril. Hy vọng bạn sẽ hình dung được cách những người tham gia tương tác để tạo ra đa chữ ký và tác động của các tham số giao thức là gì.

  • Mô phỏng này được chạy bởi một CLI mà bạn sẽ xây dựng và chạy, và điều đó cuối cùng sẽ tạo ra nhiều chữ ký Mithril thực sự !

  • Với mục đích tái lập kết quả, mô phỏng sử dụng nguồn ngẫu nhiên xác định.

  • Trong quá trình mô phỏng, một số hiện vật sẽ được ghi vào một thư mục artifacts, chẳng hạn như verification keys, individual signaturesvà multi signatures.

  • Máy tính Linux (ưu tiên) hoặc macOS.

  • Chuỗi công cụ Rust (phiên bản 1.62.0+).

Tải xuống từ Github (HTTPS)

git clone https://github.com/input-output-hk/mithril.git

Hoặc (SSH)

git clone [email protected]:input-output-hk/mithril.git

Thay đổi thư mục

cd mithril/demo/protocol-demo

Chạy thử nghiệm (Tùy chọn)

make test

Xây dựng có thể thực thi

make build

Kiểm tra xem tệp nhị phân Mithril Client có hoạt động tốt hay không bằng cách chạy trợ giúp của nó

./mithrildemo -h

Bạn nên thấy

mithrildemo 
Simple demonstration of the Mithril protocol

USAGE:
    mithrildemo [OPTIONS]

OPTIONS:
    -h, --help                     Print help information
    -k, --k <K>                    Quorum parameter [default: 5]
    -m, --m <M>                    Security parameter, upper bound on indices [default: 200]
        --nmessages <NMESSAGES>    Number of messages to sign [default: 1]
        --nparties <NPARTIES>      Number of parties [default: 5]
        --phi-f <PHI_F>            f in phi(w) = 1 - (1 - f)^w, where w is the stake of a
                                   participant [default: 0.2]

TIP

Một lời nhắc nhở thân thiện về các tham số giao thức:

  • k: Quorumtham số đại diện cho số lượng chữ ký cá nhân tối thiểu (tập hợp từ nhiều người tham gia) cần thiết để được tổng hợp trong một chữ ký đa.

  • m: Securitytham số đại diện cho tổng số lotteriesmà mỗi người tham gia có thể tham gia để ký thông báo riêng lẻ.

  • phi-f: tham số phụ thuộc vào xác suất của một người tham gia để giành chiến thắng a lottery. Nó thay đổi giữa 0.0(ít cơ hội hơn) và 1.0(nhiều cơ hội hơn).

DANGER

Giao security levelthức phụ thuộc nhiều vào giá trị của protocol parameters.

Do đó, chúng sẽ được các nhà nghiên cứu và nhà mật mã Mithril lựa chọn cẩn thận để đảm bảo rằng chỉ các bên liên quan hợp pháp đại diện cho một ngưỡng đủ của tổng số tiền đặt cược mới có thể kết hợp các chữ ký riêng lẻ của họ thành một chữ ký đa hợp lệ.

Chạy mô phỏng với những 5người tham gia

./mithrildemo -k 5 -m 50 --phi-f 0.65 --nparties 5

Mô phỏng sẽ thành công và tạo ra (hoặc tổng hợp) một đa chữ ký!

>> Launch Mithril protocol demonstrator with configuration: 
Config {
    m: 50,
    k: 5,
    phi_f: 0.65,
    nparties: 5,
    nmessages: 1,
}

>> Protocol establish phase
Party #0: party created with 826 stakes
Party #1: party created with 741 stakes
Party #2: party created with 144 stakes
Party #3: party created with 734 stakes
Party #4: party created with 41 stakes
Protocol established to StmParameters { m: 50, k: 5, phi_f: 0.65 }

>> Protocol initialize phase:
Verifier: verifier created
Verifier: protocol params updated to StmParameters { m: 50, k: 5, phi_f: 0.65 }
Party #0: protocol params updated to StmParameters { m: 50, k: 5, phi_f: 0.65 }
Party #1: protocol params updated to StmParameters { m: 50, k: 5, phi_f: 0.65 }
Party #2: protocol params updated to StmParameters { m: 50, k: 5, phi_f: 0.65 }
Party #3: protocol params updated to StmParameters { m: 50, k: 5, phi_f: 0.65 }
Party #4: protocol params updated to StmParameters { m: 50, k: 5, phi_f: 0.65 }
Verifier: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #0: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #1: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #2: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #3: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #4: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Artifacts written to artifacts/parties-keys.json

>> Protocol issue certificates phase:
Message #0 to sign: [119, 36, 224, 63, 184, 216, 74, 55, 106, 67, 184, 244, 21, 24, 161, 28]
Party #0: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #0: lottery #2 won
Party #0: lottery #3 won
Party #0: lottery #8 won
Party #0: lottery #13 won
Party #0: lottery #16 won
Party #0: lottery #17 won
Party #0: lottery #19 won
Party #0: lottery #23 won
Party #0: lottery #25 won
Party #0: lottery #28 won
Party #0: lottery #29 won
Party #0: lottery #31 won
Party #0: lottery #42 won
Party #0: lottery #43 won
Party #0: lottery #46 won
Party #1: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #1: lottery #2 won
Party #1: lottery #3 won
Party #1: lottery #8 won
Party #1: lottery #13 won
Party #1: lottery #16 won
Party #1: lottery #17 won
Party #1: lottery #19 won
Party #1: lottery #23 won
Party #1: lottery #25 won
Party #1: lottery #29 won
Party #1: lottery #31 won
Party #1: lottery #42 won
Party #1: lottery #43 won
Party #1: lottery #46 won
Party #2: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #2: lottery #19 won
Party #2: lottery #43 won
Party #2: lottery #46 won
Party #3: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #3: lottery #2 won
Party #3: lottery #3 won
Party #3: lottery #8 won
Party #3: lottery #13 won
Party #3: lottery #16 won
Party #3: lottery #17 won
Party #3: lottery #19 won
Party #3: lottery #23 won
Party #3: lottery #25 won
Party #3: lottery #29 won
Party #3: lottery #31 won
Party #3: lottery #42 won
Party #3: lottery #43 won
Party #3: lottery #46 won
Party #4: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #4: lottery #19 won
Party #0: aggregate signature computed
Party #1: aggregate signature computed
Party #2: aggregate signature computed
Party #3: aggregate signature computed
Party #4: aggregate signature computed
Artifacts written to artifacts/single-signatures.json
Artifacts written to artifacts/multi-signatures.json

>> Protocol verify certificates phase:
Message #0 to verify: 7724e03fb8d84a376a43b8f41518a11c
Party #0: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Verifier: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Party #1: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Verifier: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Party #2: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Verifier: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Party #3: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Verifier: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Party #4: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!
Verifier: aggregate signature successfully verified for 7724e03fb8d84a376a43b8f41518a11c!

>> Congrats, protocol terminated with success!

Chạy mô phỏng với những 5người tham gia

./mithrildemo -k 5 -m 5 --phi-f 0.25 --nparties 5

Mô phỏng sẽ không thành công và không tạo ra (hoặc tổng hợp) bất kỳ đa chữ ký nào!

>> Launch Mithril protocol demonstrator with configuration: 
Config {
    m: 5,
    k: 5,
    phi_f: 0.25,
    nparties: 5,
    nmessages: 1,
}

>> Protocol establish phase
Party #0: party created with 826 stakes
Party #1: party created with 741 stakes
Party #2: party created with 144 stakes
Party #3: party created with 734 stakes
Party #4: party created with 41 stakes
Protocol established to StmParameters { m: 5, k: 5, phi_f: 0.25 }

>> Protocol initialize phase:
Verifier: verifier created
Verifier: protocol params updated to StmParameters { m: 5, k: 5, phi_f: 0.25 }
Party #0: protocol params updated to StmParameters { m: 5, k: 5, phi_f: 0.25 }
Party #1: protocol params updated to StmParameters { m: 5, k: 5, phi_f: 0.25 }
Party #2: protocol params updated to StmParameters { m: 5, k: 5, phi_f: 0.25 }
Party #3: protocol params updated to StmParameters { m: 5, k: 5, phi_f: 0.25 }
Party #4: protocol params updated to StmParameters { m: 5, k: 5, phi_f: 0.25 }
Verifier: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #0: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #1: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #2: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #3: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Party #4: protocol keys registration from [("0", 826), ("1", 741), ("2", 144), ("3", 734), ("4", 41)]
Artifacts written to artifacts/parties-keys.json

>> Protocol issue certificates phase:
Message #0 to sign: [119, 36, 224, 63, 184, 216, 74, 55, 106, 67, 184, 244, 21, 24, 161, 28]
Party #0: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #1: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #2: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #3: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #4: sign message 7724e03fb8d84a376a43b8f41518a11c
Party #0: not enough signatures to compute aggregate
Party #1: not enough signatures to compute aggregate
Party #2: not enough signatures to compute aggregate
Party #3: not enough signatures to compute aggregate
Party #4: not enough signatures to compute aggregate
Artifacts written to artifacts/single-signatures.json
Artifacts written to artifacts/multi-signatures.json

>> Protocol verify certificates phase:
Message #0 to verify: 7724e03fb8d84a376a43b8f41518a11c
Party #0: aggregate signature not found 7724e03fb8d84a376a43b8f41518a11c

>> Certificate verification failed: aggregate signature not found

TIP

Để biết thêm thông tin về Giao thức Mithril , vui lòng tham khảo phần .

Những gì bạn sẽ cần
được định cấu hình chính xác
Nguồn tải xuống
Xây dựng bản nhị phân
Xác minh bản dựng
Chạy mô phỏng
Trường hợp 1: Tạo ra một đa chữ ký
Trường hợp 2: Không tạo ra đa chữ ký
Giới thiệu về Mithril