The recent introduction of on-chain native randomness brought excitement to the community builders. This feature is available for usage in testnet & mainnet environments.
Problem statement
This feature, however, cannot be utilized from the Flow Emulator, as it does not have the notion of a system chunk transaction on every block commit. Hence, the RandomBeaconHistory contract does not record anything.
Proposed solution
The RandomBeaconHistory contract available on the emulator's service account needs a couple changes to be fully functional and mimic the behavior from testnet/mainnet environments.
We need to add the option fvm.WithRandomSourceHistoryCallAllowed(true) when configuring Emulator's blockchain
Up until now, the emulator did not have the notion of a system chunk transaction for every committed block. We need to add one, at least with a call on RandomBeaconHistory's heartbeat.
Impact
The Flow Emulator has evolved into a swiss army knife, which can be used for local development when building a dApp, or as a 3rd party library in all sorts of tools (including the Cadence testing framework). Having the randomness feature be on par with testnet & mainnet, will greatly enhance the DevEx.
A seasoned back-end engineer with a focus on problem solving and designing robust software systems. Over 9 years of experience building high-traffic search engines, marketplaces, exchanges and in-house analytics solutions. Led cross-functional teams to deliver both web and mobile apps, participating in all steps of the software development lifecycle. Open source lover and advocate.
Improve Randomness in Emulator
Grant category
Please select one:
Description
The recent introduction of on-chain native randomness brought excitement to the community builders. This feature is available for usage in
testnet
&mainnet
environments.Problem statement
This feature, however, cannot be utilized from the Flow Emulator, as it does not have the notion of a system chunk transaction on every block commit. Hence, the
RandomBeaconHistory
contract does not record anything.Proposed solution
The
RandomBeaconHistory
contract available on the emulator's service account needs a couple changes to be fully functional and mimic the behavior fromtestnet
/mainnet
environments.fvm.WithRandomSourceHistoryCallAllowed(true)
when configuring Emulator's blockchainRandomBeaconHistory
's heartbeat.Impact
The Flow Emulator has evolved into a swiss army knife, which can be used for local development when building a dApp, or as a 3rd party library in all sorts of tools (including the Cadence testing framework). Having the randomness feature be on par with
testnet
&mainnet
, will greatly enhance the DevEx.Milestones and funding
Total funding proposed: 3500 $
Team