8

I'm curious about, for instance, the frequency of chain reorganizations, and the distribution of their depths. Is this information available anywhere?

Mostly this is because I'm interested in rules for monitoring an ethereum node and comparing it to, say, etherscan's block history, in order to raise an alarm if the node is running incorrectly. But I'm also interested in things like how exchanges determine the depth at which they'll consider a transaction to be settled.

3 Answers 3

6

From looking at the block stats on etherscan over the last 20 days, it looks like there are approximately:

  • 475-525 single depth reorgs per day (uncle blocks)
  • 1-2 reorgs with depth of two per day
  • I didn't see a single depth of three or more reorg

These numbers will probably go out of date soon. Only a few months ago there were days with 2,000 uncle blocks a day.

However, you definitely have to deal with the reality that there will be a LOT of single block reorgs every day, and double block reorgs happen.

3
  • Hi there. Just curious: how are you determining the depth of each fork from the Etherscan data? Commented Jul 17, 2019 at 19:16
  • 1
    Etherscan has an excluded blocks view, that shows for each excluded block the depth at which it was excluded. I just scrolled through several thousand blocks, and looked for the ones with a depth of more than one, since this was a question I personally needed the answer to. :) Commented Jul 17, 2019 at 19:49
  • Ah, I missed the "ReorgDepth" column :-) I'm sure it didn't use to be there, so last time I looked at something related to this - on that same page - I was left scratching my head :-) Thanks! Commented Jul 17, 2019 at 21:06
2

Just to follow on from Daniel's answer, here's a crappy Python scraper to scrape Etherscan and count the number of ephemeral forks of different lengths.

Results:

Forks of length 1: 6526
Forks of length 2: 164
Forks of length -: 85699

(Note: I think the - values are from older blocks where the depth data wasn't being recorded by Etherscan... so of limited use. Might given an idea as to the relative ratio of length 1 and 2 forks.)


Code:

import requests
from bs4 import BeautifulSoup
from collections import OrderedDict

URL = "https://etherscan.io/blocks_forked?p="

def getData(sess, page):
    url = URL + page
    print("Retrieving page", page)
    return BeautifulSoup(sess.get(url).text, 'html.parser')

def getPage(sess, page):
    table = getData(sess, str(page)).find('table')
    return [[X.text.strip() for X in row.find_all('td')] for row in table.find_all('tr')]

def main():
    resp = requests.get(URL)
    sess = requests.Session()

    counts = OrderedDict()

    page = 0
    while True:
        page += 1
        data = getPage(sess, page)

        try:
            for item in data:
                if len(item) != 0:
                    if item[8] in counts:
                        counts[item[8]] += 1
                    else:
                        counts[item[8]] = 1
        except:
            break

    for k, v in counts.items():
        print("Forks of length {}: {}".format(k, v))

if __name__ == "__main__":
    main()
1

Just to add to @Daniel's great answer: the amount of necessary confirmations depends on the needed amount of surety. How sure does the party need to be that the block won't get reverted?

As noted, single block reorgs happen all the time. Anything beyond that reduces the chances of revert drastically, per every extra depth.

Basically if you'd have data from all of the nodes in the blockchain and see how often they reorg and at what depth you'd get the proper numbers. Now you can just estimate it, although that's not very trivial either.

It's always a tradeoff. If you want faster "certain" transactions you can use a smaller amount of confirmations with higher risk. The more confirmations you require the less there is risk although after certain number (around 6-10) the risk is so minimal that there's no reason to wait any longer

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.