| Motoko backend | |
|---|---|
| Rust backend |
The Basic BLS signing example demonstrates how to use vetKeys to implement a threshold BLS signing service 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.
- 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.
This example uses test_key_1 by default. To use a different available master key, change the "init_arg": "(\"test_key_1\")" line in dfx.json to the desired key before running dfx deploy in the next step.
If you want to deploy this project locally with a Motoko backend, then run:
dfx start --background && dfx deployfrom the motoko folder.
To use the Rust backend instead of Motoko, run the same command in the rust folder.
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.
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- What are VetKeys - For more information about VetKeys and VetKD.
