### Install dependencies and start the frontend Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/mldsa-signing Installs dependencies and starts the frontend development server. The frontend runs at http://localhost:5173. ```bash bun install bun run dev ``` -------------------------------- ### Install dependencies and run development server Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/with-user-authentication/setup-frontend Installs npm dependencies and starts the development server. After running, open http://localhost:5173/ in a browser. ```bash npm install npm run dev ``` -------------------------------- ### Setup environment and start servers with Docker Compose Source: https://docs.silencelaboratories.com/trio/cookbook/trio-local-setup/server Prepares the environment variables required by the servers, then starts them with Docker Compose. The setup script generates keyshare encryption keys, party signing keys, and public keys, writing them to `env-file`. After running `docker compose --env-file env-file up`, the servers log that they are listening on their respective addresses. ```bash #!/bin/bash ENV_FILE=env-file mkdir -p ./testdata rm -f ${ENV_FILE} echo IMG_TAG=v0.1.0 > ${ENV_FILE} for i in {0..1}; do # Generate keyshare encryption keys for both parties openssl rand 32 > ./testdata/kek_${i} # Generate keys used by parties to sign their MPC messages # generate 32 random bytes and store them under ./testdata/party_{0,1}_sk openssl rand 32 > ./testdata/party_${i}_sk # transform those random bytes to DER format { printf "\x30\x2e\x02\x01\x00\x30\x05\x06\x03\x2b\x65\x70\x04\x22\x04\x20" cat ./testdata/party_${i}_sk } > private_key_{i}.der # get public key in DER format, extract from that hex representation of public key PUBLIC_KEY_HEX=$(openssl pkey -in private_key_{i}.der -pubout -outform DER | xxd -p -s 12 -c 64) if [ "$i" -eq 0 ]; then echo SL_FIRST_PARTY_PUBLIC_KEY=${PUBLIC_KEY_HEX} >> ${ENV_FILE} else echo SL_SECOND_PARTY_PUBLIC_KEY=${PUBLIC_KEY_HEX} >> ${ENV_FILE} fi # delete the private key in DER format rm private_key_{i}.der done # Generate secret key for user openssl rand 32 > ./testdata/party_2_sk echo "Environment variables stored in $ENV_FILE" ``` ```shell docker compose --env-file env-file up ``` ```text [+] Running 2/0 ✔ Container first Created 0.0s ✔ Container second Created 0.0s Attaching to first, second first | 2025-10-16T17:34:25.506983Z INFO trio_svc_first::utils: listening on 172.25.0.2:8080 second | 2025-10-16T17:34:25.513590Z INFO trio_svc_second::utils: listening on 172.25.0.3:8080 ``` -------------------------------- ### Start Duo Server with Docker Compose Source: https://docs.silencelaboratories.com/duo/general/getting-started/duo-server Starts the Duo Server using the environment file generated by the setup script. ```shell docker compose --env-file env-file up ``` -------------------------------- ### Start Duo Server with docker-compose.yml and verify logs Source: https://docs.silencelaboratories.com/duo/general/getting-started/quickstart?platform=swift Sets up and starts the Duo Server locally. The compose file expects a party_0_sk file (random bytes) in the project root; create it with openssl, then run docker compose up. Successful startup logs show the cloud verifying key (33-byte hex) and the listening address; drop the leading 01 byte to get the 32-byte Ed25519 key for the SDK's cloudVerifyingKey. ```yaml services: duo-server: image: ghcr.io/silence-laboratories/dkls23-rs/duo-server:v4 command: /usr/local/bin/sigpair-node environment: RUST_LOG: info LISTEN: 0.0.0.0:8080 DEV_MASTER_SIGN_KEY: /run/secrets/duo-signing-master-key FILE_STORAGE_URL: file:///data/ ports: - 8080:8080 volumes: - duo-server-data:/data secrets: - duo-signing-master-key volumes: duo-server-data: secrets: duo-signing-master-key: file: ${MESSAGE_SIGNING_KEY:-./party_0_sk} ``` ```shell openssl rand 32 > party_0_sk ``` ```shell docker compose up ``` ```logs Attaching to duo-server-1 duo-server-1 | WARN: The dotenv file is not set duo-server-1 | 2025-09-16T09:59:09.200234Z INFO sigpair_node: Creating SimpleStorage duo-server-1 | 2025-09-16T09:59:09.201975Z INFO sigpair_node: Party VK duo-server-1 | 2025-09-16T09:59:09.202413Z INFO sigpair_node: listening on 0.0.0.0:8080 ``` -------------------------------- ### Clone the examples hub repository and navigate to the backend-template crate Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/with-user-authentication/setup-backend Clones the examples-hub repository at tag v0.2.0 and changes into the backend-template crate directory. This is the starting point for the backend service. ```bash git clone --branch v0.2.0 https://github.com/silence-laboratories/examples-hub.git cd ./examples-hub/silent-network/with-rust/backend-template ``` -------------------------------- ### Install Docker on Linux Source: https://docs.silencelaboratories.com/duo/general/getting-started/quickstart?platform=swift Install Docker on Linux using the official installation script. This is part of the optional 'Run your own Duo Server' setup. ```bash curl -fsSL https://get.docker.com | sh ``` -------------------------------- ### Clone examples repository for Golang Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/no-user-authentication/setup-backend-no-auth Clone the examples repository and navigate to the silent-network/with-go directory. ```bash git clone --branch v0.2.0 https://github.com/silence-laboratories/examples-hub.git cd ./examples-hub/silent-network/with-go ``` -------------------------------- ### Clone examples repository for Rust Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/no-user-authentication/setup-backend-no-auth Clone the examples repository and navigate to the silent-network/with-rust/cli-wallet directory. ```bash git clone --branch v0.2.0 https://github.com/silence-laboratories/examples-hub.git cd ./examples-hub/silent-network/with-rust/cli-wallet ``` -------------------------------- ### Verify OpenTofu installation with tofu -version Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/deploying-on-confidential-space/setup_terraform Verify the OpenTofu installation. The output should show the installed version, for example 'OpenTofu v1.9.1 on linux_amd64'. ```bash tofu -version ``` -------------------------------- ### Run Setup Script Source: https://docs.silencelaboratories.com/duo/general/getting-started/duo-server Makes the setup script executable and runs it to generate the environment file. ```shell chmod +x setup-env.sh ./setup-env.sh ``` -------------------------------- ### Install OpenSSL on Ubuntu/Debian Source: https://docs.silencelaboratories.com/duo/general/getting-started/quickstart?platform=swift Install OpenSSL on Ubuntu/Debian using apt. This is part of the optional Duo Server setup. ```bash # Ubuntu/Debian sudo apt-get update && sudo apt-get install openssl ``` -------------------------------- ### Golang wallet creation output Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/no-user-authentication/setup-backend-no-auth Example output after successfully creating a wallet with the Golang CLI. ```text 2025/12/14 20:15:17 INFO Connect to network endpoint endpoint=wss://silent-network-no-auth-3-2-0.sandbox.silencelaboratories.com/operator1/v2/keygen retries_left=5 2025/12/14 20:15:17 INFO new connection open url=wss://silent-network-no-auth-3-2-0.sandbox.silencelaboratories.com/operator1/v2/keygen Wallet created and saved: key_id=56348d69a98f27b4ec224285390014ba2509c727b48410b51fd469ef8bddeea5 address=0xD3297cFCEc08c529696420435859445AB3025596 file=wallets.json ``` -------------------------------- ### Copy .env.example file Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/no-user-authentication/setup-backend-no-auth Create the .env file by copying the provided .env.example file. ```bash cp .env.example .env ``` -------------------------------- ### Initialize database Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/deploying-on-confidential-space/setup-operators-resources Initialize the database by creating databases and roles for each node. Requires gcloud, psql, jq, tofu, and sql-proxy to be installed. ```bash ./google_cloud/tf/scripts/init_database.sh ``` -------------------------------- ### Import silent_shard_sdk Source: https://docs.silencelaboratories.com/duo/actions/installation?platform=swift Imports the SDK in your Dart code to verify the installation. After this, you can proceed to the Quick Start to create a session. ```dart import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk; ``` -------------------------------- ### Clone the examples-hub repository Source: https://docs.silencelaboratories.com/trio/cookbook/silent-shard-sdk-examples/clone-and-build Commands to clone the repository and navigate to the SDK directory. ```bash git clone https://github.com/silence-laboratories/examples-hub.git cd examples-hub/silent-shard-sdk ``` -------------------------------- ### Verify local node reachability Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/with-user-authentication/setup-nodes Use curl to verify that the local nodes are reachable after starting the Docker Compose setup. ```bash curl --insecure https://localhost:8081/v2/version curl --insecure https://localhost:8082/v2/version curl --insecure https://localhost:8083/v2/version ``` -------------------------------- ### Clone examples-hub repository and navigate to demo_wallet_react Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/with-user-authentication/setup-frontend Clones the examples-hub repository at branch v0.2.0 and changes into the demo_wallet_react directory. Requires npm and previous backend setup. ```bash git clone --branch v0.2.0 https://github.com/silence-laboratories/examples-hub.git cd ./examples-hub/silent-network/with-typescript/demo_wallet_react ``` -------------------------------- ### Install silent_shard_sdk from private registry Source: https://docs.silencelaboratories.com/trio/actions/installation Adds the silent_shard_sdk package from the private registry. Use the dart pub add command or add the dependency block to pubspec.yaml. After either method, run dart pub get. ```bash dart pub add 'silent_shard_sdk:{"version":"1.0.0", "hosted":"https://dart-pkg.silencelaboratories.com"}' ``` ```yaml dependencies: silent_shard_sdk: version: 1.0.0 hosted: https://dart-pkg.silencelaboratories.com ``` -------------------------------- ### Expected Duo server startup logs Source: https://docs.silencelaboratories.com/duo/general/getting-started/quickstart?platform=swift Expected server logs after a successful start. The `Party VK` line contains the 66-byte hex string; drop the leading `01` byte to get the 32-byte `cloudVerifyingKey`. ```text Attaching to duo-server-1 duo-server-1 | WARN: The dotenv file is not set duo-server-1 | 2025-09-16T09:59:09.200234Z INFO sigpair_node: Creating SimpleStorage duo-server-1 | 2025-09-16T09:59:09.201975Z INFO sigpair_node: Party VK duo-server-1 | 2025-09-16T09:59:09.202413Z INFO sigpair_node: listening on 0.0.0.0:8080 ``` -------------------------------- ### Setup Environment Variables Script Source: https://docs.silencelaboratories.com/duo/general/getting-started/duo-server Generates the env-file with IMG_TAG and the first party public key, and creates the signing key files. Save as setup-env.sh. ```bash #!/bin/bash ENV_FILE=env-file mkdir -p ./testdata rm -f ${ENV_FILE} echo IMG_TAG=v6.4.0 > ${ENV_FILE} # Generate keys used by parties to sign their MPC messages # generate 32 random bytes and store them under ./testdata/party_0_sk openssl rand 32 > ./testdata/party_0_sk # transform those random bytes to DER format { printf "\x30\x2e\x02\x01\x00\x30\x05\x06\x03\x2b\x65\x70\x04\x22\x04\x20" cat ./testdata/party_0_sk } > private_key_0.der # get public key in DER format, extract from that hex representation of public key PUBLIC_KEY_HEX=$(openssl pkey -in private_key_0.der -pubout -outform DER | xxd -p -s 12 -c 64) echo SL_FIRST_PARTY_PUBLIC_KEY=${PUBLIC_KEY_HEX} >> ${ENV_FILE} # delete the private key in DER format rm private_key_0.der # Generate secret key for user openssl rand 32 > ./testdata/party_2_sk echo "Environment variables stored in $ENV_FILE" ``` -------------------------------- ### Start an EdDSA session with createEddsaTrioSession Source: https://docs.silencelaboratories.com/trio/actions/session Initializes an EdDSA MPC session using the minimal setup. Requires a CloudWebSocketClient connected to the cloud node and the cloud verifying key. The session is ready for MPC operations such as keygen and sign. ```typescript import { CloudWebSocketClient } from '@silencelaboratories/silent-shard-sdk'; import { createEddsaTrioSession } from '@silencelaboratories/silent-shard-sdk/eddsa'; const CLOUD_NODE_URI = 'localhost:8080'; const cloudVerifyingKey = 'SERVER_PUBLIC_KEY_HEX'; const cloudClient = new CloudWebSocketClient(CLOUD_NODE_URI, false); export const initSession = async () => { const session = await createEddsaTrioSession({ client: cloudClient, cloudVerifyingKey: cloudVerifyingKey, }); console.log('Session created successfully'); return session; }; ``` -------------------------------- ### Clone and enter the example-hub iOS app Source: https://docs.silencelaboratories.com/duo/general/getting-started/quickstart?platform=swift Clones the reference app and changes into the iOS Duo initiator directory. Run these commands before opening the Xcode project. ```bash git clone https://github.com/silence-laboratories/examples-hub.git cd examples-hub/silent-shard-sdk/with-ios/duo-initiator ``` -------------------------------- ### Start an ECDSA session with createEcdsaTrioSession Source: https://docs.silencelaboratories.com/trio/actions/session Initializes an ECDSA MPC session using the minimal setup. Requires a CloudWebSocketClient connected to the cloud node and the cloud verifying key. The session is ready for MPC operations such as keygen and sign. ```typescript import { CloudWebSocketClient } from '@silencelaboratories/silent-shard-sdk'; import { createEcdsaTrioSession } from '@silencelaboratories/silent-shard-sdk/ecdsa'; const CLOUD_NODE_URI = 'localhost:8080'; const cloudVerifyingKey = 'SERVER_PUBLIC_KEY_HEX'; const cloudClient = new CloudWebSocketClient(CLOUD_NODE_URI, false); export const initSession = async () => { const session = await createEcdsaTrioSession({ client: cloudClient, cloudVerifyingKey: cloudVerifyingKey, }); console.log('Session created successfully'); return session; }; ``` -------------------------------- ### Copy the environment file Source: https://docs.silencelaboratories.com/duo/cookbook/example-apps/react-native-boilerplate/setup Copies .env.example to .env. No editing is required for the sandbox because the file is pre-filled with working demo credentials. ```bash cp .env.example .env ``` -------------------------------- ### Create DuoSession for ECDSA, EdDSA, and Taproot Source: https://docs.silencelaboratories.com/duo/actions/session?platform=react-native These Dart snippets create a DuoSession for ECDSA, EdDSA, and Taproot using the SilentShard SDK. Each setup function configures a CloudClient (local node URI for ECDSA/Taproot, demo server for EdDSA) and calls the corresponding createDuo*Session function. The ECDSA and Taproot examples use a local node URI with port 8080 and isSecure false, while the EdDSA example uses the hosted demo server with isSecure true. ```dart import 'dart:io'; import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk; Future setup([String cloudVerifyingKeyHex = 'SERVER_PUBLIC_KEY_HEX']) async { /// The port number is the port number of the cloud node. const port = 8080; /// The nodeUri is the URI of the cloud node. It is the IP address of the cloud node. /// Localhost url used for Android and iOS is shown below. /// 10.0.2.2 is the IP address of the Android emulator. /// 0.0.0.0 is the IP address of the iOS simulator. final nodeUri = Platform.isAndroid ? '10.0.2.2:$port' : '0.0.0.0:$port'; final cloudClient = sdk.CloudClient( baseUri: nodeUri, isSecure: false, ); final session = await sdk.createDuoEcdsaSession( cloudClient: cloudClient, cloudVerifyingKeyHex: cloudVerifyingKeyHex, storageClient: sdk.SimpleStorageClient(), ); return session; } ``` ```dart import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk; Future setup( [String cloudVerifyingKeyHex = '01cfa1ff5424d14eb60614d7ddf65a32243d26ddf7000d10007853d7336395efe4']) async { // Our hosted demo server — for quick testing. Run your own for production. final cloudClient = sdk.CloudClient( baseUri: 'demo-server.silencelaboratories.com', isSecure: true, ); final session = await sdk.createDuoEddsaSession( cloudClient: cloudClient, cloudVerifyingKeyHex: cloudVerifyingKeyHex, storageClient: sdk.SimpleStorageClient(), ); return session; } ``` ```dart import 'dart:io'; import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk; Future setup([String cloudVerifyingKeyHex = 'SERVER_PUBLIC_KEY_HEX']) async { /// The port number is the port number of the cloud node. const port = 8080; /// The nodeUri is the URI of the cloud node. It is the IP address of the cloud node. /// Localhost url used for Android and iOS is shown below. /// 10.0.2.2 is the IP address of the Android emulator. /// 0.0.0.0 is the IP address of the iOS simulator. final nodeUri = Platform.isAndroid ? '10.0.2.2:$port' : '0.0.0.0:$port'; final cloudClient = sdk.CloudClient( baseUri: nodeUri, isSecure: false, ); final session = await sdk.createDuoTaprootSession( cloudClient: cloudClient, cloudVerifyingKeyHex: cloudVerifyingKeyHex, storageClient: sdk.SimpleStorageClient(), ); return session; } ``` -------------------------------- ### Rust wallet creation output Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/no-user-authentication/setup-backend-no-auth Example output after successfully creating a wallet with the Rust CLI. ```text Wallet created and saved: key_id=ed4d3db3b7d7e0808f1921f59db01fa4834b82c6efae8ba2a2379b55a43a9c16 address=0xA3A1E2F5D465B0E6B08536c7522474f0A16BB0B8 file=.wallets.json ``` -------------------------------- ### Install OpenSSL on Windows via Chocolatey Source: https://docs.silencelaboratories.com/duo/general/getting-started/quickstart?platform=swift Installs OpenSSL on Windows using Chocolatey. Requires Chocolatey to be installed. ```bash choco install openssl ``` -------------------------------- ### Install core library with npm or yarn Source: https://docs.silencelaboratories.com/duo/actions/installation?platform=swift Install the core library using npm or yarn. Use a consistent install workflow throughout. ```bash npm install @silencelaboratories/silent-shard-sdk ``` ```bash yarn add @silencelaboratories/silent-shard-sdk ``` -------------------------------- ### Clone and enter the Trio initiator iOS project Source: https://docs.silencelaboratories.com/trio/general/getting-started/quickstart Clones the example-hub repository and changes into the iOS Trio initiator project directory. Run these commands before opening the Xcode project. ```bash git clone https://github.com/silence-laboratories/examples-hub.git cd examples-hub/silent-shard-sdk/with-ios/trio-initiator ``` -------------------------------- ### Precompute and Finalize Signature Example Source: https://docs.silencelaboratories.com/trio/actions/pre_sign A complete example showing the workflow of pre-signing and finalizing a signature using Example.swift. ```swift let messageHash = "e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03" // preSign precomputes the message-independent part of a signature; preSignFinal // turns it into a full signature once the message is known. ECDSA only. func performPreSignAndFinalize(keyId: String, trioSession: TrioSession) async -> Data? { // Compute the pre-signature. let preSignResult = await trioSession.preSign(keyId: keyId) switch preSignResult { case .success(let preComputedSignature): Swift.print("PreSign: success, size \(preComputedSignature.count)") // Finalize the pre-signature with the actual message. let finalResult = await trioSession.preSignFinal( preSignature: preComputedSignature, message: messageHash, derivationPath: "m" // This is the default; use your desired path, e.g. "m/1/2" ) switch finalResult { case .success(let signature): Swift.print("PreSignFinal: success, size \(signature.count)") return signature case .failure(let error): // show the error to the user or abort the process Swift.print(error) return nil } case .failure(let error): // show the error to the user or abort the process Swift.print(error) return nil } } ``` -------------------------------- ### publicKeyHex (get) Source: https://docs.silencelaboratories.com/api/react-native/mldsa-sdk/classes/MldsaKeyshare Gets the public key as a hexadecimal string. ```APIDOC ## publicKeyHex (get) ### Description Returns the public key as a hexadecimal string. ### Method Accessor (get) ### Returns string ``` -------------------------------- ### publicKeyBase64 (get) Source: https://docs.silencelaboratories.com/api/react-native/mldsa-sdk/classes/MldsaKeyshare Gets the public key as a Base64-encoded string. ```APIDOC ## publicKeyBase64 (get) ### Description Returns the public key as a Base64-encoded string. ### Method Accessor (get) ### Returns string ``` -------------------------------- ### Clone the examples-hub repository Source: https://docs.silencelaboratories.com/duo/cookbook/example-apps/silent-shard-sdk-examples/clone-and-build Clone the examples-hub repository and navigate to the silent-shard-sdk directory. Both Duo apps live in this repository, so clone it once and then pick the platform you want to run. ```bash git clone https://github.com/silence-laboratories/examples-hub.git cd examples-hub/silent-shard-sdk ``` -------------------------------- ### Create Web3 wallet with Golang CLI Source: https://docs.silencelaboratories.com/silent-network/cookbook/cookbook/tutorial-creating-web3-wallet/no-user-authentication/setup-backend-no-auth Executes the wallet creation command using the Golang CLI. ```bash go run . wallet -c -file wallets.json -t 2 -n 3 -signAlg secp256k1 ``` -------------------------------- ### keyIdHex (get) Source: https://docs.silencelaboratories.com/api/react-native/mldsa-sdk/classes/MldsaKeyshare Gets the key ID as a hexadecimal string. ```APIDOC ## keyIdHex (get) ### Description Returns the key ID as a hexadecimal string. ### Method Accessor (get) ### Returns string ``` -------------------------------- ### keyIdBase64 (get) Source: https://docs.silencelaboratories.com/api/react-native/mldsa-sdk/classes/MldsaKeyshare Gets the key ID as a Base64-encoded string. ```APIDOC ## keyIdBase64 (get) ### Description Returns the key ID as a Base64-encoded string. ### Method Accessor (get) ### Returns string ```