# Katana VRF
## Starknet
The current Starknet implementation is documented [here](https://docs.pragma.build/Resources/Cairo%201/randomness/randomness). However this is not practical for dojo games using [slot](https://cartridge.gg/blog/introducing-slot).
In Starknet, the VRF relies on a off-chain actor to fulfill requests. It happens in the following order:
1. A `RandomnessRequest` event is emitted
2. Check that request is in `RECEIVED` status
3. Compute the seed
4. Generate randomness (ecvrf)
5. Estimate callback fee
6. Submit randomness on-chain
## Katana
It's currently implemented in python, in rust we can leverage the ecvrf [crate](https://docs.rs/ecvrf/latest/ecvrf/) or even safer the SUI [implementation](https://github.com/MystenLabs/sui/blob/c774f8452d6d5f428e9101d9a8ae531aabae6ac0/docs/content/guides/developer/cryptography/ecvrf.mdx#L4).
Within Katana, it would work as followed:
1. A `RandomnessRequest` event is emitted, can be a default built-in event in dojo
2. Block finalization: get events
3. Compute the seed
4. Generate randomness
5. Set `random_outpout` builtin in the VM scope to the generated value
It should probably be under a feature flag and available only when launching katana with the `--randomness` option.
With such a design anyone should be able to easily verify the randomness generated by Katana.
Should the verification happen directly within the world engine ? Or by any frontend/consumer game ?