Friday, March 6, 2020

Marchero

With two cryptocurrency integrations under my belt I've set out with a solid plan for Monero.

Instead of jumping in and figuring it out as I go along I want to make sure that I have the solutions I'll need, well defined and scoped out. It's a good thing I'm going this path, too.

Turns out that there isn't really much in the way of JavaScript code for Monero out there. Probably the two best (and possibly only), solutions at the moment are monero-javascript and MyMonero.

Although there's no official Monero JavaScript library, the monero-javascript project is probably the closest to the original C++ client. This derived code comes in the form of WebAssembly, a low-level language that runs a lot closer to the metal than JavaScript. This means that WebAssembly is generally faster when doing things like calculations, but with some trade-offs like ease of use. JavaScript is a lot easier to code and understand, but it tends to run slower. In modern browsers, both run side by side so developers can decide which parts need to work fast, and which parts need to be easier to change and maintain.

The MyMonero project is actually a set of supporting libraries for a Monero wallet. It seems to have a lot more "real world" mileage but has a smaller dev team and hasn't been updated for many months, unlike monero-javascript which was updated as recently as today. MyMonero also uses WebAssembly for some of the core wallet functionality but the "bindings", or how this functionality is exposed to JavaScript, are different.

Between the two solutions, I've had more luck in getting support for monero-javascript. Neither project is well documented so having someone to run questions by is, at least at this point, a winning feature.

This will be my first time working with WebAssembly so factoring in some learning time is prudent. I'll only be learning to use existing code rather than learning how to write it but still, it's a new thing for me.

As I mentioned, support for Monero via JavaScript is surprisingly rare, so I may end up contributing some original code back to the project(s) I'll be using. I haven't yet decided which of them will find its way into CypherPoker.JS because there are still some open questions about how certain things are done and if they're even possible. However, right now monero-javascript is looking like the best choice.

Once I'm satisfied that all the building blocks are viable, I'll add the cryptocurrency handler and integrate it all the way through to the front end. As with BTC and BCH, a Monero testnet option will be available along with a faucet so that you can test it out without using any actual XMR. A full client option that uses the downloadable monerod client, the equivalent of a full Bitcoin node, will be available alongside the "light" option which will use external APIs. After that I'll upgrade the live demo (and server), update the wallet generator, post v0.5.2 code documentation, create a new release, and write a wrap-up post.

I want to stress again that this is all contingent on whether or not the JavaScript libraries actually do what I need them to do, and if there exists at least one public API that can be used in place of the daemon (monerod). But based on the help I've received from the Monero community so far I'm feeling optimistic.

Probably the most interesting thing about the Monero integration is that it represents the final, Rumsfeldian, "known unknown" of the CypherPoker.JS project. It's the last thing I'm embarking on with essentially zero prior knowledge; I know that I know nothing.

The rest of the project, the other cryptocurrencies, smart contracts, peer-to-peer communications - those are all things I'd at least had an introduction to if not outright practical knowledge of. When it comes time to add Ethereum support I'll be able to confidently say that it's nothing new. Incorporating Tor anonymization ... been there, done that.

When it comes to Monero, though, I'm a wide-eyed ignoramus. Never owned any XMR, never ran a Monero wallet, never tried out a Monero block explorer; seems I'm even getting some of the technical terminology wrong. Basically, it's the last part of the project's core vision that comes with a steep learning curve and a not-insignificant chance of failure. I mean, I don't think I'm gonna fail but I can't point to any definitive reason why I should think that.

There's no pragmatic reason to believe that March and (the) Monero (integration) will be contemporaneous but then again, why not?



No comments:

Post a Comment