/ Finance

DREAM Bitcoin Escrow Payment System (Escoin) Setup Guide

DREAM is happy to release the Escoin code as open source, and we welcome contributions and feedback. Escoin is short for Escrow Coin (it's not a coin!).

Snip20180614_218

A fundamental component of the DREAM marketplace is our Bitcoin escrow payment system. You can find out more in our Bitcoin Escrow Payment System Blog and we'd suggest reading it before continuing. The code is available on GitHub.

This article seeks to help guide you on how to configure your servers to run Escoin.

Fundamental components of the escoin payment system are as follows:

Knowledge of the following skills will be very benificial:

  • Node.js/JavaScript
  • Express for API
  • Sequelize for Database
  • Bitcore for Bitcoin transaction building, and exchange rates
  • Linux / Shell / Git / NPM
  • Mocha and Chai for JavaScript Unit tests
  • lodash.js
  • REST

Escoin Server Installation

This covers installation process of Escoin server on Centos 7.3 OS.

Installation steps:

1.	Updating system:

sudo yum upgrade -y && reboot

2.	Installing necessary repos:

’sudo yum install epel-release -y’ wget -q -O — http://www.atomicorp.com/installers/atomic | sh

3) Installing pip:

sudo yum -y install python-pip

4) Installing supervisor:

sudo pip install supervisor
sudo mkdir -p /etc/supervisord/conf.d
echo_supervisord_conf > /etc/supervisord/supervisord.conf
echo “[include]” >> /etc/supervisord/supervisord.conf
echo “files = conf.d/*.conf” >> /etc/supervisord/supervisord.conf
wgethttps://gist.githubusercontent.com/mozillazg/6cbdcccbf46fe96a4edd/raw/
2f5c6f5e88fc43e27b974f8a4c19088fc22b1bd5/supervisord.service
-O /usr/lib/systemd/system/supervisord.service
systemctl start supervisord
systemctl enable supervisord
ln -s /etc/supervisord/supervisord.conf /etc/

5) Install git client

yum install git

6) Clone project files from git:

cd /opt && git clone — — — — — — — -

7) Install node

curl — silent — locationhttps://rpm.nodesource.com/setup_4.x | bash -
yum install -y gcc-c++ make nodejs

8) Create supervisor config for app:

documentscat /etc/supervisord/conf.d/escoin.confdocuments
[program:escoin]
command=/usr/bin/node /opt/escoin/app.js
directory=/opt/escoin
autostart=true
autorestart=true
user=escoin
stdout_logfile=/var/log/escoin/escoin.log
redirect_stderr=true
stdout_logfile_maxbytes=10MB

9) Add necessary resources:

sudo useradd escoin
sudo mkdir /var/log/escoin
sudo chown -R escoin /var/log/escoin
sudo chown -R escoin /opt/escoin/

10) Install node modules

cd /opt/escoin && npm update

11) Generate certs (if use self-signed)

cd /opt/escoin && openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

12) Install mysql-server:

sudo rpm -ivh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo yum install mysql-server -y
sudo systemctl start mysqld
sudo mysql_secure_installation

13) Create db and user:

mysql -u root -p
> create database escoin;
> grant all privileges on escoin.* to [email protected] identified by ‘[email protected]’;

14) Edit app configs

vi /opt/escoin/config/config.js

Settings to adjust:

port — server port
dbname — database name from step 13
dbuser — database user from step 13
dbpassword — database password from step 13
dbhost — database host from step 13
vaulthost0,vaulthost1,vaulthost2 — vault hosts

15) Start app

sudo supervisorctl update

16) Check app logs

tail /var/log/escoin/escoin.log

Vault Server Setup
This document covers installation process of Vault server on Centos 7.3 OS.

Installation steps:

1.	Updating system:

sudo yum upgrade -y && reboot

2) Installing pip:

sudo yum -y install python-pip

3) Installing supervisor:

sudo pip install supervisor
sudo mkdir -p /etc/supervisord/conf.d
echo_supervisord_conf > /etc/supervisord/supervisord.conf
echo “[include]” >> /etc/supervisord/supervisord.conf
echo “files = conf.d/*.conf” >> /etc/supervisord/supervisord.conf
wgethttps://gist.githubusercontent.com/mozillazg/6cbdcccbf46fe96a4edd/raw/
2f5c6f5e88fc43e27b974f8a4c19088fc22b1bd5/supervisord.service-O /usr/lib/systemd/system/supervisord.service
systemctl start supervisord
systemctl enable supervisord
ln -s /etc/supervisord/supervisord.conf /etc/

4) Download Vault and setup:

wgethttps://releases.hashicorp.com/vault/0.6.5/vault_0.6.5_linux_amd64.zip
unzip vault_0.6.5_linux_amd64.zip
sudo mv vault /usr/local/bin/
sudo mkdir /etc/vault
sudo useradd vault
sudo mkdir -p /opt/vault && sudo chown -R vault /opt/vault
sudo mkdir /var/log/vault && sudo chown -R vault /var/log/vault

5) Create vault config:

cat /etc/vault/config.hcl
backend “file” {
path = “/opt/vault”
}
listener “tcp” {
address = “0.0.0.0:8200”
tls_cert_file = “/etc/vault/cert.pem”
tls_key_file = “/etc/vault/key.pem”
}
disable_mlock = true

6) Create Vault certs:

cd /etc/vault && sudo openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes

7) Create supervisor config for vault:

cat /etc/supervisord/conf.d/vault.conf
[program:vault]
command=/usr/local/bin/vault server -config=/etc/vault/config.hcl
autostart=true
autorestart=true
user=vault
logfile_maxbytes=10MB
redirect_stderr=true
stdout_logfile=/var/log/vault/vault.log

8) Generate unseal tokens and initiate storage:

vault init -tls-skip-verify

9) To work with vault we need to unseal it first:

vault unseal -tls-skip-verify

We can check vault status by executing

vault status -tls-skip-verify

It should return something like:

Sealed: false
Key Shares: 5
Key Threshold: 3
Unseal Progress: 0
Unseal Nonce: Version: 0.6.5
Cluster Name: vault-cluster-4a7efec7
Cluster ID: 58bbb884–9984–6ae7–57eb-515214ebed0c

Known Issues & Comments

  1. Sometimes the Escoin process restarts. We use “Monit” to monitor and report to Slack.
  2. We suggest installing OSSEC on all servers and having an isolated management server.
  3. The transaction firewall is in a passive state at this stage, we rely on monitoring.


The DREAM platform isn’t just another untested beta program on a white paper… It’s live and being used right now to hire blockchain professionals. The token sale will enable DREAM’s innovative team to take DREAM to the next level by integrating A.I. and incorporating our platform token.

Social Channels

DREAM Bitcoin Escrow Payment System (Escoin) Setup Guide
Share this

Subscribe to DREAM Blog