Setting up your workstation

This first guide will walk you through a step-by-step installation of the required tools to start developing on NEM.

Running Catapult Service Bootstrap


Catapult Server nodes (layer 1) build the peer-to-peer blockchain network. Catapult Rest nodes (layer 2) provide the API gateway that the applications may use to access the blockchain and its features.

You are going to run a private chain for learning purposes using Catapult Service Bootstrap. This service runs Catapult server instances and Catapult REST nodes locally.

  1. Make sure you have docker and docker-compose installed before running the following commands:
$> git clone --branch v0.1.0
$> cd catapult-service-bootstrap
$> docker-compose up


Is catapult service bootstrap not working? Check these troubleshooting tips.

  1. Check if you can get the first block information:
$> curl localhost:3000/block/1

Creating a test account

An account is a key pair (private and public key) associated to a mutable state stored in the NEM blockchain. In other words, you have a deposit box on the blockchain, which only you can modify with your key pair. As the name suggests, the private key has to be kept secret at all times. Anyone with access to the private key, ultimately has control over the account.

The public key is cryptographically derived from the private key. It would take millions of years to do the reverse process and therefore, the public key is safe to be shared.

Finally, the account address is generated with the public key, following the NEM blockchain protocol. Share this address instead of the public key, as it contains more information, such as a validity check or which network it uses (public, testnet or private).

NEM2-CLI conveniently allows you to perform the most commonly used commands from your terminal i.e. using it to interact with the blockchain, setting up an account, sending funds, etc.

  1. Install NEM2-CLI using npm.
$> sudo npm install --global nem2-cli
  1. Create an account with the command line tool.
$> nem2-cli account generate --network MIJIN_TEST --save --url http://localhost:3000

The network flag is set to MIJIN_TEST. Test network is an alternative NEM blockchain used for development and testing purposes.

Use save flag to store the account on your computer. NEM2-CLI uses stored account to sign the transactions that you start.

  1. You should be able to see the following lines in your terminal, containing the account credentials:


    Public Key: 33E0…6ED

    Private Key: 0168…595

What is XEM and how to get it?

The underlying cryptocurrency of the NEM network is called XEM. Every action on the NEM blockchain costs XEM, in order to provide an incentive for those who validate and secure the network.

Let’s use an account which already has XEM. We will need it to register the namespace and mosaic.

  1. Open a terminal, and go to the directory where you have download Catapult Bootstrap Service.
$> cd  build/generated-addresses/
$> cat addresses.yaml
  1. Under the section nemesis_addresses, you will find the key pairs which contain XEM.
  2. Load the first account as a profile in NEM2-CLI.
$> nem2-cli profile create

Introduce your private key: 41************************************************************FF
Introduce NEM 2 Node URL. (Example: http://localhost:3000): http://localhost:3000
Insert profile name (blank means default and it could overwrite the previous profile):

Setting up the development environment

It is time to choose a programming language. Pick the one you feel most comfortable with, or follow your project requirements.

Create a folder for your new project and run the instructions for the selected language.

  1. Create a package.json file. The minimum required Node.js version is 8.9.X.
$> npm init
  1. Install nem2-sdk and rxjs library.
$> npm install nem2-sdk rxjs
  1. nem2-sdk is build with TypeScript language. It is recommended to use TypeScript instead of JavaScript when building applications for NEM blockchain.

Make sure you have at least version 2.5.X installed.

$> sudo npm install --global typescript
$> typescript --version
  1. Use ts-node to execute TypeScript files with node.
$> sudo npm install --global ts-node
  1. Create a package.json file. The minimum required Node.js version is 8.9.X.
$> npm init
  1. Install nem2-sdk and rxjs library.
$> npm install nem2-sdk rxjs
  1. Open a new Java gradle project. The minimum JDK version is JDK 8. Use your favourite IDE or create a project from the command line.
gradle init --type java-application
  1. Edit build.gradle to use Maven central repository.
repositories {
  1. Add nem2-sdk and reactive library as a dependency.
dependencies {
    compile "io.nem:sdk:0.9.1"
    compile "io.reactivex.rxjava2:rxjava:2.1.7"
  1. Execute gradle build and gradle run to run your program.
  1. Create a new project using a C# IDE. If it is Visual Studio, use the Package Manager Console to install the nem2-sdk.
  2. Open the Tools > NuGet Package Manager > Package Manager Console menu command.
  3. Enter nem2-sdk and reactive library packages names in the terminal.
$> Install-Package nem2-sdk
$> Install-Package System.Reactive

Are you using another IDE? In that case check different ways to install a NuGet Package.

Continue: Writing your first application.