I want to understand on-chain and off-chain operations in the context of randomness. Kindly provide me an example so that its clear to me.
I got one post here:
What are offchain and onchain Transactions?
but they did not discuss off-chain and on-chain in the context of randomness.
One example of off-chain is:
We saw some of the pitfalls of bad randomness on Ethereum, but what can one do to produce truly random numbers? A standard recommendation is to go off-chain and employ external sources. These are typically either an outside “oracle” service (e.g., Oraclize), or hashed inputs by multiple users with competitive interests.
What is meant by the outside "oracle" service (e.g Oraclize)? What is a hashed input (is it a random id?) ? If you could tell me about an inside oracle that would be useful too.
For on-chain, I got the following:
To summarize, our recommendation for on-chain random number generation is to follow a pattern such as: • Accept a bet, with payment, register the block number of the bet transaction. • The bettor has to not only place the bet but also invoke the contract in a future transaction (within the next 256 blocks). The contract will compute the blockhash of the earlier-registered block number, and use it to determine the success of the bet.
What I understand is that for on-chain we have to use some sort of blockchain variable. Am I right?
Zulfi.