SPSP Payments

When using SPSP to make a payment, for example here: https://medium.com/interledger-blog/spsp-simple-payment-setup-protocol-2028292e6925, we’re saying “SPSP.pay”.

How do we know how many packets are sent/received in total between 2 parties? Do we keep track of that manually in a database? If yes, is the database bilateral between sender and receiver? or one entity trusts the other? Also if we do track packets manually (i.e. outside ILP), where/when should the database be updated?

I can’t seem to find a more complete example for client/server SPSP or STREAM setup.

1 Like

In Interledger, the sender and receiver don’t have any settlement relationship nor do they have any trust relationship.

The only relationship is to your direct peer. If you’re connecting to Interledger through Moneyd, we would call this peer your “upstream connector” or “uplink.” When you send packets through your upstream connector, Moneyd keeps track of the amounts and settles them.

So SPSP isn’t doing any of the tracking for settlements, that all lies at the Interledger layer. This lets you save a lot of headache when implementing high level protocols: settlement is always abstracted away.

@sharafian We have some knowledge gaps with ILP so thank you for these. And apologies if some of the question sound primitive.

To follow up:
1- is it possible to have a remote moneyd instance?
2- when you “spsp.pay” which currency are you paying in and what denomination?

By settles, you mean update a local db? or actual ledger settlement?
How do retrieve a state between 2 peers in order to settle on the blockchain (if moneyd doesn’t settle on ledger)

Moneyd does settle on-ledger. The configuration that moneyd uses to connect to its upstream connector determines the currency that this happens in. (for XRP, https://github.com/interledgerjs/moneyd-uplink-xrp).

The currency that SPSP pays in depends on what currency is used by the moneyd it connects to. If you use a moneyd uplink in XRP, then the currency will be XRP. The ILDCP protocol (https://github.com/interledgerjs/ilp-protocol-ildcp) can be used to fetch this information using any plugin. It queries the parent and then gets its own ILP address, asset code, and asset scale as a response.

It’s possible to use a moneyd instance remotely. The ILP_CREDENTIALS environment variable can be used to set the configuration of the plugin that any ILP application creates. If the server of this is set to a remote server, the application will connect to a remote server.

1 Like

So we would need at least 1 moneyd instance per currency.
Are there uplink connectors or moneyd’s for ETH/BTC or others?
Any documentation on building our own to support more currencies?

I understand that a user is required to deposit some money with their uplink in order to transact. They don’t need to, if trust is vested in the user.

If we’re using moneyd as an uplink connector, does that mean that the user would need to deposit money with moneyd for settlement to be made possible? Also why use the word “uplink”? What would a downlink be or do?

Moneyd has an uplinks, but is not an uplink itself. The reason we say “uplink” or “upstream connector” is taken from internet terminology. It’s like the router that you send all of your traffic up to. Moneyd sends all of its traffic to its uplink because it doesn’t know any routing logic itself.

From the upstream connector’s perspective I suppose you could call moneyd a downlink, but ‘link’ implies that it’s providing connectivity which would be confusing. Really, the connector provides Interledger connectivity to moneyd and not the other way around.

There is an ETH uplink (GitHub - interledgerjs/moneyd-uplink-eth: Connect to the ILP network using ETH.) and a BTC plugin using lightning (GitHub - interledgerjs/settlement-lightning: ⚡️ Settle Interledger payments using the Lightning Network) which has not yet been packaged up as a moneyd uplink. However, I don’t know of any public connectors currently offering ETH liquidity because it’s kinda unstable right now. Kava Labs is doing more of the work on the multi-currency stuff though, so they might correct me on that. I’m not super familiar with the code they’ve released recently.

What’s the reason you want multiple moneyd instances in different currencies?

We are working with Xpring trying to adopt ILP to power our p2p swaps for OTC desks. (https://hedgebase.io)

Currently we “escrow” signed transactions from both sides and release them on the appropriate ledgers to perform a p2p swap. Another feature is regular transactions, as in paying or requesting money. We want the ability for a user to send in any currency and have that converted to whatever the receiver is requesting. Those are the 2 most prominent use cases, and we use AWS cloud + blockchain to get them implemented.

It would be extremely helpful if you or Evan can jump on a 30 min call to help us with some early advice on design to shave off some time. We like the concept of ILP but we have some questions to help assess the right use cases.