1

Hey valuable community member,

I am currently on a randomness pallet which can be used as a production counterpart to the insecure randomness-collective-flip pallet.

This is my current version:

https://github.com/zeitgeistpm/zeitgeist/blob/d40f4c3c7a52c7e346aaa39ff980135938073eed/zrml/relay-randomness/src/lib.rs

I wonder why this kind of pallet was not already written. Seems like other than Moonbeam nobody needed production randomness yet. But we at ZeitgeistPM do now for our random juror selection in a court.

Can you give examples and hints how to implement a secure and reliable version of this pallet?

Currently it is integrated in the following way:

        impl cumulus_pallet_parachain_system::Config for Runtime {
            ...
            type OnSystemEvent = zrml_relay_randomness::CustomSystemEventHandler<Runtime>;
            ...
        }

        impl zrml_relay_randomness::Config for Runtime {
            type SelfParaId = parachain_info::Pallet<Runtime>;
        }

1 Answer 1

1

Can you give examples and hints how to implement a secure and reliable version of this pallet?

It is not easily possible out of the box. Hence the deprecation of the former randomness pallet.
The only way to currently get secure randomness on-chain is to use some kind of oracle or bridge.

Alternatively an interactive multi-step commit/reveal scheme could be used but needs some maintenance transactions from different parties. This is only verifiable secure if the user themselves participated in the same round.

2
  • Thx for your quick answer. What's about using the randomness hash of the BABE protocol as described in the example? If I read your answer correctly, a bridge or oracle has even more secure randomness than the BABE protocol?
    – Chralt
    Commented Mar 8, 2023 at 8:27
  • 1
    The BABE session randomness is not cryptographically secure. It can be influenced by validators in various ways to gain an advantage. Ultimately it boils down to economic security since the validators get penalized for it; you can probably still use it for a 5$ lottery, but not a 5000$. But in the long run yes, having some oracle or interactive protocols are the only secure ways of doing it. Commented Mar 8, 2023 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.