Skip to content

Commit 8d05175

Browse files
authored
feat: CRP-2844 CRP-2850 add Motoko backend for BLS signing example and ICP Ninja layout and buttons (#175)
1 parent 1a17994 commit 8d05175

File tree

33 files changed

+4656
-517
lines changed

33 files changed

+4656
-517
lines changed

.github/workflows/examples-basic-bls-signing.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,65 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}
2020
cancel-in-progress: true
2121
jobs:
22-
examples-basic-bls-signing-darwin:
22+
examples-basic-bls-signing-rust-darwin:
2323
runs-on: macos-15
2424
steps:
2525
- uses: actions/checkout@v4
2626
- name: Provision Darwin
2727
run: |
2828
bash .github/workflows/provision-darwin.sh
29-
- name: Deploy Basic BLS Signing Darwin
29+
- name: Deploy Basic BLS Signing Rust Darwin
3030
run: |
3131
set -eExuo pipefail
3232
cargo install candid-extractor
3333
npm i
34-
pushd examples/basic_bls_signing
35-
./deploy_locally.sh
34+
pushd examples/basic_bls_signing/rust
35+
dfx start --background && dfx deploy
3636
cd frontend
3737
npm run lint
38-
examples-basic-bls-signing-linux:
38+
examples-basic-bls-signing-rust-linux:
3939
runs-on: ubuntu-24.04
4040
steps:
4141
- uses: actions/checkout@v4
4242
- name: Provision Linux
4343
run: bash .github/workflows/provision-linux.sh
44-
- name: Deploy Basic BLS Signing Linux
44+
- name: Deploy Basic BLS Signing Rust Linux
4545
run: |
4646
set -eExuo pipefail
4747
cargo install candid-extractor
4848
npm i
49-
pushd examples/basic_bls_signing
50-
./deploy_locally.sh
49+
pushd examples/basic_bls_signing/rust
50+
dfx start --background && dfx deploy
51+
cd frontend
52+
npm run lint
53+
examples-basic-bls-signing-motoko-darwin:
54+
runs-on: macos-15
55+
steps:
56+
- uses: actions/checkout@v4
57+
- name: Provision Darwin
58+
run: |
59+
bash .github/workflows/provision-darwin.sh
60+
- name: Deploy Basic BLS Signing Motoko Darwin
61+
run: |
62+
set -eExuo pipefail
63+
cargo install candid-extractor
64+
npm i
65+
pushd examples/basic_bls_signing/motoko
66+
dfx start --background && dfx deploy
67+
cd frontend
68+
npm run lint
69+
examples-basic-bls-signing-motoko-linux:
70+
runs-on: ubuntu-24.04
71+
steps:
72+
- uses: actions/checkout@v4
73+
- name: Provision Linux
74+
run: bash .github/workflows/provision-linux.sh
75+
- name: Deploy Basic BLS Signing Motoko Linux
76+
run: |
77+
set -eExuo pipefail
78+
cargo install candid-extractor
79+
npm i
80+
pushd examples/basic_bls_signing/motoko
81+
dfx start --background && dfx deploy
5182
cd frontend
5283
npm run lint

Cargo.lock

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ members = [
55
"backend/rs/canisters/ic_vetkeys_encrypted_maps_canister",
66
"backend/rs/canisters/ic_vetkeys_manager_canister",
77
"backend/rs/canisters/tests",
8-
"examples/basic_bls_signing/backend",
98
]
109
resolver = "2"
1110

examples/basic_bls_signing/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Basic BLS Signing
22

3+
| Motoko backend | [![](https://icp.ninja/assets/open.svg)](http://icp.ninja/editor?g=https://github.com/dfinity/vetkeys/tree/main/examples/basic_bls_signing/motoko)|
4+
| --- | --- |
5+
| Rust backend | [![](https://icp.ninja/assets/open.svg)](http://icp.ninja/editor?g=https://github.com/dfinity/vetkeys/tree/main/examples/basic_bls_signing/rust) |
6+
37
The **Basic BLS signing** example demonstrates how to use **[vetKeys](https://internetcomputer.org/docs/building-apps/network-features/vetkeys/introduction)** 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.
48

59
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.
@@ -18,18 +22,15 @@ For confirming that the canister can only produce signatures in the intended way
1822
- [Internet Computer software development kit](https://internetcomputer.org/docs/building-apps/getting-started/install)
1923
- [npm](https://www.npmjs.com/package/npm)
2024

21-
### Install Dependencies
25+
### Deploy the Canisters Locally
2226

27+
If you want to deploy this project locally with a Motoko backend, then run:
2328
```bash
24-
npm install
29+
dfx start --background && dfx deploy
2530
```
31+
from the `motoko` folder.
2632

27-
### Deploy the Canisters
28-
29-
Run the local deployment script, which starts the local development environment (`dfx`) if necessary, builds both backend and frontend (asset) canisters, and installs them locally.
30-
```bash
31-
bash deploy_locally.sh
32-
```
33+
To use the Rust backend instead of Motoko, run the same command in the `rust` folder.
3334

3435
## Example Components
3536

@@ -44,7 +45,7 @@ The backend consists of a canister that:
4445

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

47-
To run the frontend in development mode with hot reloading (after running `deploy_locally.sh`):
48+
To run the frontend in development mode with hot reloading (after running `dfx deploy`):
4849

4950
```bash
5051
npm run dev

examples/basic_bls_signing/backend/Cargo.toml

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/basic_bls_signing/deploy_locally.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/basic_bls_signing/dfx.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)