{"id":18700023,"url":"https://github.com/theborakompanioni/cln-spend-and-replace-plugin","last_synced_at":"2026-04-28T17:01:30.619Z","repository":{"id":161099261,"uuid":"632023953","full_name":"theborakompanioni/cln-spend-and-replace-plugin","owner":"theborakompanioni","description":"Core Lightning :zap: plugin to immediately re-stack all outgoing sats from your node.","archived":false,"fork":false,"pushed_at":"2023-12-17T20:41:45.000Z","size":5849,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":4,"default_branch":"devel","last_synced_at":"2025-06-25T19:02:15.629Z","etag":null,"topics":["bitcoin","cln","core-lightning","lightning"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theborakompanioni.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T14:50:00.000Z","updated_at":"2023-07-08T05:13:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b4a5702-f1c7-4b76-b3ce-1819b2221bd2","html_url":"https://github.com/theborakompanioni/cln-spend-and-replace-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/theborakompanioni/cln-spend-and-replace-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theborakompanioni%2Fcln-spend-and-replace-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theborakompanioni%2Fcln-spend-and-replace-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theborakompanioni%2Fcln-spend-and-replace-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theborakompanioni%2Fcln-spend-and-replace-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theborakompanioni","download_url":"https://codeload.github.com/theborakompanioni/cln-spend-and-replace-plugin/tar.gz/refs/heads/devel","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theborakompanioni%2Fcln-spend-and-replace-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","cln","core-lightning","lightning"],"created_at":"2024-11-07T11:35:24.224Z","updated_at":"2026-04-28T17:01:30.601Z","avatar_url":"https://github.com/theborakompanioni.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/theborakompanioni/cln-spend-and-replace-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/theborakompanioni/cln-spend-and-replace-plugin/actions/workflows/build.yml)\n[![GitHub Release](https://img.shields.io/github/release/theborakompanioni/cln-spend-and-replace-plugin.svg?maxAge=3600)](https://github.com/theborakompanioni/cln-spend-and-replace-plugin/releases/latest)\n[![License](https://img.shields.io/github/license/theborakompanioni/cln-spend-and-replace-plugin.svg?maxAge=21000000)](https://github.com/theborakompanioni/cln-spend-and-replace-plugin/blob/master/LICENSE)\n\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/theborakompanioni/cln-spend-and-replace-plugin/blob/master/docs/assets/images/logo-dark.svg#gh-light-mode-only\" alt=\"Logo\" width=\"256\" /\u003e\n    \u003cimg src=\"https://github.com/theborakompanioni/cln-spend-and-replace-plugin/blob/master/docs/assets/images/logo-light.svg#gh-dark-mode-only\" alt=\"Logo\" width=\"256\" /\u003e\n\u003c/p\u003e\n\n\ncln-spend-and-replace-plugin\n===\nCore Lightning :zap: plugin to immediately re-stack all outgoing sats from your node.\n\n**Note**: Most code is still experimental - ~~**use with caution**~~ **do not use till v0.1.0 is reached**.\nThis project is under active development. Pull requests and issues are welcome.\n[Look at the changelog](changelog.md) to track notable changes.\n\n- [x] Place market orders on exchange for all outgoing payments\n- [x] In `dry-run` mode (or on any other network than `mainnet`), place massively undervalued limit orders\n- [ ] Blocked: Withdraw via Lightning automatically (according to @pierrerochard, Kraken is working on enabling programmatic withdrawals via lightning; however, it is not live yet)\n\n## RPC commands\n\n### `snr-listconfigs`\nCommand to list all configuration options.\n\n```shell\nuser@host:~$ lightning-cli snr-listconfigs\n{\n  \"result\": {\n    \"dry-run\": false,\n    \"fiat-currency\": {\n      \"default\": \"USD\"\n    },\n    \"exchange\": {\n      \"name\": \"Kraken\",\n      \"host\": \"api.kraken.com\"\n    }\n  }\n}\n```\n\n### `snr-version`\nCommand to print the plugin version.\n\n```shell\nuser@host:~$ lightning-cli snr-version\n{\n  \"result\": {\n    \"version\": \"0.1.0-dev.4.uncommitted+7f363fa\"\n  }\n}\n```\n\n### `snr-exchangeinfo`\nCommand to list exchange specific information.\n\n```shell\nuser@host:~$ lightning-cli snr-exchangeinfo\n{\n  \"result\" : {\n    \"name\": \"Kraken\",\n    \"description\": \"Kraken is a Bitcoin exchange operated by Payward, Inc.\",\n    \"host\": \"api.kraken.com\",\n    \"metadata\": {\n      \"instruments\": {\n        \"BTC/USD\": {\n          \"min-amount\" : \"0.00001\"\n        }\n      }\n    }\n  }\n}\n```\n\n### `snr-ticker`\nGet the ticker representing the current exchange rate for the provided currency.\n\n```shell\nuser@host:~$ lightning-cli snr-ticker\n{\n  \"result\": {\n    \"BTC/USD\": {\n      \"ask\": \"27308.20000\",\n      \"bid\": \"27308.20000\",\n      \"high\": \"28000.00000\",\n      \"low\": \"27155.00000\",\n      \"open\": \"27588.10000\",\n      \"last\": \"27308.20000\"\n    }\n  }\n}\n```\n\n```shell\nuser@host:~$ lightning-cli snr-ticker GBP\n{\n  \"result\": {\n    \"BTC/GBP\": {\n      \"ask\": \"21896.70000\",\n      \"bid\": \"21896.70000\",\n      \"high\": \"22496.10000\",\n      \"low\": \"21803.60000\",\n      \"open\": \"22201.40000\",\n      \"last\": \"21901.50000\"\n    }\n  }\n}\n```\n\n### `snr-balance`\nGet the balance of your account.\n\n```shell\nuser@host:~$ lightning-cli snr-balance\n{\n  \"result\": {\n    \"_\": {\n      \"id\": null,\n      \"name\": null,\n      \"balances\": {\n        \"BTC\": {\n          \"available\": \"0.0002100000\",\n          \"available-for-withdrawal\": \"0.0002100000\",\n          \"borrowed\": \"0\",\n          \"depositing\": \"0\",\n          \"frozen\": \"0\",\n          \"loaned\": \"0\",\n          \"total\": \"0.0002100000\",\n          \"withdrawing\": \"0\"\n        },\n        \"USD\": {\n          \"available\": \"42.1337\",\n          \"available-for-withdrawal\": \"42.1337\",\n          \"borrowed\": \"0\",\n          \"depositing\": \"0\",\n          \"frozen\": \"0\",\n          \"loaned\": \"0\",\n          \"total\": \"42.1337\",\n          \"withdrawing\": \"0\"\n        }\n      }\n    },\n    \"margin\": {\n      \"id\": \"margin\",\n      \"name\": \"margin\",\n      \"balances\": {\n        \"BTC\": {\n          \"available\": \"0.0002100000\",\n          \"available-for-withdrawal\": \"0.0002100000\",\n          \"borrowed\": \"0\",\n          \"depositing\": \"0\",\n          \"frozen\": \"0\",\n          \"loaned\": \"0\",\n          \"total\": \"0.0002100000\",\n          \"withdrawing\": \"0\"\n        },\n        \"USD\": {\n          \"available\": \"42.1337\",\n          \"available-for-withdrawal\": \"42.1337\",\n          \"borrowed\": \"0\",\n          \"depositing\": \"0\",\n          \"frozen\": \"0\",\n          \"loaned\": \"0\",\n          \"total\": \"42.1337\",\n          \"withdrawing\": \"0\"\n        }\n      }\n    }\n  }\n}\n```\n\n### `snr-history`\nGet the trade history of your account.\n\n```shell\nuser@host:~$ lightning-cli snr-history\n{\n  \"result\": {\n    \"open\": {\n      \"abcdef-00000-000001\": {\n        \"id\": \"abcdef-00000-000001\",\n        \"type\": \"BID\",\n        \"status\": \"NEW\",\n        \"is-open\": true,\n        \"is-final\": false,\n        \"original-amount\": \"0.42\",\n        \"remaining-amount\": \"0.42\",\n        \"limit-price\": \"21.0\",\n        \"asset-pair\": \"BTC/USD\",\n        \"ref\": \"0\",\n        \"date\": \"2021-05-26T03:33:20Z\",\n        \"timestamp\": 1622000000\n      }\n    },\n    \"closed\": {\n      \"abcdef-00000-000000\": {\n        \"id\": \"abcdef-00000-000000\",\n        \"type\": \"BID\",\n        \"order-id\": \"abcdef\",\n        \"price\": \"21000.0\",\n        \"original-amount\": \"0.21\",\n        \"asset-pair\": \"BTC/USD\",\n        \"ref\": \"\",\n        \"fee-amount\": \"0.090103\",\n        \"fee-currency\": \"USD\",\n        \"date\": \"2021-05-14T13:46:40Z\",\n        \"timestamp\": 1621000000\n      }\n    }\n  }\n}\n```\n\n### `snr-placetestorder`\nPlace a minimal, greatly undervalued limit order to test if exchange settings are working properly.\n\n```shell\nuser@host:~$ lightning-cli snr-placetestorder\n{\n  \"result\": {\n    \"order\": {\n      \"id\": \"abcdef-00000-000002\",\n      \"type\": \"BID\",\n      \"asset-pair\": \"BTC/GBP\",\n      \"amount\": \"0.00001000\",\n      \"price\": \"2189.67\"\n    }\n  }\n}\n```\n\n## Development\n\n### Requirements\n- java \u003e=17\n- docker\n\n### Build\n```shell script\n./gradlew build -x test\n```\n\n### Run\nTBD\n \n### Test\n```shell script\n./gradlew test integrationTest --rerun-tasks\n```\n\n### Dependency Verification\nGradle is used for checksum and signature verification of dependencies.\n\n```shell script\n# write metadata for dependency verification\n./gradlew --write-verification-metadata pgp,sha256 --export-keys\n```\n\nSee [Gradle Userguide: Verifying dependencies](https://docs.gradle.org/current/userguide/dependency_verification.html)\nfor more information.\n\n### Checkstyle\n[Checkstyle](https://github.com/checkstyle/checkstyle) with adapted [google_checks](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml)\nis used for checking Java source code for adherence to a Code Standard.\n\n```shell script\n# check for code standard violations with checkstyle\n./gradlew checkstyleMain --rerun-tasks\n```\n\n### SpotBugs\n[SpotBugs](https://spotbugs.github.io/) is used for static code analysis.\n\n```shell script\n# invoke static code analysis with spotbugs\n./gradlew spotbugsMain --rerun-tasks\n```\n\n\n## Contributing\nAll contributions and ideas are always welcome. For any question, bug or feature request, \nplease create an [issue](https://github.com/theborakompanioni/cln-spend-and-replace-plugin/issues). \nBefore you start, please read the [contributing guidelines](contributing.md).\n\n\n## Resources\n\n- Bitcoin: https://bitcoin.org/en/getting-started\n- Lightning Network: https://lightning.network\n- cln Plugin Docs: https://lightning.readthedocs.io/PLUGINS.html\n- Spring Boot (GitHub): https://github.com/spring-projects/spring-boot\n---\n- cln (GitHub): https://github.com/ElementsProject/lightning ([Docker](https://hub.docker.com/r/elementsproject/lightningd))\n- JRPClightning (GitHub): https://github.com/clightning4j/JRPClightning\n- XChange (GitHub): https://github.com/knowm/XChange\n- bitcoin-spring-boot-starter (GitHub): https://github.com/theborakompanioni/bitcoin-spring-boot-starter\n\n## License\n\nThe project is licensed under the Apache License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheborakompanioni%2Fcln-spend-and-replace-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheborakompanioni%2Fcln-spend-and-replace-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheborakompanioni%2Fcln-spend-and-replace-plugin/lists"}