Sending out of the Interledger Network

Maya Sharafian
Interledger Blog
Published in
2 min readMar 22, 2018

Any participants in the Interledger network can send money to each other. But it’s also possible to send to someone’s cryptocurrency wallet if they don’t know anything about Interledger!

In this tutorial, you’ll learn how to use Interledger to send money to any XRP address.

If you’re interested in adding more cryptocurrencies, let us know in our #ledger-plugins channel. We have Ethereum and Lightning integrations in progress.

Prerequisites

This tutorial assumes that you’re running Moneyd on your computer, and that it’s connected to the Interledger testnet. You can read about how to set up Moneyd here.

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

Get A Testnet Account

We’re going to create a new testnet account, to send some money to.

curl -X POST 'https://faucet.altnet.rippletest.net/accounts'

You’ll get a funded account as your response.

{
"account": {
"address" : "r...",
"secret":"s..."
},
"balance":10000
}

Query the balance of your account with the command below. Replace r... with the address you got from the command above.

curl 'https://testnet.data.api.ripple.com/v2/accounts/r.../balances?currency=XRP'

Your account starts with a balance of 10,000 XRP.

{
"result": "success",
"ledger_index": 7701193,
"limit": 200,
"balances": [
{
"currency": "XRP",
"value": "10000"
}
]
}

Send a Payment to Your Address

Make sure that you have permissions to install node modules globally. Replace the r... with the address you got in the previous section.

npm install -g ilp-spsp
ilp-spsp send --amount 5555 --receiver '$settle.ilp-test.com/r...'

Now let’s query the balance again. There’s a 1-minute sleep, because the settlement is delayed for efficiency reasons.

Replace the r... with the address you got in the previous section.

sleep 60 && curl 'https://testnet.data.api.ripple.com/v2/accounts/r.../balances?currency=XRP'

You can see that 0.005555 XRP has been added to the account balance.

{
"result": "success",
"ledger_index": 7701491,
"limit": 200,
"balances": [
{
"currency": "XRP",
"value": "10000.005555"
}
]
}

Now you know how to send money to anyone, without making the receiver run their own server!

How Did That Work?

  • You send an Interledger packet to a service that offers “outgoing settlement.”
  • The service associates the packet with a cryptocurrency account.
  • After a timeout (to allow for more packets to accumulate), that money is sent to the cryptocurrency account as an on-chain transaction.

Because the owner of the cryptocurrency account is not participating in Interledger, they cannot cryptographically guarantee their receipt of funds.

A malicious settlement service could refuse to pay out, so it’s best suited to small amounts. For important funds, you should run a receiver on Interledger yourself.

--

--