Htmlcoincore Node Web Server

with Explorer and RPC API

An Althash full node for building applications and services with Node.js. A node is extensible and can be configured to run additional services.


Getting Started

1) Set up Nginx -

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

2) Set up node.js - (follow step 1)

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04

3) Secure Nginx with HTTPS Let's Encrypt -

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04

4) Install nvm -

https://github.com/nvm-sh/nvm#installing-and-updating

5) Type Commands -

nvm i v6


6) Install mongo

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/


7) Install Dependencies ZMQ, GCC, G++, ....

sudo add-apt-repository ppa:bitcoin/bitcoin


sudo apt-get install libzmq3-dev gcc-6 g++-6 build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 libgmp3-dev libdb4.8-dev libdb4.8++-dev screen


8) Install Dependencies Boost,...

sudo apt-get install libssl-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev


9) Install for Linux users

git clone https://github.com/HTMLCOIN/HTMLCOIN --recursive


cd HTMLCOIN/depends/


make


git submodule update --init --recursive


cd ..


./autogen.sh


./configure --disable-shared --enable-cxx --enable-static --enable-bitcore-rpc --prefix=`pwd`/depends/x86_64-pc-linux-gnu --without-gui --without-miniupnpc


make clean


make


10) Install htmlcoincore-node

npm install -g https://github.com/htmlcoin/htmlcoincore-node.git#master


htmlcoincore-node create mynode


cd mynode


htmlcoincore-node install https://github.com/htmlcoin/htmlcoin-api.git#master


htmlcoincore-node install https://github.com/denuoweb/htmlcoin-explorer.git#master


11) Edit mynode/htmlcoincore-node.json

{

"network": "livenet",

"port": 8000,

"services": [

"htmlcoin-api",

"htmlcoin-explorer",

"htmlcoind",

"web"

],

"servicesConfig": {

"htmlcoind": {

"spawn": {

"datadir": "/home/user/.htmlcoin",

"exec": "/home/user/HTMLCOIN/src/htmlcoind"

}

},

"htmlcoin-explorer": {

"apiPrefix": "htmlcoin-api",

"routePrefix": "htmlcoin-explorer"

},

"htmlcoin-api": {

"disableRateLimiter": true,

"routePrefix": "htmlcoin-api",

"db": {

"host": "127.0.0.1",

"port": "27017",

"database": "htmlcoin-explorer",

"user": "",

"password": ""

},

"erc20": {

"updateFromBlockHeight": 0

}

}

}

}


12) Edit ~/.htmlcoin/htmlcoin.conf

rpcuser=user

rpcpassword=password

port=4888

rpcport=4889

rpcallowip=127.0.0.1

whitelist=127.0.0.1

zmqpubrawtx=tcp://127.0.0.1:28333

zmqpubhashblock=tcp://127.0.0.1:28333

server=1

txindex=1

addressindex=1

timestampindex=1

spentindex=1

addrindex=1

dbcache=8192

checkblocks=144

maxuploadtarget=1024

logevents=1

gen=0

maxconnections=500

rpcworkqueue=300


13) Configure Nginx ports

sudo nano /etc/nginx/sites-available


/default

location / {

proxy_pass http://localhost:5931;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

}

location /htmlcoin-explorer {

proxy_pass http://localhost:8000;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

}

location /htmlcoin-api {

proxy_pass http://localhost:8000/htmlcoin-api;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection 'upgrade';

proxy_set_header Host $host;

proxy_cache_bypass $http_upgrade;

}

sudo systemctl restart nginx.service


14) Run Node on a screen session

screen -t htmlcoin

htmlcoincore-node start

CTRL a CTRL d to exit screen session

The API endpoints will be available by default at:

http://localhost:8000/htmlcoin-api/

Open a web browser to:

http://localhost:8000/htmlcoin-explorer