E2E Demo
Pre-alpha. The devnet pre-alpha is a mock network with no MPC. Read the warning in the introduction first.
The multisig demo runs a 2-of-3 multisig against a live network. Two members approve a message, and the network signs it with the dWallet the multisig controls. Then a second message is rejected, and never reaches the network. The demo uses the SDK as an app does, in mock mode for the pre-alpha.
| Language | File |
|---|---|
| TypeScript, run with Bun | examples/multisig/e2e/main.ts |
| Browser, React | examples/multisig/react/ |
Before you run it
-
Get a devnet keypair with about 1 SOL from https://faucet.solana.com.
-
Build the multisig program and deploy it to devnet. The Pinocchio variant builds to
target/deploy/ika_example_multisig.so:cargo build-sbf --tools-version v1.54 --arch v3 --manifest-path examples/multisig/pinocchio/Cargo.toml \ -- --features devnet-pre-alpha solana program deploy -u devnet --keypair <your-keypair.json> target/deploy/ika_example_multisig.so -
For the demo and the React page, install and build this repository once, as the voting demo shows.
Running the TypeScript demo
cd examples
PAYER_KEYPAIR=<your-keypair.json> \
bun multisig/e2e/main.ts 8siGnE3tCZbu4LTuX8QoBPErvWeGBF4pRSJDnaGdHyQv <multisig program id>
It reads the same environment variables as the voting demo: PAYER_KEYPAIR, RPC_URL and
GRPC_URL, with the devnet pre-alpha as the default.
Running the React page
cd examples/multisig/react
VITE_DWALLET_PROGRAM_ID=8siGnE3tCZbu4LTuX8QoBPErvWeGBF4pRSJDnaGdHyQv \
VITE_MULTISIG_PROGRAM_ID=<multisig program id> \
pnpm dev
The page needs a browser wallet, such as Phantom, set to devnet and holding devnet SOL. It talks
gRPC-Web to the pre-alpha directly, so it needs no proxy. VITE_RPC_URL and VITE_GRPC_WEB_URL pick
another cluster or network.
The page keeps the user’s root seed in memory only. Reloading the page loses the keys, and with them the user’s share of the dWallet the page made. A real app keeps the root seed, encrypted, or derives it from something the user holds.
What the demo does
1/9 Make the payer a user: new keys, the encryption key registered on Solana,
and a gas deposit for the request key
2/9 Run a key generation over gRPC
3/9 Accept the user's share on Solana and wait until the dWallet is active
4/9 Create the 2-of-3 multisig, signed by the payer while it still owns the dWallet
5/9 Transfer the dWallet to the multisig program's CPI authority
6/9 A member proposes the message
7/9 Two members approve. The second approval reaches the threshold, and the
program issues the signature voucher in the same transaction
8/9 Take a presign and ask the network to sign, naming the voucher. Check that the
signature is the one written into the voucher account, and that it verifies
under the dWallet's public key
9/9 Propose a second message and reject it with two members. No voucher is
issued, so the network is never asked
Expected output
═══ dWallet Multisig E2E Demo (TypeScript) ═══
[1/9] Registering new keys and a gas deposit for the payer...
✓ Encryption key registered, gas deposit created
[2/9] Running a distributed key generation over gRPC...
[3/9] Accepting the user's share and waiting for the dWallet...
✓ dWallet account: ...
[4/9] Creating the 2-of-3 multisig...
✓ Multisig: ...
[5/9] Handing the dWallet to the multisig program...
✓ Owner is now the multisig program's signing address: ...
[6/9] A member proposes the message...
✓ Transaction: ...
[7/9] Approval 1/2: member 1 approves...
✓ Member 1 approved
[7/9] Approval 2/2: member 2 approves...
✓ Member 2 approved
✓ The multisig approved the transaction
✓ Voucher issued on chain: ...
[8/9] Taking a presign from the network, then asking it to sign...
✓ Presign allocated
✓ The network returned a signature
✓ The same signature is committed in the voucher account
✓ The signature verifies under the dWallet's public key
[9/9] Proposing a second message and rejecting it...
✓ The second message was rejected and never reached the network
═══ The demo ran to the end ═══
The shared code is split as in the voting demo.