NEM Exchange Integration Guide

This tutorial will quickly guide you through everything an exchange needs to add NEM.

1. Account

To create an account go to https://nem.io/downloads/ and download the desktop client. We recommend creating a simple wallet. The delegated keys can be found at Services/Delegated Harvesting/Manage delegated account. The account’s private key can be found at Account.

2. API Documentation

NEM is completely API based and therefore language agnostic. To get started, take a look at the API documentation https://nemproject.github.io/.

Further, the NEM Knowledge Base consolidates lots of developer resources and examples: https://docs.nem.io.

3. Self-Hosted Node/Hugenode

Most exchanges like to run their own node for obvious reasons. I’d still like to point out that you can use the NEM library to execute API calls on a pool of supernodes. This is more reliable than running your own node since the call will be attempted until a working node has been found: https://nemlibrary.com/documentation/connection_pool/

3.1. Self-Hosted Node

If you want to run your own node, you can use the supernode guide and skip step 3: https://forum.nem.io/t/nem-supernode-command-line-tutorial-for-debian-8-4/2211

3.2. Self-Hosted Hugenode

If you require historical lookups (i.e. running /account/transfers/all with a hash that’s older than 36 hours), you’ll need to change a few settings for your node and you’ll need much more RAM.

RAM Requirements

Running a node with historical lookups requires at least 9GB of RAM for the NIS process. I recommend a 16GB VPS that assigns 10GB to the NIS. Check section 1.3. of the supernode guide and change the config file to:

#!/bin/bash

java -Xms10240M -Xmx10240M -cp ".:package/nis:package/nis/*:package/libs/*" org.nem.deploy.CommonStarter

Config Changes

Change the following in nis-ncc/package/nis/config.properties:

nis.optionalFeatures = TRANSACTION_HASH_LOOKUP|HISTORICAL_ACCOUNT_DATA

and

nis.transactionHashRetentionTime = -1
5 Likes

Thank you Paul. Your article was very useful and took us one step closer to integrating NEM with our Exchange. However if falls short of explaining how to monitoring deposits and withdrawals. Could you please elaborate on these two subjects?

@HugoV
Please PM in Telegram Shin Tatt.
He is NEM Technical Trainer. Will help you with integration.
I’ve sent you contact in private message.

1 Like

How would you monitor deposits and withdrawals if it wouldn’t be a blockchain but a normal RMDBS ?

Majority of exchanges are doing this way.
They have a unique cold wallet address.
When a user wants to deposit they give (display) to the user an unique message ID.
The user needs to send this message in the same transaction that he sands to deposit xem to the exchange.

check for example this address (bittrex wallet)
http://explorer.nemchina.com/#/s_account?account=ND2JRPQIWXHKAA26INVGA7SREEUMX5QAI6VU7HNR

check this transaction:
http://explorer.nemchina.com/#/s_tx?hash=847c90dc9f28a0a2ae062ebbfaf4e7f1d6fea2336cb6f05ea0520585d2314187

you see there is a message sent by the user.
this an unique ID generated by the exchange to track user deposits.

I hope this info could help you.

Thanks for the mention, I have made the guide available to everyone on Github:

Please feel free to improve on the content =)