Bitcoin Forum
May 05, 2024, 07:36:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Detecting forks with bitcoind  (Read 731 times)
bukaj (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
May 11, 2013, 01:37:26 PM
 #1

Is there any way to detect blockchain fork using bitcoind and RPC? I would like to suspend accepting incoming transactions during blockchain forks longer than or close to my level of required confirmations (i.e. 6). AFAIK client has to track all branches so this information is available in it. I think it could be important failsafe measure especially in light of ongoing discussion about replacing transactions with new ones with higher fee.
1714937762
Hero Member
*
Offline Offline

Posts: 1714937762

View Profile Personal Message (Offline)

Ignore
1714937762
Reply with quote  #2

1714937762
Report to moderator
1714937762
Hero Member
*
Offline Offline

Posts: 1714937762

View Profile Personal Message (Offline)

Ignore
1714937762
Reply with quote  #2

1714937762
Report to moderator
1714937762
Hero Member
*
Offline Offline

Posts: 1714937762

View Profile Personal Message (Offline)

Ignore
1714937762
Reply with quote  #2

1714937762
Report to moderator
Even if you use Bitcoin through Tor, the way transactions are handled by the network makes anonymity difficult to achieve. Do not expect your transactions to be anonymous unless you really know what you're doing.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714937762
Hero Member
*
Offline Offline

Posts: 1714937762

View Profile Personal Message (Offline)

Ignore
1714937762
Reply with quote  #2

1714937762
Report to moderator
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
May 11, 2013, 07:00:11 PM
 #2

If there is a longer fork with more work that your node thinks is invalid, you'll get this alert:

    Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.

(see the GetWarnings() function in main.cpp).

If you are on the fork with the most work... I suppose if the second-best chain was forked more than 6 blocks back and contained more than... oh,  5 blocks and the timestamp on the last block in that chain was less than ?an hour ago? that could trigger another alert.

All that might be tricky to implement-- either (or both) forks might themselves have forks.  Or, theoretically, there could be three or more active forks, some of which might have equal proof-of-work...

How often do you get the chance to work on a potentially world-changing project?
bukaj (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
May 11, 2013, 10:27:56 PM
 #3

Thank you for the answer. I'll look into it. I think it would be useful to create RPC API command to return info about such status. For example "getforkstatus 6" could return true if longest chain is longer or equal than next longest chain by at least 6 block. Additionally some --forknotify <cmd> command-line parameter could notify about detecting blockchain fork...
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!