NodesHost
NodesHost aims to easily display information about cryptocurrency wallets. This MEAN application can be used for keeping track of personal nodes or be used as a platform to sell node services to others through the Blockchain.info API.
Features
- Support for most types of standard cryptocurrency wallets
- Material Design using Angualar Material
- Lists relevant information about each coin, such as links, logo, and abbreviation
- Nodes display connected peers and details about themselves
- Relies on REST API
Setup
This setup was done with a server running Ubuntu 16.04LTS.
- Clone the repository and enter into it.
- Copy
config.sample.js
toconfig.js
and enter your settings. - Install the relevant linux packages:
apt get nodejs npm
. - Install all the required node dependencies by
npm install
. - Run the server by typing
npm start
in a separate screen. - Navigate to
localhost:3000
in your web browser and click Purchase. - Fill out the form. Using the PUT IP REST API call, update the IP address with the server running the wallet.
- Start the wallet on your server running the wallet, typically
./daemond start
(can be the same server running NodesHost). - Configure the server by placing the following files in
/var/www/html
and adding the cron jobs listed below bycrontab -e
. Install the following dependencies:php5 apache2 libapache2-mod-php5
.
Code Snippets
These files should be placed on the server running the cryptocurrency wallet. Replace all variables with ones pertinent to the intended use case.
index.html
Redirects user to the node management site. ABBRV is the coin abbreviation.
<html>
<head>
<META http-equiv="refresh" content="0;URL=http://localhost:3000/#/nodes/ABBRV/">
</head>
<body>
<p>If you are not directly redirected in 5 seconds, please click <a href="http://localhost:3000/">here</a>.</p>
</body>
</html>
info.php
Contains status about cryptocurrency wallet. Replace walletrpc, port, and password with appropriate values.
<?php
$name = "PROC5";
//Gets wallet information from current server and encodes it into JSON readable format
require_once 'jsonRPCClient.php';
$config = array(
"rpcport" => port,
"user" => "walletrpc",
"password" => "password"
);
$url = "http://{$config['user']}:{$config['password']}@127.0.0.1:${config['rpcport']}/";
$client = new jsonRPCClient($url);
$getinfo = $client->getinfo();
$getpeerinfo = $client->getpeerinfo();
$info = array(
'name' => $name,
'general' => $getinfo,
'peerinfo' => $getpeerinfo
);
print(json_encode($info));
jsonRPCClient.php
Allows PHP to access cryptocurrency wallet. Can be found here.
Cron Jobs
These help reduce performance loss by restarting the wallet every day. Server reboot is optional. Replace user, wallet, and daemond variables.
0 0 * * * /user/wallet/src/daemond stop
1 0 * * * apt-get update;apt-get upgrade -y
# 8 0 * * * sudo -S reboot
10 0 * * * /user/wallet/src/daemond &