diff --git a/bin/build-go.sh b/bin/build-go.sh index 1a66ea2..61a70d5 100644 --- a/bin/build-go.sh +++ b/bin/build-go.sh @@ -3,7 +3,7 @@ # update repository & install dependencies sudo apt-get update -y sudo apt-get upgrade -y -sudo apt-get install -y git mercurial build-essential software-properties-common wget pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev nodejs npm +sudo apt-get install -y git mercurial build-essential software-properties-common wget pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev nodejs npm ntp # add ethereum repos sudo add-apt-repository -y ppa:ethereum/ethereum-qt @@ -29,3 +29,12 @@ npm install npm install pm2 -g cp -b ./processes-go.json ./../processes.json + +# set up time update cronjob +cat > /etc/cron.hourly/ntpdate << EOF +#!/bin/sh +sudo service ntp stop +sudo ntpdate -s ntp.ubuntu.com +sudo service ntp start +EOF +sudo chmod 755 /etc/cron.hourly/ntpdate diff --git a/bin/build.sh b/bin/build.sh index cefe98f..d0f4f53 100644 --- a/bin/build.sh +++ b/bin/build.sh @@ -16,7 +16,7 @@ sudo add-apt-repository -y ppa:ethereum/ethereum-dev sudo apt-get -y update sudo apt-get -y upgrade -sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libargtable2-dev clang-3.5 lldb-3.5 nodejs npm +sudo apt-get -y install build-essential g++-4.8 git cmake libboost-all-dev automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons libncurses5-dev libcurl4-openssl-dev wget qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libargtable2-dev clang-3.5 lldb-3.5 nodejs npm ntp # add node symlink sudo ln -s /usr/bin/nodejs /usr/bin/node @@ -55,3 +55,11 @@ npm install npm install pm2 -g cp -b ./processes.json ./.. +# set up time update cronjob +cat > /etc/cron.hourly/ntpdate << EOF +#!/bin/sh +sudo service ntp stop +sudo ntpdate -s ntp.ubuntu.com +sudo service ntp start +EOF +sudo chmod 755 /etc/cron.hourly/ntpdate diff --git a/bin/eth.sh b/bin/eth.sh index 6bd399b..14bc8ae 100644 --- a/bin/eth.sh +++ b/bin/eth.sh @@ -2,7 +2,7 @@ trap "exit" INT if [ -f /usr/bin/ethereum ] then - ethereum -rpc true + geth --rpc true else eth -x 15 -l 30303 -n off -m off -v 1 -j fi \ No newline at end of file diff --git a/lib/node.js b/lib/node.js index d5bda0c..95a5b05 100644 --- a/lib/node.js +++ b/lib/node.js @@ -100,7 +100,7 @@ function Node() console.error('Socket connection closed'); }) .on('error', function error(err) { - console.error(err); + console.error("socket:", err); }) .on('reconnecting', function reconnecting(opts) { console.warn('We are scheduling a reconnect operation', opts); @@ -143,7 +143,7 @@ Node.prototype.isActive = function() code: '1', msg: err }); - console.error(err); + console.error("peerCount:", err); } this.stats.active = false; @@ -177,7 +177,7 @@ Node.prototype.getBlock = function(number) code: '3', msg: err }); - console.error(err); + console.error("blockNumber:", err); } } @@ -196,7 +196,7 @@ Node.prototype.getBlock = function(number) code: '2', msg: err }); - console.error(err); + console.error("getBlock:", err); } return block; @@ -307,11 +307,11 @@ Node.prototype.getStats = function() if(this.stats.block.number > 0) this.getLatestBlocks(); - try { - this.stats.pending = web3.eth.getBlockTransactionCount('pending'); - } catch (err) { - console.error(err); - } + // try { + // this.stats.pending = web3.eth.getBlockTransactionCount('pending'); + // } catch (err) { + // console.error("getBlockTransactionCount('pending'):", err); + // } this.stats.mining = web3.eth.mining; this.stats.gasPrice = web3.eth.gasPrice.toString(10); this.stats.listening = web3.net.listening; @@ -392,7 +392,7 @@ Node.prototype.emit = function(message, payload) socket.emit(message, payload); } catch (err) { - console.error(err); + console.error("socket.emit:", err); } } }