cln-plugins/currencyrate
dependabot[bot] 2d1c1beff9 build(deps): bump cachetools
Bumps the all-dependencies group with 1 update in the /currencyrate directory: [cachetools](https://github.com/tkem/cachetools).


Updates `cachetools` from 7.1.6 to 7.1.7
- [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/tkem/cachetools/compare/v7.1.6...v7.1.7)

---
updated-dependencies:
- dependency-name: cachetools
  dependency-version: 7.1.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-10 11:18:24 +02:00
..
currencyrate.py currencyrate: update shebang dependency versions 2026-05-12 22:12:19 +02:00
Makefile currencyrate: new plugin to do currency conversions. 2021-01-14 18:35:49 +01:00
manifest.json currencyrate: add reckless manifest 2026-07-24 15:18:49 +02:00
pyproject.toml build(deps): bump cachetools 2026-08-10 11:18:24 +02:00
README.md currencyrate: add note for v26.04+ including currencyrate plugin already 2026-04-20 11:30:18 +02:00
test_currencyrate.py currencyrate: switch to new coindesk api 2025-02-26 12:53:59 -05:00
uv.lock build(deps): bump cachetools 2026-08-10 11:18:24 +02:00

Starting with CLN v26.04 a currencyrate plugin comes with CLN: currencyconvert

Currencyrate plugin

This plugin provides Bitcoin currency conversion functions using various different backends and taking the median. It caches results for an hour.

Installation

You need uv to run this plugin like a binary. After uv is installed you can simply run

lightning-cli plugin start /path/to/currencyrate.py

If you use systemd to start CLN, you must have uv in the PATH that systemd uses, which is likely different than the PATH from your shell. Most uv installation methods install uv into your user's home directory (~/.local/bin or ~/.cargo/bin), which systemd cannot access.

You can either:

Option 1: Install uv system-wide (recommended):

curl -LsSf https://astral.sh/uv/install.sh | sudo env UV_INSTALL_DIR="/usr/local/bin" sh

Option 2: Copy your existing user installation:

sudo cp "$(command -v uv)" /usr/local/bin/uv

Option 3: Configure your systemd service to use a custom PATH (see systemd documentation).

To verify uv is accessible to systemd:

sudo systemd-run --user --wait command -v uv

This should output /usr/local/bin/uv.

For general plugin installation instructions see the repos main README.md

Options:

  • --add-source: Add a source, of form NAME,URL,MEMBERS where URL and MEMBERS can have {currency} and {currency_lc} to substitute for upper-case and lower-case currency names. MEMBERS is how to deconstruct the result, for example if the result is {"USD": {"last_trade": 12456.79}} then MEMBERS would be "USD,last_trade".
  • --disable-source: Disable the source with this name.

You can specify these options multiple times to add or disable multiple sources.

Commands

currencyrates returns the number of msats per unit from every backend, eg:

$ lightning-cli currencyrates USD
{
   "coindesk": "5347227msat",
   "bitstamp": "5577515msat",
   "coingecko": "5579273msat",
}

currencyconvert converts the given amount and currency into msats, using the median from the above results. eg:

$ lightning-cli currencyconvert 100 USD
{
   "msat": "515941800msat"
}

Default Currency Sources

Thanks to those services who provide this information. Coindesk require a blurb, so I did that for everyone (quoting from their front page):

  • www.bitstamp.net: "The original global crypto exchange."
  • api.coingecko.com: "The world's most comprehensive cryptocurrency API"
  • api.coindesk.com: "Powered by CoinDesk: https://www.coindesk.com/price/bitcoin"
  • api.coinbase.com: "The easiest place to buy, sell, and manage your cryptocurrency portfolio."
  • blockchain.info: "The World's Most Popular Way to Buy, Hold, and Use Crypto"