Skip to content

Commit

Permalink
sapphire/precompiles: added information about VRF/RNG derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarMist committed Jul 31, 2023
1 parent 695aff2 commit 4f24466
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/dapp/sapphire/precompiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ Sapphire.randomBytes(64, abi.encodePacked(msg.sender, this.perContactSecret));
```
:::

The mode (e.g. simulation or 'view call' vs transaction execution) is fed to TupleHash (among other
block-dependent components) to derive the "key id", which is then used to derive a per-block VRF key
from epoch-ephemeral entropy (using KMAC256 and cSHAKE) so a different "key id" will result in a
unique per-block VRF key. This per-block VRF key is then used to create the per-block root RNG which
is then used to derive domain-separated (using Merlin transcripts) per-transaction random RNGs which
are then exposed via this precompile.

## X25519 Key Derivation

### Overview
Expand Down

0 comments on commit 4f24466

Please sign in to comment.