5

I have been sending myself transactions back and forward between MEW and Parity trying to get a transaction included in a specific block number however I seem to be always 3 - 6 blocks behind where I want it.

This is in preparation for the Golem crowdsale, I want to make sure I don't miss out and ideally my transaction lands in the first block from when the sale starts.

A few questions:

  • Is it a sound strategy to broadcast the transaction 1, 2, or 3 blocks before the start block (on my 6 test transactions this still put me a few blocks after the 'start block'), what about the risk of my transaction being confirmed before the sale start block?
  • What are the best gas setting to get my transaction confirmed as fast as possible, if I include 2,000,000 gas how much is that in Eth and do I need to alter the gas price to give myself the best chance of it getting confirmed quickly?

Thanks for having a read, would be interested to hear what others would do in this situation to give the best chance of getting my Eth into the Golem crowdsale.

I have recorded my tests, what block I was hoping for and what block the transaction confirmed and the gas setting I used if that info is handy I could post it.

Thanks in advance!

4

It's basically impossible to guarantee a transaction occurs in a given block. There's too many factors--network latency, the block gas limit, uncles, miners who mine empty blocks, other transactions, etc. Chances are, by the time you're actually looking at block X, it's too late to get in block X+1, since a miner may have already decided what transactions to mine.

Technically, you could write a contract that only relays a transaction if the block number is right. This is unlikely to help you, as it will increase gas use in that transaction and therefore make it more difficult to actually get in that specific block.

It's also unlikely that you can get the first block after a crowdsale in general, because the specific block of the sale contract being created is also unknown. It's quite possible that, as a large contract, it won't fit and it will be delayed until the blocks aren't so full. The existence of the crowdsale contract could be checked by another contract, but again, this might not actually help you.

OK, but what do you actually do?

A higher gas won't help. It's how many steps, at most, the transaction will pay for. A higher gas price will give your transaction priority over others. The cost for a transaction is (gasUsed * gasPrice) wei, and one ETH is 10^18 wei. Note that no matter how much gas is specified, you only pay for how much you use.

Timing-wise, I'd just wait until the contract is ready, then send the transaction. There's not much use in trying to get it exact as soon as possible, since you probably can't.

  • Thanks for the detailed reply. What would you suggest I set the gas price to to give the transaction the highest priority and how much would that approximately be in Eth? – Eth Bro Nov 9 '16 at 21:48
  • It really depends on what other people are doing. Normally, 50 GWei should be a pretty high-priority tx, but if everyone else is raising their prices then it becomes a bidding war. – Tjaden Hess Nov 9 '16 at 23:37
  • I can't really advise how much it will cost, since I don't know how much gas would be used. I doubt it will be that high overall. Filling an entire block nowadays (2~ million gas) with a 50 GWei transaction would be but 0.1 ETH. Your transaction will likely cost far, far, less than that. – Matthew Schmidt Nov 10 '16 at 18:48

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.