Dynamic devshard: per-escrow BLS DKG (NIZK dealings, on-chain T0) #1748
Replies: 2 comments 3 replies
|
One thing worth knowing before you settle the "failed DKG refunds" question, since it touches the
Filed with the details in #1749. Raising it here because a per-escrow DKG that leans on the same |
|
I like the original idea, especially removing the sequencer as the single authority capable of closing an escrow. A chain-verifiable committee authorization mechanism would make devshards substantially more resilient to a cheating or unavailable sequencer. My main concern is the increase in devshard startup time. Today, escrow creation requires one transaction and the shard can start almost immediately. With the proposed DKG, the escrow remains Have we considered alternative approaches or a phased implementation?
For option 3, the rule could be: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Dynamic devshard: per-escrow BLS DKG (NIZK dealings, on-chain T0)
Status: draft — design only; not implemented.
Related: host-initiated close in
finalization.This document specifies a per-escrow BLS12-381 distributed key generation (DKG) so a devshard has a stable root public key
PKthat a third party can check was generated by the hosts who actually dealt for that escrow. Dealings are publicly verifiable (NIZK). There is no complaint / dispute phase.Dealings are p2p off-chain. The chain sees only the final artifact
T0(signed dealings +PK). It re-verifies that artifact (hosts are not trusted). A deadline unions every valid signed dealing anyone submitted, so one assembler cannot drop a host. ThenPK = ∏ A_iover that union.Resharing (keep
PKafter a membership tx) is a follow-on. Genesis uniqueness does not depend on it.1. Summary
Today
MsgCreateDevshardEscrowlocks funds and samplesslots(typically 16 participant addresses). Settlement still uses per-slot signatures. There is no per-escrow BLS key, and the existingx/blsDKG is epoch-wide, interactive, and rebuilt every epoch.This proposal makes escrow creation heavier:
slots) — already true. The creator does not pick the host set.MsgSubmitDevshardT0with the artifact (signed dealings + claimedPK). Gas-free if the signer is a listed slot (§6.5). The chain re-verifies every dealing; “we already checked p2p” is not trusted.PKon the first tx. Untildkg_deadlineit unions every valid signed dealing from every submit (happy path = one fullT0; an omitted host adds only their dealing). At the deadline, if|D| ≥ t, it storesT0andPK = ∏ A_i. Otherwise DKG fails.PKis a compact quorum verifier key (telemetry, and optionally a settle encoding). It is not what makes host-initiated close or roster changes possible — see What this buys.PKalone is a group element and proves nothing about origin.T0is the proof. Hosts assemble it off-chain; the chain re-verifies and unions fragments so the submitter does not choose the dealer subset.Heavier create is the cost. The win is a chain-stored
PKthat third parties can check without trusting the creator or fetching n slot signatures — see What this buys.What this buys
The chain-stored
PKis a compact quorum verifier that a third party can check without trusting the escrow creator. That is the product. Self-settle and dynamic membership are not.Not a win: self-settle
Today
MsgSettleDevshardEscrowrequiressettler == escrow.Creator(VerifyDevshardSettlement) and2n/3+1per-slot secp signatures. Host-initiated close needs the first check dropped. The second check is already committee authorization.finalization.mdis the close protocol: off-chain vote/commit, then oneFinalizeSubmitcarryingVoteQC/CommitQC(or today’s slot signatures). The Cosmos signer can be any host or relayer. BLS is not required.A threshold signature
Verify(PK, settlement_digest, σ)can shrink that tx. Compactness is not a new capability and is not a reason to run this DKG. Per-slot signatures stay a valid settle encoding.Not a win: dynamic membership
Today
slotsare frozen atMsgCreateDevshardEscrow. Changing the roster without a new escrow is a membership tx (add host/remove host): updateslots, version the roster for nonce routing and quorum. That tx is required whether or not a BLS key exists — it is how every host and the chain learn who is in and when the set changed.Resharing (§11) does not replace that tx. It is extra work after the membership tx, only if a
PKalready exists and third parties should keep verifying the same key. BLS does not make the shard dynamic; the membership tx does. A new DKG on each add would only matter if you had chosenPKas a cached identity (telemetry below).Cross-devshard verifiable telemetry
Each host sits in many devshards. Inflight work (“how much is this host processing right now”) is local to a shard unless it is published. Self-signed load is cheap to lie about. A threshold BLS signature under that shard’s
PKis a quorum statement:Gossip
telemetry ‖ σamong chain participants (hosts / controllers), not as per-inference on-chain txs. Any other devshard:PKforescrow_idfrom chain (the DKG output).Verify(PK, telemetry, σ).No need to be in the escrow, no need for
T0at verify time, no trust in the gossip relay. The chain-storedPKis the verifier key. (n slot signatures would also work if the verifier fetches the currentslots;PKis the compact form.)Uses: avoid sending more work to a host already hot in other shards; validation / admission / routing with a shared view of in-process load.
Constraints (so this stays telemetry, not a second consensus):
escrow_id+ height (and maybe a monotonic telemetry nonce); ignore stale heights.PKthose attestations verify against.2. Goals
skunless they corrupt more than the signing threshold.PKis uniquely determined by this escrow’s ceremony id and the union of valid signed dealings at the deadline. A censored subset packed by oneT0sender cannot be the final product.T0without private shares and without a dispute round.PK, a membership tx may be followed by resharing soPKdoes not rotate. Resharing is not what changes the roster.slots; encryption and dealing signatures use each participant’s already-registered secp256k1 account key.MsgSubmitDevshardT0from a listed slot charges no fee. Cost is prepaid byCreateDevshardFee.PK. Compact BLS settle is an optional encoding, not a close-authority change.3. Non-goals (this document)
x/blsDKG used for network-wide PoC signatures.settler == Creatorand verify host quorum (CommitQCor slot signatures).finalization.mdowns that. BLS settle is optional compactness.add host/remove host) — required to changeslotswhether or not this DKG exists. This doc does not specify who may add or hownew_slotsis chosen.repeated DevshardSlotSignature.slotsis enough; NIZKs do not need extra rounds). This doc only requires: each dealing is signed, and the chain sees a union of those signed blobs by the deadline.T0(only if on-chain verify gas becomes a problem).4. Glossary
nn = len(slots) = GroupSize(16).tt = DevshardQuorumSlots(2n/3 + 1= 11).tshares reconstructsk/ a signature.A_ii’s public contributiong^{a_{i,0}}(G2, BLS12-381).PK∏ A_iover accepted dealers (all valid dealings at the deadline).PK_ii, used later for share verification and resharing.T0PK. Built p2p; chain re-verifies and unions fragments.T_kk≥1: old public shares, new committee, accepted reshare dealings, samePK.k+ new slot list).5. Why NIZK (and what it is not)
A signature on
A_ionly proves identityipublished a group element. It does not prove:iknowsa_iwithA_i = g^{a_i}(rogue-key / contribution cancellation: last dealer setsA_n = PK* · (∏_{j<n} A_j)^{-1}and knowssk*);Two NIZKs per dealing close that:
A_i(Schnorr / Fiat–Shamir), bound to the ceremony id — blocks cancellation.C_i[0] = A_i). Specified in §5.2 as DLEQ/PVSS, not Groth 2021.NIZKs do not by themselves name the dealers. Long-term signatures on the dealing do. NIZKs do not survive as a proof if the chain only stores
PKand throwsT0away.Protocol effect: dealing is one shot; aggregation is “keep valid dealings.” No
VERIFYINGphase, noMsgSubmitVerificationVector, no dispute txs.That path is specified at the message layer (§6.3–§6.4): the keeper re-verifies every dealing inside the submitted artifact; a bad dealing is dropped from the union (or fails that tx), not a complaint. Hosts already verified p2p; the chain does it again so a lying
T0cannot pass. What §5.1 specifies is which checks run.5.1 What the chain verifies (no DKG disputes)
On each dealing inside
MsgSubmitDevshardT0(and on any fragment merged before the deadline) the keeper MUST check, in order:slots, at most one dealing per slot in the union, window open. Not a NIZK.A_i = C_i[0]— Fiat–Shamir, bound toceremony_id. Anti-cancellation. Required. Foundational Schnorr/Fiat–Shamir patents have expired; this is the same class as RFC 8235.j, the ciphertext encryptsf_i(j)consistent with the Feldman vectorC_i. Anyone can check; recipients do not complain. Required for “no disputes.” Must not depend on Groth 2021 (§5.2).C_ihastcoefficients in the BLS12-381 subgroup used forPK.If any check fails, that dealing is not admitted to the union. There is no complaint phase.
Schnorr without (3) would still need Feldman decrypt-and-complain (today’s epoch
x/bls). That contradicts this section. Groth 2021 is one implementation of (3); it is not the spec.5.2 Share correctness without Groth 2021 (patent-avoidance)
Normative v1: Feldman vector + hashed-ElGamal in the same group as
g+ Chaum–Pedersen DLEQ, Fiat–Shamir (Schoenmakers-style PVSS, 1990s). No pairing product argument, no Groth NI-DKG.Each participant has an encryption key
pk_j = g^{x_j}in the same group as the Feldman generator (G2, matchingPK). Not secp256k1 ECIES: proving ECIES plaintext in a cheap NIZK is why people reach for SNARKs or Groth’s pairing encryption.For each recipient
j, dealeriwith shares = f_i(j):Fiat–Shamir for
π_jbindsceremony_id,i,j,C_i,R,U,ct.Chain (n = 16):
Y_jequals Feldman(C_i,j)π_jverifiesY_j ≟ g^{ct - H(ceremony_id ‖ i ‖ j ‖ U)}(this binds the plaintext to
Y_j; without it, hashed-ElGamal would need a recipient complaint)The chain never decrypts.
Recipient
j:s = ct - H(ceremony_id ‖ i ‖ j ‖ R^{x_j}). If the three checks passed,g^s = Y_jalready.Do not use for v1: Groth 2021 NI-DKG, Groth16, or a vendor SNARK/STARK stack. Those can carry implementation patents. Schnorr + DLEQ are 1980s/1990s sigma protocols whose foundational patents have expired. This is not a legal opinion; it is the construction this spec requires so we are not tied to Groth 2021.
Optional later: swap Groth-style multi-receiver pairing encryption behind the same
verify(dealing) → boolinterface (compression only). For n = 16 that is not expected to win on-chain verify cost — see §5.3.5.3 Comparison with Groth NI-DKG (2021)
Reference: Jens Groth, Non-interactive distributed key generation and key resharing, ePrint 2021/339. Not Groth16 (2016). (If “Groth 2011” is used loosely, it is the same pairing-NIZK family; the DKG paper is 2021.)
Same protocol. P2p one dealing per dealer, one
T0on chain, same deadline union, same Lagrange reshare (§11). Groth does not cut interactions or rounds.Different payload. DLEQ: Feldman vector + n hashed-ElGamals + n Chaum–Pedersen proofs. Groth: packed pairing CCA ciphertext + one pairing NIZK for the whole dealing.
O(t + n)ncheap G2 DLEQs + 1 Schnorr per dealingT0(n dealers)n²DLEQs (16² = 256at GroupSize)npairing verifiesn = 16: DLEQ is expected as fast or faster on-chain. Each DLEQ is a few G2 multi-exps (same class as existing BLS ops). Groth verify is pairings, which cost much more per op. Groth reduces count of proofs, not protocol work; at 16 slots that count is small, so pairings do not pay off. Groth’s win is large
n(Internet Computer scale), wheren²DLEQs andnElGamals dominate size and time.v1 stays DLEQ. Revisit Groth only if a profiled
MsgSubmitDevshardT0verify is too slow and counsel accepts that implementation.6. On-chain create → DKG → store PK
6.1 Escrow create (existing, extended)
MsgCreateDevshardEscrowstays the listing step:slotsfrom the model epoch group (currentGetSlotsFromSorted/app_hash/escrow_id/model_id).CreateDevshardFee(already charged at create) pre-pays on-chain artifact verify (MsgSubmitDevshardT0), not n dealing txs.New escrow fields (conceptual):
slotsdkg_statusPENDINGCOMPLETEDorFAILEDdkg_deadlinedkg_timeout_blocksbls_pkPKt0_hashH(T0)t0The escrow is not ready for inference while
dkg_status != COMPLETED. Hosts that would otherwise attach on create wait forPK.dkg_timeout_blocksis a new param: the dealing window. At that height the EndBlocker either finalizesPKor marksFAILED(refund / refusal, same spirit asrefusal_timeout).6.2 P2P dealings, on-chain artifact only
Dealings are not chain txs. Listed hosts gossip signed NIZK dealings among
slots(transport out of scope). Each host verifies Schnorr + DLEQ locally, decrypts its ciphertexts, and holds a candidate setD.What goes on-chain is the artifact: the set of signed dealings plus a claimed
PK. The chain re-verifies (same checks as hosts). “Already verified off-chain” is not an input.Waiting for a deadline and accepting a quorum is still required (offline hosts should not fail create). A single assembled
T0would otherwise allow:That is subset censorship, not a NIZK failure. Close it without putting n dealings on-chain in the happy path:
MsgSubmitDevshardT0.dkg_deadline, the keeper unions valid dealings by slot id from every submit (fullT0or a one-dealing fragment).PKis the product over that union at the deadline, not over a preferred blob.T0(all p2p dealings). Omitted host: one small extra submit of their signed dealing; it merges.A listed host who never dealt p2p and never submitted a fragment is absent, not censored.
6.3 Off-chain dealing window
Listed hosts watch
devshard_escrow_created. Each hosti ∈ slotsthat participates:f_iof degreet-1.C_i, per-recipient ElGamal + DLEQ, Schnorr onA_i, identity signature). Ciphertexts cover the fullslotslist.sk_iuntil the chain deadline (the accepted set may still grow).Any listed host may then submit:
Keeper, per dealing in the message:
dkg_status == PENDING, height< dkg_deadline.slots; if that slot already has a dealing in the union, the new one must be byte-identical (else reject that dealing).ceremony_idmatches §7.slotslist.Admit each valid dealing into the escrow’s union. Invalid dealings are skipped; they are not disputes. Claimed
pkis not stored until the deadline (recomputed from the union).Fee is 0 when the Cosmos signer is a listed slot (§6.5).
6.4 Deadline aggregation (chain freezes
T0)At
dkg_deadline, letDbe the union of admitted dealings, ordered by slot index.|D| < t(ormin_dealers):dkg_status = FAILED. NoPK.PK = ∏_{i ∈ D} A_i(ignore the claimedpkexcept as a sanity check: mismatch → still use the recomputed product, or fail the artifact if a submit insisted on a wrongpk— normative: always recompute)PK_iT0 = (ceremony_id, slots, D, PK, …),t0_hash,dkg_status = COMPLETEDdevshard_dkg_completedThe submitter never chooses the product. They only relay signed dealings the chain re-checks.
Accepted dealers set
sk_i = ∑_{j ∈ D} f_j(i)from ciphertexts in the frozenT0(same bytes they already had p2p if the union matches).6.5
MsgSubmitDevshardT0is gas-freePlan: listed hosts post the artifact (or a missing-dealing fragment) with zero gas fee. Create already paid; the signer must be ∈
slots. That is spam protection — at most a handful of T0 txs per escrow, not an open faucet.Ante (cheap, before DLEQ verify): 0 fee only if:
MsgSubmitDevshardT0;PENDING, height< dkg_deadline;slots.Anyone else pays the normal min fee.
Still meter gas. Cap dealings per tx and bytes. Prepaid verify budget (from
CreateDevshardFee) decrements on each dealing verified (success or fail) so a listed host cannot loop junk proofs for free forever.7. Ceremony id
Computed by hosts and by the keeper. Suggested preimage (canonical protobuf / byte encoding TBD):
Every NIZK challenge and every dealing signature MUST include
ceremony_id. That is what stops:T0;PKgenerated offline, or from a subset packed by one submitter.Reshare rounds use a different domain (
dkg/v1vsreshare/v1) and bind roundkplus the new slot list (§11). Genesis dealings cannot be replayed as reshares.8. T0 artifact
T0is public. It MUST NOT contain secret polynomials or decryptedsk_i.Minimum contents:
ceremony_id,n,tslots(create-time list)D ⊆ slots(those with a valid dealing by the deadline)D: the dealing already verified at submit timePKandPK_i(recomputable)T0is the concatenation of keeper-accepted dealings plus the EndBlocker product. It is not a message someone uploads.Storage:
T0/ fragments until the deadline; then the escrow points at the frozen union (t0_hashover canonical encoding).PKandH(T0). Full dealings stay on-chain (n = 16). Do not skip NIZK verify at submit and keep only a laterPK.Hosts keep
sk_iin local sealed storage (same class of problem asescrow-keys-at-rest.md, but for BLS shares).9. Cryptographic profile (v1)
PKand commitments in G2 (same convention as currentx/bls)t-1pk_j = g^{x_j}in G2 (§5.2). Not secp256k1 ECIES.A_i, Fiat–Shamir withceremony_idDo not use interactive Feldman + verification-vector acks for this ceremony.
10. Using PK after COMPLETED
PKfrom escrow query. They verify BLS signatures againstPK. They do not needT0unless they audit origin.Verify(PK, load_attestation, σ)across chain participants (What this buys).Verify(PK, settlement_digest, σ)as a compact stand-in for slot signatures /CommitQC. That does not replace droppingsettler == Creatoror the finalization commit procedure. Per-slot signatures remain sufficient.sk_i/PK_iamong hosts; aggregation is off-chain.Until
COMPLETED, gateways must not treat the escrow as live.11. Resharing ceremony (math)
Join/leave is a membership tx on mainnet (
add host/remove host). That tx is what changesslots. Recreating the escrow is unnecessary even with secp-only settlement.This section is only for keeping an already issued
PKafter that tx. A new DKG would sample a newskand a newPK, breaking telemetry verifiers that cached the old key. Resharing produces a fresh Shamir sharing of the sameskfor a new player set(n', t'). Who may add or remove, and hownew_slotsis chosen, belong on the membership tx — not here.11.1 What is already known
After genesis (or after
T_{k-1}), there is a unique polynomialFof degree< twithF(0) = skandPK = g^{sk}.Old player
iholdssk_i = F(i). Everyone can compute the public sharefrom the previous verification vector (evaluate commitments at
i). The chain storesPKand thePK_ifor the current committee.Write
λ_{i,Q}(0)for the Lagrange coefficient of old idiin a setQof sizet, interpolating at0:Any honest
t-setQof old shares satisfies∑_{i ∈ Q} λ_{i,Q}(0) · sk_i = sk, henceThat identity is what a reshare must preserve. It is not the genesis rule
PK = ∏ A_i(sum of fresh secrets). Mixing the two aggregations would yield the wrong key.11.2 Each old holder re-shares
sk_iOld dealer
idoes not sample a newa_{i,0}. They sample a polynomialg_iof degree< t'with constant term equal to their existing share:Verification vector
C'_i = (g^{g_i(0)}, g^{g_i,1}, …, g^{g_i,t'-1}). Encrypted valuesg_i(j)for every new player idjin the new slot list (sizen'). Same NIZK dealing shape as genesis: PoK of dlog ofC'_i[0], share-correctness of the ciphertexts.The binding that this is a reshare of the shard key, not a new DKG:
If that fails, the dealing is invalid. A dealer cannot re-share an arbitrary scalar and still pass.
Ceremony id for round
k(hosts and keeper):NIZKs and dealing signatures bind
reshare_id. Ciphertexts are addressed tonew_slots, not to the old list.11.3 Deadline set and canonical interpolating set
Each old slot that still holds
sk_ip2p-broadcasts one reshare dealing. Same inclusion as genesis: signed dealings,MsgSubmitDevshardTk(or reuse T0 msg shape) relays the artifact; union untilreshare_deadline; take every valid dealingD.If
|D| < t, the round fails.PKunchanged; old shares still work. NoT_k.If
|D| ≥ t, letQbe the canonicalt-subset ofD(lowest old slot indices inD). New shares and the new verification vector are interpolated fromQonly. Extra valid dealings (D \ Q) are stored and checked (C'_i[0] = PK_i) but do not enter Lagrange — using|Q| ≠ tin the sum below would be the wrong degree.This is the dual of genesis “product of all
A_i”: here the secret is already fixed, so the combinator is Lagrange on at-set, not a product over everyone who showed up.11.4 New shares
New player
jdecryptsg_i(j)for eachi ∈ Qand setsThen
sk'_j = F'(j)for a uniqueF'of degree< t'withF'(0) = sk. In generalsk'_j ≠ sk_jeven ifjwas already in the old committee.Public new verification vector (homomorphic, chain-computable):
Constant term:
That is the keeper check that the reshare did not change the root key. New public shares
PK'_j = C'(j)(evaluateC'at new ids). Oldsk_ifor members who left are useless forF'; they cannot sign under the new sharing.Add is the same formulas with
n' > n(new ids appear in the ciphertext list). Remove isn' < n(left ids get no new share).t'may equalt.11.5
T_kChain-built, like
T0:reshare_id, old slots, new slots,t,t',Q,DPK(must equalC'[0])PK'_jThird parties: origin is still
T0; current custody isT_k. Signature verify usesPKonly.Who may open a reshare round is the membership tx (or a follow-on after it). Fee exemption for reshare txs is not specified here. The math does not depend on them.
12. Open questions
|D|. Defaultt(11 of 16) matches signing quorum. A highermin_dealers(e.g.n-f) makes post-DKG liveness safer if more hosts drop. Not a trust issue if §6.2–§6.4 hold.slots[j](cold / account). Warm keys stay for session traffic, not for DKG identity.refusal_timeoutvs a dedicated DKG fail handler.13. Contrast with current
x/blsepoch DKGx/blstodayslotsPKstable for the escrowT0(§5–§6)T0T0on the escrowC_k0PK = ∏ A_iDo not overload
InitiateKeyGenerationForEpochfor devshards.14. Implementation sketch (when scheduled)
dkg_timeout_blocks, optionalmin_dealers; proto fields onDevshardEscrow;MsgSubmitDevshardT0.MsgSubmitDevshardT0is gas-free when signer ∈slots(§6.5), plus prepaid verify budget.sk_ifrom frozenT0.escrow_idrejected; omitted dealing still counts if submitted as a fragment; finalize only at deadline;PK = ∏ A_iover union; unlisted signer not fee-exempt.T_kafter a membership tx ifPKmust stay stable (§11).All reactions