Hi,
I am looking for a post-merge source of randomness in Solidity.
Is the Randao reveal from the Beacon chain available for use in Smart Contracts, or if not, are there plans to do so?
Thanks ![]()
Hi,
I am looking for a post-merge source of randomness in Solidity.
Is the Randao reveal from the Beacon chain available for use in Smart Contracts, or if not, are there plans to do so?
Thanks ![]()
Yes. You can access it via block.difficulty() since it’s the same opcode under the hood, just with changed semantics. And it’s an EVM-level change so it affects all contracts, even ones deployed before the merge. From the point of view of Solidity it’s just a cosmetic change - renaming the built-in. The new name will be available in the next release: feat: introduce `block.prevrandao` as alias for `block.difficulty` · Issue #13512 · ethereum/solidity · GitHub.
fantastic news, thanks for the reply ![]()