Skip to content

Commit

Permalink
Update to newest mq, doweig, & mrv777
Browse files Browse the repository at this point in the history
  • Loading branch information
mrv777 committed Apr 18, 2017
1 parent 28bf819 commit 751a4d5
Show file tree
Hide file tree
Showing 133 changed files with 3,538 additions and 1,201 deletions.
25 changes: 22 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-markdown');
grunt.loadNpmTasks('grunt-angular-gettext');
grunt.loadNpmTasks('grunt-mocha-test');

// Load Custom Tasks
grunt.loadTasks('tasks');
Expand Down Expand Up @@ -38,7 +39,8 @@ module.exports = function (grunt) {
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/ngprogress/build/ngProgress.min.js',
'bower_components/angular-gettext/dist/angular-gettext.min.js',
'bower_components/angular-naturalsort/dist/naturalSortVersionDates.min.js'],
'bower_components/angular-naturalsort/dist/naturalSortVersionDates.min.js',
'bower_components/angular-qrcode/qrcode.js'],
dest: 'public/js/angularjs-all.js'
},
main: {
Expand All @@ -62,6 +64,7 @@ module.exports = function (grunt) {
'bower_components/sigma/sigma.min.js',
'bower_components/sigma/plugins/*.min.js',
'bower_components/underscore/underscore-min.js',
'bower_components/qrcode-generator/js/qrcode.js',
'bower_components/zeroclipboard/ZeroClipboard.min.js'],
dest: 'public/js/vendors.js'
},
Expand Down Expand Up @@ -106,7 +109,7 @@ module.exports = function (grunt) {
},
jshint: {
options: {
jshintrc: '.jshintrc'
jshintrc: '.jshintrc'
},
all: ['api/**/*.js',
'app.js',
Expand All @@ -119,8 +122,21 @@ module.exports = function (grunt) {
'redis.js',
'sockets/**/*.js',
'tasks/**/*.js',
'test/**/*.js',
'utils**/*.js']
},
mochaTest: {
test: {
options: {
reporter: 'spec',
quiet: false,
clearRequireCache: false,
noFail: false,
timeout: '250s'
},
src: ['test']
}
},
markdown: {
all: {
files: [
Expand Down Expand Up @@ -183,7 +199,7 @@ module.exports = function (grunt) {
nggettext_compile: {
all: {
options: {
module: 'ark_explorer'
module: 'lisk_explorer'
},
files: {
'public/src/js/translations.js': ['po/*.po']
Expand All @@ -198,6 +214,9 @@ module.exports = function (grunt) {
// Default task(s).
grunt.registerTask('default', ['watch']);

// Register tasks for travis.
grunt.registerTask('travis', ['jshint', 'mochaTest']);

// Compile task (concat + minify).
grunt.registerTask('compile', ['nggettext_extract', 'nggettext_compile', 'concat', 'uglify', 'cssmin', 'copy']);

Expand Down
200 changes: 86 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,171 +1,143 @@
# Ark Blockchain Explorer

Ark blockchain explorer version 0.1. Works with Ark wallet API. Uses Redis for caching data and Freegeoip for IP geo-location.
Ark Explorer version 0.2 works in conjunction with the Ark Core API. It uses Redis for caching data and Freegeoip to parse IP geo-location data.

[![Build Status](https://travis-ci.org/ArkEcosystem/Ark-explorer.svg?branch=development)](https://travis-ci.org/ArkEcosystem/Ark-explorer)

## Prerequisites

* Nodejs v4.0.0 or higher (https://nodejs.org/)
* Redis (http://redis.io)
* Freegeoip (https://github.com/fiorix/freegeoip)
* Bower (http://bower.io/)
* Grunt.js (http://gruntjs.com/)
These programs and resources are required to install and run Ark Explorer

## Installation
- Nodejs v6.9.2 or higher (<https://nodejs.org/>) -- Nodejs serves as the underlying engine for code execution.

To install run:
```
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
```

```
npm install
bower install
```
- Redis (<http://redis.io>) -- Redis is used for caching parsed exchange data.

## Redis - (Ubuntu Installation)
`sudo apt-get install -y redis-server`

Redis is used for caching parsed exchange data. To install Redis perfom the following:
- Freegeoip (<https://github.com/fiorix/freegeoip>) -- Freegeoip is used by the Network Monitor for IP address geo-location.

```
sudo apt-get install redis-server
```
```
wget https://github.com/fiorix/freegeoip/releases/download/v3.1.5/freegeoip-3.1.5-linux-amd64.tar.gz
tar -zxf freegeoip-3.1.5-linux-amd64.tar.gz
ln -s freegeoip-3.1.5-linux-amd64 freegeoip
nohup ./freegeoip/freegeoip > ./freegeoip/freegeoip.log 2>&1 &
```

Once installation is complete, run the server using the following command:
- Bower (<http://bower.io/>) -- Bower helps to install required JavaScript dependencies.

```
nohup redis-server &
```
`sudo npm install -g bower`

## Freegeoip
- Grunt.js (<http://gruntjs.com/>) -- Grunt is used to compile the frontend code and serves other functions.

Freegeoip is used by the Network Monitor for IP address geo-location.
`sudo npm install -g grunt`

Installation is very simple. Download and unpack the latest release from: https://github.com/fiorix/freegeoip/releases
- Forever (<https://github.com/foreverjs/forever>) -- Forever manages the node processes for Ark Explorer

Then start the server in the background, using the following command:
`sudo npm install -g forever`

```
./freegeoip > /dev/null 2>&1 &
```
- Git (<https://github.com/git/git>) -- Used for cloning and updating Ark Explorer

## Configuration
`sudo apt-get install -y git`

- Tool chain components -- Used for compiling dependencies

`sudo apt-get install -y python build-essential automake autoconf libtool`

`config.json` file contains configuration settings.
## Installation Steps

Example:
Clone the Ark Explorer Repository:

```
{
"configuration" : {
"development": {
"host": "0.0.0.0",
"port": 6040
},
"production": {
"host": "0.0.0.0",
"port": 80
},
"ark" : {
"host" : "127.0.0.1",
"port" : 4001
},
"freegeoip" : {
"host" : "127.0.0.1",
"port" : 8080
},
"redis" : {
"host" : "127.0.0.1",
"port" : 6379,
"password" : ""
},
"cacheTTL" : 20,
"fixedPoint" : 100000000,
"enableCandles" : true,
"updateCandlesInterval" : 30000,
"enableOrders" : true,
"updateOrdersInterval" : 30000,
"enableExchange" : true,
"updateExchangeInterval" : 900000,
"btcusdExchange" : "bitfinex",
"arkbtcExchange" : "poloniex"
}
}
git clone https://github.com/ArkEcosystem/ark-explorer.git
cd ark-explorer
npm install
bower install
```

* `cacheTTL` - time to live cache in redis.
* `fixedPoint` - fixed point number of Ark (10^8).
* `enableCandles` - enable or disable updating of candlestick data.
* `updateCandlesInterval` - time to update candlestick data.
* `enableOrders` - enable or disable updating of order book data.
* `updateOrdersInterval` - time to update order book data.
* `enableExchange` - enable or disable exchange currency courses.
* `updateExchangeInterval` - time to update exchange currency courses.
* `btcusdExchange` - default is bitfinex, alternatives are: bitstamp & btce.
* `arkbtcExchange` - default is poloniex.
## Build Steps

## Build
#### Frontend
The frontend must be built with Grunt before starting Ark Explorer. Run the following command to compile the frontend components:

Frontend must be built with grunt:
`grunt compile`

```
grunt compile
```
#### Market Watcher
Candlestick data needs to be initialized prior to starting Ark Explorer. During runtime candlestick data is updated automatically.

If you want to work with frontend and see updates in realtime run:
To build candlestick data for each exchange run:

```
grunt
```
`grunt candles:build`

It will update css/js files as changes are made.
To update candlestick data manually run after initialization:

## Market Watcher
`grunt candles:update`

To build candlestick data for each exchange run:
## Configuration

```
grunt candles:build
```
The default `config.js` file contains all of the configuration settings for Ark Explorer. These options can be modified according to comments included in configuration file.

To update candlestick data manually run:
#### Top Accounts

To enable Top Accounts functionality, start your ark node (not the explorer) using the following command:

```
grunt candles:update
TOP=true node app.js
```

During runtime candlestick data is updated automatically.
## Managing Ark Explorer

## Benchmarks
To test that Ark Explorer is configured correctly, run the following command:

To run benchmark tests run:
`node app.js`

```
node benchmark.js
```
Open: <http://localhost:6040>, or if its running on a remote system, switch `localhost` for the external IP Address of the machine.

## Launch
Once the process is verified as running correctly, `CTRL+C` and start the process with `forever`. This will fork the process into the background and automatically recover the process if it fails.

Development:
`forever start app.js`

```
node app.js
```
After the process is started its runtime status and log location can be found by issuing this statement:

Open: [http://localhost:6000](http://localhost:6000)
`forever list`

Production:
To stop Explorer after it has been started with `forever`, issue the following command:

```
NODE_ENV=production node app.js
```
`forever stop app.js`

Open: [http://localhost](http://localhost)
## Tests

Ports for both mode can be found in `config.json`
Before running any tests, please ensure Ark Explorer and Ark Client are configured to run on the Ark Testnet.

## Top Accounts
Replace **config.js** with **config.test** file from the **test** directory:

To enable Top Accounts functionality, start your ark node _(not the explorer)_ using the following command:
`cp test/config.test ./config.js`

Replace the **config.json** for the Ark Client the corresponding file under the **test** directory:

`cp test/config_Ark.json /PATH_TO_Ark_DIR/config.json`

Then restart the Ark Client (example):

`bash /PATH_TO_Ark_DIR/Ark.sh reload`

Launch Ark Explorer (runs on port 6040):

`forever start app.js`

Run the test suite:

`npm test`

Run individual tests:

```
TOP=true node app.js
npm test -- test/api/accounts.js
npm test -- test/api/transactions.js
```

## Authors
Expand Down
23 changes: 0 additions & 23 deletions api/candles.js

This file was deleted.

7 changes: 7 additions & 0 deletions api/delegates.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,11 @@ module.exports = function (app) {
function (data) { req.json = data; return next(); }
);
});

app.get('/api/delegates/getDelegateProposals', function (req, res, next) {
api.getDelegateProposals(
function (data) { res.json(data); },
function (data) { req.json = data; return next(); }
);
});
};
Loading

0 comments on commit 751a4d5

Please sign in to comment.