- Focus on small payments and have connector limit bandwidth per user
- Focus on payment channels for cryptocurrencies instead of escrow or trustlines
- We need a production-ready open source connector ASAP
- Add fulfillment data
Draft 1 of PSK2 attempts to support both streaming and chunked payments. However, it includes some features that are only useful for chunked payments and does not include some others that would be needed for a proper chunked payments implementation.
Based on a conversation with @sharafian, this proposes narrowing the scope of PSK2 while making it easier to build use cases like streaming and chunked payments on top.
For context, @justmoon had the idea to use PSK2 for "payment sockets", which I started implementing yesterday. However, @sharafian made the point that for many receiver use cases, it's better for the PSK2 receiver not to keep state but to simply call a callback for every chunk it gets. Applications will figure out their own logic for which chunks to accept and how to track the balance for different users or interactions. Therefore, PSK2 doesn't need the fields that are specifically fo
const net = require('net') | |
const server = net.createServer((connection) => { | |
connection.on('close', () => console.log('server close')) | |
connection.on('end', () => console.log('server end')) | |
connection.on('error', () => console.log('server error')) | |
connection.on('finish', () => console.log('server finish')) | |
connection.on('data', (chunk) => console.log('server got data', chunk.length)) | |
//setTimeout(() => console.log('reading data', connection.read(1000)), 10) |
const { createConnection } = require('ilp-protocol-stream') | |
const getPlugin = require('ilp-plugin') | |
async function run () { | |
const clientPlugin = getPlugin() | |
const connection = await createConnection({ | |
plugin: clientPlugin, | |
// These are the ILP address and secret from the server | |
destinationAccount, | |
sharedSecret |
const IlpStream = require('ilp-protocol-stream') | |
const createPlugin = require('ilp-plugin') | |
// Note this requires a local moneyd instance to work | |
// See https://github.com/interledgerjs/moneyd for instructions | |
async function run () { | |
const serverPlugin = createPlugin() | |
const server = await IlpStream.createServer({ | |
plugin: serverPlugin |
const IlpStream = require('ilp-protocol-stream') | |
const createPlugin = require('ilp-plugin') | |
const serverPlugin = createPlugin() | |
const server = await IlpStream.createServer({ | |
plugin: serverPlugin | |
}) | |
server.on('connection', (connection) => { | |
console.log('server got connection') |
const clientPlugin = createPlugin() | |
const clientConn = await IlpStream.createConnection({ | |
plugin: clientPlugin, | |
destinationAccount, | |
sharedSecret | |
}) | |
// Streams are automatically given ids (client-initiated ones are odd, server-initiated are even) | |
const streamA = clientConn.createStream() | |
const streamB = clientConn.createStream() |
ilp-protocol-stream git:master ❯ node example.js ⏎ | |
server generated ILP address (test.amundsen.bmp.btp18q1xrp.tPcfTiM2_-stOLrODMIQbFX7BLln60TC8qy2BefdDsQ.local.X22YdPW64RhBKHCHYYjVDnpz7x83I76gbWq6_JY4Ngs.PNOMQrElaGRlc5VK2uKIFSug) and shared secret (e945dd40aecfe9191e83e8dce2ab81d1fe4760c9ef5a0f71b227adc9308ca173) for client | |
server got connection | |
sending data to server on stream 1 | |
sending data to server on stream 3 | |
sending money to server on stream 1 | |
server got a new stream: 1 | |
server got a new stream: 3 | |
server stream 1 got incoming payment for: 100 | |
server stream 1 got data: hello there! |
This is a very rough outline of the things that need to be done to implement autometrics in another language: