|
1 | 1 | # BP Node |
2 | 2 |
|
3 | | -Bitcoin blockchain indexing and wallet notification node. It may be considered |
4 | | -electrum server replacement, which is faster, provides modern API (supporting |
5 | | -wallet descriptors, LN-specific queries, client-side-validation tech like RGB, |
6 | | -modern RPC subscribe interfaces). |
7 | | - |
8 | | -The node was originally designed and implemented by |
9 | | -[Dr Maxim Orlovsky](https://github.com/dr-orlovsky) as a part of |
10 | | -[LNP/BP Standards Association](https://github.com/LNP-BP) effort for |
11 | | -building the foundation for LNP/BP layer 2 and 3 bitcoin application ecosystem. |
12 | | -It is based on other LNP/BP projects such as [BP Core Lib], [BP Standard Lib], |
13 | | -[BP Wallet Lib] and can be easily integrated with the rest of LNP/BP nodes like |
14 | | -[LNP Node], [RGB Node], [Storm Node]. |
15 | | - |
16 | | -In the future it is planned to upgrade the node into a fully-validating bitcoin |
17 | | -node by using [`bitcoinkernel`] library for validating blocks. |
18 | | - |
19 | | -## Node services |
20 | | - |
21 | | -The node organized as a set of threads, interacting via crossbeam API with each |
22 | | -other -- and via [Strict RPC] with connecting clients. It leverages microservice |
23 | | -architecture with [I/O Reactor] (used instead of async), authentication with |
24 | | -self-sovereign identities ([SSI]) and end-to-end encryption from [Cyphernet] |
25 | | -crates. |
26 | | - |
27 | | -The node provides following set of services: |
28 | | -- `bpd`: main service providing clients with RPC request/reply API and managing |
29 | | - life cycle of the rest of the node services (launching, terminating, brokering |
30 | | - inter-service communications). |
31 | | -- `blockd`: service parsing and (in the future, using `bitcoinkernel`) |
32 | | - validating bitcoin blocks, storing them in the database. |
33 | | -- `mempoold`: manages mempool transactions. |
34 | | -- `walletd`: service instantiated for each wallet client. It knows about wallet |
35 | | - descriptor, monitors new mempool and mined transactions and notifies |
36 | | - subscribed client about their changes. |
37 | | -- `watchd`: watchtower service for lightning network and RGB. |
38 | | -- `listend`: interface listening to Bitcoin Core or an external indexing service |
39 | | - (like Esplora), if one is used. |
40 | | - |
41 | | -## RPC and client tools |
42 | | - |
43 | | -The repository also contains a BP Node RPC library (`bp-rpc` crate in |
44 | | -[`rpc`](./rpc) directory) and command-line tool (`bp-cli` crate in |
45 | | -[`cli`](./client) directory) for querying/working with the node. |
| 3 | + |
| 4 | + |
| 5 | +[](./LICENSE) |
| 6 | + |
| 7 | +Bitcoin blockchain indexing and wallet notification node. It may be considered Electrum server or |
| 8 | +Esplora replacement, being faster, providing modern binary API, supporting wallet descriptors, |
| 9 | +LN-specific queries, client-side-validation tech like RGB, modern publication-subscribe interfaces, |
| 10 | +Noise encryption in network connectivity, asymmetric cryptographic client authentication and many |
| 11 | +more. |
| 12 | + |
| 13 | +The node designed and implemented by [Dr Maxim Orlovsky](https://github.com/dr-orlovsky) as a part |
| 14 | +of [LNP/BP Labs](https://github.com/LNP-BP) effort in building the foundation for LNP/BP layer 2 and |
| 15 | +3 bitcoin application ecosystem. It is based on other LNP/BP projects such as [BP Core Lib], |
| 16 | +[BP Standard Lib], [BP Wallet Lib] and can be easily integrated with the rest of LNP/BP nodes like |
| 17 | +[LNP Node]. |
| 18 | + |
| 19 | +In the future it is planned to upgrade the node into a fully-validating bitcoin node by using |
| 20 | +[`bitcoinkernel`] library for validating blocks. |
| 21 | + |
| 22 | +## Components |
| 23 | + |
| 24 | +This repository contains the following crates: |
| 25 | + |
| 26 | +- `bp-node`: main indexing daemon, which can be used as an embedded multi-thread service, or |
| 27 | + compiled into a standalone binary (`bpd`); |
| 28 | +- `bp-client`: client to work with the daemon and a command-line utility `bp-cli`; |
| 29 | +- `bp-rpc`: a shared crate between `bp-node` and `bp-client`. |
| 30 | + |
| 31 | +## Node Architecture |
| 32 | + |
| 33 | +The node operates as a set of threads, communicating through Crossbeam channels. It leverages |
| 34 | +[`microservices.rs`] and [`netservices.rs`] crates, which serves as the node non-blocking |
| 35 | +reactor-based (see [`io-reactor`]) microservice frameworks. |
| 36 | + |
| 37 | +The node daemon has the following components: |
| 38 | + |
| 39 | +- **RPC**: reactor-based thread managing incoming client connections, notifying them about changes |
| 40 | + to the subscribed information; |
| 41 | +- **Block importer**: a client connecting an integration service (see below) to bitcoin blockchain |
| 42 | + provider (Bitcoin Core, other Bitcoin nodes or indexers) receiving downloaded and new blocks; |
| 43 | +- **Block processor**, a worker pool parsing new blocks coming from the integrated providers into |
| 44 | + database; |
| 45 | +- **Persistence**, an embedded ReDB database; |
| 46 | +- **Query worker pool**, running queries for the client subscriptions in the database. |
| 47 | + |
| 48 | +In order to operate one also needs to provide a node with an interface to bitcoin blocks integrating |
| 49 | +it with either Bitcoin Core, or any other node or indexer. |
| 50 | + |
| 51 | +By default, the node exposes a binary RPC API over TCP, which can be exposed as more high-level APIs |
| 52 | +(HTTP REST, Websocket-based or JSON-RPC) using special adaptor services. |
| 53 | + |
| 54 | +## OS Support |
| 55 | + |
| 56 | +The project currently supports only Linux and UNIX OSes. Support for macOS is currently broken due |
| 57 | +to use of a Rust language unstable feature on macOS platform by one of the project dependencies, and |
| 58 | +will be recovered soon. Windows support is a work-in-progress, requiring downstream [`io-reactor`] |
| 59 | +framework changes. |
46 | 60 |
|
47 | 61 | [`bitcoinkernel`]: https://github.com/bitcoin/bitcoin/issues/27587 |
| 62 | + |
48 | 63 | [BP Core Lib]: https://github.com/BP-WG/bp-core |
| 64 | + |
49 | 65 | [BP Standard Lib]: https://github.com/BP-WG/bp-std |
| 66 | + |
50 | 67 | [BP Wallet Lib]: https://github.com/BP-WG/bp-wallet |
| 68 | + |
51 | 69 | [LNP Node]: https://github.com/LNP-WG/lnp-node |
52 | | -[RGB Node]: https://github.com/RGB-WG/rgb-node |
53 | | -[Storm Node]: https://github.com/Storm-WG/storm-node |
54 | 70 |
|
55 | | -[SSI]: https://github.com/LNP-BP/SSI |
56 | | -[Cyphernet]: https://github.com/cyphernet-labs |
57 | | -[Strict RPC]: https://github.com/strict-types/strict-rpc |
58 | | -[I/O Reactor]: https://github.com/rust-amplify/io-reactor |
| 71 | +[`io-reactor`]: https://github.com/rust-amplify/io-reactor |
| 72 | + |
| 73 | +[`microservices.rs`]: https://github.com/cyphernet-labs/microservices.rs |
| 74 | + |
| 75 | +[`netservices.rs`]: https://github.com/cyphernet-labs/netservices.rs |
0 commit comments