Skip to content
Interledger Transport Protocol for sending multiple streams of money and data over ILP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts ci: include script to publish docs May 3, 2018
test perf: use oer-utils#dj-alloc-writer Nov 28, 2018
example.js feat: server.close() May 23, 2018
npmrc-env ci: publish to npm May 3, 2018
package-lock.json 1.8.9 Nov 29, 2018
typedoc.js feat(connection): expose source and destination account Aug 27, 2018


Interledger Transport Protocol for sending multiple streams of money and data over ILP.

NPM Package CircleCI codecov JavaScript Style Guide Known Vulnerabilities Greenkeeper badge FOSSA Status

STREAM is the recommended Transport Protocol to use for most Interledger applications.

The protocol allows a "client" and "server" to establish a bidirectional connection through Interledger that can be used to send money and data. This module handles authentication, encryption, flow control (making sure one party doesn't send more than the other can handle at once), and congestion control (avoiding sending more packets than the network can handle).


Requires Node >= v8.10.

npm install ilp-protocol-stream


These snippets assume you are running a local moneyd.

You'll need ilp-plugin to run the example.

npm install ilp-plugin

See example.js for a runnable example, or paste the snippets into your own node project below. You'll need to provide a means of getting the shared secret from Server to Client.


Clients connect with the destinationAccount and sharedSecret generated by a Server.

const { createConnection } = require('ilp-protocol-stream')
const getPlugin = require('ilp-plugin')

const { destinationAccount, sharedSecret } = getThisFromTheServerSomehow()

async function run () {
  const connection = await createConnection({
    plugin: getPlugin(),

  const stream = connection.createStream()
  stream.write('here is some more data')
  await stream.sendTotal(100)
  await stream.sendTotal(200)

run().catch((err) => console.log(err))


const { createServer } = require('ilp-protocol-stream')
const getPlugin = require('ilp-plugin')

async function run () {
  const server = await createServer({
    plugin: getPlugin()

  // These need to be passed to the client through an authenticated communication channel
  const { destinationAccount, sharedSecret } = server.generateAddressAndSecret()

  server.on('connection', (connection) => {
    connection.on('stream', (stream) => {

      // Set the maximum amount of money this stream can receive

      stream.on('money', (amount) => {
        console.log(`got money: ${amount} on stream ${}`)

      stream.on('data', (chunk) => {
        console.log(`got data on stream ${}: ${chunk.toString('utf8')}`)

      stream.on('end', () => {
        console.log('stream closed')

run().catch((err) => console.log(err))


See the full API docs at:

The most important functions and classes to look at are:

  • createConnection - open a Connection to a Server
  • Server - class used to listen for incoming Connections
  • Connection - class that manages the communication between a Client and a Server
  • DataAndMoneyStream - stream class that can be used to send/receive data and money


PRs, new ideas, and questions are very welcome!

Please feel free to open issues to discuss any problems you run into or suggestions you have.



FOSSA Status

You can’t perform that action at this time.