Skip to main content

Endur

Bitcoin-only License: GNU GPLv3 Top Languages Size Last commit

Endur banner

What are Stable Channels?

Stable Channels is a library and technology that lets users peg a portion of their bitcoin to a dollar balance.

The Stable Channels implementation runs a full Lightning node that lets users stabilize their bitcoin holdings.

The LSP/Server keeps the user stable by overcollateralizing the Stable Channel at the time of channel creation. Each user (the stability receiver and the the LSP/stability provider) puts in the same amount of bitcoin, the stability mechanism is activated.

The stability mechanism works like this: each node queries four exchange price feeds every minute. Based on the updated price, they adjust the channel balance with their counterparty to keep the stability receiver's balance at a fixed dollar value (e.g., $100,000 of bitcoin).

Stable Channels Architecture

Both parties remain self-custodial and can opt out anytime via cooperative or forced on-chain channel closure.

The project is in-progress and is based on LDK Node. Prior versions were compatible with LND and CLN. These legacy implementation can be found in /legacy.

Links with examples:

Stable Channels Process

Every 30 seconds, the price of bitcoin:

  • (a) Goes up:

    • Stable Receiver loses bitcoin.
      • Less bitcoin is needed to maintain the dollar value.
      • The Stable Receiver pays the Stable Provider.
  • (b) Goes down:

    • Stable Receiver gains bitcoin.
      • More bitcoin is needed to maintain the dollar value.
      • The Stable Provider pays the Stable Receiver.
  • (c) Stays the same:

    • No action required.

Contributions

Prerequisites

  • git - --fast-version-control
  • python 3.9 and above - High-level general-purpose programming language
  • uv - Extremely fast Python package & project manager, written in Rust

The following guide walks through setting up your local working environment using git as distributed version control system and uv as Python package and version manager. If you do not have git installed, run the following command.

Install using Homebrew (Darwin)
brew install git
Install via binary installer (Linux or Windows Subsystem for Linux [WSL])
  • Debian-based package management
sudo apt install git-all
  • Fedora-based package management
sudo dnf install git-all
Install using Winget (Windows Powershell)
winget install --id Git.Git -e --source winget

If you do not have uv installed, run the following command.

Install using Homebrew (Darwin)
brew install uv
Install using standalone installer (Darwin, Linux, or Windows Subsystem for Linux [WSL])
curl -LsSf https://astral.sh/uv/install.sh | sh
Install using Winget (Windows Powershell)
winget install --id=astral-sh.uv -e

Once you have git distributed version control system installed, you can clone the current repository and install any version of Python above version 3.9 for this project. The following commands help you set up and activate a Python virtual environment where uv can download project dependencies from the PyPI open-sourced registry defined under pyproject.toml file.

Set up environment and synchronize project dependencies
git clone git@github.com:krutt/endur.git
cd endur
uv venv --python 3.9.6
source .venv/bin/activate
uv sync --dev

Payout Examples (entry = $100,000/BTC)

Each side puts in 1 BTC at $100,0000.

Abbreviations:

  • SR = Stable Receiver (targeting $100,000)
  • SP = Stable Provider
  • Δ = Delta / Change
Price Change (%) New BTC Price SR (BTC) SR (USD) SP (BTC) SP (USD) SR Fiat Δ$ SR BTC Δ SR Fiat Δ% SR BTC Δ% SP Fiat Δ$ SP BTC Δ SP Fiat Δ% SP BTC Δ%
-30 70,000.00 1.43 100,000.00 0.57 40,000.00 0.00 +0.43 0% +42.86% -60,000.00 -0.43 -60.00% -42.86%
-20 80,000.00 1.25 100,000.00 0.75 60,000.00 0.00 +0.25 0% +25.00% -40,000.00 -0.25 -40.00% -25.00%
-10 90,000.00 1.11 100,000.00 0.89 80,000.00 0.00 +0.11 0% +11.11% -20,000.00 -0.11 -20.00% -11.11%
0 100,000.00 1.00 100,000.00 1.00 100,000.00 0.00 0.00 0% 0% 0.00 0.00 0% 0%
10 110,000.00 0.91 100,000.00 1.09 120,000.00 0.00 -0.09 0% -9.09% +20,000.00 +0.09 +20.00% +9.09%
20 120,000.00 0.83 100,000.00 1.17 140,000.00 0.00 -0.17 0% -16.67% +40,000.00 +0.17 +40.00% +16.67%
30 130,000.00 0.77 100,000.00 1.23 160,000.00 0.00 -0.23 0% -23.08% +60,000.00 +0.23 +60.00% +23.08%

Acknowledgements

  1. Satoshi Lives!
  2. The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments
  3. Delving Bitcoin: Stable Channels - peer-to-peer dollar balances on Lightning
  4. github: toneloc/stable-channels
  5. หลายขนาด - Lai Khnad typeface by uvSOV - Worawut Thanawatanawanich
  6. Chaumian E-cash
  7. Cashu

License

This project is licensed under the terms of the GNU General Public License 3.0 license.

Metadata

Release files for endur 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for endur 0.0.1
File Size Uploaded
endur-0.0.1.tar.gz 699.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for endur 0.0.1
File Interpreter ABI Platform
endur-0.0.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details

Total release size: 12.6 MB

Release files / endur-0.0.1.tar.gz

Download URL endur-0.0.1.tar.gz
Size 699.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4452945e272ac3813544b2b1f28e765de6ca45843c383ecc297e81e996123190
BLAKE2b-256 checksum
How to use checksums
6d7350b8263de3174e0ac2f123d0192354907beea781b6f4b51e50cb03f14f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.20

Release files / endur-0.0.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL endur-0.0.1-cp313-cp313-macosx_11_0_arm64.whl
Size 11.9 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
35d00977930aae8286020a11c48df4bec5c2bdc99e7ae98e2e7813c96b1236b7
BLAKE2b-256 checksum
How to use checksums
9ea679fdc857a0cd69ab37c6fc8a63e0ffa5839d72a788609a1cadc8ae41a519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.20

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page