A novel component of Anoma is a Distributed Key Generation (DKG) scheme. George Gkitsas describes the concepts in DKG, starting with simple constructions, building up to the aggregatable DKG.
Introduction
Many cryptographic applications currently require a trusted third party to generate and/or hold secrets. This party constitutes a single point of failure - it can be DoS-ed, breached or not operate in an honest manner. Removing the need for a trusted third party results in a more robust and trustworthy system.
Let's first specify the problem in more technical terms. We consider a node of a system a 'single point of failure' (SPOF) when at least one of the following is true:
the operation of the whole system fails if that node becomes unavailable (caused either internally or by an adversary)
the node has full access to the secret even for a single point in time
misbehaving of the node can make the system deliver incorrect results
Distributed Key Generation (DKG) allows a group of parties to generate and store a shared key, while preventing any single party from having access to that key at any point in time. Instead, each party holds a piece of information called a ‘key share’. The common secret might be used in either symmetric or asymmetric encryption, and in the latter case it has a public key counterpart.
In order to execute a cryptographic operation such as decryption or signing, a quorum of a minimum size above a threshold t must be assembled and each party of the quorum must participate in the process using their key share. More specifically, each party of the quorum uses their share to produce a partial result of the cryptographic operation. The partial results are then sent to a node that combines them to produce the final result of the operation. Note that this node doesn't acquire any knowledge of the key shares or the secret. Cryptographic algorithms that work in such a setup belong to the domain of threshold cryptography.
For example, assume a sender and a receiver, with the sender wishing to send encrypted data to the receiver and the receiver not to be trusted with the secret key. A group of parties that share the secret is used on the receiver's side. The sender will use the group's public key to encrypt the data and send it over to the receiver. Upon receipt, the receiver will send the encrypted data to the group's parties requesting a decryption. Each party (decryption server) will perform an operation on the encrypted data using its share and the result (decryption share) will be sent back to the receiver. The receiver will check the validity of each received decryption share in turn. The receiver can fully decrypt the encrypted data when it collects a number of valid decryption shares that exceeds the threshold value.
The above works similarly for signing. The parties will be the signing servers and each one will produce a signature share that will be sent to a server for validation. Once that server collects an amount of valid signature shares that exceeds the threshold, it is able to compile the group signature on the data. The signature can be verified by any third party using the group's public key.
This post starts by explaining simpler constructions and builds up to the Aggregatable DKG construction.
“If you want to keep a secret, you must also hide it from yourself.”
― George Orwell, 1984
Secret sharing
We start with the problem of storing a common secret without having a SPOF. The secret needs to be held by the parties in the form of shares and it shouldn't be possible to disclose the secret unless a quorum is assembled. Secret sharing schemes offer exactly that and are the basis of DKG constructions. We will focus on Shamir’s Secret Sharing (SSS).
SSS makes use of the property that a polynomial of degree d can be uniquely reconstructed by any set of d+1 points using the Lagrange interpolation.SSS works as follows.Assume there exist n parties Pi,i∈[1,n] and the threshold is set at t(1≤t≤n):
A ‘dealer’ generates a secret s∈Fp and constructs a random polynomial f(x)=i=0∑taixi in Fp, of degree t and with its constant term set to the secret value f(0)=f0=s.
The dealer then calculates n shares si=f(i),∀i=1,2..,n.
The shares are privately ‘dealt’ to the parties (sharing phase).
From this point and after, any t+1 parties (and no less) can use their shares to reconstruct the polynomial and thus reveal the secret (reconstruction phase).
SSS is depicted in the following figure.
In SSS, we trust the dealer to be honest. A dealer is honest when it deals shares that are consistent, ie. shares that are generated using the same polynomial. If the shares are not generated by the same polynomial, then different quorums composed of different parties will reconstruct different secret values. Here the dealer is able to force the system to operate in an inconsistent manner and thus poses a SPOF. Omitting our trust that the dealer is honest forces us to use a share validation mechanism.
A Verifiable Secret Sharing (VSS) scheme protects against such a malicious dealer by enabling parties to verify the shares’ consistency and thus ensuring that the shared secret can be correctly reconstructed. For example, Feldman’s VSS (Fel-VSS) extends SSS to a VSS by making the dealer broadcast homomorphic commitments to each of the polynomial’s coefficients Fi=gai. Alternatively we can view these commitments as one commitment to the polynomial:
F(x)=i=0∏tFixi=g∑i=0taixi=gf(x)
The parties can use these commitments to verify that their share belongs to the polynomial by checking if
gis=F(i)=j=0∏tFjij
Distributed Key Generation
Up to this point, we have removed the need of trusting the dealer to be honest by using a VSS, but we still bear the risk of the dealer becoming non-operational or leaking the secret. In order to avoid the above in a DKG, the secret needs to be generated in a distributed manner as opposed to being centrally generated by one dealer. We will now present how Pedersen’s DKG works.
In Pedersen’s DKG (Ped-DKG), all parties are dealers following Fel-VSS. This technique of making all parties dealers following a VSS is how many DKGs are constructed. The protocol works as follows:
Each party Pi generates a secret si, a random polynomial fi(x)=i=0∑taixi with degree t and a Feldman commitment to it Fi(x)=∏igaixi.
It then calculates its public key share pi=gsi and broadcasts a commitment to it Ci=C(pi,ri).
When all Pi finished broadcasting, each Pi opens Ci and the shared pubic key is set to pk=i=1∏npi with the corresponding secret being s=i=1∑nsi.
Finally, Pi broadcasts the commitment to the polynomial and distributes shares sij of its secret to all other parties Pj (sharing phase).
Ped-DKG features a complaint round inside the sharing phase to remove invalid shares.When the verification of a share sxy fails, Py broadcasts a complaint against Px.If the complaints against Px are more than t, then Px is disqualified. If they are less than t but not 0, then Px publishes all sxy that had a complaint, and if any of those shares fails verification, then Px is disqualified.Disqualified parties are excluded from contributing to the secret by setting their shares to 1.
The state of the system after the sharing phase is completed is such that each participating party holds n−1 shares and their own secret.For reconstructing the shared secret we need to obtain all secrets si by reconstructing each polynomial fj(x).For that we need t+1 points for each polynomial.Since each party has a point of each polynomial, any t+1 parties suffice to reconstruct all n secrets and thus reveal the common secret.
Ped-DKG assumes a fully synchronous communication model according to which all messages are delivered within a strict time bound. This assumption provides assurance that this protocol will always terminate successfully.
Ped-DKG can tolerate dishonest parties that don't form a majority:n≥2t+1⟹t≤2n+1
Ped-DKG performance can be reviewed by the following metrics:
Verification complexity: O(n2) operations since every party needs to verify shares from all others
Broadcast messages: n broadcast messages of size O(n)
Different DKG algorithms can provide performance improvements as well as other benefits. Here, we will focus on the recently released Aggregatable DKG protocol.
Aggregatable DKG
The Aggregatable DKG (Agg-DKG) provides a significant performance improvement compared to other DKGs by leveraging aggregation. It uses a modified version of the Scrape PVSS as its underlying VSS.
Modified Scrape PVSS (Scrape)
Scrape is a Publicly Verifiable Secret Sharing protocol based on Fel-VSS, that provides the ability for any party, internal or 3rd, to verify the dealt shares. Scrape doesn't need a complaint round since all parties will agree on the set of valid shares based on the common public information. Since the shares need to be publicly verifiable, they are published encrypted, with each party being able to decrypt only its corresponding share. Additionally, it has properties that allow the usage of aggregation of different shared secrets. In the following subsections we describe the operations that Scrape provides.
Initialization
All parties share a Common Reference String (CRS) that includes:
a bilinear group bp=(g1∈G1,h^1∈G2)
encryption keys eki∈G2 of each party Pi with corresponding decryption keys dki∈F:eki=h^1dki (Pi keeps dki secret).
Sharing Phase
The dealer chooses a secret value a0 and sets the secret key sk=h^1a0=h^1f(0). The result of the sharing phase is the PVSS transcript that is publicly accessible and comprises of:
commitments to the polynomial's factors (Fi=g1ai)
commitments to all the dealt shares (Ai=g1f(ωi))
encryptions of all dealt shares (Y^i=ekif(ωi)).
Verification
Verification starts with checking the shares' commitments against the polynomial commitment and then checks if the encrypted shares correspond to the shares of those commitments:
j∏Ajlj(β)=?j∏Fiβj
e(g1,Y^j)=?e(Aj,ekj),∀j∈[1,n]
with Ij being the corresponding Lagrange polynomial, β$F a nd e:G1×G2GT is a Type III bilinear map. We are certain that the shares that pass the above checks belong to the committed polynomial and they are the same shares with the committed ones.
Secret reconstruction
To reconstruct the secret a quorum S of t+1 parties first needs to decrypt their shares A^i=Y^idki−1=h^1f(ωi) and check if their bilinear mapping check holds e(g1f(ωi),h^1)=e(g1,h^1f(ωi)).The secret key is reconstructed using the Lagrange interpolation in the exponent at point 0:
sk=∏∗i∈SA^_ili(0)=h^_1∑∗i∈Sf(ωi)li(0)=h^_1f(0)
Aggregation
Aggregation of PVSS transcripts can be achieved due to the homomorphicity of the commitment and encryption schemes used. Given two polynomials, f1,f2 with corresponding transcripts:
we calculate the transcript pvss3 that corresponds to f3=f1+f2 by:
F3,i=F1,iF2,i,∀i∈[1,t]
A3,i=A1,iA2,i,∀i∈[1,n]
Y^3,i=Y^1,iY^2,i,∀i∈[1,n]
Agg-DKG
Agg-DKG is constructed as per Ped-DKG by making all parties Scrape dealers. Each dealer generates its own secret ci and its PVSS transcript (n PVSS transcripts are generated in total). The group's public key is pk=(g1a,u^1a)∈G1×G2 and the secret key is sk=h^1a∈G2 , where a∈F and u^1∈G2.
Each dealer deals a secret h^1ci and a=∑Qci. Q is the set of honest dealers and is uniquely determined by all parties based on the same public data.
Each dealer will need to provide a signed proof of knowledge for its secret. In Agg-DKG this is achieved by issuing a Signature-of-Knowledge (SoK). Each dealer is equiped with a signing key pair (ski,vki). To produce the SoK it first commits to its secret Ci=g1ci and then signs it:
The simplest way to verify shares would be that all parties verify all PVSS transcripts.But since the PVSS transcripts can be aggregated, it becomes possible for verifiers to verify aggregations of transcripts.Agg-DKG uses gossiping of aggregated transcripts instead of an all-to-all approach to reduce the total verification complexity from O(n2) to O(nlog2n).Since gossiping is random, the aggregation might include the same transcript several times.To reflect that, share weights wi are included in the calculation of the final secret, which becomes sk=∑Qwici.
To incorporate all the above, Agg-DKG augments the PVSS transcript described previously to the DKG transcript:
tr=((C0..Cn),(w0..wn),(σ0..σn),pvss)
where pvss is an aggregated PVSS transcript.
A transcript is called full transcript if it is valid and includes t+1 contributions. A valid transcript is a transcript that passes verification (see below). Clearly, more than one full transcript exists.
Aggregation
Aggregation of DKG transcripts is performed by aggregating the pvss, merging the Ci and σi vectors and element-wise summing the wi vectors. The resulting transcript will refer to the combined polynomial that corresponds to the weighted shares.
Verification
Verification of a DKG transcript starts with verifying pvss first.Then, for every contribution i:wi=0, σi gets verified.Finally, verification that all the corresponding commitments are consistent to the combined polynomial commitment in pvss takes place.
Protocol
Agg-DKG works under the fully synchronous communication assumption. That means that there is a strict time bound between rounds and all messages (honest and adversarial) within a round will be seen by all parties by the end of the round. The protocol is as follows:
each dealer Pi starts by constructing its own DKG transcript:
it deals Scrape shares and sets pvss to the resulting PVSS transcript.
it then generates its commitment and SoK and setting its weight to 1.
the rest of commitments and SoKs are set to ⊥ and their weights to 0.
These initial DKG transcripts are gossiped and a process of verify → aggregate → gossip rounds starts in the network. At any point the transcripts in circulation will be aggregations of some of the initial transcripts. The following take place in each round of this phase:
each party verifies incoming transcripts and aggregates the ones that pass verification
each party broadcasts their newly aggregated non-full transcript to O(clogn) randomly selected parties (c chosen as a small number ≥4)
each party that generates a full transcript after aggregation will broadcast it to all nodes with a probability of n2.
all parties decide to keep the full transcript for which the corresponding public key pk has the smallest bit-count in binary representation.
We notice that the protocol's termination relies on constructing a full transcript. This is bound to happen after enough rounds take place in the synchronous setup. The first round that a full transcript was broadcasted is agreed to be the last round of the protocol. There is a chance that more than one full transcripts were broadcasted during the last round. The last point in the protocol description deals with this case.
The above results in a communication complexity of O(clog2n) broadcasts.
Agg-DKG can handle tc<2n−logn crashed nodes and can tolerate tb≤logn corrupted parties by a byzantine adversary.The threshold upper bound can be computed by:
t≤n−tc−tb⟹t<2n
Final Thoughts
Agg-DKG has a performance advantage over other schemes that makes it scale better for real-world applications. Additionally, the usual complaint rounds during sharing are replaced by a gossiping protocol, which likely requires comparable effort to implement. Also, an indirect benefit of being publicly verifiable is that crashed nodes are able to obtain their secret shares as long as they come back online without being excluded and without losing their decryption key.
On the other hand, Agg-DKG is based on a synchronous communication model that assumes that all messages are delivered in bound time. This assumption might not be accurate when using real-world communication means such as the Internet. Finally, the secret key and secret shares are group elements instead of field elements. This prevents the usage of Agg-DKG with many well-known cryptosystems that operate on shares that are field elements.
In a future post, we will describe the work we do on DKGs as part of the Anoma protocol, presenting the decisions taken and explaining the reasoning behind them.
Written by George Gkitsas, previously a zero-knowledge cryptography researcher & protocol developer at Heliax, the team building the Anoma Protocol.
If you're interested in zero-knowledge cryptography and cutting-edge cryptographic protocols engineering positions in Rust, check out the open positions at Heliax.