Skip to main content

Questions tagged [randomness]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

Randomness in substrate pallets

We are creating a price guessing game as a substrate pallet. We would like to fetch random objects from an API for the game. What options can we use to get randomness within our pallet?
René Hürter's user avatar
0 votes
0 answers
9 views

Not able to get randomness on unit test

I'm building a pallet that requires some randomness to simulate the act of tossing a coin. That's why I'm following the same implementation as provided on the Lottery pallet. Particularly, the ...
nhussein11's user avatar
0 votes
0 answers
53 views

Cryptographic requirements for random numbers on substrate chain

As far as I know, one of the possibilities to generate random numbers within a substrate chain is by using the pallet_insecure_randomness_collective_flip. However, the documentation explicitly states ...
nhussein11's user avatar
0 votes
0 answers
53 views

How to generate random number of a specific length in Substrate pallet

I want to generate random number of a specific length. I can't use insecure-randomness-collective-flip because it's not recommended for production. I also can't use rand package because it doesn't ...
Boleng's user avatar
  • 523
4 votes
1 answer
73 views

Why doesn't Substrate implement a CSPRNG (Cryptographically Secure Pseudorandom Number Generator)?

In the Rust documentation here it says that the hashing function that a Rust HashMap uses is SipHash. It says SipHash can provide resistance to DoS attacks involving hash tables, not that it will, ...
Luke Schoen's user avatar
  • 2,346
1 vote
1 answer
106 views

How to implement a production randomness pallet?

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:/...
Chralt's user avatar
  • 543
3 votes
1 answer
59 views

What does `no particular order` mean for storage iterations?

I am always curious what the documentation for the storage means when I see the following. Enumerate all elements in the map in no particular order. https://paritytech.github.io/substrate/master/...
Chralt's user avatar
  • 543
3 votes
2 answers
242 views

How can I generate a random seed now that self.env.random() is removed in ink?

We were using self.env.random() in our contract to generate a random number. The calling user's AccountId was used to give additional entropy to the random generation. fn get_random_number(&self, ...
forgetso's user avatar
  • 1,514
5 votes
1 answer
117 views

Removing randomness-collective-flip pallet from runtime

We recently tried to remove pallet-randomness-collective-flip from our runtime. This pallet has been in our runtime since it was created as it was included in the template-node-runtime, but we never ...
AlastairHolmes's user avatar
4 votes
2 answers
291 views

How can I use BABE's randomness in my parachain?

I would like to use BABE's randomness for some on-chain logic. IIUC using BABE inside a parachain's runtime is not recommended good practice because there's no fallback for producing blocks if no ...
Sacha Lansky's user avatar
  • 2,640
6 votes
2 answers
116 views

Test is not generating random number

I am trying to generate random number using the tutorial: #[pallet::config] pub trait Config: frame_system::Config { type Event: From<Event<Self>> + IsType<<Self as ...
Amiya Behera's user avatar
4 votes
1 answer
88 views

On-chain pseudo-random numbers - agreed by all

I'm looking for a source of random numbers - doesn't need to be cryptographically secure, just hard to predict in advance but agreed by and visible to all participants. I'm thinking about using the ...
JelliedOwl - Paul's user avatar