RNG
Synchronous random number generation inside the TEE. The randomness is derived from TEE-internal entropy combined with optional personalization data, ensuring that the output is unpredictable to all parties — including the node operator.
Proposer bias. A block proposer could theoretically simulate RNG outputs and selectively order transactions to influence outcomes. Seismic's TEE setup largely mitigates this, but high-stakes applications should consider commit-reveal schemes. See Footguns — RNG Proposer Bias for details.
Input
Raw bytes in the following layout:
[0:4]
output length
4 bytes (uint32)
Number of random bytes to generate
[4:]
personalization
arbitrary bytes
Optional data to influence the RNG output
Output
random bytes
bytes
Random bytes of the requested length
Built-in helpers
Seismic Solidity provides built-in functions that call this precompile and automatically cast the result to the appropriate shielded type. If you use these, you don't need to deal with the raw precompile interface or manual casting.
Shielded integers:
sync_rng8()→suint8sync_rng16()→suint16sync_rng32()→suint32sync_rng64()→suint64sync_rng96()→suint96sync_rng128()→suint128sync_rng256()→suint256
Shielded fixed bytes:
sync_rng_b1()→sbytes1...
sync_rng_b32()→sbytes32
Use cases
Shuffling hidden card decks or secret orderings
Generating nonces for on-chain cryptographic operations
Examples
Without personalization
With personalization
To pass personalization bytes, call the precompile directly at 0x64:
Last updated

