SPSP is a protocol designed for making payments, like sending some money to a friend or tipping the person who wrote a tutorial (at $sharafian.com). In this tutorial, you will:

Prerequisites

This tutorial assumes that you’re running Moneyd on your computer, and that it’s connected to the Interleger testnet.

If you’re not yet set up, it should only take a minute. You don’t need to register any accounts or use any cryptocurrency to use the Interledger testnet.

Making an SPSP Payment

Make sure that you have permissions to install node modules globally.

npm install -g ilp-spsp
ilp-spsp send --amount 10 --receiver '$spsp.ilp-test.com'

If you were successful, you’ll see:

paying 10 to "$spsp.ilp-test.com"...
sent!

To see it in again with more output, run:

DEBUG=ilp* ilp-spsp send --amount 10 --receiver '$spsp.ilp-test.com'

Receiving an SPSP Payment

You need an SPSP server to receive SPSP payments. Fortunately, you can install one on NPM. It uses Localtunnel so that you don’t need to expose your machine publicly.

npm install -g ilp-spsp-server
ilp-spsp-server --subdomain my_subdomain

Replace my_subdomain with your name or a random string. If the name you’re trying is already taken, then the server won’t work.

In a different terminal, run:

ilp-spsp send --amount 10 --receiver '$my_subdomain.localtunnel.me'

SPSP in Your Applications

You can use the ilp-protocol-spsp module in your applications, in order to send SPSP payments. To connect your application to ILP, we’ll use the ilp-plugin module.

This snippet below is equivalent to the ilp-spsp command that you ran in the “Making an SPSP Payment” section.

const plugin = require('ilp-plugin')()
const SPSP = require('ilp-protocol-spsp')

async function run () {
  console.log('paying $spsp.ilp-test.com...')

  await SPSP.pay(plugin, {
    receiver: '$spsp.ilp-test.com',
    sourceAmount: '10'
  })

  console.log('paid!')
}

run().catch(e => console.error(e))