Try   HackMD

Drand: Cryptographic Background

This document provides an overview on the cryptographic building blocks that drand uses to generate publicly-verifiable, unbiasable, 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

n participants out of which at most
f<n
are malicious. drand heavily relies on threshold cryptography primitives, where (at least) a threshold of
t=f+1
nodes have to work together to successfully execute certain cryptographic operations. Threshold cryptography has many applications as it allows to avoid single points of failure. One such application are cryptocurrency multi-sig wallets, where
t
-of-
n
participants are required to sign a transaction using a threshold signature scheme.

Note: This document is intended for a general audience and no deep 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

n participants. This is done through a
t
-of-
n
Distributed Key Generation (DKG) process at the end of which each of the
n
participants obtains a copy of the collective public key together with a private key share of the collective private key 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
t
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 to split a secret value

s into
n
shares
s1,,sn
such that
s
can only be reconstructed if a threshold of
t
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

p denoted by
Zp
. Let
sZp
denote the secret to be shared.

Share Distribution: To share

s, a dealer first creates a polynomial
q(x)=a0+a1x++at1xt1
with
a0=s
and (random)
aiZp
for
i=1,,t1
and then creates one share
si
for each participant
i
by evaluating
q(x)
at the integer
i
and setting
si=(i,q(i))
.

Secret Reconstruction: To recover the secret

s, one first collects at least
t
shares, then uniquely reconstructs
q(x)
via Lagrange interpolation, and finally obtains
s
as
s=a0=q(0)
. Note that any subset of
t
-of-
n
shares can be used to perform Lagrange interpolation and uniquely determine
s
. Having any subset of less than
t
shares does not allow to learn anything about
s
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 denote a cyclic group of prime order
p
in which computing discrete logarithms is intractable. A cyclic group means there exists a generator
g
such that any element
xG
can be written as
x=ga
for some
a{0,,p1}
.

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) of the form
(A0,A1,,At1)=(gs,ga1,,gat1)
. These commitments enable each participant
i
to verify that their share
si=(i,q(i))
is consistent with respect to the polynomial
q(x)
by checking that
gq(i)=j=0t1(Aj)ij
holds.

Secret Reconstruction: The recovery of secret

s works as in regular SSS with the difference that verified to be valid shares are used.

Distributed Key Generation

Although VSS schemes protect against a malicious dealer, the dealer still knows the secret itself. To create a collectively shared secret

s 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
n
instances of Feldman's VSS in parallel on top of some additional verification steps.

Share Distribution: Every participant

i creates a (random) secret
siZp
and shares it with all other participants using VSS by sending a share
si,j
to each participant
j
and broadcasting the list of commitments
(Ai,0,Ai,1,,Ai,t1)
to everyone.

Share Verification: Each participant verifies the shares it receives as prescribed by Feldman's VSS scheme. If participant

j receives an invalid share
si,j
from participant
i
, then
j
broadcasts a complaint. Afterwards, participant
i
must reveal the correct share
si,j
or is considered an invalid dealer.

Share Finalization: At the end of the protocol, the final share of participant

i is
si=jsj,i
for all participants
j
that are valid, i.e., for all those
j
not excluded during the verification phase. The collective public key associated with the valid shares can be computed as
S=jAj,0
for all valid participants
j
.

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 on 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, unbiasable, 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. Afterwards 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) where
G1
,
G2
, and
Gt
are cyclic groups of prime order
p
with generators
g1
,
g2
, and
gt
, respectively, and a pairing operation
e:G1×G2Gt
with the following properties:

Bilinearity:

a,bZp,PG1,QG2, we have
e(aP,bQ)=e(P,Q)ab
.

Non-degeneracy:

e1.

Computability: There exits an efficient algorithm to compute

e.

drand currently uses the BLS12-381 curve

Randomness Generation

To generate publicly-verifiable, unbiasable, 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. 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 require 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

xZp at random and then computes the corresponding public key as
X=g2xG2
.

Signature Generation: Let

H:{0,1}G1 denote a cryptographic hash function that maps arbitrary bit strings to elements of
G1
. To compute a BLS signature
σ
on a message
m
, the signer simply computes
σ=xH(m)G1
.

Signature Verification: To verify that a BLS signature

σ on a message
m
is valid, the verifier checks if
e(H(m),X)=e(σ,g2)
holds using the signer's public key
X
. 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)
.

Threshold BLS Signature

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

n participants execute a
t
-of-
n
DKG to setup a collective public key
SG2
, and private key shares
siZp
of the unknown collective private key
s
, as described above.

Partial Signature Generation: To sign a message

m each participant
i
uses his private key share
si
to create a partial BLS signature
σi=siH(m)
.

Partial Signature Verification: To verify the correctness of a partial signature

σi on
m
, a verifier uses the public key share
Si
, which is generated during the DKG, and verify that
e(H(m),Si)=e(σi,g2)
holds.

Signature Reconstruction: To reconstruct the collective BLS signature

σ on
m
, a verifier first needs to gather
t
different and valid partial BLS signatures
σi
on
m
followed by a Lagrange interpolation on them.

Signature Verification: To verify a collective BLS signature

σ, a verifier simply checks that
e(H(m),S)=e(σ,g2)
holds where
S
is the collective public key.

Thanks to the properties of Lagrange interpolation, the value of

σ is independent of the subset of
t
valid partial signatures
σi
chosen during signature reconstruction. Additionally, Lagrange interpolation also guarantees that no set of less than
t
signers can predict or bias
σ
. In summary, a threshold BLS signature
σ
exhibits all properties required for publicly-verifiable, unbiasable, unpredictable, and distributed randomness.

Chained Randomness

The drand randomness beacon operates in discrete rounds

r. In every round, drand producess a new random value using threshold BLS signatures which are linked together into a chain of randomness. To extend this chain of randomness, each drand participant
i
creates in round
r
the partial BLS signature
σir
on the message
m=H(rσr1)
where
σr1
denotes the (full) BLS threshold signature from round
r1
and
H
a cryptographic hash function. Once at least
t
participants have broadcasted their partial signatures
σir
on
m
, anyone can recover the full BLS threshold signature
σr
. At that point, the random value of round
r
is simply its hash
H(σr)
. Afterwards, drand nodes move to round
r+1
and reiterate the above process. For round
r=0
drand participants sign a seed fixed during the drand setup. 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 present two distinct signatures
σr
and
σr
in a given round
r
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,

t-of-
n
distributed key generation, and threshold BLS signatures to generate publicly-verifiable, unbiasable, 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 (see paper. The threshold scheme described here is described and proven in the following paper from Boldyreva.