NERO
Infrastructure

Infrastructure

How NERO Embedded Wallets work — MPC key splitting, server-side architecture, and security guarantees

Infrastructure

How Embedded Wallets Work

When a user logs in through your app, NERO creates a non-custodial wallet using threshold cryptography. The private key is split into two shares at generation time:

  • Device share — held on the user's browser, encrypted with a device-specific key
  • Server share — held by the NERO MPC Auth backend, protected by HSM and distributed across nodes

Both shares must cooperate to produce a signature. The full private key sk = sk_A × sk_B (mod q) is never reconstructed during normal signing operations. The MtA (Multiplicative-to-Additive) protocol allows each party to compute partial signatures independently, which are then combined into a standard ECDSA signature.

Key Distribution Model

Security relies on three independent factors:

FactorStorageProtectionCompromise Alone
Device factorUser's browser (IndexedDB)AES-256-GCM encryption with device-specific keyAttacker gets encrypted blob, unusable without device key
Auth factorNERO backend (PostgreSQL + HSM)AES-256-GCM + HSM key wrapping + Shamir sub-sharesAttacker gets one encrypted share, insufficient to sign
Recovery factorUser-managed backupPassword-protected composite blob (scrypt + AES-256-GCM)Attacker needs password (12+ chars, scrypt with N=131072)

Lost share recovery: If the device share is lost but NERO is online, the user re-authenticates and the SDK restores the share from the backend. If NERO goes permanently offline, the recovery factor enables full offline key reconstruction.

Threshold guarantee: Compromising any single factor is insufficient to forge signatures. An attacker needs the device share AND the server share simultaneously to sign transactions.

Server-Side Architecture

The NERO MPC Auth backend is a production-grade Express.js service implementing the server side of MPC protocols.

Request Processing Pipeline

Every API request passes through an 11-layer middleware chain:

LayerPurpose
Request IDUUID per request for tracing
Request loggingStructured logging for monitoring
Security headersHelmet CSP, HSTS, X-Frame-Options
API versioningRoute to correct handler version
Device IDTrack device across sessions
Content validationReject malformed payloads
Size limit1MB max request body
Global rate limitingPrevent abuse (100 req/15 min default)
API key validationAuthenticate the developer's project
CORS enforcementPer-project origin allowlisting
Per-key rate limitingPlan-based operation quotas

Data Layer

ComponentPurpose
PostgreSQLUsers, sessions, key shares, projects, billing, audit logs
Redis (optional)Rate limit counters, plan cache, WebSocket pub/sub
HSMKey material wrapping (AWS KMS, GCP Cloud KMS, or local for development)

Key Storage

Server key shares are stored encrypted at rest:

Server share (plaintext, in memory only during signing)


AES-256-GCM encryption (MPC_ENCRYPTION_KEY)


HSM key wrapping (AWS KMS / GCP Cloud KMS)


PostgreSQL (mpc_party_states table)


Optional: Shamir sub-shares distributed across N nodes

The mpc_party_states table stores:

  • Encrypted state blob
  • Encryption salt and IV
  • GCM authentication tag
  • State commitment hash (for integrity verification)

Distributed Deployment

For high availability, the server share can be split into N sub-shares using Shamir's Secret Sharing:

  • Sub-shares distributed across nodes in different regions
  • M-of-N threshold required for reconstruction
  • Each sub-share has its own per-share encryption
  • Inter-node authentication uses HMAC-SHA256 (node ID + timestamp + signature)
  • Coordinator node collects M sub-shares, reconstructs the share in memory, signs, then zeros the memory

Node roles:

  • Standalone — single server (development/small deployments)
  • Coordinator — orchestrates signing, collects sub-shares from workers
  • Worker — stores sub-shares, responds to coordinator queries

Security Measures

MechanismWhat It Protects Against
AES-256-GCM encryption at restDatabase compromise — shares are encrypted blobs
HSM key wrapping (AWS KMS / GCP KMS)Key material extraction — keys never leave hardware
Distributed Shamir sub-sharesSingle-node compromise — no node has the complete share
Rate limiting (per-key, per-operation)Brute force and resource exhaustion
CORS + domain allowlistingUnauthorized cross-origin requests
Device fingerprintingSession hijacking — binds sessions to physical devices
Audit loggingIncident investigation — full trail of all sensitive operations
MFA gating (TOTP, SMS OTP, email OTP)Credential theft — additional factor for sensitive operations
Schnorr proofs (DKLS)Protocol manipulation — proves correct execution
Feldman VSS commitments (Pedersen)Share tampering — verifiable secret sharing
PKCE for OAuthAuthorization code interception and CSRF

Dual Protocol Architecture

The backend implements two independent MPC protocols:

DKLS (Default)Pedersen DKG
Sharing modelMultiplicative: sk = sk_A × sk_B (mod q)Additive: sk = sk_A + sk_B (mod q)
Parties2 (client + server)N (multi-party)
Wallet typeEOA (Externally Owned Account)Smart Account (ERC-4337)
Key generation2 HTTP rounds (commitment → reveal with Schnorr proof)3 rounds via WebSocket (commitment → share → verify)
Signing5 HTTP calls using MtA with oblivious transfer3 phases via WebSocket with Lagrange interpolation
Zero-knowledge proofsSchnorr proof of knowledge (Fiat-Shamir)Feldman VSS polynomial commitments
TransportHTTP request/responseWebSocket for real-time coordination

Authentication Infrastructure

The backend supports 9 OAuth providers with full server-side implementation:

ProviderOAuth FlowUser Identifier
GoogleAuthorization Code + PKCEEmail
AppleAuthorization CodeEmail or Apple ID
GitHubAuthorization CodeEmail
DiscordAuthorization CodeEmail
LINEAuthorization CodeLINE user ID
LinkedInAuthorization CodeEmail
Twitter/XOAuth 2.0Email or handle
WeChatAuthorization CodeWeChat union ID
FacebookAuthorization CodeEmail

Plus passwordless methods: email OTP (via Resend), SMS OTP (via Twilio), and custom JWT verification.

Session management:

  • JWT-based (access token + refresh token)
  • Access token: 15 minutes default (configurable 1–60 min)
  • Refresh token: 7 days
  • Automatic token refresh at 60-second threshold
  • Device-bound sessions with fingerprint verification

Privacy

  • The only required stored identifier is an anonymized OAuth subject ID
  • No user email or name is stored by default (configurable per project)
  • Device keys are generated locally on the user's browser and never transmitted
  • Share exchange during key generation uses ephemeral ECDH keys (discarded after protocol completion)

Billing & Metering

Usage is metered per Monthly Active Wallet (MAW):

TierPriceMAW IncludedOverage
Free$0100
Growth$49/mo1,000Per-MAW pricing
Scale$149/mo10,000Per-MAW pricing

Metered events: wallet creation, signing operations, key material exports. See the Dashboard for plan management.

On this page