optout
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # LDK Splicing Prototype Note: Please feel free to add comments to this document! (login with github) ![](https://hackmd.io/_uploads/HJqXD6zl6.png) # About Splicing Best starting point is Dusty Daemon's [lightningsplice.com](https://lightningsplice.com/) site. **What is Splicing?** Splicing can change the capacity of a channel, without closing it. It's possible to increase or decrease the capacity, by adding or removing some funds on-chain. **Why Splicing?** Splicing can be used for different goals. e.g.: - For a routing node, splicing allows to increase the capacity of a well-performing channel (without closing it). It is even possible to move some funds to one channel to another in one go. - For a LSP node -- wallet setup, the channel can be upgraded/downgraded as needed (alternative is to open an additional or close & reopen). - For a LN + Onchain spending wallet experience it is possible to keep funds in LN, and send from it or receive to it on-chain using splicing (alternative is to keep them in separate 'pockets', or use Submarine Swap). The main advantage is less on-chain operations (one instead of two in some use cases), but splicing also opens up new use cases (mentioned above). The first implementation is/was in CLN, started by Dusty Daemon. # Status of Splicing ## Specification The splicing spec is quite mature, but not yet finalized. ([bolts PR #863](https://github.com/lightning/bolts/pull/863)) ## Implementations **Core Lightning** CLN has released splicing implementation, experimental. Released with `23.08` (Aug'23). **Eclair/Phoenix (Acinq)** Released, used in production, between their LSP node and the wallets. Not interoperable with other implementations. (Versions: Lightning-kmp lib: version 1.5.0, Jul'23, Phoenix Android wallet release [2.0.0](https://github.com/ACINQ/phoenix/releases/tag/android-v2.0.0), Aug'23.) # Splicing in [LDK](https://lightningdevkit.org/) It is work-in-progress, on the 2023 Roadmap. Tracking issue: https://github.com/lightningdevkit/rust-lightning/issues/1621 # News - Nov 13: Splicing message definitions got merged (PR #2544) - Oct 1: Phoenix iOS v2.0 released, bringing splicing to iOS as well. - Aug 23: CLN splicing implementation released, release `23.08`. - Aug 16: New Phoenix Android version 2.0 released, uses splicing internally. - Aug 11: My [Nostr post on successful splice using ldk proto](https://primal.net/e/note1eae7aexsxajykslzz8xtn8tcn0mludsymfyert6cpr0v0sav3ajq5xtvcq) - Jul'23: Client lib by Acinq, lightning-kmp, released with splicing support (v 1.5.0) # LDK-Splicing prototype (by optout) **Warning:** *This prototype is experimental code, using it will likely result in some funds lost!* The current (`splicing-hapa2`) prototype is a rudimentary splicing implementation in LDK, aimed to be the basis for the final implementation. Some of the simplifying assumptions: - No quiscence is used/checked - Happy path only, no complex combinations, no error scenarios - TX negotiation messages are skipped, two simpler messages are used instead **Repositories:** - https://github.com/ldksplicing/ldk-spicing - https://github.com/ldksplicing/ldk-sample # Contact/Contribute Please feel free to ask questions or give feedback: - [Discord LDK channel](https://discord.gg/xaYE3pDQpm), channel #splicing (or #ldk-dev or #general) - Nostr: optout@nostrplebs.com, [npub](https://primal.net/p/npub1kxgpwh80gp79j0chc925srk6rghw0akggduwau8fwdflslh9jvqqd3lecx) - GitHub (repo links above) # Prototype Details ## ldk-splicing Contains the splice proto: required messages, new API `splice_channel`, and some events (e.g. `SpliceAcked`), and also a step-by-step functional test. ## ldk-sample Exposes the splice functionality, through a new `splicein` command (`splicein <channel_id> <peer_pubkey> <add_amt_satoshis>`). Works on an existing channel, and adds some more funds to it. ## ldk-node Currently not done, but it is planned to expose splicing functionality through ldk-node as well. ## Building modified LDK - Clone https://github.com/ldksplicing/ldk-splicing ``` git clone https://github.com/ldksplicing/ldk-splicing cd ldk-splicing ``` or alternatively you can use an existing LDK folder ``` cd rust-lightning git remote add ldksplicing https://github.com/ldksplicing/ldk-splicing git fetch ldksplicing git checkout -b splicing -t ldksplicing/main ``` - Build it, simply with `cargo build` - You can try or look a splicing use case test: `cargo test splic` ## Building modified `ldk-sample` - Clone https://github.com/ldksplicing/ldk-splicing ``` git clone https://github.com/ldksplicing/ldk-sample cd ldk-sample ``` - Modify `Cargo.toml` to point to locally built modified LDK. Under `[dependencies]` replace the `lightning...` lines: ``` # To build against updated LDK built locally, you need to change the following 7 lines to the form: # lightning = { path = "<RELATIVE_PATH_TO_LDK_FOLDER>/lightning", features = ["max_level_trace"] } # instead of # lightning = { version = "0.0.117", features = ["max_level_trace"] } ``` You need to do this for all lines (7 of them). - Build: `cargo build` - For running, you need a locally accessible Bitcoin Core node. - Run: `cargo run <bitcoind-rpc-username>:<bitcoind-rpc-password>@<bitcoind-rpc-host>:<bitcoind-rpc-port> datadir1 19735 testnet` After startup, type `help` command, you should see a `splicein` command: ``` COMMANDS: Channels: ... splicein <channel_id> <peer_pubkey> <add_amt_satoshis> ``` ## End-to-end test between two `ldk-sample` instances **Prerequisites:** - A locally built modified LDK (`rust-lightning`); see above. - A locally built modified `ldk-sample`, using modifed LDK; see above. - a Bitcoin Core node on testnet, accessible through RPC, with a wallet loaded with some balance. **Steps** Start two shells (`S1:` and `S2:` indicate the shell): ``` S1: cd ldk-sample S1: cargo run <bitcoind-rpc-username>:<bitcoind-rpc-password>@<bitcoind-rpc-host>:<bitcoind-rpc-port> datadir1 19735 testnet S2: cd ldk-sample S2: cargo run <bitcoind-rpc-username>:<bitcoind-rpc-password>@<bitcoind-rpc-host>:<bitcoind-rpc-port> datadir2 19745 testnet --> note the 'Local Node ID' displayed S1: openchannel <node-id-from-S2>@localhost:19745 8000 S1: listchannels S1: splicein <channel-id-from-above> <node-id-from-S2> 2000 S1: listchannels ``` Sample output: ``` LDK startup successful. Enter "help" to view available commands. Press Ctrl-D to quit. Local Node ID is 03b6d5..a0. > > openchannel 020ab1..5c@localhost:19745 3500 EVENT: initiated channel with peer 020ab1..5c. EVENT: Channel 3a09ec..f3 with peer 020ab1..5c is pending awaiting funding lock-in! EVENT: Channel 3a09ec..f3 with peer 020ab1..5c is ready to be used! > > listchannels [ { channel_id: 3a09ec..f3, funding_txid: f2a439..3a, peer_pubkey: 020ab1..5c, is_channel_ready: true, channel_value_satoshis: 3500, }, ] > > splicein 3a09ec..f3 020ab1..5c 2000 EVENT: initiated splice-in with add'l amount 2000 on channel 3a09ec..f3. Debug SpliceAcked channel_id 3a09ec..f3 pre-post 3500 5500 curr funding f2a4397..3a 1 EVENT: Channel 3a09ec..f3 splicing tx created, from 3500 to 5500, txid ae8f28d4843f2d24ae0558b05841d2555ee70df0e404e7b37a18c85c56a6054a > > listchannels [ { channel_id: 3a09ec..f3, funding_txid: ae8f28..4a, peer_pubkey: 020ab1..5c, is_channel_ready: false, channel_value_satoshis: 5500, }, ] > > closechannel 3a09ec..f3 020ab1..5c EVENT: initiating channel close EVENT: Channel 3a09ec..f3 with counterparty 020ab1..5c closed due to: CooperativeClosure > > listchannels [] > ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully