wietse

Building on the XRP ledger. β™₯ Wife, kids, 🦜 & programming (TS, nodejs, Linux ...) – BDFL at @XRPLLabs (XRP ledger tools development πŸŽ‰)

With almost 60k unique accounts in the XRP TipBot database, a little under 700k tips processed and close to 2MM XRP tipped, I believe I can rightfully say my hobby project got a bit out of hand πŸŽ‰

While some other crypto-communities witnessed their TipBots go out of service because of limited usage or creators fearing for regulation, the usage of the XRP TipBot increased. The XRP community embraced the XRP TipBot big time, celebrating positivity and generosity.

I'm proud beyond words to see how generous the XRP community members are. How people send some of their XRP across the world in seconds to help others out, sponsor charities and show their appreciation.

The XRP TipBot was never to become a business. No fees, no revenue: just some of my time and some donations to keep the servers spinning.

I didn't implement some (much requested) features to make sure the TipBot would stay a hobby project. Imagine deposits and withdrawals in fiat, tips with notes & higher tip limits allowing a use case for payments and remittance, etc. β€” amazing features, but they could/would slowly spin the XRP TipBot into a business.

I felt pretty comfortable operating the XRP TipBot as a hobby project. Even while usage increased and the amount of XRP in custody stacked up. I'm living in The Netherlands, and crypto regulation wasn't a thing (just yet). Of course I always knew things would change at some point.

Then at the 3rd of July this year, the Dutch government announced things were about to change for crypto businesses / projects.

2020: Mandatory registration

In the Netherlands, the DNB β€œThe Dutch Bank” is entrusted with the supervision and regulation of entities involved in moving money. If you want to get a e-money license, start a bank, start a currency exchange business, etc. you'll have to get a license from the DNB. They are tasked with license issuance, audits, investigations in case of suspected wrongdoing, etc.

Countries in the European Union are obliged to comply with new AMLD5 rules starting January 10th 2020, as they need to tighten up their processes to prevent money laundering and the financing of terrorism.

The Dutch government decided to task the DNB with the supervision and regulation of crypto businesses as well. While the Dutch government did not yet pass the bill on crypto regulation, it is without a doubt this will happen within a few months.

Last week, at the 8th of November 2019, the DNB organized a seminar for crypto businesses to brief them on what's about to happen. I was invited for the seminar, and gladly visited the event. It was well organized, clear and answered most of my questions.

The DNB explained they won't be issuing licenses for crypto businesses, but there will be a mandatory, paid registration. Crypto businesses will be vetted, as will their directors. This will be on a per-company, per-directory basis, respecting the nature and the extent of the company and it's business. After successful registration, crypto companies will be periodically audited.

Crypto businesses are to establish rules risk profiles, and get to know their customer (KYC) well enough to assign a risk profile. All transactions will have to be continuously monitored to improve and possibly reassign these risk profiles. Suspicious transactions will have to be reported to the (Dutch) Financial Intelligence Unit.

One thing is sure: the 'Wild West' days of cryptocurrency are ending.

β€” and I believe this is a good thing.

Opportunities

While regulation may create new barriers to entry the world of programmable money, I believe the only way to get through this phase of development and adoption is to gain lots of trust and credibility from the general public.

Companies, founders and developers can now show they in this for the long run, leading the way.

I fully intend to comply with the Dutch law and soon to be implemented crypto regulation. I see this as an opportunity to learn, professionalize, and take things to the next level.

While I'm at it, I believe this is a great opportunity to converge some other projects like XRParrot into one amazing XRP-focussed platform. Keywords are fun and usability: the key factors that contributed to the success of the XRP TipBot and XRParrot.

(XRParrot, my service for European customers to turn (limited amounts of) fiat into XRP, runs separated from the XRP TipBot as I didn't want to mix my hobby project with a business, even though XRParrot is not focussed at generating any profits)

A glimpse of the future

KYC & AML: Onboarding, deposits & withdrawals

I intend to keep the TipBot easily accessible, but there will be some changes adding a few steps before one can start using the XRP TipBot.

Right now, all you need to get started with the TipBot is a Twitter, Reddit or Discord account and some balance that may even already be available to you because another user already tipped you.

No point beating around the bush here: there will be mandatory KYC to start using the XRP TipBot. However, KYC will be part of a even bigger change: XRP TipBot accounts. Users will have to register one XRP TipBot account, linking their social media accounts to their one XRP TipBot account.

This will mean you can link your Twitter, Reddit and Discord profiles (even a multitude of them) to one XRP TipBot account, sharing one TipBot balance.

Depending on the user risk profile (based on the amount of XRP flowing in and out of the account) KYC will be as minimal as possible, up to a full exchange like KYC process. While I still have to get up to speed about the minimum KYC requirements, phone and email verification will definitely be part of setting up your XRP TipBot account. This will also bring mandatory (two factor) withdrawal confirmations, one of the things I wanted to add for a long time.

A new workflow for tips to unregistered users

The ability to send XRP to Twitter, Reddit and Discord users, even before they registered a XRP TipBot account, contributed greatly to the user base growth.

The soon to be passed law in The Netherlands requires businesses to know their customers. Tips sent to not-yet-registered social media handles will be parked and locked in the account of the sender, waiting to be claimed by the person tipped. The amount of XRP parked & locked will be transferred to the beneficiary once registered and KYC'd.

(I'm considering adding an expiration (eg. two years) on parked & locked tips.)

Identity

As you may have noticed I started this blog by talking about my (beloved) XRP TipBot hobby project, then to move on writing about regulation & crypto businesses. If I'm going to take the XRP TipBot alive & to the next level, compliant with regulations, I don't think I can call it a hobby project anymore. It will require lots of work, hiring a lawyer, getting vetted by the regulator, getting a contact with a KYC provider, scanning transactions for AML risk, etc.

So. Let's take the existing XRP TipBot features. Improve them. Add a great, user friendly user interface. Turn it into a business. Add features like higher tip amounts, transaction descriptions, fiat conversion...

I feel the name β€œXRP TipBot” doesn't quite cover this new platform I'm describing.

I don't have any inspiration for a good name for the β€œregulated XRP TipBot V2” platform, but I'm pretty sure, with the help of the XRP community, I'll be able to find a good name that:

  • covers the features of the new platform
  • is attractive to new (potentially: crypto unaware) users
  • works in other cultures as well (where β€œtips” aren't a thing)
  • is appealing to the existing user base as well

Monetizing the XRP TipBot

Last but not least (I'm pretty sure the XRP TipBot is going to lose a few users here 😭)... Monetization. Until now I was able to keep the XRP TIpBot running based on donations. All I had to cover were the hosting costs. No need to cover my time, as any hobby will consume spare time (and you can imagine the amount of positive energy a well-received project like the XRP TipBot gives).

With what's about to happen, it will be impossible for me to operate the XRP TipBot without covering some great expenses, up front, repetitive and on a per-user basis (KYC). The Dutch regulator (DNB) already disclosed the registration of a crypto business will also mean a fee will be charged, and audits will cost money. I won't be able to do this all by myself: I'll have to hire specialists (like a lawyer & KYC+AML tools).

So... Believe me: I hate to ask for this, but:

Imagine registering your XRP TipBot account, charging a few bucks*. Imagine the platform taking a small fee when making deposits / withdrawals. Would you still be use the XRP TipBot?

The XRP TipBot becoming a β€œplatform to transfer value” (using the XRPL and ILP) focussing on social media integrations, an open ecosystem for developers, a user friendly web & app environment, regulatory compliance, etc.: would a platform like that be viable when relying on (as small as possible) fees? Will the XRP Community be on board? Would the majority of the users be willing to go through a KYC procedure?

Questions I needed answered before investing a lot of time and money into what could be the second generation of the... β€œXRP TipBot” (?)

As I'm already focussed on the projects we're building at XRPL Labs (and potential spin-offs) I will have to turn the XRP TipBot into a (small) business, breaking even.

I won't be able to turn it into a start up, as I don't have the time, and I firmly believe a project like the TipBot is better off if it is self-sustaining: if the user base is willing to go through KYC, and if they are willing to come up with the (digital) cash to support the platform.

* Charging a few bucks: for new users, the fee could potentially be covered by taking a chunk out of the XRP waiting for the new user, as there may already be parked & locked tips sent by existing users.

--

Thanks for the cover photo https://unsplash.com/@beatriz_perez!

It's magic! Those XRPL developers interacting live with the XRP ledger. Building blockchain apps.

Nope. Not magic. Those coders just learned how to do that πŸ˜‰ Some learned it a little faster because they already had coding experience, but they had to start without any coding experience as well.

I cannot code. It's too hard. I don't understand it, at all.

But you can. The basics are not hard. If you can solve easy riddles, think logically, you can definitely do some basic coding after a few minutes of studying this blog (OK, 30 minutes, maybe ;))

My computer is old, it cannot be used for coding, right?

Don't worry, your computer will be able to do this (as will you).

You are going to check your own XRP balance by coding a simple tool that interacts with the XRP ledger πŸ˜‰ 😎

And I am going to try to explain what to do, and what you are actually doing. Let's have some fun!

Where to start...

I guess this is the hardest part. Honestly. If you want to start coding (let's say you google β€œhow to start coding”) you'll find a million tutorials, how to's, video's and they will all tell you to download tool X, install application Y, start with programming language Z, and so on.

There is no right or wrong: it's partially preference and the programming language depends on what you want to code (and some programming languages can do almost the same, so again: preference, although some programming languages are better suited for specific purposes though).

For this tutorial I already decided on the language and editor we're going to use πŸ˜‰

A programming language

We're going to code Javascript (let's call it JS), and we're going to run the JS code on our computer using nodejs. If you just start coding JS, your computer won't know what to do with those coded JS files. Your computer needs nodejs to run your code.

I picked JS because:

  1. If you want to interact with the XRP ledger, there are already a lot of libraries, code samples and packages available in JS. I publish XRPL related JS code, libraries and samples almost on a weekly basis.
  2. The language is not that strict: it will not complain about a missing semicolon or an extra space in your code. We can worry about writing clean and consistent code later πŸ‘
  3. The basics are pretty straight forward.

Note: if you google javascript, nodejs, etc. you'll find a lot of contradicting, possibly outdated information. There are many different JS frameworks, dialects and ways to run JS code. It can run in your browser, on your computer, on a server, as an application, etc. It can be very confusing at times but I'll keep this tutorial as simple as possible by focussing only on the things we need to get you started.

Code editor and a way to run your code

You can use Notepad to write code, but there are code editors (applications) to make the life of developers a lot easier. Code editors are Notepad on steroids: they offer code completion, tooltips with information, automatic indentation, syntax highlighting, etc.

Again, there are several good code editors. We're going with Visual Studio Code because it's open source, fast, offers a great plugin ecosystem and it runs on Windows, OSX and Linux.

We'll run the JS code we're going to write using nodejs. In the next video I'll show/explain in 4 minutes how to install and configure your computer to do some actual coding 😎

The steps are similar for OSX / Linux users, except they can skip installing Git at 1:22 – 2:32, and skip configuring the terminal (default shell) at 3:44 – 4:05.

https://www.youtube.com/watch?v=9gVK6fp3UOo

So now your computer is ready. Time to explain a little bit more and start coding!

Before we start coding

Before we are going to write a few lines of code, there are a few things I want to explain. These things will help you understand what's happening in a few minutes (when writing some code).

  • We are going to run the code by invoking node (in the terminal, in Visual Studio Code). If you want to stop your code, you can press Control and C at the same time.
  • Before we are going to write our code, we are going to use the command line utility npm to download a package we are depending on. The npm command line utility was automatically installed NPM is an abbreviation for 'node package manager'. Many developers write open source helper libraries, tools and ready to use plugins. Developers can publish these libraries, tools and plugins to npmjs.com so other developers can easily use them by installing them with the npm command line utility.
  • While you can pick any file name to store your code, and run your code from that custom file name, the commonly used name for the entry JS file is index.js.

Now we're going to use Visual Studio Code, our editor, to create a folder on your computer, open the folder, and create our index.js file. We're going to open the terminal and verify our working directory as well, by issuing the pwd command (abbreviation for print working directory)

https://youtu.be/fEp5nWvujhI

Practice: write a few simple lines of code and run it:

https://www.youtube.com/watch?v=HwOVa5N1G78

That wasn't that hard, was it? Now you know how to write a line and execute it, we're going to install a dependency using npm, called rippled-ws-client. This is a package I created to make a connection with a XRPL node, send a request and receive the response data from the XRPL node.

Using the rippled-ws-client package we will setup a websocket connection to my XRPL node. A server (like an XRPL node) allow websocket connections to be made by a client (like your JS code) to send and receive information. Websockets can stay open for a long period of time while allowing two way communication between the client and server.

So let's install the package using npm, and start using the package to connect to wss://fh.xrpl.ws: a secure websocket connection (wss) to fh.xrpl.ws: my full history XRPL node.

https://www.youtube.com/watch?v=HL0bvqkU5hQ

Here's the code we just wrote:

The client returns a Promise. You can recognize a JS promise by the ...then()...catch()... syntax. A promise:

  1. Does something asynchronously, like in this case: setting up a connection.
  2. then() it takes whatever output the previous action gave, and passes this on to a a piece of code you can write (a function).
  3. Optionally: catch() an error. We didn't do this in this example.

The piece of code we just wrote can be explained like this:

After printing 'Connected' in the terminal, we call the close() method. The close() method is one of the methods available on the **connection** object. Another method available is send(), allowing you to send a JSON formatted command to the connected XRPL node.

Just like the rippled-ws-client returns a Promise with the connection, the method connection.send(...) returns a Promise with the response on your request from the connected XRPL node.

We are going to send an account_info command to the XRPL node. The format we use to send commands to the XRPL node over our websocket connection is called JSON: 'JavaScript Object Notation'. If you read the XRPL command documentation, you can find sample JSON formatted requests to send over websocket connections to an XRPL node.

Sample **account_info** command:

The sample contains the XRP TipBot account address, but you can/should of course enter your own XRPL account address.

We're going to get the account Balance from the response. The balance will be a string (instead of a integer) in drops. There are one million drops per XRP, so to show our XRPL account balance, we'll have to:

  1. Convert the string to an integer (we can use the parseInt(...) function to do this)
  2. Divide by 1000000 (we can simply divide an integer by appending / 1000000)

Let's do this. Here goes nothing πŸ˜‰

https://www.youtube.com/watch?v=OmwjtinAn3I

You just coded your own live connection to the XRP ledger, and got your balance from an XRPL node. Cool 😎 right!?

Well, that's it for now. You probably have some questions and we've barely scratched the surface of coding node, talking to XRPL nodes, etc. but we had to start somewhere, right?

I'll make some time in the future to do a few follow up blogs, picking up where we left off. Maybe some other community members will jump in to answer some questions πŸ˜‡?

There are some more code snippets below for Coil subscribers!

Cover photo by Baciu Tudor

Read more...