Trying to generate some randomness without using VRF or commit/reveal. It's for a small priced NFT (about 100 dollars) so it's much less than the block reward.

My idea is to hash together 3 variables:

  • 1 - A sender variable that cannot be influenced by the miner such as msg.sender (address of sender)

  • 2 - A smart contract variable such as an auto-increasing item_id that cannot be influenced by anyone

  • 3 - A miner variable that cannot be influenced or known by the sender

I'm having difficulty finding the third variable. I've read that block.coinbase returns the address of the current block's miner, since it is not know who will mine the block, it seems to me like an option.

The second option would be the current block timestamp as seconds since unix epoch, that I can get with block.timestamp, since, in my understanding, won't be known prior to the mining of the block.

Do these work or am I missing something here? Can these variables be read for the current block or just for a past block?


Browse other questions tagged or ask your own question.