Constructs a Randomness
instance.
The Anchor program instance.
The public key of the randomness account.
Readonly
programThe Anchor program instance.
Readonly
pubkeyThe public key of the randomness account.
Commit and reveal randomness in a single transaction.
The callback to execute after the reveal in the same transaction.
The signers to sign the transaction.
The queue public key.
Optional
configs: { The configuration options.
Optional
computeThe compute unit limit.
Optional
computeThe price per compute unit in microlamports.
A promise that resolves when the transaction is confirmed.
Generate a randomness commit
solana transaction instruction.
This will commit the randomness account to use currentSlot + 1 slothash
as the non-repeating randomness seed.
The queue public key for the commit instruction.
Optional
authority_: PublicKeyThe optional authority public key.
A promise that resolves to the transaction instruction.
Loads the randomness data for this Randomness
account from on chain.
A promise that resolves to the randomness data.
Will throw an error if the randomness account does not exist.
Serialize ix to file.
The reveal instruction of a transaction.
Optional
fileName: string = "serializedIx.bin"The name of the file to save the serialized IX to.
A promise that resolves when the file has been written.
Will throw an error if the request fails.
Static
createCreates a new Randomness
account.
The Anchor program instance.
The keypair of the new Randomness
account.
The queue account to associate with the new Randomness
account.
Optional
payer_: PublicKeyThe payer for the transaction. If not provided, the default payer from the program provider is used.
A promise that resolves to a tuple containing the new Randomness
account and the transaction instruction.
Static
createCreates a new Randomness
account and prepares a commit transaction instruction.
The Anchor program instance.
The queue account to associate with the new Randomness
account.
A promise that resolves to a tuple containing the new Randomness
instance, the keypair, and an array of transaction instructions.
Switchboard commit-reveal randomness. This account type controls commit-reveal style randomness employing Intel SGX enclaves as a randomness security mechanism. For this flow, a user must commit to a future slot that would be unknown to all parties at the time of commitment. The user must then reveal the randomness by then sending the future slot hash to the oracle which can then be signed by the secret key secured within the Trusted Execution Environment.
In this manner, the only way for one to predict the randomness is to: