{"id":29143459,"url":"https://github.com/vulpemventures/neutrino-elements","last_synced_at":"2025-06-30T20:07:31.243Z","repository":{"id":37862975,"uuid":"433448851","full_name":"vulpemventures/neutrino-elements","owner":"vulpemventures","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-19T08:19:59.000Z","size":4691,"stargazers_count":3,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-30T15:57:02.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/vulpemventures.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-30T13:51:11.000Z","updated_at":"2023-05-20T10:59:16.000Z","dependencies_parsed_at":"2023-01-17T17:31:05.636Z","dependency_job_id":null,"html_url":"https://github.com/vulpemventures/neutrino-elements","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/vulpemventures/neutrino-elements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vulpemventures%2Fneutrino-elements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vulpemventures%2Fneutrino-elements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vulpemventures%2Fneutrino-elements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vulpemventures%2Fneutrino-elements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vulpemventures","download_url":"https://codeload.github.com/vulpemventures/neutrino-elements/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vulpemventures%2Fneutrino-elements/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262842920,"owners_count":23373167,"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":[],"created_at":"2025-06-30T20:07:28.264Z","updated_at":"2025-06-30T20:07:31.154Z","avatar_url":"https://github.com/vulpemventures.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neutrino Elements\n\n[![Go](https://github.com/vulpemventures/neutrino-elements/actions/workflows/ci.yml/badge.svg)](https://github.com/vulpemventures/neutrino-elements/actions/workflows/ci.yml)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/vulpemventures/neutrino-elements)](https://pkg.go.dev/github.com/vulpemventures/neutrino-elements)\n[![Release](https://img.shields.io/github/release/vulpemventures/neutrino-elements.svg?style=flat-square)](https://github.com/vulpemventures/neutrino-elements/releases/latest)\n[![Go Report Card](https://goreportcard.com/badge/github.com/vulpemventures/neutrino-elements)](https://goreportcard.com/report/github.com/vulpemventures/neutrino-elements)\n[![Bitcoin Donate](https://badgen.net/badge/Bitcoin/Donate/F7931A?icon=bitcoin)](https://blockstream.info/address/3MdERN32qiMnQ68bSSee5CXQkrSGx1iStr)\n\nNeutrino + Elements\n\n## Overview\n\nNeutrino-elements is a set of useful packages and binaries that can be used to \"watch\" Liquid side-chain events.\u003cbr\u003e\nIt uses Compact Block Filter (BIP0158) to implement a light client for [elements](https://elementsproject.org/) based networks.\u003cbr\u003e\n\nTwo packages, that works independently, are provided if you want to build your own light client:\u003cbr\u003e\n- `NodeService` is a full node maintaining an up-to-date state of the block headers + compact filters. The NodeService writes down headers and filters in repositories.\u003cbr\u003e\n- `ScannerService` uses filters and headers repositories to handle `ScanRequest` which aims to know if an outpoint (identified by its script) is spent or not.\u003cbr\u003e\n\nTwo binaries are provided if you want to use ready light client:\u003cbr\u003e\n- `neutrinod` is a daemon that accepts websocket connections on which clients can send requests to watch for events related to wallet-descriptor\u003cbr\u003e\nneutrinod also exposes HTTP endpoint that supports adding webhooks to receive notifications when an event occurs.\u003cbr\u003e\n- `neutrino` is a simple command line tool that can be used to watch Liquid side-chain events.\u003cbr\u003e\n\n## Local Development\n\n### Requirements\n- Go (^1.17.*)\n- Nigiri (^0.4.*)\n\n### Build neutrinod \u0026 neutrino CLI\n\n```\nmake build-nd\nmake build-n\n```\n\n### Run test\n\n```\nmake test\n```\n\n### Run neutrinod and postgres db inside Docker container\n\n```\nmake dev\n```\n\n### Run neutrinod and postgres db separately\n\n- Run `make pgcreatedb` to create database inside postgres container\n- Run(or use binaries) `go run ./cmd/neutrinod/main.go` to start neutrinod\n- Run `make wpkh` to fund address with two transactions and get wpkh wallet descriptor\n- Run `go run ./cmd/neutrino/* subscribe --descriptor=\"{WPKH_DESCRIPTOR}\" --block_height=0 --events=unspentUtxo` to watch for events\n\n## Usage\n\n### Run neutrinod\n\n```\n./neutrinod\n```\n\n### Config CLI\n```\n./neutrino config\n```\n\n### Watch for events related to wallet-descriptor(websocket-{HOST:PORT}/neutrino/subscribe/ws) \n```\n./neutrino subscribe --descriptor=\"{WALLET_DESCRIPTOR}\" --block_height={BLOCK_HEIGHT} --events=unspentUtxo\n```\n### Add webhook(http)\n```sh\ncurl -X POST http://localhost:8000/neutrino/subscribe/http \\\n   -H 'Content-Type: application/json' \\\n   -d '{\"actionType\":\"register\", \"eventTypes\":[\"unspentUtxo\"], \"descriptorWallet\":\"wpkh(037470e26cc774eca62ca19e1a182461a5f3d3680acbc593ce3f38cd142c26c03d)\", \"startBlockHeight\":0, \"endpointUrl\":\"http://127.0.0.1:62900\"}'\n```\n\n## API\nNeutrinod can be used to subscribe to events related to wallet-descriptor using web-socket or by registrating webhook using HTTP.\u003cbr\u003e\n\n### Web-socket\nTo subscribe to events related to wallet-descriptor using web-socket connection, send below json :\u003cbr\u003e\n```json\n{\n    \"actionType\":\"register\", \n    \"eventTypes\":[\"unspentUtxo\"], \n    \"descriptorWallet\":\"{WALLET_DESCRIPTOR}\", \n    \"startBlockHeight\":\"{START_BLOCK_HEIGHT}\", \n}\n```\nto the following endpoint:\n```\n/neutrino/subscribe/ws\n```\n\n### HTTP \nTo register webhook, send bellow json :\u003cbr\u003e\n```json\n{\n  \"actionType\": \"register\",\n  \"eventTypes\": [\"unspentUtxo\"],\n  \"descriptorWallet\": \"{WALLET_DESCRIPTOR}\",\n  \"startBlockHeight\": \"{START_BLOCK_HEIGHT}\",\n  \"endpointUrl\": \"{ENDPOINT_URL}\"\n}\n```\nto the following endpoint:\n```\n/neutrino/subscribe/http\n```\n\nValid actionTypes: \"register\", \"unregister\"\u003cbr\u003e\nValid eventTypes: \"unspentUtxo\", \"spentUtxo\"\u003cbr\u003e\n\n## License\n\nMIT - see the LICENSE.md file for details\n\n## Acknowledgments\n\n* [Neutrino - Light bitcoin client](https://github.com/lightninglabs/neutrino)\n* [Compact Block Filters for Light Clients - BIP158](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki)\n* [tinybit](https://github.com/Jeiwan/tinybit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvulpemventures%2Fneutrino-elements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvulpemventures%2Fneutrino-elements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvulpemventures%2Fneutrino-elements/lists"}