Skip to content

Instantly share code, notes, and snippets.

@nolim1t
Last active August 24, 2020 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolim1t/ee1123af9ec369722caeb66b717a0428 to your computer and use it in GitHub Desktop.
Save nolim1t/ee1123af9ec369722caeb66b717a0428 to your computer and use it in GitHub Desktop.
PSBT for LND Client

Do not attempt this with real funds until you've mastered the below! It may end up unrecoverable. (Thank you for making bitcoin more valuable)

Reading Material

Why?

Because funds are better off on my hodl wallet (cold) than hot wallet.

This is the manual way of doing so for now.

How

With a hardware wallet

Without a hardware wallet

Connect to remote peer

First connect to remote peer.

lncli --network=testnet connect <peername>

Open Channel in PSBT Mode

From the hardware wallet, first get a close address (so the funds come back).

Then try to open a channel

lncli --network=testnet openchannel --node_key <node_id> --local_amt 50000 --psbt --no_publish --close_address <close_address>

List the available wallets

bitcoin-cli -testnet listwallets

Wallet Operations

Assuming we don't have a wallet path lets use wallet.dat in the wallet directory and see if we have funds!

bitcoin-cli -testnet -rpcwallet="" listtransactions

Ensure you have multiple windows

Use a tool such as tmux to have more than one screen.

Connect to remote peer

First connect to remote peer.

lncli --network=testnet connect <peername>

Open Channel in PSBT Mode

Get close address

bitcoin-cli -testnet -rpcwallet="" getnewaddress

Open channel

lncli --network=testnet openchannel --node_key <node_id> --local_amt 50000 --psbt --no_publish --close_address <close_address>

Grab the address and amount

  1. Get the address and amount and use it to create an unsigned PSBT transaction.
  2. Sign the PSBT transaction and approve on HW wallet
  3. DO NOT Broadcast
  4. Copy signed PSBT to LND to verify and then copy again.

The transaction should be broadcasted

Create PSBT from wallet

bitcoin-cli -testnet walletcreatefundedpsbt -rpcwallet="" [] '[{"<address>":<amount>}]'

Process PSBT

bitcoin-cli -testnet walletprocesspsbt -rpcwallet="" <psbt>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment