{"id":13570013,"url":"https://github.com/RGB-WG/rgb-node","last_synced_at":"2025-04-04T06:31:36.904Z","repository":{"id":37064214,"uuid":"261824231","full_name":"RGB-WG/rgb-node","owner":"RGB-WG","description":"RGB node - the official server-side implementation","archived":true,"fork":false,"pushed_at":"2023-10-02T21:37:03.000Z","size":1865,"stargazers_count":148,"open_issues_count":25,"forks_count":40,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-02-26T03:34:46.006Z","etag":null,"topics":["bitcoin","client-side-validation","lightning","lightning-network","lnp-bp","rgb","smart-contracts"],"latest_commit_sha":null,"homepage":"https://rgb.tech","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RGB-WG.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["dr-orlovsky"]}},"created_at":"2020-05-06T16:58:29.000Z","updated_at":"2025-01-11T10:55:06.000Z","dependencies_parsed_at":"2024-01-14T03:50:13.011Z","dependency_job_id":"5e67121e-c83c-4085-a69e-f5403bbde44e","html_url":"https://github.com/RGB-WG/rgb-node","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGB-WG%2Frgb-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGB-WG%2Frgb-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGB-WG%2Frgb-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RGB-WG%2Frgb-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RGB-WG","download_url":"https://codeload.github.com/RGB-WG/rgb-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247134445,"owners_count":20889399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","client-side-validation","lightning","lightning-network","lnp-bp","rgb","smart-contracts"],"created_at":"2024-08-01T14:00:47.175Z","updated_at":"2025-04-04T06:31:31.890Z","avatar_url":"https://github.com/RGB-WG.png","language":"Rust","funding_links":["https://github.com/sponsors/dr-orlovsky"],"categories":["Awesome RGB(Really Good Bitcoin)"],"sub_categories":["Code Repositories"],"readme":"# RGB Node\n\n![Build](https://github.com/LNP-BP/rgb-node/workflows/Build/badge.svg)\n![Lints](https://github.com/LNP-BP/rgb-node/workflows/Lints/badge.svg)\n\n[![crates.io](https://meritbadge.herokuapp.com/rgb_node)](https://crates.io/crates/rgb_node)\n[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nThis is source for daemon executables and library that can run RGB backend. For\nwallet and exchange integration please check an interface to it and demo\nprojects from [RGB SDK](https://github.com/LNP-BP/RGB-SDK).\n\nThis repository contains RGB node source code and SDK for wallet \u0026 server-side\ndevelopment.\n\nThe node may run as a set of daemons (even in different docker containers);\na multi-threaded single process or as a set of managed threads within a\nwallet app.\n\nFor an easy test setup that allows to experience the node's capabilities, you\ncan check out the [demo](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/doc/demo-0.1/).\n\n## Design\n\nThe node (as other nodes maitained by LNP/BP Standards Association and Pandora\nCore company subsidiaries) consists of multiple microservices, communicating\nwith each other via LNP ZMQ RPC interface.\n\n[Node architecture](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/doc/node_arch.jpeg)\n\nThe set of microservices representing node can run as either:\n1) single daemon process on desktop or a server;\n2) cloud of docker-based daemons, one per microservice, with instance\n   scalability and in geo-distributed environment;\n3) inside a single mobile app as threads;\n4) and even different nodes can be combined in their services between themselves\n   into a single executables/mobile apps;\n5) all P2P communications are end-to-end encrypted and work over Tor.\n\nOther nodes, designed an maintained by LNP/BP Standards Association with the\nsame architecture include:\n* [LNP Node](https://github.com/LNP-BP/lnp-node) for running Lightning Network\n  Protocol (LNP) and Generalized Lightning Channels (GLC).\n* [BP Node](https://github.com/LNP-BP/bp-node) for indexing bitcoin blockchain\n  (you may think of it as a more efficient Electrum server alternative)\n* Bifrost – node for storing/passing client-side-validated data with watchtower\n  functionality and used for Storm/RGB/DEX infrastructure\n\nOther third parties provide their own nodes designed with the same architecture,\nfor instance:\n* [Keyring](https://github.com/pandoracore/keyring) for managing private key\n  accounts, storage and signatures with support for miniscript and PSBTs\n\n## Project organization \u0026 architecture\n\n* [`src/api/`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/api/) –\n  LNP messages for all daemons used for message bus\n* [`src/bin/`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/bin/) –\n  binaries for daemons \u0026 CLI launching main process\n* [`src/cli/`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/cli/) –\n  CLAP-based command line API talking to message bus\n* [`src/i8n/`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/i8n/) –\n  functions exposed to FFI talking to message bus\n* `src/\u003cname\u003e/` – service/daemon-specific code:\n  - [`src/stash/`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/stash) –\n    daemon managing RGB stash data and its storage;\n    you may  configure it (with either config file, environment vars or\n    command-line arguments) to use different forms of storage drivers;\n  - [`src/contracts`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/contracts) –\n    daemons supporting high-level APIs for\n    working with different forms of RGB Schema: RGB-20 (fungible assets),\n    RGB-21 (collectionables/NFTs) etc;\n  - [`src/rgbd`](https://github.com/LNP-BP/rgb-node/tree/v0.2.0/src/rgbd) –\n    daemon orchestrating bootstrapping of stash and\n    contracts daemons\n\nEach daemon (more correctly \"microservice\", as it can run as a thread, not\nnecessary a process) or other binary (like CLI tool) follows the same\norganization concept for module/file names:\n* `error.rs` – daemon-specific error types;\n* `config.rs` – CLAP arguments \u0026 daemon configuration data;\n* `runtime.rs` – singleton managing main daemon thread and keeping all ZMQ/P2P\n  connections and sockets; receiving and processing messages through them;\n* `processor.rs` – business logic functions \u0026 internal state management which\n  does not depend on external communications/RPC;\n* `index/`, `storage/`, `cache/` – storage interfaces and engines;\n* `db/` – SQL-specific schema and code, if needed.\n\n## Install\n\nMinimum supported rust compiler version (MSRV): 1.45\n\n### Local\n\nTo compile the node, please install [cargo](https://doc.rust-lang.org/cargo/),\nthen run the following commands:\n\n#### Linux\n\n    sudo apt update\n    sudo apt install -y build-essential cmake libpq-dev libsqlite3-dev libssl-dev libzmq3-dev pkg-config\n\n#### MacOS\n\n    brew install cmake libpq sqlite pkg-config openssl zmq\n\n#### Both\n\n    git clone https://github.com/LNP-BP/rgb-node.git\n    cd rgb-node\n    cargo install --all-features --bins --path .\n\nNow, to run the node you can execute\n\n    rgbd --data-dir ~/.rgb --bin-dir ~/.cargo/bin -vvvv --contract fungible\n\n### In docker\n\nIn order to build and run a docker image of the node, run:\n```bash\ndocker build -t rgb-node .\ndocker run --rm --name rgb_node rgb-node\n```\n\n## Using\n\nFirst, you need to start daemons:\n`rgbd -vvvv -d \u003cdata_dir\u003e -b \u003cbin_dir\u003e --contract fungible`\nwhere `bin_dir` is a directory with all daemons binaries (usually\n`~/.cargo/bin` from repo source after `cargo install --all-features --bins --path .`\ncommand).\n\nIssuing token:\n`rgb-cli -d \u003cdata_dir\u003e -vvvv fungible issue TCKN \"SomeToken\" \u003csupply\u003e@\u003ctxid\u003e:\u003cvout\u003e`\n\nNext, list your tokens\n`rgb-cli -d \u003cdata_dir\u003e -vvvv fungible list`\n\nDo an invoice\n`rgb-cli -d \u003cdata_dir\u003e -vvvv fungible invoice \u003ccontract_id\u003e \u003camount\u003e \u003ctxid\u003e:\u003cvout\u003e`,\nwhere `\u003ccontract_id\u003e` is id of your token returned by the last call, and\n`\u003ctxid\u003e:\u003cvout\u003e` must be a transaction output you are controlling.\n\nSave the value of the binding factor you will receive: it will be required in\nthe future to accept the transfer. Do not share it!\nSend the invoice string to the payee.\n\nDoing transfer: this requires preparation of PSBT; here we use ones from our\nsample directory\n`rgb-cli -d \u003cdata_dir\u003e -vvvv fungible transfer \"\u003cinvoice\u003e\" test/source_tx.psbt \u003cconsignment_file\u003e test/dest_tx.psbt -i \u003cinput_utxo\u003e [-a \u003camount\u003e@\u003cchange_utxo\u003e]`\nNB: input amount must be equal to the sum of invoice amount and change amounts.\n\nThis will produce consignment. Send it to the receiving party.\n\nThe receiving party must do the following:\n`rgb-cli -d \u003cdata_dir\u003e -vvvv fungible accept \u003cconsignment_file\u003e \u003cutxo\u003e:\u003cvout\u003e \u003cblinding\u003e`,\nwhere `utxo` and the `blinding` must be values used in invoice generation\n\n## Developer guidelines\n\nIn order to update the project dependencies, run `cargo update`.\nIf any dependency updates, the `Cargo.lock` file will be updated, keeping\ntrack of the exact package version.\n\nAfter an update, run tests (`cargo test`) and manually test the software\nin order to stimulate function calls from updated libraries.\n\nPlease check [software using RGB Node](#software-using-rgb-node) for integration\nexamples.\n\nIf any problem arises, open an issue.\n\n\n## Software using RGB Node\n\n* [Bitcoin Pro](https://github.com/pandoracore/bitcoin-pro): tool for\n  RGB asset issue \u0026 management for asset by the issuers\n* [MyCitadel](https://github.com/mycitadel) Bitcoin, LN \u0026 RGB\n  enabled wallet service with support for other LNP/BP protocols\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRGB-WG%2Frgb-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRGB-WG%2Frgb-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRGB-WG%2Frgb-node/lists"}