For the complete documentation index, see llms.txt. This page is also available as Markdown.

ARCHITECTURE

Overview

This is a 3-Party Threshold ECDSA MPC (Multi-Party Computation) Wallet system built on AWS Nitro Enclaves. It enables distributed key generation and signing where no single party holds the complete private key, ensuring enhanced security for Ethereum wallet operations.

DKG (Distributed Key Generation) Flow

Browser (mpc-client.html):

  • Generate client polynomial: f_c(x) = a0 + a1*x

  • Compute evaluations: f_c(1), f_c(2), f_c(3)

  • Compute public commitment: G * a0

  • Generate ECDH keypair for encryption

Parent Relays to EnclaveValidates the request body and calls sendToEnclave({ type: 'dkgInit', data: {...} }).

Enclave Processes DKG Init Generates session ID, ECDH keypair, enclave and server polynomials, derives shared secret, stores pending DKG state in memory.

Browser Completes DKGDecrypts enclave share, combines: Share 1 = f_c(1) + f_e(1) + f_s(1), encrypts client share 3, posts to /api/dkg/contribute.

Parent Generates KMS KeyCalls generateDataKey() from AWS KMS, receives { plaintextKey, encryptedKey }, then relays with data key to enclave.

Enclave Completes DKG Computes Share 2 & Share 3 via Lagrange, derives Ethereum address from combined public key, encrypts shares with AES-256-GCM.

Parent Stores & RespondsUploads sessionId.json with encrypted shares and data key to S3. Returns { ethereumAddress, combinedPublicKey } to browser.

Complete Signing Flow

3. Enclave Flow

The Nitro Enclave is an isolated VM instance with no network access and no persistent storage. All communication is via vsock only, and all cryptographic operations occur within this hardware-isolated environment.

Enclave Architecture

Request Types Handled by Enclave

Type
Handler
Purpose

health

healthHandler

Return enclave health status

status

statusHandler

Return initialization status

dkgInit

dkgInitHandler

Initialize DKG session

dkgContribute

dkgContributeHandler

Complete DKG, generate shares

partialSign

partialSignHandler

Create partial ECDSA signature

simpleSign

simpleSignHandler

Simple signing (legacy)

signComplete

signCompleteHandler

Complete signing (legacy)

getSession

getSessionHandler

Retrieve session info

deleteSession

deleteSessionHandler

Clear session data

init

initHandler

Legacy single-step DKG

runRust

runRustHandler

Execute Rust attestation binary

compute

computeHandler

Generic computation


4. Vsock Communication Flow

What is Vsock?

Vsock (Virtual Socket) is a communication protocol that enables communication between a virtual machine and its hypervisor/host, or between virtual machines. In AWS Nitro Enclaves, vsock is the only communication channel between the parent EC2 instance and the enclave.

Vsock Configuration

Vsock Connection Lifecycle

Vsock Request/Response Protocol

Vsock (Virtual Socket) is the only communication channel between the parent EC2 instance and the Nitro Enclave. Each request opens a new connection, sends JSON, waits for a newline-terminated JSON response, then closes.

Parent → Enclave Communication Code

Enclave Vsock Server Code

5. Security Architecture

3-Party Threshold Setup

Encryption Layers

Data Flow Security

Last updated