Start an Interledger node locally and create a local ILP test network.
This tutorial describes how to:
moneydon your system.
- Start an Interledger node on a local test network using moneyd.
- Send and receive value using the SPSP (Simple Payment Setup Protocol) API.
Before you begin
Install a stable version of Node.js (10.16.0 LTS is recommended).
Note: For this tutorial you do not need to use any cryptocurrency. Since you will be running ILP on a local test network, settlement (moving real money) does not take place.
moneyd, open a terminal and run the following command:
$ npm install -g moneyd
After you’ve installed
moneyd, run the following command to start your local node:
$ moneyd local
Running the above command creates an Interledger node that listens on port 7768.
Send and receive value
Once you have
moneyd running, you can send and receive value over ILP using the SPSP API. For this tutorial,
we’ll use the SPSP command line tool.
Install the SPSP client and server
To install an SPSP client and server, open a new terminal and run:
$ npm install -g ilp-spsp ilp-spsp-server
Start the SPSP server
By default, the SPSP server uses localtunnel to create an HTTP endpoint.
Alternatively, you can set up the server on
port by disabling localtunnel.
To receive value, start the SPSP server using the following command:
$ ilp-spsp-server --localtunnel false --port 8080
The above command will create
http://localhost:8080 as your HTTP endpoint.
Now, to send value, open another terminal and run:
$ ilp-spsp send --amount 10 --receiver 'http://localhost:8080'
You should see
sent! on the sending terminal and
got packet for 10 units on the receiving terminal confirming
that you have successfully sent and received value through the Interledger protocol. You are now ready to use
SPSP in your applications.