In Ethereum smart contracts, getting true randomness can be tricky and dangerous. Here’s why:
The Problem:
When you use common methods like blockhash or now for randomness in Solidity, it can be manipulated by miners. This makes your contract vulnerable to attacks, especially in games or lotteries.
The code in the below attached image seems to generate a random number, but it’s predictable and can be exploited.
The Solution: Chainlink VRF 👀
Chainlink’s Verifiable Random Function (VRF) provides a secure and verifiable way to get true randomness that cannot be tampered with.
Here’s how Chainlink VRF solves the problem:
- Chainlink VRF generates a random number off-chain and provides cryptographic proof that it was done fairly.
- The smart contract verifies this proof on-chain, ensuring the randomness is - reliable and cannot be tampered with.
- The cryptographic process ensures that even miners or oracles cannot influence the outcome, hence guaranteeing true randomness
Top comments (0)