nuexplorer
##Nu network Block Explorer NuExplorer is powered by MongoDB, Expressjs, Angularjs and Nodejs. Query for blocks, transactions, and addresses found in the Nu network (https://nubits.com).
###Dependencies
- Nodejs v0.10 or greater
- Mongodb 2.6
- Nu Client
###Installation
- Download Latest Nu Wallet NuBits
- unzip,install and launch nu.exe to sync all blocks (might be a while)
- a replica set is needed to keep track of changes in db.
- use mongod
--replSet <name>; Note:--authandbind_ip=127.0.0.1are recommended configurations
- Clone the NuExplorer repo to the server you want to deploy it on.
- cd into directory
cd ./NuExplorerOS-master - Load dependencies with
sudo npm install. - Copy the
mongo-oplog-watcherfolder intonode_modules - Adjust mongodb connection urls according to your mongodb setup
- connection urls are located in
server.js, and/public/app/api/api.tools.js,specificallyexports.db
###Setup
- Start up the mongodb daemon. For simplicity, type
mongod --replSet rs0to spin up the daemon.
- Note this uses a replica set configuration,
--replSet rs0 - The daemon will keep repeating some context telling you that it is waiting for a
mongo shellconnection
- To start the mongo shell, simply type
mongoin a new window pane
- Once the mongo shell opens, we have to connect to
mongod --replSet rs0.- To do this, type
rs.initiate() - Now, a new line should show with pointer
rs0:PRIMARY>. If it doesn't,typeuse admin, thendb.shutdownServer()and repeat step 1.
- To do this, type
- Now we need to create a new database in mongo shell
- for simplicity type
use BlockDB
- Now we need to create collections in
BlockDBto store our data
- to do this, type
db.createCollection('<CollectionName>')- replace
<CollectionName>with the following names BlockCollectionChartCollection- after creating
ChartCollectionpaste the following commands in the mongo shelldb.ChartCollection.insert({ "_id":"orphan", "orph":[] })db.ChartCollection.insert({ "_id":"diff", "pos":[] })db.ChartCollection.insert({ "_id":"numtrans", "Bits":[], "Shares":[]})
- after creating
InputTxCollectionMotionCollectionOrphanBlockCollectionOrphanTxCollectionPeerCollectionSharesAddressCollectionStatusCollection- after creating
StatusCollectionpaste the following commands in the mongo shelldb.StatusCollection.insert({_id:"statusInfo"}),db.StatusCollection.insert({_id:"addressLeftOff","blockHeight":0})
- after creating
TxCollectionVoteCollection
- replace
- Double check that you have created all the collections by typing
show collectionsin mongo shell. - Now, depending on what OS your running, we have to create a
nu.conffile.
- if your on Windows, head to the folder
C:/users/<username>/appdata/roaming/nu/ - if your on Linux, head to the folder
/root/.nu/(the same might apply to Mac OSX) - create a file called
nu.confin the folder. (windows users can use notepad) - now, open
nu.confand copy and paste the following into the file.-
server=1
-
rpcport=14001
-
rpcuser=user
-
rpcpassword=pass
-
addnode=198.52.160.71
-
addnode=198.52.217.4
-
addnode=198.52.199.75
-
addnode=198.52.199.46
-
addnode=162.242.208.43
-
addnode=192.237.200.146
-
addnode=119.9.75.189
-
addnode=119.9.12.63
-
listen=1
-
- Open the pythonparser folder, then locate and open
NuParserv007.pyin your choice of IDE
- make sure the dependencies at the top are installed on your system i.e) bitcoinrpc, pymongo, bitstring, etc.
- for bitcoinrpc, if you are using pip, use this command to install it
pip install git+https://github.com/jgarzik/python-bitcoinrpc.git - adjust
line 14according to your mongodb setup - adjust
line 30according to your nu.confrpcuser,rpcpassword,rpcportproperties - find the variables
blk01,blk02and according to where yournu.conffile is located, comment/uncomment the correct location i.e) for Windows use:blk01 = "C:/users/<username>/appdata/roaming/nu/blk0001.dat",blk02=...,blk="" - now, running the script will insert the first 10 blocks into the db. Feel free to tinker with
the variables
fi.seek()(line 416) andSTART,END(lines 486,487) respectively to insert the desired blocks.
- Feel free to take a little break at this point :) (steps 6 and 7 are optional)
- if you want to insert the latest block discovered (make it realtime), open your
nu.conffile and add this property at the bottom:
- for windows:
blocknotify=C:\<python-location>\python.exe C:\<folder-location>\NuExplorerOS\pythonparser\NuParserv007.py - for linux:
blocknotify=/usr/bin/python /<folder-location>/NuExplorerOS/pythonparser/NuParserv007.py
- now close and reopen nu.exe or nud.exe (whichever you prefer).
- start up the server with
node server.js - open your browser and visit
localhost:800
DONE! Your setup and installation is complete. If your stuck, feel free to contact me at jgeorges371@gmail.com or write a github issue.
LICENSE
The MIT License (MIT)
Copyright (c) 2016 Johny Georges
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.