# NIST Randomness Beacon

> Use the random values the US National Institute of Standards and Technology publishes, so a random choice can be proved rather than trusted. NIST publishes a fresh 512 bit value every minute, signs it, and leaves it on the public record forever, where anyone in the world can look it up. Announce in advance which minute's value a draw will use, then draw winners, audit samples or tie-breaks from it and hand out the link that lets anybody repeat the same draw and get the same answer. Read the value for any minute since July 2018, list a run of them for an audit trail, and check a value somebody published against NIST's own record. No account, no API key, no sign-up.

App · Compliance & Security · 7 actions. Web page: https://docs.lodol.com/docs/integrations/nist-randomness-beacon

## Actions

### Check a published value

Check a value somebody published against NIST's own record. Give it the value and the time it was said to come from, and it reads that moment back from NIST and says whether they agree. When they do, it also confirms the value sits inside NIST's chain by reading back the value before it, which is what would catch a record altered after the fact.

**Inputs**

- Published value (`random_value`, text, required): The value to check, as it was published. Spaces and line breaks picked up from a copy and paste do not matter.
- Published at (`published_at`, date and time, required): The date and time it was said to come from.

**Outputs**

- `asked_about` (text): The moment that was asked about, in UTC
- `chain_check` (text): What that second check found, in a line
- `checked_value` (text): The value that was handed in
- `linked_to_previous_value` (true/false): True when it follows the value before it as NIST says
- `matches` (true/false): True when NIST published that value then
- `nist_value` (text): What NIST actually published at that time
- `published_at` (text): When NIST published the value it holds
- `record_url` (text): Where anybody can read the same value
- `series` (number): Which run of values it belongs to
- `value_number` (number): Its place in that series
- `verdict` (text): The answer in a sentence, ready to show

**Example output**

```json
{
  "asked_about": "2024-09-24T10:43:20Z",
  "chain_check": "This value carries the value published a minute before it, and that earlier value matches NIST's record, so it sits inside the published chain.",
  "checked_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
  "linked_to_previous_value": true,
  "matches": true,
  "nist_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
  "published_at": "2024-09-24T10:43:00Z",
  "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000000",
  "series": 2,
  "value_number": 1000000,
  "verdict": "This is the value NIST published at 2024-09-24T10:43:00Z."
}
```

### Draw from a list

Draw entries out of a list using a random value NIST published, so the result can be checked by anybody rather than trusted. Pick winners of a prize draw, choose which orders to audit, or settle a tie. Each entry can be drawn only once. The answer carries the value used, where to read it on NIST's site, and the arithmetic in one sentence, which together are enough for someone else to arrive at the same picks from the same list.

**Inputs**

- List (`entries`, list, required): What to draw from: names, order numbers, email addresses, anything. Point it at a list an earlier step produced, or type the entries in.
- How many to draw (`pick`, number): How many entries to take out of the list. From 1 to 1000. Default: `1`.
- Published value (`random_value`, text): Leave this empty to draw on the value NIST is publishing right now. Fill it in to draw on a value you announced in advance, taking it from 'Get the random value for a time' or any other action here.

**Outputs**

- `entries_considered` (number): How many entries the list held
- `how_it_was_drawn` (text): The arithmetic, so somebody else can repeat it
- `picks` (list): What was drawn, in the order drawn
- `published_at` (text): When NIST published it, when the draw fetched it
- `random_value` (text): The published value the draw used
- `record_url` (text): Where anybody can read the same value
- `series` (number): Which run of values it belongs to
- `value_number` (number): Its place in that series

**Example output**

```json
{
  "entries_considered": 812,
  "how_it_was_drawn": "NIST's published value and the draw's position (0 for the first pick, 1 for the second, and so on) are joined and hashed with SHA-512. The result, read as one long number, is divided by how many entries are still in the list, and the remainder is the position of the entry drawn. That entry is taken out and the next pick repeats on what is left.",
  "picks": [
    "ada@example.com",
    "grace@example.com"
  ],
  "published_at": "2024-09-24T10:43:00Z",
  "random_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
  "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000000",
  "series": 2,
  "value_number": 1000000
}
```

### Get a random value by its number

Get one exact value by the numbers NIST files it under. Every value belongs to a series and has a place in it, and every answer from the other actions here carries both, so this is how a value someone quoted in a report or a press release is read back without going through its time.

**Inputs**

- Series (`series`, number, required): Which run of values it belongs to. NIST is on series 2, which it started in September 2022; series 1 ran from 2018 until April 2022. Every answer from the other actions carries this. From 1 to 100. Default: `2`.
- Value number (`value_number`, number, required): Its place in that series, counting from 1. NIST publishes one a minute, so these run into the millions. Every answer from the other actions carries this. From 1 to 1000000000. Default: `1`.

**Outputs**

- `published_at` (text): The minute it was published, in UTC
- `published_every` (text): How often NIST publishes, in words
- `random_value` (text): The 512 bits NIST published, written as 128 characters
- `record_url` (text): Where anybody can read the same value on NIST's site
- `series` (number): Which run of values it belongs to
- `signed_with_certificate` (text): The certificate NIST signed it with
- `status` (text): Normal, the first value of a series, or the first after a gap
- `value_number` (number): Its place in that series

**Example output**

```json
{
  "published_at": "2024-09-24T10:43:00Z",
  "published_every": "Every minute",
  "random_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
  "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000000",
  "series": 2,
  "signed_with_certificate": "e692b0f6b208322ac84c963e167245f6356c21f31fa95274b25e92329510b5a210d5179afb6ee25e12dd9fc2691f49ed778d9a709aa3c2ea0f3ff2eaf8c47a62",
  "status": "Normal",
  "value_number": 1000000
}
```

### Get NIST's signing certificate

Get the certificate NIST signs its published values with: who it belongs to, who issued it, and how long it lasts. Every value names the certificate that signed it, so this is what an auditor who wants to verify the signatures themselves needs. Leave the field empty for the one NIST is signing with today.

**Inputs**

- Certificate (`certificate_id`, text): Which certificate to fetch. Every value carries this on 'signed_with_certificate'. Leave it empty for the one in use right now.

**Outputs**

- `certificate` (text): The certificate itself, as text
- `certificate_id` (text): The identifier this certificate is filed under
- `id_matches_certificate` (true/false): True when the identifier is this certificate's own fingerprint, which is how NIST files them
- `is_currently_valid` (true/false): True when today falls inside those dates
- `is_the_current_one` (true/false): True when this is the certificate NIST is signing with today
- `issued_by` (text): The authority that issued it
- `issued_to` (text): The name on the certificate
- `organization` (text): Who it belongs to
- `valid_from` (text): When it became valid
- `valid_until` (text): When it expires

**Example output**

```json
{
  "certificate": "-----BEGIN CERTIFICATE-----\nMIIG/jCCBeagAwIBAgIQDoAgTz/pRbYv/MGlXRHU7DANBgkqhkiG9w0B\n-----END CERTIFICATE-----",
  "certificate_id": "87f27f431da3f584af6007fe045df13aaa81d831f335b6ee73f6334768f32d3ae10491e669b93a43e548b20370a6526c3def99643c25d8ad7bf5df95a3c2b45d",
  "id_matches_certificate": true,
  "is_currently_valid": true,
  "is_the_current_one": true,
  "issued_by": "DigiCert Global G2 TLS RSA SHA256 2020 CA1",
  "issued_to": "engine.beacon.nist.gov",
  "organization": "National Institute of Standards and Technology",
  "valid_from": "2026-09-03T00:00:00Z",
  "valid_until": "2027-03-20T23:59:59Z"
}
```

### Get the latest random value

Get the random value NIST is publishing right now. It changes every minute, nobody can predict it before it appears, and it stays on the public record forever, so anyone can look up later what it was. Use it whenever a decision has to be random and has to be seen to be random.

**Inputs**: None.

**Outputs**

- `published_at` (text): The minute it was published, in UTC
- `published_every` (text): How often NIST publishes, in words
- `random_value` (text): The 512 bits NIST published, written as 128 characters
- `record_url` (text): Where anybody can read the same value on NIST's site
- `series` (number): Which run of values it belongs to
- `signed_with_certificate` (text): The certificate NIST signed it with
- `status` (text): Normal, the first value of a series, or the first after a gap
- `value_number` (number): Its place in that series

**Example output**

```json
{
  "published_at": "2024-09-24T10:43:00Z",
  "published_every": "Every minute",
  "random_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
  "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000000",
  "series": 2,
  "signed_with_certificate": "e692b0f6b208322ac84c963e167245f6356c21f31fa95274b25e92329510b5a210d5179afb6ee25e12dd9fc2691f49ed778d9a709aa3c2ea0f3ff2eaf8c47a62",
  "status": "Normal",
  "value_number": 1000000
}
```

### Get the random value for a time

Get the random value that was on the public record at a particular moment. This is how a draw is settled after the fact: announce beforehand that you will use the value from, say, noon on Friday, then come back and read it. Because everyone can read the same value at the same address, nobody has to take your word for what it was.

**Inputs**

- Date and time (`moment`, date and time, required): The moment to read the record at. NIST publishes a new value every minute, so this is the value that minute carried.

**Outputs**

- `asked_about` (text): The moment that was asked about, in UTC
- `how_close` (text): Whether this answers the moment asked about, in a line
- `is_from_the_same_minute` (true/false): True when NIST published in the minute asked about
- `published_at` (text): The minute it was published, in UTC
- `published_every` (text): How often NIST publishes, in words
- `random_value` (text): The 512 bits NIST published, written as 128 characters
- `record_url` (text): Where anybody can read the same value on NIST's site
- `seconds_before_the_moment` (number): How long before that moment it was published
- `series` (number): Which run of values it belongs to
- `signed_with_certificate` (text): The certificate NIST signed it with
- `status` (text): Normal, the first value of a series, or the first after a gap
- `value_number` (number): Its place in that series

**Example output**

```json
{
  "asked_about": "2024-09-24T10:43:20Z",
  "how_close": "Published in the minute asked about.",
  "is_from_the_same_minute": true,
  "published_at": "2024-09-24T10:43:00Z",
  "published_every": "Every minute",
  "random_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
  "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000000",
  "seconds_before_the_moment": 20,
  "series": 2,
  "signed_with_certificate": "e692b0f6b208322ac84c963e167245f6356c21f31fa95274b25e92329510b5a210d5179afb6ee25e12dd9fc2691f49ed778d9a709aa3c2ea0f3ff2eaf8c47a62",
  "status": "Normal",
  "value_number": 1000000
}
```

### List the values published from a time

List the values NIST published from a moment onward, in order. One a minute, so ten of them is ten minutes of the record and sixty is an hour. Use it to keep an audit trail of a window that mattered, or to show a run of values around a draw rather than the single one it used. A run that reaches the present simply stops there and says so.

**Inputs**

- Starting at (`starting_at`, date and time, required): The date and time to start reading from.
- How many (`count`, number): How many values to read. One a minute, so this is also how many minutes of the record it covers. Each is a separate request to NIST, so a long run takes a moment. From 1 to 60. Default: `10`.

**Outputs**

- `asked_for` (number): How many values were asked for
- `count` (number): How many came back
- `first_published_at` (text): When the first one was published
- `last_published_at` (text): When the last one was published
- `reached_the_end_of_the_record` (true/false): True when the run caught up with the present
- `starting_at` (text): The moment the run started from, in UTC
- `values` (list)

**Example output**

```json
{
  "asked_for": 2,
  "count": 2,
  "first_published_at": "2024-09-24T10:43:00Z",
  "last_published_at": "2024-09-24T10:44:00Z",
  "reached_the_end_of_the_record": false,
  "starting_at": "2024-09-24T10:43:00Z",
  "values": [
    {
      "published_at": "2024-09-24T10:43:00Z",
      "published_every": "Every minute",
      "random_value": "6CA50557C212E8938F9B4D0A936553851A323571631AAFFA6414ACE9982D8CB2A1B0D0A0BF18B64355C795E2409247CA85E474B30C7516D1523E13A775275AC8",
      "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000000",
      "series": 2,
      "signed_with_certificate": "e692b0f6b208322ac84c963e167245f6356c21f31fa95274b25e92329510b5a210d5179afb6ee25e12dd9fc2691f49ed778d9a709aa3c2ea0f3ff2eaf8c47a62",
      "status": "Normal",
      "value_number": 1000000
    },
    {
      "published_at": "2024-09-24T10:44:00Z",
      "published_every": "Every minute",
      "random_value": "8B2FE4C4D1D1B6E0F9E2A9B4C1D0E7F3A2B1C0D9E8F7A6B5C4D3E2F1A0B9C8D7E6F5A4B3C2D1E0F9A8B7C6D5E4F3A2B1C0D9E8F7A6B5C4D3E2F1A0B9C8D7E6F5",
      "record_url": "https://beacon.nist.gov/beacon/2.0/chain/2/pulse/1000001",
      "series": 2,
      "signed_with_certificate": "e692b0f6b208322ac84c963e167245f6356c21f31fa95274b25e92329510b5a210d5179afb6ee25e12dd9fc2691f49ed778d9a709aa3c2ea0f3ff2eaf8c47a62",
      "status": "Normal",
      "value_number": 1000001
    }
  ]
}
```
