Imagine a contract that rewards the first user that publish a specific big piece of data into the blockchain. The transaction may cost an appreciable cost if the information size is big. The problem for the publisher is that he must specify a high gas limit that may lose if there is another publisher that sends a transaction at the same moment and miners inserts that transaction before the first's one.

Is there a way to say to the miners to accept only transactions if no other transaction is send to a contract in the same block?

I was also thinking in a contract with two steps:

  1. The first one to reserve a slot to publish with a deposit
  2. A second step to actually publish it.

The problems of this strategy is that it will add a publication delay, and fill the blockchain with more transactions. Imagine the case where there are hundreds of possible publishers.

  • I think the two-step solution is the way to go. Note that the miners get to order transactions arbitrarily, so they could use that advantage to monopolize on the system Commented Apr 21, 2016 at 0:00

1 Answer 1


A two-step strategy is reasonable. Trustlessness is not free and in some applications, a multi-step strategy is required to minimize one party being able to take advantage of another party. Block times on the order of seconds (instead of minutes) and the scalability efforts behind the Ethereum platform can help DApps from premature optimization.

Is there a way to say to the miners to accept only transactions if no other transaction is send to a contract in the same block?

No, but a similar effect might be codifiable in a contract.

For example, a naive implementation would be for a contract that has a mapping alreadyPublished with block.number as the key. publish could then look like:

function publish... {
  if (alreadyPublished[block.number]) {
  // publish logic; expensive, uses lots of gas
  alreadyPublished[block.number] = true;

Publishers who are not the first, will still pay a small amount of gas for the transaction, but since the contract will immediately return, they will not pay for the expensive operations. (This works for even the same block, see comment.)

  • The expensive part is just put data in the transaction data (as a method parameter). 68gas per byte..
    – jbaylina
    Commented Apr 17, 2016 at 19:24
  • 1
    Good point, I missed that. If I think of something better, I'll update.
    – eth
    Commented Apr 17, 2016 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.