Nhảy tới nội dung

Architecture Guide

This document describes the internal architecture of the BIA (Biological Identity Attestation) protocol, covering data flows from raw biometric ingestion through to OIDC token issuance and on-chain verification.

System Overview

The BIA platform consists of six major subsystems that work together to transform biological signals into cryptographically-verifiable identity claims.

BIA Platform Architecture
Client Applications
Web, Mobile, Healthcare
OIDC / REST API
BIA OIDC Provider
Authorization, Token, UserInfo endpoints
Biometric Pipeline
Face, fingerprint, EEG
Capture
Genomic Pipeline
VCF markers, HLA
Parse
ZK Prover
Circom / Groth16
Prove
Liveness Engine
Active liveness check
Verify
Developer Platform
Apps, SDK, Stats
Build
Template Store
Encrypted biometric templates
Chain (L2)
Commitments & proofs
Biometric Blob Store
Encrypted raw captures
Six subsystems transform biological signals into cryptographically-verifiable identity claims

Component Summary

ComponentResponsibility
BIA OIDC ProviderStandards-compliant OpenID Connect server extended with biological identity claims
Biometric PipelineIngests face, fingerprint, and EEG signals; extracts templates; computes match scores
Genomic PipelineParses VCF files, extracts identity-grade SNP markers, generates commitments
ZK ProverCompiles Circom circuits, runs trusted setup, generates and verifies Groth16 proofs
Liveness EngineActive liveness detection to prevent replay and presentation attacks
Developer PlatformApp registration, SDK configuration, test flows, and usage analytics
Template StoreEncrypted biometric template storage (AES-256-GCM, user-held keys)
Chain (L2)Layer 2 for commitment anchoring, proof verification, and identity revocation
Encrypted Blob StoreRaw biometric data stored encrypted-at-rest, accessed only during re-verification

Data Flow: Registration

The registration flow transforms raw biological data into a cryptographic identity commitment.

Registration Flow
Capture & Process
1
User DeviceCapture face + fingerprint + EEG
2
Liveness EngineActive liveness check
3
UserUpload VCF file
4
Genomic PipelineParse VCF, extract 44 SNP markers
5
Biometric PipelineExtract & encrypt biometric templates
Prove & Anchor
6
ZK ProverReceive template hashes + genomic hash
7
ZK ProverGenerate identity commitment
8
ZK ProverCreate Groth16 proof
9
Chain (L2)Submit commitment + proof on-chain
10
Chain (L2)Verify proof, anchor commitment
CompleteRegistration complete — user receives commitment ID
Raw biometric data → ZK proof → on-chain commitment

Step-by-Step Breakdown

  1. Biometric capture -- The user's device captures face imagery, fingerprint scans, and EEG signals simultaneously. The liveness engine validates these are from a live person in real time.

  2. VCF upload -- The user uploads a VCF (Variant Call Format) file from a genomic sequencing provider. The genomic pipeline extracts 44 identity-grade SNP markers from autosomal chromosomes.

  3. Template extraction -- The biometric pipeline converts raw signals into compact mathematical templates (512-dimensional face embeddings, minutiae maps, EEG spectral features).

  4. Commitment generation -- The ZK prover takes hashes of all templates plus the genomic hash and produces a single identity commitment -- a binding, hiding cryptographic value.

  5. Proof generation -- A Groth16 zero-knowledge proof is generated proving the commitment was correctly computed from valid biometric inputs, without revealing those inputs.

  6. On-chain anchoring -- The commitment and proof are submitted to the Layer 2 chain. The verifier contract checks the proof and records the commitment with a block timestamp.


Liveness Pipeline

The liveness engine prevents presentation attacks (photos, videos, masks, synthetic biometrics) through multi-modal active challenges.

Liveness Verification Flow
Raw Capture
Quality Check
Active Challenge
Anti-Spoofing
Liveness Attestation
Face
Challenge: Random head pose (look left, up, blink)
Detects: Photos, flat masks, screen replays
Fingerprint
Challenge: Pressure variation (press hard, light, release)
Detects: Silicone molds, printed prints
EEG
Challenge: Cognitive task (mental arithmetic, oddball)
Detects: Pre-recorded EEG, signal injection
Signed attestation includes modalities checked, challenge IDs, device fingerprint, confidence score, and HSM signature.
Multi-modal active liveness prevents presentation attacks

Active Challenge Types

ModalityChallengeWhat It Detects
FaceRandom head pose sequence (look left, up, blink)Photos, flat masks, screen replays
FingerprintPressure variation pattern (press hard, light, release)Silicone molds, printed fingerprints
EEGCognitive task (mental arithmetic, visual oddball)Pre-recorded EEG, signal injection

Liveness Attestation

When liveness passes, the engine produces a signed attestation:

{
"attestation_type": "active_liveness",
"modalities_checked": ["face", "fingerprint", "eeg"],
"challenge_ids": ["ch_face_a1b2", "ch_fp_c3d4", "ch_eeg_e5f6"],
"timestamp": "2026-04-02T10:06:30Z",
"device_fingerprint": "dev_9x8y7z",
"confidence": 0.998,
"signature": "MEUCIQDk..."
}

This attestation is bound to the OIDC session and surfaces as bio_liveness_active: true in the id_token.


EEG Neural Fingerprint

The EEG neural fingerprint is BIA's highest-uniqueness biometric modality. It extracts a 15-feature identity vector from brain electrical activity that is stable over time yet unique to each individual.

15-Feature Model

The neural fingerprint extracts features across five frequency bands from three cortical regions:

Feature IndexFrequency BandCortical RegionFeature Type
1--3Delta (0.5--4 Hz)Frontal, Central, ParietalSpectral power ratio
4--6Theta (4--8 Hz)Frontal, Central, ParietalPhase coherence
7--9Alpha (8--13 Hz)Frontal, Central, OccipitalPeak frequency + asymmetry
10--12Beta (13--30 Hz)Frontal, Central, TemporalEvent-related desynchronization
13--15Gamma (30--100 Hz)Frontal, Parietal, TemporalCross-frequency coupling

Device Compatibility

Device TypeChannelsSampling RateBIA CompatibleNotes
Clinical-grade (BrainVision, g.tec)32--256500--2000 HzYesFull 15-feature extraction
Consumer-grade (Muse 2, Emotiv Insight)4--14256 HzYes12/15 features extractable
Single-channel (NeuroSky)1512 HzPartial6/15 features, reduced confidence
Ear-EEG (cEEGrid, IDUN)6--10250--500 HzYes10/15 features extractable
Minimum requirements

BIA requires at least 8 of 15 features for neural fingerprint authentication. This means a minimum of 4 EEG channels at 250 Hz or higher sampling rate.

Cognitive State Mapping to Health Vectors

During the neural fingerprint capture, the EEG data also yields five real-time health vectors derived from cognitive state analysis:

flowchart TD
EEG[Raw EEG Signal\n15 Features Extracted] --> ID[Identity Vector\n15-dim]
EEG --> HV[Health Vector Extraction]

HV --> CL[Cognitive Load\nTheta/Alpha Ratio\nFrontal Region]
HV --> SI[Stress Index\nBeta Asymmetry\nFrontal-Temporal]
HV --> SQ[Sleep Quality\nDelta Power\nGlobal Distribution]
HV --> FS[Focus Stability\nAlpha Suppression\nParietal-Occipital]
HV --> EV[Emotional Valence\nFrontal Asymmetry\nAlpha Band]

CL --> HVO[health_vectors Object\nin id_token]
SI --> HVO
SQ --> HVO
FS --> HVO
EV --> HVO
Health VectorDerivationValuesClinical Relevance
cognitive_loadTheta/Alpha ratio at frontal electrodeslow, normal, high, overloadCognitive impairment screening
stress_indexBeta asymmetry across frontal-temporal regionslow, moderate, high, acuteStress-related condition monitoring
sleep_qualityDelta power distribution and spindle detectionpoor, fair, good, excellentSleep disorder assessment
focus_stabilityAlpha suppression at parietal-occipital sitesunstable, moderate, high, exceptionalADHD screening, cognitive fitness
emotional_valenceFrontal alpha asymmetry (Davidson model)negative, neutral, positive, elevatedMental health baseline tracking
Health vectors require explicit consent

Health vectors are only included in the id_token when the bio:neuro scope is requested AND the user explicitly consents to cognitive state sharing during the authorization flow.


ZK Proof Pipeline

BIA uses zero-knowledge proofs to allow users to prove biological identity properties without revealing the underlying biometric data.

Pipeline Stages

flowchart LR
A[Circom Circuit\nDefinition] --> B[Circuit\nCompilation]
B --> C[Trusted Setup\nCeremony]
C --> D[Proving Key\n+ Verification Key]
D --> E[Proof Generation\nClient-Side]
E --> F[Proof Verification\nOn-Chain]

1. Circuit Compilation

BIA circuits are written in Circom 2.0 and compiled to R1CS (Rank-1 Constraint System):

CircuitConstraintsPurpose
bia-identity-v2~2.1MFull identity commitment (all modalities)
bia-genomic-commitment-v2~850KGenomic marker commitment only
bia-liveness-attestation-v1~320KLiveness attestation verification
bia-neuro-match-v1~1.4MNeural fingerprint matching
bia-selective-disclosure-v1~450KSelective claim disclosure

2. Trusted Setup

BIA uses a Groth16 proving system which requires a circuit-specific trusted setup ceremony:

  • Phase 1 (Powers of Tau): Shared across all circuits. BIA uses the Hermez ceremony with 54 participants.
  • Phase 2 (Circuit-specific): Conducted per circuit with a minimum of 10 independent participants. Ceremony transcripts are published and verifiable.

3. Proof Generation

Proof generation runs on the user's device (browser via WASM or native mobile):

CircuitProof Time (Mobile)Proof Time (Desktop)Proof Size
bia-identity-v2~12s~4s256 bytes
bia-genomic-commitment-v2~5s~1.8s256 bytes
bia-liveness-attestation-v1~2s~0.7s256 bytes
bia-neuro-match-v1~8s~2.5s256 bytes
bia-selective-disclosure-v1~3s~1s256 bytes
Proof generation is always client-side

Biometric data never leaves the user's device. The ZK prover runs locally and only the proof (256 bytes) and public inputs are transmitted.

4. Proof Verification

Verification happens both on-chain and off-chain:

  • On-chain: The L2 verifier contract checks the proof against the verification key. Gas cost is ~230K gas per verification.
  • Off-chain (OIDC mode): The BIA OIDC Provider verifies the proof server-side during the token exchange. This adds ~50ms to the token endpoint response time.

OIDC Authentication Flow

The complete authentication flow from the relying party's perspective:

sequenceDiagram
participant RP as Relying Party
participant UA as User Agent
participant BIA as BIA OIDC Provider
participant LE as Liveness Engine
participant BP as Biometric Pipeline
participant ZK as ZK Prover

RP->>UA: Redirect to /bio-oidc/authorize
UA->>BIA: GET /bio-oidc/authorize?...
BIA->>UA: Display biometric verification UI

UA->>LE: Begin biometric capture
LE->>LE: Active liveness challenge
LE-->>BP: Verified live capture

BP->>BP: Extract templates
BP->>BP: Match against stored templates
BP-->>UA: Match result + confidence

UA->>ZK: Generate identity proof (client-side)
ZK-->>UA: Groth16 proof (256 bytes)

UA->>BIA: Submit proof + biometric attestation
BIA->>BIA: Verify proof
BIA->>BIA: Compute bio claims
BIA->>UA: Redirect to redirect_uri?code=...

UA->>RP: GET /callback?code=...&state=...
RP->>BIA: POST /bio-oidc/token (exchange code)
BIA-->>RP: id_token + access_token

RP->>RP: Validate id_token signature
RP->>RP: Read bio claims
RP->>RP: Make authorization decision

Timing Budget

PhaseDurationNotes
Biometric capture3--8sDepends on modalities and challenge complexity
Template extraction200--500msRuns on-device
Liveness analysis500ms--1sServer-side analysis of challenge responses
ZK proof generation1--12sDepends on circuit and device capability
Token exchange50--100msIncludes server-side proof verification
Total (typical)5--15sEnd-to-end from start of capture to id_token

On-Chain vs OIDC Mode

BIA supports two verification modes. You can use both simultaneously for different parts of your application.

AspectOIDC ModeOn-Chain Mode
Identity assertionid_token JWT signed by BIACommitment on L2 chain
VerificationJWT signature checkSmart contract verification
Latency50--100ms2--15s (block confirmation)
CostAPI usage feeGas cost (~230K gas per verification)
PrivacyBIA sees bio claims, RP sees claimsNobody sees biometric data; only commitments
Offline verificationNo (needs BIA server)Yes (only needs chain access)
RevocationToken expiry + revocation endpointOn-chain revocation registry
Best forWeb apps, healthcare portals, quick integrationsDeFi, DAOs, privacy-critical applications
DecentralizationSemi-centralized (BIA OIDC Provider)Fully decentralized (chain + client)

Decision Guide

flowchart TD
A[Start] --> B{Need decentralized\nverification?}
B -->|Yes| C{Acceptable gas\ncosts?}
B -->|No| D[Use OIDC Mode]
C -->|Yes| E[Use On-Chain Mode]
C -->|No| F{Can tolerate\nhigher latency?}
F -->|Yes| G[Use On-Chain Mode\nwith batched proofs]
F -->|No| D
D --> H{Also need\non-chain anchoring?}
H -->|Yes| I[Use Hybrid:\nOIDC + Commitment]
H -->|No| J[OIDC Only]

Security Model

Trust Boundaries

+------------------------------------------------------------------+
| UNTRUSTED: User Device |
| +------------------------------------------------------------+ |
| | Biometric sensors, EEG device, browser/app environment | |
| | ZK proof generation runs here (biometrics never leave) | |
| +------------------------------------------------------------+ |
+------------------------------------------------------------------+
|
Proof + Attestation (no raw biometrics)
|
+------------------------------------------------------------------+
| SEMI-TRUSTED: BIA OIDC Provider |
| +------------------------------------------------------------+ |
| | Verifies proofs, issues tokens, manages sessions | |
| | Sees: bio claims, assurance level, proof validity | |
| | Does NOT see: raw biometrics, genomic data, EEG signals | |
| +------------------------------------------------------------+ |
+------------------------------------------------------------------+
|
id_token (signed)
|
+------------------------------------------------------------------+
| UNTRUSTED: Relying Party |
| +------------------------------------------------------------+ |
| | Verifies JWT signature, reads bio claims | |
| | Sees: bio_assurance_level, amr, liveness status | |
| | Does NOT see: biometric templates, match scores, raw data | |
| +------------------------------------------------------------+ |
+------------------------------------------------------------------+

Encryption Layers

LayerAlgorithmKey ManagementProtects
TransportTLS 1.3 (ECDHE + AES-256-GCM)Automated via ACMEAll data in transit
Template storageAES-256-GCMUser-derived key (HKDF from biometric + passphrase)Stored biometric templates
CommitmentPedersen commitment (BN254 curve)No key -- computationally hidingBiometric-to-identity binding
Blob storageAES-256-GCM + envelope encryptionKMS-managed DEK/KEK hierarchyRaw biometric captures
Token signingECDSA P-256 (ES256)HSM-backed, rotated quarterlyJWT integrity and authenticity

Key Hierarchy

Root Key (HSM, never exported)
|
+-- Token Signing Key (ES256, rotated quarterly)
| |
| +-- id_token signatures
| +-- access_token signatures
|
+-- Attestation Signing Key (ES256, rotated monthly)
| |
| +-- Liveness attestation signatures
| +-- Biometric match attestations
|
+-- KEK (Key Encryption Key, AES-256)
|
+-- DEK per user (Data Encryption Key, AES-256-GCM)
|
+-- Biometric template encryption
+-- Blob storage encryption

Scaling Considerations

Proof Generation Performance

Client-side proof generation is the primary bottleneck. Performance varies by device:

Device CategoryExamplebia-identity-v2 (2.1M constraints)Viable?
Flagship phone (2025+)iPhone 16 Pro, Pixel 9 Pro~8sYes
Mid-range phonePixel 8a, Galaxy A55~15sMarginal
Desktop (modern)M3 MacBook, Ryzen 7~4sYes
Desktop (budget)Intel i3-12100~8sYes
Browser (WASM)Chrome on flagship phone~12sYes
Browser (WASM)Chrome on mid-range phone~22sMarginal
Reducing proof time

For latency-sensitive applications, request only the modalities you need. bia-genomic-commitment-v2 (850K constraints) takes 3x less time than the full identity circuit.

Circuit Sizes and Artifacts

Artifactbia-identity-v2bia-genomic-commitment-v2bia-liveness-attestation-v1
R1CS file48 MB19 MB7 MB
Proving key72 MB28 MB11 MB
Verification key1.2 KB1.2 KB1.2 KB
WASM witness generator12 MB5 MB2 MB
Proof output256 bytes256 bytes256 bytes

Proving keys are downloaded once and cached on-device. The WASM witness generator loads into browser memory during proof generation.

Gas Costs (L2)

OperationGas (Optimistic L2)Approx. Cost at 0.01 gwei
Commitment registration~350K~$0.002
Proof verification~230K~$0.001
Identity revocation~80K~$0.0005
Batch verification (10 proofs)~1.2M~$0.007

Integration Patterns

Healthcare Applications

Use case: Patient identity verification for telehealth, prescription management, and clinical record access.

flowchart LR
P[Patient] --> BIA[BIA OIDC\nSubstantial Assurance]
BIA --> EHR[EHR System]
BIA --> TP[Telehealth\nPlatform]
BIA --> RX[e-Prescribing]

EHR --> |bio_assurance: substantial| AC1[Read medical\nrecords]
TP --> |bio_liveness: true| AC2[Start video\nconsult]
RX --> |bio_assurance: high\namr includes bio:face| AC3[Authorize\ncontrolled substance]

Recommended configuration:

  • Minimum assurance: substantial
  • Required modalities: face + fingerprint
  • Liveness: Required for every session
  • Scopes: openid bio bio:liveness

Clinical Trials

Use case: Participant identity verification, duplicate enrollment prevention, and consent verification.

Recommended configuration:

  • Minimum assurance: high
  • Required modalities: face + fingerprint + genomic commitment
  • Scopes: openid bio bio:liveness bio:genomic
  • Use bio_commitment_hash to detect duplicate enrollments across trial sites without sharing PII

Insurance

Use case: Policyholder verification for claims processing, fraud prevention, and remote identity proofing.

Recommended configuration:

  • Minimum assurance: substantial for routine claims, high for high-value claims
  • Required modalities: face (minimum); add fingerprint for claims above threshold
  • Scopes: openid bio bio:liveness
  • Use bio_match_score for step-up verification decisions

Identity Verification (KYC/AML)

Use case: Regulatory identity proofing where biometric binding to a real person is required.

Recommended configuration:

  • Minimum assurance: high
  • Required modalities: All available (face, fingerprint, eeg)
  • Scopes: openid bio bio:liveness bio:neuro bio:genomic
  • Use on-chain mode for audit trail immutability
  • Use zk_proof_id for regulatory audit references

Further Reading