"Good enough" in-contract RNG for BSC

I’m trying to develop a weighted probability selection algorithm on BSC and I think I need an algorithm that can generate a random number within a given range for that.

What would be a “good enough” way to achieve that? I know there’s a lot of problems with RNG in smart contracts, but is there a solution that’s practically safe enough for BSC? For example if I’m not mistaken the miners all belong to Binance there, so as long you trust Binance (I know that this goes against the philosophy of crypto…) there shouldn’t be mining attacks.

1 Like

I’m in the same boat as you. My team has spent sometime looking for alternatives on BSC for RNG. Chainlink’s VRF is coming soon to BSC, but not here yet.

ZeroSwap is apparently not here yet either. https://medium.com/zeroswaplabs/zeroswap-integrates-chainlink-ef56715baf71

Fetch.ai does not have a working product either https://medium.com/fetch-ai/launching-our-random-number-beacon-on-binance-smart-chain-8e3b7aa52be6

The approach we are taking is to do some basic RNG for our ERC721s, then at a later date, when Chainlink’s VRF comes out, we will migrate to it.

The problem is as you say, the miners will just manipulate the RNG to benefit them so there isn’t a great solution right now until Chainlink VRF comes out.

Here’s some things to consider when building your own implementation.

1 Like

Sorry, I am not familiar with the BSC-Chain, maybe you should ask for help in their forum: Home | Binance Chain Forum

Yeah, generate a safe random number is really a difficult, maybe you can have a look at this article:

2 Likes

Thank you, I think I’m waiting for VRF for now I’d rather not migrate the project in production.

2 Likes