Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 2.82 KB

File metadata and controls

56 lines (35 loc) · 2.82 KB

Basic BLS Signing

Motoko backend
Rust backend

The Basic BLS signing example demonstrates how to use vetKeys to implement secure BLS signing on the Internet Computer (IC), where every authenticated user can ask the canister (IC smart contract) to produce signatures, where the Internet Identity Principal identifies the signer. This canister ensures that users can only produce signature for their own principal and not for someone else's principal. Furthermore, the vetKeys in this dapp can only be produced upon a user request, as specified in the canister code, meaning that the canister cannot produce signatures for arbitrary users or messages.

For confirming that the canister can only produce signatures in the intended way, users need to inspect the code installed in the canister. For this, it is crucial that canisters using VetKeys have their code public.

UI Screenshot

Features

  • Signer Authorization: Only authorized users can produce signatures and only for their own identity.
  • Frontend Signature Verification: Any user can publish any signature from their principal in the canister storage and the frontend automatically checks the signature validity.

Setup

Prerequisites

Deploy the Canisters Locally

If you want to deploy this project locally with a Motoko backend, then run:

dfx start --background && dfx deploy

from the motoko folder.

To use the Rust backend instead of Motoko, run the same command in the rust folder.

Example Components

Backend

The backend consists of a canister that:

  • Produces signatures upon a user request.
  • Allows users to retrieve the root public key that can be used to check any user's signature for this canister.
  • Allows users to store signatures (real or fake) in a log datastructure.

Frontend

The frontend is a vanilla typescript application providing a simple interface for signing, showing the signatures stored in the canister, and publishing a signature.

To run the frontend in development mode with hot reloading (after running dfx deploy):

npm run dev

Additional Resources