LPsLux Proposals
Q-Chain
LP-4750

lp-4750-threshold-batch-pre-signing


lp: 4750 title: Threshold Batch Pre-Signing description: A single-pass batch kernel for the message-independent round of FROST and CGGMP21, processing M signers by N pre-signature slots in one dispatch author: Lux Core Team (@luxfi) discussions-to: https://github.com/luxfi/lps/discussions status: Draft implementation-rust: none implementation-cpp: partial implementation-go: none type: Standards Track category: Core tags: [threshold, mpc, frost, cggmp21, pre-sign, gpu, batch]

  • lp-4700
  • lp-4710
  • lp-4720
  • lp-4040

Abstract

Threshold signing is round-by-round and therefore stubbornly serial — round N cannot start until round N−1's transcript lands. But part of it is not.

Pre-signing is the portion of each protocol that does not depend on the message: nonce generation, commitment broadcast, and the per-signer scalar multiplications. Nothing in it needs to know what is being signed. So it can be done ahead of time, and — the point of this LP — M signers × N slots of it can be done at once, in one GPU dispatch, because every slot is independent of every other.

Amortized per-ceremony cost drops from O(M·N) sequential rounds to O(M) passes, with N parallelizing inside a pass. Signing itself, once the message arrives, stays serial and stays on CPU — that is LP-4040's class C, and it is a property of the protocol, not a gap.

Specification

FROST batch pre-sign

Each slot needs a nonce pair (d, e) per signer with commitments (D = d·G, E = e·G):

frost_batch_presign(M signers, N slots):
    # Stage 1: parallel nonce generation, M*N draws
    parfor (i, j) in M x N:
        d_{i,j} = sample_uniform(Fn)
        e_{i,j} = sample_uniform(Fn)

    # Stage 2: parallel scalar-muls, M*N points
    parfor (i, j) in M x N:
        D_{i,j} = d_{i,j} * G
        E_{i,j} = e_{i,j} * G

    # Stage 3: per-slot binding factor (canonical fold)
    for j in 0..N-1:
        rho_j = H_b(j, [D_{i,j}, E_{i,j} for i in 0..M-1])  # serial within slot

    return {(d_{i,j}, e_{i,j}, D_{i,j}, E_{i,j}, rho_j)}

Stages 1 and 2 fan out to M·N threads. Stage 3 is the canonical commit_root fold of LP-4040 — one thread per slot.

CGGMP21 batch pre-sign

Each slot needs a pre-signature (R, k_i⁻¹·χ_i) per signer:

cggmp21_batch_presign(M signers, N slots):
    # Stage 1: parallel nonce + chi-share generation
    parfor (i, j) in M x N:
        k_{i,j}     = sample_uniform(Fn)
        gamma_{i,j} = sample_uniform(Fn)

    # Stage 2: MtA pair products (the M*M*N quadratic blow-up)
    parfor (i, i', j) in M x M x N where i != i':
        share_{i,i',j} = mta_send(k_{i,j}, gamma_{i',j})

    # Stage 3: per-slot R combination + chi distribution
    for j in 0..N-1:
        Gamma_j   = sum_i (gamma_{i,j} * G)              # serial within slot
        R_j       = (Gamma_j)^{1/k_j}                    # k_j = sum k_{i,j}
        chi_{i,j} = k_{i,j} * x_i + sum_{i'} share_{i,i',j}

    return {(k_{i,j}, R_j, chi_{i,j})}

The M·M·N multiplicative-to-additive conversion in stage 2 dominates, and it is exactly what batching helps: one kernel pass saves M−1 round trips per slot. Stage 3 is again the canonical per-slot fold.

Determinism

sample_uniform(Fn) is deterministic on a session-bound seed, following the RFC 8032 §5.1.6 nonce derivation pattern applied per (session_id, signer_id, slot_id). No reproducible pre-signature escapes the session — slot consumption is single-shot.

Byte-equality across CPU, Metal, CUDA and WGSL is asserted on stage 3 outputs. Stage 1 and 2 outputs are checked by Schnorr / ECDSA verification of the cooked signatures produced from them, which is the right test — the nonces themselves are secret and should not be compared directly.

Known-answer tests

  • FROST: cross-oracle frost-secp256k1-tr (test-only), 5-of-7 threshold, N ∈ {1, 4, 16, 64, 256}, 50 random (session, signers) per N.
  • CGGMP21: cross-oracle multi-party-ecdsa (test-only), same threshold and slot counts.
  • crypto/{frost,cggmp21}/test/batch_presign_kat.json.

Performance target

End-to-end pre-sign throughput at 5-of-7, secp256k1, median of 25 runs. The N = 1 rows are measured; the batched rows are targets, not results, and are labeled as such:

ProtocolN slotsSequential baselineBatch (target)Ratio
FROST148.3 ms (measured, M1)48.3 ms (no batch)1.0×
FROST16772 ms152 ms5.08×
FROST643,091 ms458 ms6.75×
CGGMP211507 ms (measured, M1)507 ms (no batch)1.0×
CGGMP21168,112 ms1,142 ms7.10×
CGGMP216432,448 ms4,506 ms7.20×

The ratio grows with N and then flattens — the fixed per-dispatch cost is amortized away, and what remains is the serial per-slot fold.

Implementation status

PARTIAL:

  • FROST — full kernel shipped, Metal plus CUDA plus a WGSL host polyfill. Locally observed throughput: 128 commitments/s per backend at M = 10, N = 64.
  • CGGMP21 — full path shipped. cggmp21/cpp/paillier.{hpp,cpp} lands the 2048-bit Paillier scheme: keygen by 40-round Miller-Rabin 1024-bit safe-prime search, encrypt, decrypt, and the Π^enc sigma proof (prove and verify). All Z_{N²} arithmetic delegates to the 4096-bit Karatsuba modexp primitive (LP-4072). presign_one() produces status=0 records with real K_i = enc_N(k_i, ρ_{k_i}), G_cmt = enc_N(γ_i, ρ_{g_i}), and a pi_enc binding (K_i, k_i, ρ_{k_i}) when the caller provisions a valid PaillierKey. A zero public key emits status=0xFF, which is the legitimate "this signer's key is not provisioned" answer — the aggregator routes around it rather than failing the ceremony.

CGGMP21's ratios follow LP-4072's completion, because beyond the curve scalar multiplication the Paillier sub-step is what dominates.

Implementation

CPU canonical

crypto/frost/cpp/frost_batch_presign.{hpp,cpp} and crypto/cggmp21/cpp/cggmp21_batch_presign.{hpp,cpp}, sharing the secp256k1 scalar-mul and batch-inversion kernels (LP-4080) and the per-curve traits (LP-4082).

GPU kernels

{frost,cggmp21}_batch_presign.{metal,cu,wgsl} plus host drivers.

C-ABI

// FROST batch pre-sign — outputs M*N nonce pairs + N binding factors
int frost_batch_presign(uint32_t       M,                 // signers
                        uint32_t       N,                 // slots
                        const uint8_t *session_seed,      // 32 bytes
                        const uint8_t *signer_ids,        // M * 8 bytes
                        uint8_t       *nonce_pairs_out,   // M*N * 64 bytes (d,e)
                        uint8_t       *commit_pairs_out,  // M*N * 66 bytes (D,E compressed)
                        uint8_t       *binding_out);      // N * 32 bytes (rho)

// CGGMP21 batch pre-sign — outputs M*N k-shares + N R values + M*N chi shares
int cggmp21_batch_presign(uint32_t       M,
                          uint32_t       N,
                          const uint8_t *session_seed,
                          const uint8_t *key_shares,      // M * 32 bytes (x_i)
                          uint8_t       *k_shares_out,    // M*N * 32 bytes
                          uint8_t       *R_out,           // N * 33 bytes (compressed secp256k1)
                          uint8_t       *chi_out);        // M*N * 32 bytes

Output buffers are pre-signature material. The caller MUST treat them as one-shot, single-use and session-scoped. Reusing a slot across two messages reveals the long-term key — this is the same nonce-reuse failure that has broken ECDSA deployments repeatedly, arriving here in bulk.

Determinism harness

{frost,cggmp21}/test/batch_presign_test.{cpp,mm,cu} — M ∈ {3, 5, 7}, N ∈ {1, 4, 16, 64}, 25 random (session_seed, signer_ids, key_shares) triples per (M, N).

Security Considerations

  1. Pre-signature material (d, e, k, γ) is secret. Leaking any one of them reveals the long-term signing key. Constant-time scalar multiplication with a branchless conditional move is mandatory.
  2. Blinding does not apply here. The blinded-MSM discipline of LP-4040 protects secret scalars by randomizing them before a variable-time operation. That has no purchase in pre-signing, because the scalars themselves are the secret being produced — there is nothing to blind against. Constant-time arithmetic is the only defense.
  3. Deterministic nonce derivation MUST seed each sample_uniform with (session_id || signer_id || slot_id). Slot reuse is forbidden, and the kernel does not enforce slot-uniqueness — the session manager does.
  4. The CGGMP21 MtA send requires both signers' zero-knowledge proofs of well-formedness. This LP covers the scalar arithmetic of stage 2; the Paillier proofs run per round on CPU and are not batched.
  5. Batch sizes are capped at M ≤ 32, N ≤ 1024; larger batches force a re-dispatch. This is a defense against a hostile session manager pushing M·N > 2^20 and exhausting device memory.

Crossover

(M, N)BackendPath
M = 1 (single-signer)anysingle-key path
(M, N = 1)CPUsequential pre-sign
(M, N ≥ 4)Metal/CUDA/WGSLbatch kernel
(M, N ≥ 4)CPUtiled batch on a goroutine pool

Round-by-round signing after pre-sign stays CPU-only: a round cannot start until the previous round's transcript lands, so there is no parallelism above the pre-sign stage to harvest.

References

  • Komlo, Goldberg, "FROST: Flexible Round-Optimized Schnorr Threshold Signatures" (SAC 2020)
  • Canetti, Gennaro, Goldfeder, Makriyannis, Peled, "UC Non-Interactive, Proactive, Threshold ECDSA with Identifiable Aborts" (CCS 2020)
  • Lindell, Nof, "Fast Secure Multiparty ECDSA with Practical Distributed Key Generation" (CCS 2018) — the MtA primitive

Copyright (C) 2024-2026, Lux Industries Inc. All rights reserved.

Licensed under the MIT License.