Bitcoin Forum
May 05, 2024, 08:19:13 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Orphaned blocks detection  (Read 231 times)
pireff (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
November 09, 2019, 08:06:47 PM
 #1

Hello Bitcointalk members, as it's apparent from the title, i need a reliable way to detect orphan blocks. I wrote a custom explorer, and it's running quite fast actually, but i need an explanation on how exactly i can detect orphans, and mark them as so.

What the longest chain fork due to orphan blocks is?
If on every block sync, i check the last 1000 blocks, is that enough to assume that every block beyond these 1000 is NOT an orphan?
Is the -1 confirmations the only way to detect them?

Admins, if this post is not for this board/section, feel free to move it
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714897153
Hero Member
*
Offline Offline

Posts: 1714897153

View Profile Personal Message (Offline)

Ignore
1714897153
Reply with quote  #2

1714897153
Report to moderator
ranochigo
Legendary
*
Offline Offline

Activity: 2954
Merit: 4166


View Profile
November 10, 2019, 03:45:01 AM
 #2

Hello Bitcointalk members, as it's apparent from the title, i need a reliable way to detect orphan blocks. I wrote a custom explorer, and it's running quite fast actually, but i need an explanation on how exactly i can detect orphans, and mark them as so.
In normal circumstances, orphan occurs when block A and B are produced at the same time and that a portion of the network is building on Block A and the other is building on Block B. The miners will compete with each other until either of the sides find a block. This further extends the network and thus one of the forks now have a larger accumulated proof of work. The longer fork will supersede the shorter one. The problem with this is that nodes won't register (AFAIK) block B after they've received block A. Hence, you would need to have a very good connection to the network and a modified client to see all of the orphans that is on the network.
What the longest chain fork due to orphan blocks is?
IIRC, the longest fork I've seen was during the 2013 hard fork and that lasted >30 blocks. Normally, the orphans should not go beyond 6 blocks.
If on every block sync, i check the last 1000 blocks, is that enough to assume that every block beyond these 1000 is NOT an orphan?
Is the -1 confirmations the only way to detect them?
The orphan blocks are stored within the Bitcoin database. Parse the database and you should be able to sieve them out.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Sohyun Park
Member
**
Offline Offline

Activity: 103
Merit: 10


View Profile
November 14, 2019, 01:11:21 PM
 #3

it's running quite fast actually, but i need an explanation on how exactly i can detect orphans, and mark them as so.

Yes, it is running fast but, why do you wan to detect is as you can see last 2 years there are zero orphan blocks mined. You can check all the details of the orphan block in the link below:
https://www.blockchain.com/charts/n-orphaned-blocks?timespan=all

Also, here are all the blocks that are "mined but ultimately not attached to the main Bitcoin blockchain".
https://api.blockchain.info/charts/n-orphaned-blocks?timespan=all&scale=1&format=json

ranochigo
Legendary
*
Offline Offline

Activity: 2954
Merit: 4166


View Profile
November 14, 2019, 01:43:27 PM
 #4

it's running quite fast actually, but i need an explanation on how exactly i can detect orphans, and mark them as so.

Yes, it is running fast but, why do you wan to detect is as you can see last 2 years there are zero orphan blocks mined. You can check all the details of the orphan block in the link below:
https://www.blockchain.com/charts/n-orphaned-blocks?timespan=all

Also, here are all the blocks that are "mined but ultimately not attached to the main Bitcoin blockchain".
https://api.blockchain.info/charts/n-orphaned-blocks?timespan=all&scale=1&format=json
That's wrong. Orphan blocks still occur once in a while but they are less common with the better connection between the mining pools. Mining pools are often listening directly to each other and thus it is less likely for orphans to occur.  It was more common in the past whereby the propagation of the network was much slower.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
fronti
Legendary
*
Offline Offline

Activity: 2909
Merit: 1307



View Profile
November 14, 2019, 05:35:27 PM
 #5

The orphan blocks are stored within the Bitcoin database. Parse the database and you should be able to sieve them out.
only when your Node receives this block while running.
if you download the database from another node that only the valid blocks are transferred

correct me if I'm wrong.

If you like to give me a tip:  bc1q8ht32j5hj42us5qfptvu08ug9zeqgvxuhwznzk

"Bankraub ist eine Unternehmung von Dilettanten. Wahre Profis gründen eine Bank." Bertolt Brecht
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!