GithubHelp home page GithubHelp logo

clhwi's Introduction

clhwi: C-Lightning Plugin to Fund Channels Directly from Hardware Wallets

Setup

Install hwi and python-bitcoinrpc to your global python 3 installation

python3 -m pip install hwi python-bitcoinrpc

If you're on Linux, you may need to install hardware wallet udev rules (probably requires sudo):

hwi installudevrules

Make sure you have server=1 in your bitcoin.conf. Run bitcoin core in testnet mode:

bitcoind -testnet

Add the following values to your ~/.lightning/config:

network=testnet
bitcoin-rpcuser=<your-bitcoin-rpc-username>
bitcoin-rpcpassword=<your-bitcoin-rpc-password>
bitcoin-rpcport=<your-bitcoin-rpc-testnet-port>
bitcoin-rpcconnect=<your-bitoin-rpc-testnet-host>

Run lightnind in testnet mode with the plugin specified:

/lightningd --network=testnet --plugin=/path/to/clhwi.py

Usage

Plug in device and unlock hardware device.

Run the following command to create a watch-only Bitcoin Core wallet associated with your device. WALLETNAME will be the name of the watch-only wallet within Bitcoin Core:

$ lightning-cli hwi-initialize WALLETNAME
"fund this address: 2N1cGNNAv4hMRhoCsT3TK3LH7Ltfceyu2kx"

Fund the address returned above

Locate a node to open a channel with (1ml can help here). Grabe the node id (pubkey@host:port).

For example, to open a 100,000 sat channel with this node, run the following

$ lightning-cli hwi-open-channel 100000 0303ba0fed62039df562a77bfcec887a9aa0767ff6519f6e2baa1309210544cd3d@5.9.150.112:9735 WALLETNAME

Confirm the transaction on your device and the channel should open.

TODO:

  • This proof-of-concept makes many unnecessary assumptions (required config values, Bitcoin Core backend). Perhaps it would be better to just offer a sign-funding-tx method that takes a PSBT as argument -- you can produce this PSBT any way you like, instead of using bitcoin RPC within the plugin.
  • Remove python-bitcoinrpc dependency

clhwi's People

Contributors

justinmoon avatar vindard avatar

Stargazers

Dylan avatar  avatar Yuval Kogman avatar  avatar Z avatar likewhoa avatar thib avatar Will Pankiewicz avatar William Casarin avatar Richard Bondi avatar

Watchers

William Casarin avatar James Cloos avatar  avatar  avatar

Forkers

vindard

clhwi's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.