Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown fix + Dockerfile added + Location fix + Responsive design + Bug fixed #331

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0626ecf
Fix broken Markdown headings
bryant1410 Apr 16, 2017
75bf2f5
Add automated docker hub builds
karalabe Oct 26, 2017
4a879a9
Use latest version for getting location info
AyushyaChitransh Feb 13, 2018
43f5d65
Using corrected IP address
AyushyaChitransh Feb 13, 2018
31a3f84
Fix block history if chain is shorted than MAX_HISTORY.
karalabe Mar 23, 2017
bc4b0b9
Log IP addresses with blocks to detect spammers
karalabe Aug 18, 2017
82e2fa3
Log total difficulties to detect spammers.
karalabe Sep 9, 2017
4e9492f
Introduce an ID reservation list.
karalabe Sep 12, 2017
592a98c
fixed mobile layout
hackmod Apr 4, 2018
5a92f6c
use hidden-* attributes properly
hackmod Apr 5, 2018
838fff5
simplified *hashrateFilter
hackmod Apr 5, 2018
1c551e4
src-lite: totalDifficultyFilter filter added
hackmod Apr 5, 2018
9a70697
src: remove min-width attribute from body
hackmod Apr 5, 2018
60094ba
src: show block counter properly
hackmod Apr 5, 2018
3a46bb6
remove google analytics
hackmod Apr 8, 2018
815f62f
fixed layout and css/js for responsive layout.
hackmod Apr 8, 2018
5f786d8
fixed totalDifficultyFilter, fixed gaslimit number format
hackmod Jun 25, 2018
a3df054
Comment warning message
Sep 15, 2018
7c5fe12
Add package-lock.json
Sep 15, 2018
e4bd94e
Remove un-maintained files
Sep 15, 2018
953c06a
Update package.json for new repo
Sep 15, 2018
53e7387
Update README.md
Sep 15, 2018
e17779c
Update travis.yml
Sep 15, 2018
0dc75c9
Added grunt-cli :smile:
Sep 15, 2018
6384f86
Update travis.yml
Sep 15, 2018
94c9fa6
Revert "fixed totalDifficultyFilter, fixed gaslimit number format"
Sep 15, 2018
9f7e077
Fixed gas limit
Sep 15, 2018
943e0e9
Add exa hash on filters.js just in case
Sep 15, 2018
465f662
build -> dist
Sep 15, 2018
8c2e983
Update README.md
Sep 15, 2018
4b671ba
Bump version to 0.1.0
Sep 15, 2018
926fb2f
Add robots.txt, cleanup config.js list
Sep 16, 2018
f0736bd
Update README.md
Sep 16, 2018
722c191
Update package.json
Sep 16, 2018
b637ddc
Add instruction to add new node
AyushyaChitransh Sep 16, 2018
6fc79cf
Merge pull request #3 from AyushyaChitransh/patch-2
Sep 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/.git
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
node_js:
- "0.12"
env:
global:
secure: Qdkmi13nqcXskABBhbuGZmRakh4orOW1dalkSCyUbzGuYf0OdYF8ttNVuJa0WSWI4KhNXhtz2p3I8dM95wL++LCVqXFmIvZtX8Nca36KlNxIPNXPjn0odayh+c4pgrhrbz8TDmDXl9IPuZmNz8HHtN7xmIn6YDcm13wA3gTmfwo=
sudo: required
dist: trusty
node_js: '8'
install:
- npm install
- npm run dist
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM mhart/alpine-node:latest

ADD . /eth-netstats
WORKDIR /eth-netstats

RUN npm install && npm install -g grunt-cli && grunt

EXPOSE 3000
CMD ["npm", "start"]
64 changes: 39 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Ethereum Network Stats
Ethereum Network Stats based off github.com/cubedro/eth-netstats
============
[![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url]

This is a visual interface for tracking ethereum network status. It uses WebSockets to receive stats from running nodes and output them through an angular interface. It is the front-end implementation for [eth-net-intelligence-api](https://github.com/cubedro/eth-net-intelligence-api).
This is a visual interface for tracking ethereum network status. It uses WebSockets to receive stats from running nodes and output them through an angular interface. It is the front-end implementation for [eth-net-intelligence-api](https://github.com/eosclab/eth-net-intelligence-api).

![Screenshot](https://raw.githubusercontent.com/cubedro/eth-netstats/master/src/images/screenshot.jpg?v=0.0.6 "Screenshot")

![Screenshot](https://raw.githubusercontent.com/eosclab/eth-netstats/master/src/images/screenshot.jpg?v=0.0.6 "Screenshot")

## Prerequisite
* node
Expand All @@ -16,40 +17,53 @@ Make sure you have node.js and npm installed.
Clone the repository and install the dependencies

```bash
git clone https://github.com/cubedro/eth-netstats
git clone https://github.com/eosclab/eth-netstats
cd eth-netstats
npm install
sudo npm install -g grunt-cli
```

##Build the resources
NetStats features two versions: the full version and the lite version. In order to build the static files you have to run grunt tasks which will generate dist or dist-lite directories containing the js and css files, fonts and images.

## Build the resources

To build the full version run
To build run
```bash
grunt
npm run dist
```

To build the lite version run
```bash
grunt lite
```

If you want to build both versions run
```bash
grunt all
```

##Run
## Run

```bash
npm start
```

see the interface at http://localhost:3000

[travis-image]: https://travis-ci.org/cubedro/eth-netstats.svg
[travis-url]: https://travis-ci.org/cubedro/eth-netstats
[dep-image]: https://david-dm.org/cubedro/eth-netstats.svg
[dep-url]: https://david-dm.org/cubedro/eth-netstats
## Add nodes to site

For now, the site should be looking blank. For instruction on adding new nodes to the site, refer to [eth-net-intelligence-api](https://github.com/eosclab/eth-net-intelligence-api).

## Updates since original cubedro/eth-netstats base:

+ Fixed block history if chain is shorted than MAX_HISTORY

+ Fixed broken headings in Markdown files

+ Docker support added (compatible with puppeth)

+ Updated geoip-lite package to latest version (fixed location info)

+ Responsive design patch added for mobile view

+ Bug fixed with charts and formats

## To-do list

+ Update npm libraries for vulnerability patch & performance increase

+ Add average TPS calculation

+ More features with DPOS / POA!

[travis-image]: https://travis-ci.org/eosclab/eth-netstats.svg
[travis-url]: https://travis-ci.org/eosclab/eth-netstats
[dep-image]: https://david-dm.org/eosclab/eth-netstats.svg
[dep-url]: https://david-dm.org/eosclab/eth-netstats
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ else
}
}

var banned = require('./lib/utils/config').banned;
var banned = require('./lib/utils/config').banned;
var reserved = require('./lib/utils/config').reserved;

// Init http server
if( process.env.NODE_ENV !== 'production' )
Expand Down Expand Up @@ -106,7 +107,7 @@ api.on('connection', function (spark)
{
console.info('API', 'CON', 'Hello', data['id']);

if( _.isUndefined(data.secret) || WS_SECRET.indexOf(data.secret) === -1 || banned.indexOf(spark.address.ip) >= 0 )
if( _.isUndefined(data.secret) || WS_SECRET.indexOf(data.secret) === -1 || banned.indexOf(spark.address.ip) >= 0 || _.isUndefined(data.id) || reserved.indexOf(data.id) >= 0 )
{
spark.end(undefined, { reconnect: false });
console.error('API', 'CON', 'Closed - wrong auth', data);
Expand Down Expand Up @@ -196,7 +197,7 @@ api.on('connection', function (spark)
data: stats
});

console.success('API', 'BLK', 'Block:', data.block['number'], 'from:', data.id);
console.success('API', 'BLK', 'Block:', data.block['number'], 'td:', data.block['totalDifficulty'], 'from:', data.id, 'ip:', spark.address.ip);

Nodes.getCharts();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ History.prototype.add = function(block, id, trusted, addingHistory)
propagTimes: []
}

if( this._items.length === 0 || (this._items.length === MAX_HISTORY && block.number > this.worstBlockNumber()) || (this._items.length < MAX_HISTORY && block.number < this.bestBlockNumber() && addingHistory) )
if( this._items.length === 0 || (this._items.length > 0 && block.number > this.worstBlockNumber()) || (this._items.length < MAX_HISTORY && block.number < this.bestBlockNumber() && addingHistory) )
{
item.propagTimes.push({
node: id,
Expand Down
3 changes: 3 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Node.prototype.setInfo = function(data, callback)

Node.prototype.setGeo = function(ip)
{
if (ip.substr(0, 7) == "::ffff:") {
ip = ip.substr(7)
}
this.info.ip = ip;
this.geo = geoip.lookup(ip);
}
Expand Down
34 changes: 6 additions & 28 deletions lib/utils/config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
var trusted = [
'52.16.188.185',
'54.94.239.50',
'54.174.74.156',
'54.172.25.93',
'54.174.75.126',
'54.173.232.137',
'52.7.205.180',
'52.7.218.44',
'52.7.205.152',
'52.7.224.174',
'92.51.165.126',
'84.117.82.122',
'73.40.58.88',
'178.19.221.38',
'185.37.145.18',
'172.31.39.87',
'86.120.171.69',
'86.123.155.6',
'188.24.81.133',
'::ffff:127.0.0.1',
];
var trusted = [];

var banned = [
// '198.48.150.206'
];
var banned = [];

module.exports = {
trusted: trusted,
banned: banned
};
trusted: trusted,
banned: banned,
reserved: []
};
Loading