8

I am wondering if there is a standard/de facto P2P library/implementation/spec used by Bitcoin Core and other implementations of Bitcoin?

0

2 Answers 2

10

Bitcoin has its own custom wire protocol using TCP. Peer discovery is by address rumoring, where connected nodes gossip about other potential available peers. When a node is new and has nobody to gossip with, they make a DNS lookup of specific hostnames which provide a number of known-good peers to make an outgoing connection to. If DNS seeds fail and none of the known peers are good, Bitcoin Core nodes fall back to a set of hardcoded peers as a last resort.

https://developer.bitcoin.org/devguide/p2p_network.html#peer-discovery

Bitcore, BitcoinJ and python-bitcoinlib all have basic implementations of the wire protocol in JavaScript, Java and Python respectively. It is fairly simple to interact with nodes but misbehavior (such as sending invalid data) will cause the remote peer to ban you.

1

I'd like to note that Bitcoin P2P libraries for C# are also available in NBitcoin and the Stratis fullnode.

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.