Bitcoin Forum
April 28, 2024, 06:44:48 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how the ban score algorithm calculates?  (Read 89 times)
DifDrama (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 32


View Profile
August 23, 2023, 03:46:48 AM
Merited by NotATether (5), ABCbits (1)
 #1

I searched for information about ban score, but was still confused. Could you kindly provide insight into how the ban score algorithm calculates the ban score attributed to a node?  Specifically, I'm interested in understanding the criteria for misbehaviors that trigger the ban score algorithm and result in a ban score being assigned to a node.  Additionally, I would greatly appreciate guidance on where to access official documentation or resources to learn more comprehensively about this topic.  Any views or responses will be greatly appreciated.
1714286688
Hero Member
*
Offline Offline

Posts: 1714286688

View Profile Personal Message (Offline)

Ignore
1714286688
Reply with quote  #2

1714286688
Report to moderator
1714286688
Hero Member
*
Offline Offline

Posts: 1714286688

View Profile Personal Message (Offline)

Ignore
1714286688
Reply with quote  #2

1714286688
Report to moderator
1714286688
Hero Member
*
Offline Offline

Posts: 1714286688

View Profile Personal Message (Offline)

Ignore
1714286688
Reply with quote  #2

1714286688
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10505



View Profile
August 23, 2023, 04:57:40 AM
Merited by ABCbits (5), ranochigo (4), hosseinimr93 (4), BlackHatCoiner (4), DdmrDdmr (1), DifDrama (1)
 #2

I don't think there is any documentation that you can find and read specially since "ban score" is not part of the protocol (it is not part of consensus rules), it is what bitcoin core defines and uses internally to prevent abuse and can change.

You'll have to read the source code to understand the details of it. As far as I can tell it is all happening in the net_processing.cpp file by making calls to the Misbehaving() method and passing a value as the "points" to add to the misbehaving point of the peer (that is the ban score). As long as the total point doesn't surpass the threshold (default=100) the connection will remain open otherwise it will be terminated.

Some examples of the "unacceptable" behavior that would disconnect a peer is sending an invalid block or block header or transaction which would ban the peer.

Other times where the peer would be given a "yellow card" instead of being banned are when they break some other "soft" rules like sending more headers in a headers message as they should, or when they send you a block that you don't have the parent to.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5539


Self-proclaimed Genius


View Profile
August 23, 2023, 05:00:45 AM
Merited by ABCbits (1), DifDrama (1)
 #3

Any views or responses will be greatly appreciated.
There's a lot of criteria and ban score based from the severity of its misbehavior.

For that, you'll need to check it directly on the code, "new_processing.cpp": https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp#L539-L543
The linked line and comments show "howmuch" ban score to add to a misbehaving peer.
Search for "misbehaving(" on that link to check all the scores and reasons, the developers conveniently added comments to explain each.

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

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

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

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

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

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











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











▄▄▄▄█
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1498
Merit: 7294


Farewell, Leo


View Profile
August 23, 2023, 09:36:33 AM
Merited by pooya87 (2), ABCbits (2), DifDrama (1)
 #4

It's also worth to note that the ban score is determined differently across Bitcoin Core versions, and probably even more across in different Bitcoin clients. For example, in release notes of v0.20.2 you can notice there has been update. Another example is Gocoin, which is another Bitcoin client, using a different algorithm for misbehaving[2].

[1] https://github.com/bitcoin/bitcoin/blob/5aa67eb3655a0023f0cf115176fc8d5bac53cdcd/doc/release-notes/release-notes-0.20.2.md?plain=1#L61-L84
[2] https://github.com/piotrnar/gocoin/blob/8d6e60ce6f16631f66585cc6ef75c8a31dd52afa/client/network/core.go#L440C1-L461

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

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

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

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

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

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











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











▄▄▄▄█
DifDrama (OP)
Jr. Member
*
Offline Offline

Activity: 33
Merit: 32


View Profile
August 24, 2023, 06:22:09 AM
 #5

Thank you all. It really helped me a lot.
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!