cubedro / eth-netstats

Ethereum Network Stats
https://ethstats.net/
GNU General Public License v3.0
854 stars 539 forks source link

I cant see running nodes #328

Open maroodb opened 5 years ago

maroodb commented 5 years ago

How to make eth-netstats detect running nodes?

AyushyaChitransh commented 5 years ago

You are required to run https://github.com/cubedro/eth-net-intelligence-api

This API will collect information of your RPC and send that information to eth-netstats site.

Remember to update the config.json file and start using pm2 start app.json

zscole commented 5 years ago

and be sure to prepend WS_SECRET=<pw> to the eth netstats command on the or you'll get an error. the topology is like this:

  1. a primary node is running eth net stats, which parses data streams coming from the api nodes and serves that data on the netstats page
  2. all the other nodes are running eth net intelligence api and they push that data stream to the server node
  3. you need to format your app.json file properly:

{ "NODE_ENV" : "production", "RPC_HOST" : "localhost", "RPC_PORT" : "8545", "LISTENING_PORT" : "30303", "INSTANCE_NAME" : "", // this is arbitrary value that just indicates the name of the node on the net stats page "CONTACT_DETAILS" : "", "WS_SERVER" : "192.168.168.201:3000", // this should be set to the IP address of the node that's running eth net stats "WS_SECRET" : "password", // add whatever password you want. needs to be the same on every node though "VERBOSITY" : 2 } } ]

  1. when you start eth netstats on your server node, use command WS_SECRET=<password> npm start
  2. start api on other nodes with pm2 start app.json
  3. enjoy the sweet taste of precious data
maroodb commented 5 years ago

I always got the error: "[eth] =✘= Web3 connection attempt #0 failed" this my app.json :

[
  {
    "name"              : "node-app",
    "script"            : "app.js",
    "log_date_format"   : "YYYY-MM-DD HH:mm Z",
    "merge_logs"        : false,
    "watch"             : false,
    "max_restarts"      : 10,
    "exec_interpreter"  : "node",
    "exec_mode"         : "fork_mode",
    "env":
    {
      "NODE_ENV"        : "production",
      "RPC_HOST"        : "localhost",
      "RPC_PORT"        : "8502",
      "LISTENING_PORT"  : "30312",
      "INSTANCE_NAME"   : "",
      "CONTACT_DETAILS" : "",
      "WS_SERVER"       : "localhost:3000",
      "WS_SECRET"       : "7/7use94",
      "VERBOSITY"       : 2
    }
  }
]
mikeyb commented 5 years ago

it cant connect to run web3 commands. Check your ports and make sure services are running. This is end user problem, not eth-netstats

maroodb commented 5 years ago

I run geth using this command line: geth --datadir innofactory1/ --syncmode 'full' --port 30312 --rpc --rpcaddr 'localhost' --rpcport 8502 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://20c47b4a7bd6d8383f87c1c988e601c7aa27ba7177b25d57e00794d1917c0c992dc37b93dfdf54741633179fd9a96a34fc2687d606ad48e2015ef2d958f3f0fb@10.2.1.124:30310' --networkid 1515 --gasprice '0' --unlock '0x40ee4953da28c4db0f15d671cefc29724ce2b87a' --password innofactory1/password.txt --mine and I can send transaction using nodejs console.

mikeyb commented 5 years ago

okay :+1:

mikeyb commented 5 years ago

Did you happen to notice the part where you dont start the WS service? Probably gonne need that running to use websockets to geth

maroodb commented 5 years ago

yeah isn't it enabled. but I am not sure "WS_SECRET" where to mention it in geth

mikeyb commented 5 years ago

It is not enabled. No where in your geth command do you enable WS. Try typing this and reading: geth --help | grep ws

maroodb commented 5 years ago

sorry I made a typing mistake, I meant isn't enabled

AyushyaChitransh commented 5 years ago

There is another issue with your app.json It should have an instance name, or else, pm2 won't start properly.

The errors about web3 indicate that pm2 service is unable to communicate with RPC.

WS_SECRET is a password which is set when eth-netstat is started and same password is supplied when pm2 is started.