|
1 |
| -# RGB Node & SDK |
| 1 | +# RGB Node |
2 | 2 |
|
3 | 3 | [](https://api.travis-ci.com/LNP-BP/rgb-node)
|
4 | 4 |
|
| 5 | +This is source for daemon executables and library that can run RGB backend. For |
| 6 | +wallet and exchange integration please check an interface to it and demo |
| 7 | +projects from [RGB SDK](https://github.com/LNP-BP/RGB-SDK). |
| 8 | + |
5 | 9 | This repository contains RGB node source code and SDK for wallet & server-side
|
6 | 10 | development.
|
7 | 11 |
|
8 | 12 | The node may run as a set of daemons (even in different docker containers);
|
9 | 13 | a multi-threaded single process or as a set of managed threads within a
|
10 | 14 | wallet app.
|
11 | 15 |
|
12 |
| -## Build |
| 16 | +## Design |
| 17 | + |
| 18 | +The node (as other nodes maitained by LNP/BP Standards Association and Pandora |
| 19 | +Core company subsidiaries) consists of multiple microservices, communicating |
| 20 | +with each other via LNP ZMQ RPC interface. |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +The set of microservices representing node can run as either: |
| 25 | +1) single daemon process on desktop or a server; |
| 26 | +2) cloud of docker-based daemons, one per microservice, with instance |
| 27 | + scalability and in geo-distributed environment; |
| 28 | +3) inside a single mobile app as threads; |
| 29 | +4) and even different nodes can be combined in their services between themselves |
| 30 | + into a single executables/mobile apps; |
| 31 | +5) all P2P communications are end-to-end encrypted and work over Tor. |
| 32 | + |
| 33 | +Other nodes, designed an maintained by LNP/BP Standards Association with the |
| 34 | +same architecture include: |
| 35 | +* [LNP Node](https://github.com/LNP-BP/lnp-node) for running Lightning Network |
| 36 | + Protocol (LNP) and Generalized Lightning Channels (GLC). |
| 37 | +* [BP Node](https://github.com/LNP-BP/bp-node) for indexing bitcoin blockchain |
| 38 | + (you may think of it as a more efficient Electrum server alternative) |
| 39 | +* Bifrost – node for storing/passing client-side-validated data with watchtower |
| 40 | + functionality and used for Storm/RGB/DEX infrastructure |
| 41 | + |
| 42 | +Other third parties provide their own nodes: |
| 43 | +* [Keyring](https://github.com/pandoracore/keyring) for managing private key |
| 44 | + accounts, storage and signatures with support for miniscript and PSBTs |
| 45 | +* [MyCitadel](https://github.com/mycitadel/mycitadel-node) Bitcoin, LN & RGB |
| 46 | + enabled wallet service with support for other LNP/BP protocols |
| 47 | + |
| 48 | +## Project organization & architecture |
| 49 | + |
| 50 | +* [`src/api/`](src/api/) – LNP messages for all daemons used for message bus |
| 51 | +* [`src/bin/`](src/bin/) – binaries for daemons & CLI launching main process |
| 52 | +* [`src/cli/`](src/cli/) – CLAP-based command line API talking to message bus |
| 53 | +* [`src/i8n/`](src/i8n/) – functions exposed to FFI talking to message bus |
| 54 | +* `src/<name>/` – service/daemon-specific code: |
| 55 | + - [`src/stash/`](src/stash) – daemon managing RGB stash data and its storage; |
| 56 | + you may configure it (with either config file, environment vars or |
| 57 | + command-line arguments) to use different forms of storage drivers; |
| 58 | + - [`src/contracts`](src/contracts) – daemons supporting high-level APIs for |
| 59 | + working with different forms of RGB Schema: RGB-20 (fungible assets), |
| 60 | + RGB-21 (collectionables/NFTs) etc; |
| 61 | + - [`src/rgbd`](src/rgbd) – daemon orchestrating bootstrapping of stash and |
| 62 | + contracts daemons |
| 63 | + |
| 64 | +Each daemon (more correctly "microservice", as it can run as a thread, not |
| 65 | +necessary a process) or other binary (like CLI tool) follows the same |
| 66 | +organization concept for module/file names: |
| 67 | +* `error.rs` – daemon-specific error types; |
| 68 | +* `config.rs` – CLAP arguments & daemon configuration data; |
| 69 | +* `runtime.rs` – singleton managing main daemon thread and keeping all ZMQ/P2P |
| 70 | + connections and sockets; receiving and processing messages through them; |
| 71 | +* `processor.rs` – business logic functions & internal state management which |
| 72 | + does not depend on external communications/RPC; |
| 73 | +* `index/`, `storage/`, `cache/` – storage interfaces and engines; |
| 74 | +* `db/` – SQL-specific schema and code, if needed. |
13 | 75 |
|
14 | 76 | ### Local
|
15 | 77 |
|
@@ -68,13 +130,6 @@ The receiving party must do the following:
|
68 | 130 | `rgb-cli -d <data_dir> -vvvv fungible accept <consignment_file> <utxo>:<vout> <blinding>`,
|
69 | 131 | where `utxo` and the `blinding` must be values used in invoice generation
|
70 | 132 |
|
71 |
| -## Language bindings |
72 |
| - |
73 |
| -The following bindings are available: |
74 |
| -- [Android](/ffi/android) |
75 |
| -- [iOS](/ffi/ios) |
76 |
| -- [Node.js](/ffi/nodejs) |
77 |
| - |
78 | 133 | ## Developer guidelines
|
79 | 134 |
|
80 | 135 | In order to update the project dependencies, run `cargo update`.
|
|
0 commit comments