P2P-CASH is a library which allows to communicate with Bitcoin full nodes such as BCHN. While direct communication over TCP sockets is not available in the browsers, we make use of a lightweight WebSocket-to-TCP proxy[1]. The library features monitoring for new network events such as new mempool transactions, new blocks, new double spend proofs[2] and new peers joining the network. On a lower level you can subscribe to and send any p2p messages defined in protocol[3]. On a higher level many convenient methods are exposed, such as broadcast already signed transactions, query for mempool contents, fetch most recent transactions, download block headers and entire blocks. Heck, you can even do the IBD (initial block download) and run a full node in your browser! The idea of this library is to enable developers to create custom indexers and do sophisticated data analysis. Yeah, and without the need to host their own full node and download the entire blockchain first. This is not a replacement for an ElectrumX server such as Fulcrum[4] but rather a complementary missing piece which adds more convenience and power to aid the developer as if they would work with a full node:    * monitoring all new blocks, transactions and DSPs    * monitoring specific address transactions    * downloading blocks    * getting mempool contents, etc. You can choose to connect to a single trusted node or minimize the trust and connect to a cluster of several nodes. The cluster's confidence can be configured to be lower than 100% which increases the fault tolerance. This project is a continuation and expansion of bsv-p2p[5], it adds support for cash addresses, p2sh addresses, cashtokens and cashtoken addresses, double spend proofs, convenience methods and cluster operation mode. Idea of using a cluster is taken from great electrum-cash[6] project.

[1] https://github.com/mainnet-pat/websockify-js

[2] https://flowee.org/docs/spec/network/messages/dsproof-beta/

[3] https://en.bitcoin.it/wiki/Protocol_documentation

[4] https://electrum-cash-protocol.readthedocs.io/en/latest/protocol-methods.html

[5] https://github.com/kevinejohn/bsv-p2p

[6] https://gitlab.com/GeneralProtocols/electrum-cash/library


New events

New transaction, block and double spend proof hashes will appear here


Request responses will be rendered here

Do you like P2P-CASH? Tips are welcome!
pat#111222; 🎀