Is there some method to create a transaction and make sure that it is the last in that block? If not, how close can you get to being last?

The reason I ask is that the following page depends on that being the case: https://github.com/slockit/dao/wiki/Why-The-Stalker-attack-is-a-non-issue

EDIT: By last in the block I mean that any transaction sent afterwards will be in the next block. Im not referring the ordering of transactions within a block.

  • There are answers to this question already and it brings up other points that haven't been touched on before, so this is good to have and editing it would have been messy. I asked what I think you really want to know at: ethereum.stackexchange.com/questions/4587/… – eth Jun 3 '16 at 3:11
  • I see you haven't answered the question yet. Do you yourself believe the method outlined on that github page should be a successful defence? – zunior Jun 3 '16 at 3:31
  • I don't know what they mean so asking like you :) – eth Jun 3 '16 at 3:34

No. There is no way to guarantee when a transaction is going to be mined. It is not possible for a transaction to guarantee that it is mined at a specific block N, or at a specific position within block N.

Even if you are a miner, your controls are limited because mining is a lottery. A miner is not guaranteed to "win" at block N. A miner does get to order the transactions in a block, so they can put their transactions in whatever positions they desire. A miner could also discard their winning block, say if they win at block N-1, but there are no guarantees that when they try again at block N, that they will win.

  • Well if there is no guarantee of exactly when, is there ever some range we can guarantee it to be in? If not, is there ever some exact time or range for which we can say there is a very high probability it will be mined in? – zunior Jun 3 '16 at 3:07
  • Practically, there are many variables that affect the probability such as how many peers are you connected to; who are they connected to; how many pending transactions are in the network, etc. But I've found an example why there's no high probability. Flipping a coin heads is 50% probability, but it doesn't matter how many tails have been flipped before, the probability of getting heads is still 50%. You could be that miner and all you know is you have 50% chance of mining the next block, and all the probability says is that in a span of many blocks, you will have mined around half of them. – eth Jun 3 '16 at 3:31

No, unless you are the winning miner. The winning miner decides on the order of transactions.

See What happens when a smart contract gets several similar calls in the same block? and What is the order and concurrency behavior of multiple calls to a contract in a single transaction?.

If you have multiple transactions from the same account, they will get executed in the increasing nonce sequence.

  • No I don't mean in terms of the ordering of the transactions within a block. I mean the last transaction that makes it into the block regardless of its order. i.e. any transaction sent after that one will be recorded on the next block – zunior Jun 3 '16 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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