0

I'm a bit confused about the description found here on randomness:

If I were running a node, I could publish a transaction only to my own node and not share it. I could then run the coin flip function to see if I won — and if I lost, choose not to include that transaction in the next block I'm solving. I could keep doing this indefinitely until I finally won the coin flip and solved the next block, and profit.

since I thought that a function called on a contract is considered a transaction that is broadcasted to all nodes on a network rather than to a single node whose refusal to publish the transaction can allow this scenario to play out. I reviewed the post cited on that here but wasn't able to get any clarity: How can I securely generate a random number in my smart contract?

reactor
  • 135
  • 4

1 Answers1

1

A malicious miner can simulate transaction execution and don't include the transaction if it doesn't pay him.

A miner doesn't have to broadcast their own transaction. It can keep them until a block containing them is mined.

Ismael
  • 30,570
  • 21
  • 53
  • 96
  • thanks! I'm super new to all of this and I feel like I don't completely understand. I was under the impression that mining is a completely passive process that just involves volunteering hardware cycles via gpu/cpu/asic while running a mining program or client. It sounds like that might not be the case and I was wondering if you can point me to a resource that can clarify this. Thanks! – reactor Feb 15 '21 at 19:35
  • 1
    Search about "miner extractable value" and you will find some articles. There's an article about bots running on the blockchain https://medium.com/@danrobinson/ethereum-is-a-dark-forest-ecc5f0505dff. more advanced stuff are papers like https://arxiv.org/abs/2101.05511, https://arxiv.org/abs/1904.05234, or projects like github.com/flashbots/mev-research. – Ismael Feb 16 '21 at 05:51