How difficult would it be to create a Ruby Gem to interact with Interledger?
In what capacity do you want to interact with interledger, and how much of what you’re doing needs to be in Ruby?
If you can run some javascript but want to be able to send payments using Ruby, then you’d need to run moneyd as a JS shell and translate ilp-spsp to ruby.
If you can’t run any javascript, you’ll need to translate both moneyd and ilp-spsp to ruby.
Another alternative to explore is to use someting like execjs which lets you execute JavaScript from Ruby (though at that point, why not just use JavaScript?).
All good points. In the end, we want to create a method to pay for an order like in the summit video. https://youtu.be/WsMmoD_1hrU
Excelsior
Got it. In this case, you’d need at least SPSP implemented in Ruby. You’d need to be connected to moneyd, but hopefully you can use one of the existing moneyd implementations. If you need to implement moneyd in ruby also, this likely increases the difficulty and complexity significantly. I’m not sure how to advise on your first step, maybe @sharafian or @sabinebertram can weigh in.
Relevant reading:
Hi @captproton ,
I briefly looked into this and it is like going down a rabbit hole. Like @AJ58O said, I think you need to at least implement ilp-protocol-spsp, however, this depends on ilp-protocol-stream and some functions require an instance of ilp-plugin as input. ilp-protocol-stream itself has ilp-specific dependencies as well and so the spiral unfolds. Good news, I don’t think you have to re-implement moneyd.
@AJ58O has already pointed you towards some specs, here are the others:
- SPSP (for completeness) including push payments and pull payments
- STREAM
- ILP Plugin
I’m not the expert here so @sharafian, correct me if I’m wrong.
Yeah you could implement a full ILP stack in Ruby if you want. What I would do is just break the application into two services though, one of which is in JS and uses all the Interledger.js libraries (you could alternatively use rust or any other language with an ILP library). The other service is your Ruby app. Then the two of them can communicate to each other using your RPC of choice (REST, GRPC, etc.).
I know it’s not exactly what you’re asking for but it’s probably the most reasonable way to do this without requiring someone to do a lot of ruby work. If you’re interested in implementing the Interledger stack in ruby then more power to you!
I would strongly advise against trying to re-implement the whole Interledger stack in another language (it took me ~9 months to implement most of the protocols in Rust and I was already very familiar with their inner-workings).
As part of the Interledger Rust project, we’re including an HTTP API that lets you interact with Interledger, without having to write in a specific language. The API is still fairly basic but we’ll be adding more functionality to it over time and would love feedback on it.
Overall, I think it’s better if we have a few full implementations of Interledger that expose HTTP, gRPC, or C APIs/ABIs for applications in other languages to call, rather than requiring a full implementation in every language.
Really exciting! From my perspective, HTTP API is a huge step towards easing the onboarding process. Another step that would help is to have moneyd/interledger dockerized. Then anybody who wants to use interledger can just pull a docker image, run it on their box of choice and start using ILP via the HTTP API with very little setup. I started trying to standardize the InterledgerJS configuration and start steps, but got distracted. I might pick that project back up
This page has instructions for downloading a docker image that contains the Interledger.rs node and settlement engines and automatically connecting it to the testnet: https://github.com/interledger-rs/interledger-rs/blob/master/docs/testnet.md