Skip to main content

Cryptography

This document provides an overview of the cryptographic building blocks that drand uses to generate publicly-verifiable, unbiased, and unpredictable randomness in a distributed manner. The drand beacon has two phases (a setup phase, and a beacon phase), which we describe below.

Generally, we assume that there are nn participants, out of which at most f<nf<n are malicious. drand heavily relies on threshold cryptography primitives, where (at least) a threshold of t=f+1t=f+1 nodes have to work together to execute certain cryptographic operations successfully.

Threshold cryptography has many applications, as it avoids single points of failure. One such application is cryptocurrency multi-sig wallets, where tt-of-nn participants are required to sign a transaction using a threshold signature scheme.

Note: This document is intended for a general audience, and no in-depth cryptographic background knowledge is necessary to understand the presented concepts.

Setup phase

The purpose of the drand setup phase is to create a collective private, and public key pair shared among nn participants. This is done through a tt-of-nn Distributed Key Generation (DKG) process at the end of which each of the nn participants obtains a copy of the collective public key, together with a private key share of the collective private key. The key shares are computed such that no individual node knows the entire collective private key.

Each private key share can then be used to perform cryptographic threshold computations, such as generating threshold signatures, where at least tt contributions produced using the individual private key shares are required to successfully finish the collective operation.

A DKG is performed in a fully distributed manner, avoiding any single points of failure. We give an overview of the different sub-components of the drand DKG implementation in the following subsections.

🤐 Secret sharing

Secret sharing is an important technique that many advanced threshold cryptography mechanisms rely on. Secret sharing allows one to split a secret value ss into nn shares s1,,sns_1,\ldots,s_n such that ss can only be reconstructed if a threshold of tt shares is available.

Shamir's Secret Sharing (SSS) scheme is one of the most well-known and widely used secret sharing approaches, and it is a core component of drand. SSS works over an arbitrary finite field, but for simplicity, we use the integers modulo pp denoted by Zp\mathbb{Z}_p. Let sZps \in \mathbb{Z}_p denote the secret to be shared.

Share Distribution: To share ss a dealer first creates a polynomial q(x)=a0+a1x+...+at1xt1q(x) = a_0 + a_1x + ... + a_{t-1}x^{t-1} with a0=sa_0 = s and (random) aZpa \in \mathbb{Z}p for i=1,,t1i = 1,\ldots,t-1

The dealer then creates one share sis_i for each participant ii by evaluating q(x)q(x) at the integer ii and setting si=(i,q(i))s_i = (i,q(i)).

Secret Reconstruction: To recover the secret ss, one first collects at least tt shares, then uniquely reconstructs q(x)q(x) via Lagrange interpolation, and finally obtains ss as s=a0=q(0)s = a_0 = q(0).

Note that any subset of tt-of-nn shares can be used to perform Lagrange interpolation and uniquely determine ss. Having any subset of fewer than tt shares does not allow one to learn anything about ss, though.

🤫 Verifiable secret sharing

Shamir's Secret Sharing scheme assumes that the dealer is honest but this assumption might not always hold in practice.

A Verifiable Secret Sharing (VSS) scheme protects against malicious dealers by enabling participants to verify that their shares are consistent with those dealt to other nodes ensuring that the shared secret can be correctly reconstructed later on.

drand uses Feldman's VSS scheme, an extension of SSS. Let G\mathbb{G} denote a cyclic group of prime order pp in which computing discrete logarithms is intractable.

A cyclic group means there exists a generator gg such that any element xGx \in \mathbb{G} can be written as x=gax = g^a for some a0,,p1a \in {0,\ldots,p-1}.

Share Distribution: In addition to distributing shares of the secret to the participants, the dealer also broadcasts commitments to the coefficients of the polynomial q(x)q(x) of the form (A0,A1,,At1)=(gs,ga1,,gat1)(A_0,A_1,\ldots,A_{t−1}) = (g^s,g^{a_1},\ldots,g^{a_{t-1}}).

These commitments enable each participant ii to verify that their share si=(i,q(i))s_i = (i,q(i)) is consistent with respect to the polynomial q(x)q(x) by checking that gq(i)=j=0t1(Aj)ijg^{q(i)} = \prod_{j=0}^{t-1}(A_j)^{i^j} holds.

Secret Reconstruction: The recovery of secret ss works as in regular SSS with the difference that verified to be valid shares are used.

🔑 Distributed key generation (DKG)

Although VSS schemes protect against a malicious dealer, the dealer still knows the secret itself. To create a collectively shared secret ss such that no individual node gets any information about it, participants can utilize a Distributed Key Generation (DKG) protocol.

drand uses Pedersen's DKG scheme, which essentially runs nn instances of Feldman's VSS in parallel on top of some additional verification steps.

Share Distribution: Every participant ii creates a (random) secret siZps_i \in \mathbb{Z}_p and shares it with all other participants using VSS by sending a share si,js_{i,j} to each participant jj and broadcasting the list of commitments (Ai,0,Ai,1,,Ai,t1)(A{i,0},A_{i,1},\ldots,A_{i,t-1}) to everyone.

Share Verification: Each participant verifies the shares it receives as prescribed by Feldman's VSS scheme. If participant jj receives an invalid share si,js_{i,j} from participant ii, then jj broadcasts a complaint. Afterward, participant ii must reveal the correct share si,js_{i,j} or is considered an invalid dealer.

Share Finalization: At the end of the protocol, the final share of participant ii is si=jsj,is_i = \sum_j s_{j,i} for all participants jj that are valid, i.e., for all those jj not excluded during the verification phase.

The collective public key associated with the valid shares can be computed as S=jAj,0S = \sum_j A_{j,0} for all valid participants jj.

Note: Even though the secret created using Pedersen's DKG can be biased, it is safe to use for threshold signing as shown by Rabin et al.

🚨 Beacon phase

In the previous section, we gave an overview of how to produce a collective distributed key pair via a DKG protocol. In this section, we describe how to use this collective key pair to generate publicly-verifiable, unbiased, and unpredictable randomness in a distributed manner

We first give an overview of pairing-based cryptography (PBC) which has become quite popular lately and is used in many modern consensus protocols or zero-knowledge proofs such as zk-SNARKs.

Afterward, we show how drand uses PBC in the randomness beacon generation phase for threshold Boneh-Lynn-Shacham (BLS) signatures.

Finally, we explain how drand links the generated threshold BLS signatures into a randomness chain.

Pairing-based cryptography

Pairing-based cryptography is based on bilinear groups (G1,G2,Gt)(\mathbb{G}_1,\mathbb{G}_2,\mathbb{G_t}) where G1,G2,\mathbb{G}_1,\mathbb{G}_2, and Gt\mathbb{G_t} are cyclic groups of prime order pp with generators g1g_1, g2g_2, and gtg_t respectively, and a pairing operation e:G1×G2Gte : \mathbb{G}_1 \times \mathbb{G}_2 \to \mathbb{G}_t with the following properties:

Bilinearity: a,bZp,PG1,QG2\forall a,b \in \mathbb{Z}_p^{\ast}, \forall P \in \mathbb{G}_1, \forall Q \in \mathbb{G}_2, we have e(aP,bQ)=e(P,Q)abe(aP,bQ) = e(P,Q)^{ab}.

Non-degeneracy: e1e \neq 1.

Computability: There exists an efficient algorithm to compute ee.

drand currently uses the BLS12-381 curve.

🎲 Randomness generation

To generate publicly-verifiable, unbiased, distributed randomness, drand utilizes threshold Boneh-Lynn-Shacham (BLS) signatures.

Below we first describe regular BLS signatures followed by the threshold variant.

BLS signature

BLS signatures are short signatures that rely on bilinear pairings and consist only of a single element in G1\mathbb{G}_1.

They are deterministic in the sense that a BLS signature depends only on the message and the signer's key unlike other signature schemes, such as ECDSA, which requires a fresh random value for each signed message to be secure.

Put differently, any two BLS signatures on a given message produced with the same key are identical. In drand, we utilize this property to achieve unbiasability for the randomness generation. The BLS signature scheme consists of the following sub-procedures:

Key Generation: To generate a key pair, a signer first chooses a private key xZpx \in \mathbb{Z}_p^{\ast} at random and then computes the corresponding public key as X=g2xG2X = g_2^x \in \mathbb{G}_2.

Signature Generation: Let H:{0,1}G1H : \{0,1\}^{\ast} \to \mathbb{G}_1 denote a cryptographic hash function that maps arbitrary bit strings to elements of G1\mathbb{G}_1.

To compute a BLS signature σ\sigma on a message mm, the signer simply computes σ=xH(m)G1\sigma = xH(m) \in \mathbb{G}_1.

Signature Verification: To verify that a BLS signature σ\sigma on a message mm is valid, the verifier checks if e(H(m),X)=e(σ,g2)e(H(m),X) = e(\sigma,g_2) holds using the signer’s public key XX.

It is easy to see that this equation holds for valid signatures since e(H(m),X)=e(H(m),g2x)=e(H(m),g2)x=e(xH(m),g2)=e(σ,g2)e(H(m),X) = e(H(m),g_2^x) = e(H(m),g_2)^x = e(xH(m),g_2) = e(\sigma,g_2)

Signature threshold

The goal of a threshold signature scheme is to collectively compute a signature by combining individual partial signatures independently generated by the participants. A threshold BLS signature scheme has the following sub-procedures:

Key Generation: The nn participants execute a tt-of-nn DKG to setup a collective public key SG2S \in \mathbb{G}_2, and private key shares siZps_i \in \mathbb{Z}_p^{\ast} of the unknown collective private key ss, as described above.

Partial Signature Generation: To sign a message mm each participant ii uses their private key share sis_i to create a partial BLS signature σi=siH(m)\sigma_i = s_{i}H(m).

Partial Signature Verification: To verify the correctness of a partial signature σi\sigma_i on mm, a verifier uses the public key share SiS_i, which is generated during the DKG, and verifies that e(H(m),Si)=e(σi,g2)e(H(m),S_i) = e(\sigma_i,g_2) holds.

Signature Reconstruction: To reconstruct the collective BLS signature σ\sigma on mm, a verifier first needs to gather tt different and valid partial BLS signatures σi\sigma_i on mm followed by a Lagrange interpolation on them.

Signature Verification: To verify a collective BLS signature σ\sigma, a verifier simply checks that e(H(m),Si)=e(σi,g2)e(H(m),S_i) = e(\sigma_i,g_2) holds where SS is the collective public key.

Thanks to the properties of Lagrange interpolation, the value of σ\sigma is independent of the subset of tt valid partial signatures σi\sigma_i chosen during signature reconstruction.

Additionally, Lagrange interpolation also guarantees that no set of less than tt signers can predict or bias σ\sigma.

In summary, a threshold BLS signature σ\sigma exhibits all properties required for publicly-verifiable, unbiased, unpredictable, and distributed randomness.

🔏 Smaller signatures for resource constrained applications

The above description of the signature threshold scheme accurately describes how we generate signatures that contain all the necessary properties for randomness under the pedersen-bls-chained and pedersen-bls-unchained schemes. Under these schemes, messages are mapped to a point on G2\mathbb{G}_2 and public keys are a point on G1\mathbb{G}_1. As a result, message signatures are 96 bytes long and public keys are 48 bytes long. For systems where users are signing large messages and/or storing a lot of public keys, this trade-off makes a lot of sense: a 96 byte signature will be a small proportion of the entire message stored or transmitted. Additionally, signatures can be aggregated to save space, whereas aggregation isn't usually desirable for public keys, thus minimizing the size of the public keys is optimal for most systems. For drand however, we create a single public key at launch of the network and emit random beacons (and thus signatures) at a constant rate as long as the network is running. It is therefore more interesting to minimize the size of the signatures. As of v1.5.0 drand supports a new scheme, bls-unchained-on-g1, which exploits the bilinearity property of the BLS signature scheme to swap the generator groups for signatures and public keys such that signatures are created on G1\mathbb{G}_1 and public keys are a point on G2\mathbb{G}_2. This reduces the storage requirements of the node operators by 50% as well as reducing latency and costs for any downstream users that require fetching and storing random beacons (such as smart contracts).

Thus for that scheme, the following operations apply:

Key Generation: The nn participants execute a tt-of-nn DKG to setup a collective public key SG2S \in \mathbb{G}_2, and private key shares siZps_i \in \mathbb{Z}_p^{\ast} of the unknown collective private key ss.

Partial Signature Generation: To sign a message mm each participant ii uses their private key share sis_i to create a partial BLS signature σi=siH(m)\sigma_i = s_{i}H(m).

Partial Signature Verification: To verify the correctness of a partial signature σiG1\sigma_i \in \mathbb{G}_1 of the message mm, a verifier uses the public key share SiS_i, which is generated during the DKG, and verifies that e(H(m),Si)=e(σi,G2)e(H(m),S_i) = e(\sigma_i,G_2) holds.

Signature Reconstruction: To reconstruct the collective BLS signature σ\sigma of the message mm, a verifier first needs to gather tt different and valid partial BLS signatures σi\sigma_i of mm and then needs to perform a Lagrange interpolation on them using the coefficients generated during the distributed key generation.

⛓️ Chained and Unchained Modes

drand nodes currently support three schemes, though they can roughly be divided into two modes: chained or unchained.

The drand randomness beacon operates in discrete rounds rr. In every round, drand produces a new random value using threshold BLS signatures which can be linked together, or not, into a chain of randomness.

In chained mode, in order to extend the chain of randomness, each drand participant ii creates the partial BLS signature σir\sigma_i^r on the message m=H(rσr1)m = H(r || \sigma_{r-1}) in round rr, where σr1\sigma_{r-1} denotes the (full) BLS threshold signature from round r1r - 1 and HH is a cryptographic hash function.

randomness_chained.png Chained mode is supported by using the pedersen-bls-chained scheme.

In unchained mode, in order to produce unchained randomness, each drand participant ii creates the partial BLS signature σir\sigma_i^r on the message m=H(r)m = H(r) in round rr, where HH is a cryptographic hash function.

randomness_unchained.png

Unchained mode is supported by using the either the pedersen-bls-unchained or bls-unchained-on-g1 scheme.

Once at least tt participants have broadcasted their partial signatures σir\sigma_i^r on mm, anyone can recover the full BLS threshold signature σr\sigma_r.

At that point, the random value of round rr is simply its hash H(σr)H(\sigma_r).

Afterward, drand nodes move to round r+1r+1 and reiterate the above process.

For round r=0r=0, drand participants sign a seed fixed during the drand setup. In chained mode, this process ensures that every new random value depends on all previously generated signatures. Since the signature is deterministic, there is also no possibility for an adversary of forking the chain and presenting two distinct signatures σr\sigma_r and σr\sigma_r^{'} in a given round rr to generate inconsistencies in the systems relying on public randomness.

In a nutshell, this construction of using the hash of a BLS signature can be considered as a Verifiable Random Function because of the uniqueness of the signature output combined with the usage of the random oracle (the hash function). When the input is unpredictable, the output of the random oracle is indistinguishable from a uniform distribution.

Conclusion

To summarize, drand is an efficient randomness beacon daemon that utilizes pairing-based cryptography, tt-of-nn distributed key generation, and threshold BLS signatures to generate publicly-verifiable, unbiased, unpredictable, distributed randomness.

To learn more about the background of drand, we refer to the corresponding slides.

Finally, for more formal background on public randomness, we refer to the research paper titled "Scalable Bias-Resistant Distributed Randomness" published at the 38th IEEE Symposium on Security and Privacy.

The threshold scheme described here is described and proven in this paper from Boldyreva.

This recent Real World Crypto 2025 talk by Joseph Bonneau also covers the state of the art when it comes to randomness beacons and explains we cannot do "better" than drand without having "Verifiable Delay Functions".