drandchain.gno
3.66 Kb · 63 lines
1package bls254
2
3// The drand "evmnet" chain's identity: the four facts about the beacon that are
4// properties of the CHAIN rather than of any code here.
5//
6// THIS IS THE ONE PLACE THE GROUP PUBLIC KEY IS WRITTEN DOWN. Before this file it
7// appeared only in test files, duplicated across drandvectors_test.gno and
8// drandgas_test.gno; both now read it from here, and r/splash/beacon decodes it
9// once at init. A second copy of a verification key is a second thing to get
10// wrong, and the wrong one would reject every real signature or -- far worse in a
11// different scheme -- accept a forged one.
12//
13// IT LIVES IN THIS PURE PACKAGE, NOT IN THE REALM, because it describes drand,
14// not SPLASH. The realm that consumes it is one consumer; the tests are another;
15// r/splash/arcade/raffle needs PeriodSeconds for a build-time guard and must not
16// have to import a realm to get it.
17//
18// PROVENANCE, AND IT IS NOT DOCUMENTATION. Every value below was read from
19// drand's own /info endpoint and is byte-identical from three independent relays
20// -- api.drand.sh, api2.drand.sh and drand.cloudflare.com. The verbatim curl
21// commands and responses are recorded twice, in testdata/drand/rounds.raw.txt
22// here and in r/splash/beacon/testdata/drand-rounds.raw.txt.
23const (
24 // DrandEvmnetChainHash identifies the chain. It is not used in verification
25 // -- the signed message is keccak256(uint64 round) and nothing else -- so it
26 // is here to name what a signature belongs to, and to make a wrong-chain
27 // fixture obvious to a reader rather than only to the pairing check.
28 DrandEvmnetChainHash = "04f1e9062b8a81f848fded9c12306733282b2727ecced50032187751166ec8c3"
29
30 // DrandEvmnetScheme is the scheme ID, and it is the reason drandcurve.gno
31 // uses SVDW and not SSWU. See DrandDST.
32 DrandEvmnetScheme = "bls-bn254-unchained-on-g1"
33
34 // DrandEvmnetPeriodSeconds is the cadence: ONE ROUND EVERY THREE SECONDS.
35 //
36 // THIS NUMBER IS THE ONE THAT BREAKS THINGS. The SPLASH beacon it replaces
37 // ran at five minutes, so every round-denominated duration anywhere in this
38 // repository was 100x wrong the moment the key changed, while still being
39 // dimensionally consistent and therefore invisible to the build guards that
40 // compared rounds to rounds. Any realm expressing a DURATION in rounds must
41 // multiply by this constant and compare against seconds. See
42 // r/splash/beacon/DRAND-MIGRATION.md section 6.
43 DrandEvmnetPeriodSeconds = 3
44
45 // DrandEvmnetGenesisTime is round 1's unix timestamp, so round r is signed at
46 // DrandEvmnetGenesisTime + DrandEvmnetPeriodSeconds*(r-1).
47 //
48 // NO REALM ON THIS TOOLCHAIN CAN USE THIS FOR ANYTHING, and that is worth
49 // saying where someone will look for it: there is no block-timestamp getter,
50 // so a realm cannot compare a round to the wall clock. It is here so that a
51 // human or a test harness can, and so that the round <-> time mapping the
52 // whole pin argument rests on is written down next to the period.
53 DrandEvmnetGenesisTime = 1727521075
54
55 // DrandEvmnetPubKeyHex is the 128-byte G2 group public key in EIP-197 wire
56 // order (x_imag|x_real|y_imag|y_real) -- exactly the byte string /info serves
57 // as "public_key", which is why it needs no reordering here.
58 //
59 // It is the DKG's collective key, held by no single party. That is the point
60 // of the migration: under the SPLASH beacon one key holder knew every future
61 // round's randomness, and under this one nobody below the threshold does.
62 DrandEvmnetPubKeyHex = "07e1d1d335df83fa98462005690372c643340060d205306a9aa8106b6bd0b3820557ec32c2ad488e4d4f6008f89a346f18492092ccc0d594610de2732c8b808f0095685ae3a85ba243747b1b2f426049010f6b73a0cf1d389351d5aaaa1047f6297d3a4f9749b33eb2d904c9d9ebf17224150ddd7abd7567a9bec6c74480ee0b"
63)