Hearing about Blocks and Transactions Fast with bloXroute’s BDN

bloXroute Team
Jul 16, 2020 · 7 min read

By bloXroute Labs Strategy & Ops Eleni Steinman

We recently wrote an article about how sending transactions (Txs) fast benefits traders. The TL;DR: sending transactions fast could make you more money.

In this article we will explore the other side of the equation: why traders should care about hearing of blocks and transactions fast.

Why Hearing About Blocks & Transactions Fast Matters

Well, because you can make more money.

Blocks

Hearing about blocks fast means you are always aware of the most up to date state of the network. This includes important information, such as exchange rates, available accounts to be liquidated, and contract or wallet values.

It’s not uncommon for traders in traditional finance to pay for special high-speed data feeds or locate their servers next to exchange servers to minimise communication times. This is because knowing the given state is required to be able to act (e.g. liquidate an account, capture an arbitrage opportunity, etc.), and knowing that state slightly faster than your competitors means you can react slightly faster, and thus increase your chances of capturing value.

Transactions

Sometimes referred to as the “transaction pool” (Geth), “transaction queue” (Parity), or mempool (Bitcoin), the list of transactions waiting for confirmation can be a wealth of untapped information that could provide traders a competitive edge to capture value. This is because these pending Txs can be leading indicators to forthcoming changes to the state of the network (e.g. a change in exchange rates, an account suddenly becoming underwater, an arbitrage appearing, etc.).

As our last article pointed out, speed is everything — and being able to predict and act quickly upon changes in state can result in profitable trading strategies.

Let’s explore a few examples.

Price Oracles

Almost all DeFi projects such as MakerDAO or Compound rely on data feeds, known as Oracles, to report asset prices on-chain. These asset prices are then used by the protocol to calculate important metrics, such as collateralization ratios or if an option position is now in the money.

For example, the Compound has its own Price Oracle contract that has the current exchange rates of all supported assets. The Price Oracle records on Ethereum the “anchor price” every hour. This price is then used to calculate which loans are underwater. Liquidators are incentivized to liquidate these underwater loans by repaying the borrowed funds, and in return receive the liquidated collateral with some discount.

Knowing the anchor price faster than competing Liquidators could offer a competitive advantage in capturing profit.

  1. Knowing the latest state, and thus anchor price faster, would reveal which positions are available for liquidation before competing Liquidators are aware of this opportunity
  2. Conversely, knowing the latest state could minimize costs as you would be less likely to try to liquidate an account that has already been acted on (wasting the gas fee)
  3. Knowing what transactions are pending could reveal indicators of what the next anchor price will be
  4. Knowing what transactions are pending may allow you to monitor for liquidating transactions to then send a transaction with a higher fee to outbid the Liquidator

Compound provides an Account API to feed traders a list of loans that are underwater. However, it is recommended to build your own as the Account Service provided by Compound Finance has considerable block delay, providing an opportunity for those that can use a faster solution.

Market Making

Market Makers are high-volume traders that stand ready to buy or sell an asset. They do this by continually quoting prices and volumes at which they are willing to buy and sell. There is a risk to Market Makers that the price moves against them, and they sell low as the price quickly rises or buy as the price is dropping. Thus, Market Makers must be fast to cancel and requote prices.

Here, we see the value of fast block and transaction data. Market Makers on DEXes benefit from knowing the current price so they can quickly react to changes. Additionally, knowing the pending transaction pool could allow Market Makers to see price changes before they happen and cancel orders before they lose money.

Arbitrage

Arbitrage opportunities arise when there is a pricing mismatch between two different exchanges. Traders can take advantage of this price mismatch by purchasing the asset on one exchange and simultaneously selling at a higher price on another exchange, profiting the difference.

Again, the same logic applies. Knowing the current state or having an indicator that will reveal that state gives traders an advantage in spotting these zero-sum profit opportunities.

Beating Congestion

As noted in our previous post, gas prices in ETH can rise quickly and cause a trader to lose an opportunity if their transaction now carries too low a gas price to be included. Monitoring the mempool could allow traders to be made aware of rising gas prices quicker and thus adjust their transaction gas fee.

So, how well connected are you?

To win the block race, Miners not only have to solve the cryptographic puzzle first, but they also must tell other Miners about their winning block. This means Miners care most about propagating data to each other — not to non-mining nodes. We can even see this in the data, blocks and, by virtue, transactions (since they travel to the same peers) tend to flow first to Miners and then to the rest of the network.

This means unless you’ve directly connected with a Miner, you probably are not receiving data very fast.

bloXroute is directly connected to the largest Miners in the Ethernet network and our architecture is such that those connected to us are only 2-hops away from each other. From tests, we’ve seen propagation speeds increase by over 100% for some nodes using the bloXroute BDN, cutting the time until blocks are received by more than half. Overall, in one test we saw an average block propagation time of 190ms with the BDN versus 250ms without the BDN, which is a 25% improvement.

To show that transactions and blocks are heard faster from the BDN, we’ve made our BDN’s statistics publicly available here. Under BDN Efficiency, Users can see the percent of transactions and blocks that Gateways (described in more detail below) hear first from the BDN rather than the P2P network (i.e. transactions that were propagated faster with the BDN).

In this 24-hour window, Gateways heard about blocks first from the BDN 88.5% of the time and transactions first from the BDN 70.3% of the time. Put another way, the BDN sent blocks faster to the Gateway than the P2P network sent to the Gateway 88.5% and 70.3% of the time, respectively. (Note: this number will never be 100 as the initial proposed block will always be sent from a node to the Gateway for propagation.)

bloXroute Tx Stream

bloXroute offers traders a Tx Stream, which can help you hear of transactions faster. We outline bloXroute’s architecture in our last post, which you can read about here.

There are two ways to subscribe to the Tx Stream: 1) via the bloXroute Gateway or 2) via the bloXroute Cloud-API.

bloXroute Gateway

If you run your own node and have installed the bloXroute Gateway, you can subscribe to the Tx Stream via the bloXroute Gateway.

bloXroute Gateway supports publish / subscribe to new pending transactions in the Ethereum network. Our documentation page has detailed steps on how to subscribe.

The bloXroute Gateway also includes a small Python SDK for connecting to this service.

Cloud-API

If you are not running your own node, you can subscribe to the transaction feeds provided over bloXroute’s Cloud-API. These feeds are functionally identical to the Gateway-API feeds. Detailed directions on how to do this can be found here.

Available Subscriptions

The Tx Stream currently supports two subscription feeds: newTxs and pendingTxs. These messages are sent as JSON-RPC notifications over the Gateway’s websocket RPC server.

For expedience, all transactions received through the BDN are immediately published to the newTxs feed. These transactions have had basic validations done (e.g. checksums and other sanity checks) but may not be accepted into the TxPool.

The bloXroute Gateway will then leverage the BDN for further validation of the transaction (e.g. check that it will be accepted into the TxPool), and publish results to the pendingTxs. You can optionally enable validation against your local Ethereum node as well, which may be faster in some scenarios

We always want to hear from Users. If you’re interested in using any of our services or have questions, please contact bizdev@bloxroute.com.

bloXroute Labs

Scaling blockchains to thousands of on-chain transactions…