Send payments between Lightning Networks using Interledger
This demo sends payments between instances of the Lightning Network on Bitcoin and Litecoin using an Interledger Connector and the Lightning Ledger Plugin.
- Node.js >= v7.10.0
- Docker (only to run local Lightning nodes)
You can skip this step if you already have 2 lightning nodes setup on the Bitcoin Lightning Network and 2 on the Litecoin Lightning Network.
The following uses BitFury's simple-simnet
to run local testnets and Lightning daemons for both Bitcoin and Litecoin.
In one terminal run:
git clone https://github.com/BitfuryLightning/simple-simnet
cd simple-simnet
./bitcoin/build.sh
./bitcoin/start.sh
In another terminal run:
cd simple-simnet
./litecoin/build.sh
./litecoin/start.sh
This will run a connector and automatically configure it to connect to the lnd
nodes started in the previous step.
In a new terminal run:
git clone https://github.com/interledgerjs/ilp-lightning-demo
cd ilp-lightning-demo
npm install
node run-connector.js
To configure the connector to use different lnd
nodes, set the environment variables BITCOIN_LND_1
, BITCOIN_LND_2
, LITECOIN_LND_1
, LITECOIN_LND_2
to those lnd
nodes' RPC endpoints.
From another terminal run the following to send a payment from one of the Bitcoin lnd
nodes to a Litecoin lnd
node.
node send.js
(Run with the environment variable DEBUG=ilp*
to see additional details of what is happening.)
Interledger is a protocol for connecting payment networks or ledgers.
Connectors use ledger plugins to connect to different types of ledgers. This demo uses ilp-plugin-lightning
to send payments through instances of the Lightning Network.
The Interledger packet is attached to transfers across individual ledgers and instructs connectors where to forward payments. Hashed-Timelock Agreements (HTLAs), a generalization of HTLCs, are used to secure Interledger payments.
For more information on Interledger, see interledger.org or the Interledger RFCs for the protocol specs.