Skip to content

Instantly share code, notes, and snippets.

@dougvk
Last active January 24, 2018 06:26
Show Gist options
  • Save dougvk/f9604ec083b0e096ff06ff22f0a9fa9e to your computer and use it in GitHub Desktop.
Save dougvk/f9604ec083b0e096ff06ff22f0a9fa9e to your computer and use it in GitHub Desktop.
Connect to a node and open a payment channel

Find a node from the website, like SLEEPYARK

root@docker-s-6vcpu-16gb-nyc3-01:~# lightning-cli connect 02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432 104.198.32.198 9735
{ "id" : "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432" }

And now you should be GOSSIPING with the node

root@docker-s-6vcpu-16gb-nyc3-01:~# lightning-cli getpeers
{ "peers" :
[
{ "state" : "GOSSIPING", "peerid" : "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432", "netaddr" :
[ "104.198.32.198:9735" ], "connected" : true, "owner" : "lightning_gossipd" } ] }

Then set a reasonable tx fee (in BTC/kB) for your bitcoin node

root@docker-s-6vcpu-16gb-nyc3-01:~# bitcoin-cli settxfee 0.005

Then open and fund a layer 2 lightning channel to the peer

root@docker-s-6vcpu-16gb-nyc3-01:~# lightning-cli fundchannel 02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432 200000
{ "tx" : "020000000001018bfe9f8ad414a2ba6cabe3ff91901dd9b4a51e40dede0439a5fcdcca1bd6a7a800000000171600149d3b1cdf27cc5d1d1cbaf74b24621ea979b11168ffffffff02465e0100000000001600141679b360311df963d881d7560fe08a615583fda4400d0300000000002200205c5b2b6b7bf08e157b66144644ed69cb0fc3b356285c80b63e31def60937925e02483045022100e6a8ef79cf4109cddb8de45167a962ce918e1f148a8fcf2dcfe8c74dec8aecdb02207d58a824152985b974fdf0e55acc04bc7b14061fda3528119f1d1aceab20b335012103dd126550f1c399bc5d0aa210c0a9725d4d31fe0f3e711298f80765058703d27300000000" }

Check your lightning wallet for the tx id

root@docker-s-6vcpu-16gb-nyc3-01:~# lightning-cli listfunds
{ "outputs" :
[
{ "txid" : "c48cbca7bc1569514e9b52dc7d4df01ae3372503cb204b82f7b2d7e3fb742b7c", "output" : 0, "value" : 89670 } ] }
@cndaniel
Copy link

instead of lightning-cli getpeers , lightning-cli listpeers ?

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