ReasonML and NEM Blockchain; Let’s get this bread🥖😎

NEM Blockchain onboarding combined with ReasonML crash course

This article explains basic usage of NEM2-SDK with ReasonML, together with NEM2-CLI.

Introduction

We will go trough setting up NEM Catapult services to catapult our blockchain workflow, then we will interact with the blockchain itself using NEM SDK for javascript, but to be extra-cool™ we will write our examples using ReasonML.

ReasonML is essentially a syntax for OCaml programming language, it comes with a bunch of useful tooling, that allows us to compile it to Javascript.

NEM is a relatively new blockchain technology, that handles multisignature transactions with ease, and has a wonderful dev-tooling.

Prerequisite

This article assumes you are familiar on an entry level with Docker, Javascript, Git and Blockchain (e.g. Ethereum, Tezos, …).

Getting started

First of all, let’s go trough the technologies that we will use:

NEM Blockchain is a platform, that aims to ease the blockchain integration into existing / new apps, by providing a very very nice 💆‍♀️ developer experience out of the box. It enables private/public chains, smart asset trading and multi-signature transactions.

ReasonML is a syntax and a toolbox, powered by OCaml, aimed at Javascript developers.

We will start by installing the NEM Catapult stack first. We are mainly interested in those two parts:

Catapult server nodes (blockchain node); This layer handles the P2P blockchain magic 🧙‍♂️🔮

(blockchain node); This layer handles the P2P blockchain magic 🧙‍♂️🔮 Catapult Rest nodes (API layer); This layer provides an easy way for us (developers) to integrate with NEM 💻

1. Installing Catapult

Start off by cloning the catapult-service-bootstrap repository, and follow up by composing all the docker services using the commands below.

For those who are not familiar with docker or git, we’re copying a bunch of code from a remote repository, and then starting the provided services using docker ‘virtual machines’.

Once the NEM stack is running, your terminal output should look something like this.

Next step is to verify, that our Rest and Blockchain nodes are running. You can do that by querying the REST API provided by Catapult Rest, as shown below.