Latest posts

Multi-currency exchange on Ripple, Pathfinding and Bridging with XRP

This was originally a Tweet thread I wrote, but I have re-hashed it here for better longevity and discoverability.

This week Ripple and Moneygram announced a partnership to use Ripple and their XRP digital asset as part of their process for transferring money about.

On Twitter, a number of people have wondered how XRP fits into this process. And with the recent price surges and drops in XRP how that would affect things. Surely if the price of XRP is volatile then that creates risk when doing currency exchanges with it.

Actually, no, it doesn't really. One of the really cool things about Ripple that many people don't realise (or overlook the power of) is that it has a built in decentralised exchange. Given the point of Ripple is to improve cross-border payments, this makes a lot of sense. However some people don't understand how this would work, and how someone like Moneygram would use it in conjunction with XRP.

OK, let's try and demonstrate how volatility won't matter too much when making a payment on Ripple. Unlike, say, Bitcoin you can make payments in any source/destination currency on Ripple. So for example, I can send someone BTC by paying in USD.

Let's look at an actual transaction that does this:


this is a transaction on the open, public XRP Ledger (blockchain). It was just randomly picked as the first one I found, and was from 20 minutes ago. It is someone paying 0.22 BTC and funding that with 2,996 USD.

You will notice this is a single transaction on the network. A single atomic unit of work that has happened. Yet it changes 43 nodes in the ledger. If you scroll down you will see a USD/XRP offer node, and a XRP/BTC offer node that were modified.

these are offer nodes on the order book. Someone has said "I have some BTC I'll sell for XRP" and someone has said "I have some XRP to sell for USD". The Ripple matching engine has found these automatically. All the sender did was say "I want to send BTC by paying in USD"

The Ripple matching engine has looked at all the open offers and decided that this is the best 'path'. ie, the most cost efficient way to get USD -> BTC. The reason it was likely cost effective is there were lots of offers open for USD/XRP and XRP/BTC at the time. This is where the utility of XRP comes in. If all other currencies have a pair with XRP, then you can get from any currency to any other currency via XRP. You no longer need to have direct pairings between each and every currency combination.

The payment transaction 'consumed' a number of those open offers in order to fulfil the requirements of the sender, from cheapest, to more expensive. Hence each offer will likely have a slightly different exchange rate, as they will be offering different rates.

But they key point here is that OVERALL the exchange rate to the end user was a single rate of 13,618 USD/BTC. This transaction was completed in about 3 seconds and cost 0.000015 XRP (0.003 cents).

The point here being that XRP was used a bridge currency between USD and BTC, yet neither the sender nor the recipient held XRP. It was supplied by the market. By the people holding XRP and putting offers on the order books.

I can actually ask Ripple to give me the order book for, say BTC to ETH and it will construct a 'synthetic' order book based on autobridging other orders. e.g. if there is an offer from BTC to XRP and one from XRP to ETH, then Ripple can construct a synthetic offer from BTC to ETH and give me the price for it.

And hence the volatility of XRP itself is not much concern here, as the entire transaction from USD to XRP to BTC is atomic. In fact the sender doesn't know of care what the price of XRP even is. It could be $0.2 or $200. Doesn't matter to them.

The price of XRP being higher is helpful, as it increases the liquidity on the network. A higher value XRP can convey a higher value of other currencies.

This is why I, personally, am investing in XRP and think it will be a good investment in the long run. I think Ripple will be successful and that a lot of other partnership announcements like this will come out in 2018 and beyond. And, ultimately, supplies of XRP will be needed to make this work. Whilst there is a lot of XRP in circulation, it is actually quite a small amount compared to the $5 trillion that is moved every single day on the foreign exchange markets.

Ripple and Bitcoin, a use-case for collaboration

There is a lot of hate out there for Ripple and XRP by some bitcoin fanatics, but they are solving different problems, and here is a use-case of how they compliment each other.

My Last Three Years in Numbers

A look at the last three years of my work in numbers.

Intro to Ripple and XRP

I've recently started playing about with the cryptocurrency XRP and the Ripple network, here is a quick introduction to it.

My University Thesis - Full Text Indexing

I found my university thesis from 17 years ago, along with the code for the full text indexer I wrote back then.

Automating Feature Branch Builds on iOS and Android

This is a talk given at Codemobile 2017 conference in Chester, UK. It was a 5 minute lightning talk detailing how to automate the building of apps for each and every feature branch created as ...

How To Make Better Coffee Without Breaking the Bank

With about £60 of equipment and a bit of knowhow you can produce far better coffee at home than your cup of instant.

Testing Randomness in Python

I needed to be able to unit test some python code that had a random element to it. Here's how I made it deterministic.

Finding Provisioning Profiles by Name Rather than UUID

Despite my previous thoughts, you can actually use Xcode 8’s find-by-name functionality for manual signing on a CI setup.

Duplicate Keychain Entries in macOS Sierra

I upgraded a build server to macOS Sierra and the keychain unlocking stopped working, here is how I fixed it.