6

I'm currently performing my Ethereum logic using pyethereum and then sending transactions via a remote node using https://infura.io/. It's not fast enough for my needs. What can I do to ensure my transactions hit the blockchain as fast as possible? Should I run a full node myself? Is there something better?

Please ignore gas price for this discussion.

  • If you're trying to front-run other transactions, being a miner yourself is the most reliable way. (although this is within protocol, some community members will think of this as "playing dirty") If you're trying to get two of your own transactions included back to back, you should combine them into one transaction instead. If there's a third reason, it would help to know what it is. – carver Nov 22 '17 at 15:09
4

What can I do to ensure my transactions hit the blockchain as fast as possible?

Most simply, the miner who finds the next block must have your transaction in their pool, and choose to include it. Because they choose, you cannot "ensure" inclusion, only increase your chances.

In an ideal world, for maximum speed, you would peer directly with all the miners, and know their automated inclusion criteria up-front. (It's not always exclusively price)

Should I run a full node myself?

Going through infura means an extra hop between you and the miners... but maybe infura is more than one hop closer to the miners than you would be if you ran a full node. Also, nothing stops you from submitting to both infura and your locally-run full node, which would increase your chances of the transaction reaching the next miner before they find the block.

Please ignore gas price for this discussion

I don't know how you can talk about getting your transaction included quickly without discussing gas price. It's a critical component.

Are you assuming that you are paying enough that every miner will accept your transaction? (among miners who ever accept transactions) According to these current gas stats, that means at least 50 gwei, which the top percentile of miners charge.

Is 99% coverage okay? If you need 99.9% coverage of miners, you might need to collect your own stats on the gas price needed to be included.

Is there something better?

Fundamentally, you need to broadcast your transaction. If you have a good host machine, internet connection, client, and connection to prominent miners, then nothing will be faster than running your own full node.

  • So it sounds like I want to run a full node and determine the miner's "automated inclusion criteria". Is there source code available somewhere so I can determine this? What other than sort by gas price is there? Sort by first come first serve? Is it possible to peer directly with all the miners? How would I go about doing that? On the gas price point, assume that i'm racing someone else for transactions to a contract. And assume that i'm using a very high gas price, as high as dozens or hundreds of Gwei. – LampShade Nov 21 '17 at 2:16
  • Any idea how long a "hop" takes? Are we talking milliseconds or seconds? And any idea what percentage of miners sort by gas price vs something else like first come first serve? – LampShade Nov 21 '17 at 2:24
  • There isn't a single unified inclusion scheme. You could look at what parity and geth do for inspiration, but miners have wide latitude to modify this in arbitrary ways. They could say if sender in friend_list: include_transaction(). The yellow paper imposes only a few restrictions, like transaction validity. Several of these follow-up questions are nuanced enough to be their own SE question. – carver Nov 21 '17 at 17:03
  • Is it possible someone could bribe miners/pools to be put on a friend's list? And if so, would that friend's list be included in open source code? – LampShade Nov 21 '17 at 21:20
  • Thanks sharing. You're right about some of these questions being their own cans of worms. It seems I have more fun things to research. – LampShade Nov 21 '17 at 21:35
2

MetaMask can act as an intermediary and publish transactions on your behalf.

Etherscan allows users to send raw transactions via an API.

I'd suggest reading this question as it has some good information.

Additionally, if the limiting factor is on Infura's end, I'd suggest you consider transaction propagation. I'm not aware of Infura's configuration for their nodes, but they may restrict the number of peers that they're connected to. This could slow down transaction propagation in the network and thus, on average increase the time taken to be included into a block.

Here are some more details about Infura's downtime and response times. This should help you quantify your needs in terms of response time etc. enter image description here Response time currently at 408ms.

I think running a full node is a viable option for you if you're concerned with performance; simply because you've more control.

  • I believe MetaMask uses Infura (according to man in the middle tests). So I experimented with sending via Infura and Etherscan. I suppose I could send my transactions to both in hopes that I increase my chances of hitting the miners as soon as possible. – LampShade Nov 21 '17 at 2:22
  • Yes, you could do that! That is if running a full node is not an option. Another idea could be to run the node in an EC2 instance on AWS. Make sure that the region that holds the instance is physically close to you? Just an idea. @LampShade – Malone Nov 21 '17 at 11:29
  • Right on. Would it be potentially advantageous to run many nodes in a variety of regions and then broadcast my tx to each of them? To increase the odds it hits all miners sooner? – LampShade Nov 21 '17 at 21:25
0

You can give Fosha.org a try.

If you need an access token for testing, you can send us an e-mail (support@fosha.org).

  • Do we have to pay for that token? – Richard Horrocks Feb 28 '18 at 20:42
  • You can get a token for testing purposes for free. Just send us an e-mail. – FoshaSupport Mar 1 '18 at 6:59

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.