Port?
Closed this issue · 12 comments
What is the default port that the explorer runs on, and where am i able to change it?
Thanks.
default is 3000, or you can run with PORT=1234 node app.js
@elaineo thank you, however now i got this error: "node app.js
/home/w0lfie/explorer/routes/web3relay.js:27
throw "No connection";
^
No connection
Thanks all of the help, im not really familiar with node.js or ethereum based coins, and i would like to setup my first block explorer :/
@onnz423 are you running geth or parity?
the error only happens if web3 fails to connect.
Try this:
Run a node console
$ node
>
Paste the following into the console:
var Web3 = require("web3");
var web3;
if (typeof web3 !== "undefined") {
web3 = new Web3(web3.currentProvider);
} else {
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
web3.isConnected()
if that works, then it should connect no problem.
@elaineo thank you for quick answer once again!
I did not know i had to seperately install web3,
I had to change the port as well to 8293 i assume, because that is the HTTP rpc port of the coin that i am using.
This is the outcome from the web3:
w0lfie@instance-1:~/explorer$ node
> var Web3 = require("web3");
undefined
> var web3;
undefined
>
> if (typeof web3 !== "undefined") {
... web3 = new Web3(web3.currentProvider);
... } else {
... web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8293"));
... }
Web3 {
_requestManager:
RequestManager {
provider: HttpProvider { host: 'http://localhost:8293', timeout: 0 },
polls: {},
timeout: null },
currentProvider: HttpProvider { host: 'http://localhost:8293', timeout: 0 },
eth:
Eth {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
getBalance: { [Function: send] request: [Function: bound ], call: 'eth_getBalance' },
getStorageAt: { [Function: send] request: [Function: bound ], call: 'eth_getStorageAt' },
getCode: { [Function: send] request: [Function: bound ], call: 'eth_getCode' },
getBlock: { [Function: send] request: [Function: bound ], call: [Function: blockCall] },
getUncle: { [Function: send] request: [Function: bound ], call: [Function: uncleCall] },
getCompilers: { [Function: send] request: [Function: bound ], call: 'eth_getCompilers' },
getBlockTransactionCount:
{ [Function: send]
request: [Function: bound ],
call: [Function: getBlockTransactionCountCall] },
getBlockUncleCount:
{ [Function: send]
request: [Function: bound ],
call: [Function: uncleCountCall] },
getTransaction:
{ [Function: send]
request: [Function: bound ],
call: 'eth_getTransactionByHash' },
getTransactionFromBlock:
{ [Function: send]
request: [Function: bound ],
call: [Function: transactionFromBlockCall] },
getTransactionReceipt:
{ [Function: send]
request: [Function: bound ],
call: 'eth_getTransactionReceipt' },
getTransactionCount: { [Function: send] request: [Function: bound ], call: 'eth_getTransactionCount' },
call: { [Function: send] request: [Function: bound ], call: 'eth_call' },
estimateGas: { [Function: send] request: [Function: bound ], call: 'eth_estimateGas' },
sendRawTransaction: { [Function: send] request: [Function: bound ], call: 'eth_sendRawTransaction' },
sendTransaction: { [Function: send] request: [Function: bound ], call: 'eth_sendTransaction' },
sign: { [Function: send] request: [Function: bound ], call: 'eth_sign' },
compile: { solidity: [Object], lll: [Object], serpent: [Object] },
submitWork: { [Function: send] request: [Function: bound ], call: 'eth_submitWork' },
getWork: { [Function: send] request: [Function: bound ], call: 'eth_getWork' },
coinbase: [Getter],
getCoinbase: { [Function: get] request: [Function: bound ] },
mining: [Getter],
getMining: { [Function: get] request: [Function: bound ] },
hashrate: [Getter],
getHashrate: { [Function: get] request: [Function: bound ] },
syncing: [Getter],
getSyncing: { [Function: get] request: [Function: bound ] },
gasPrice: [Getter],
getGasPrice: { [Function: get] request: [Function: bound ] },
accounts: [Getter],
getAccounts: { [Function: get] request: [Function: bound ] },
blockNumber: [Getter],
getBlockNumber: { [Function: get] request: [Function: bound ] },
protocolVersion: [Getter],
getProtocolVersion: { [Function: get] request: [Function: bound ] },
iban:
{ [Function: Iban]
fromAddress: [Function],
fromBban: [Function],
createIndirect: [Function],
isValid: [Function] },
sendIBANTransaction: [Function: bound transfer] },
db:
DB {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
putString: { [Function: send] request: [Function: bound ], call: 'db_putString' },
getString: { [Function: send] request: [Function: bound ], call: 'db_getString' },
putHex: { [Function: send] request: [Function: bound ], call: 'db_putHex' },
getHex: { [Function: send] request: [Function: bound ], call: 'db_getHex' } },
shh:
Shh {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
post: { [Function: send] request: [Function: bound ], call: 'shh_post' },
newIdentity: { [Function: send] request: [Function: bound ], call: 'shh_newIdentity' },
hasIdentity: { [Function: send] request: [Function: bound ], call: 'shh_hasIdentity' },
newGroup: { [Function: send] request: [Function: bound ], call: 'shh_newGroup' },
addToGroup: { [Function: send] request: [Function: bound ], call: 'shh_addToGroup' } },
net:
Net {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
listening: [Getter],
getListening: { [Function: get] request: [Function: bound ] },
peerCount: [Getter],
getPeerCount: { [Function: get] request: [Function: bound ] } },
personal:
Personal {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
newAccount: { [Function: send] request: [Function: bound ], call: 'personal_newAccount' },
unlockAccount: { [Function: send] request: [Function: bound ], call: 'personal_unlockAccount' },
sendTransaction:
{ [Function: send]
request: [Function: bound ],
call: 'personal_sendTransaction' },
lockAccount: { [Function: send] request: [Function: bound ], call: 'personal_lockAccount' },
listAccounts: [Getter],
getListAccounts: { [Function: get] request: [Function: bound ] } },
trace:
Trace {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
call: { [Function: send] request: [Function: bound ], call: 'trace_call' },
rawTransaction: { [Function: send] request: [Function: bound ], call: 'trace_rawTransaction' },
replayTransaction: { [Function: send] request: [Function: bound ], call: 'trace_replayTransaction' },
block: { [Function: send] request: [Function: bound ], call: 'trace_block' },
filter: { [Function: send] request: [Function: bound ], call: 'trace_filter' },
get: { [Function: send] request: [Function: bound ], call: 'trace_get' },
transaction: { [Function: send] request: [Function: bound ], call: 'trace_transaction' } },
bzz:
Swarm {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
blockNetworkRead: { [Function: send] request: [Function: bound ], call: 'bzz_blockNetworkRead' },
syncEnabled: { [Function: send] request: [Function: bound ], call: 'bzz_syncEnabled' },
swapEnabled: { [Function: send] request: [Function: bound ], call: 'bzz_swapEnabled' },
download: { [Function: send] request: [Function: bound ], call: 'bzz_download' },
upload: { [Function: send] request: [Function: bound ], call: 'bzz_upload' },
retrieve: { [Function: send] request: [Function: bound ], call: 'bzz_retrieve' },
store: { [Function: send] request: [Function: bound ], call: 'bzz_store' },
get: { [Function: send] request: [Function: bound ], call: 'bzz_get' },
put: { [Function: send] request: [Function: bound ], call: 'bzz_put' },
modify: { [Function: send] request: [Function: bound ], call: 'bzz_modify' },
hive: [Getter],
getHive: { [Function: get] request: [Function: bound ] },
info: [Getter],
getInfo: { [Function: get] request: [Function: bound ] } },
settings: Settings { defaultBlock: 'latest', defaultAccount: undefined },
version:
{ api: '0.18.4',
node: [Getter],
getNode: { [Function: get] request: [Function: bound ] },
network: [Getter],
getNetwork: { [Function: get] request: [Function: bound ] },
ethereum: [Getter],
getEthereum: { [Function: get] request: [Function: bound ] },
whisper: [Getter],
getWhisper: { [Function: get] request: [Function: bound ] } },
providers:
{ HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider] },
_extend:
{ [Function: ex]
formatters:
{ inputDefaultBlockNumberFormatter: [Function: inputDefaultBlockNumberFormatter],
inputBlockNumberFormatter: [Function: inputBlockNumberFormatter],
inputCallFormatter: [Function: inputCallFormatter],
inputTransactionFormatter: [Function: inputTransactionFormatter],
inputAddressFormatter: [Function: inputAddressFormatter],
inputPostFormatter: [Function: inputPostFormatter],
outputBigNumberFormatter: [Function: outputBigNumberFormatter],
outputTransactionFormatter: [Function: outputTransactionFormatter],
outputTransactionReceiptFormatter: [Function: outputTransactionReceiptFormatter],
outputBlockFormatter: [Function: outputBlockFormatter],
outputLogFormatter: [Function: outputLogFormatter],
outputPostFormatter: [Function: outputPostFormatter],
outputSyncingFormatter: [Function: outputSyncingFormatter] },
utils:
{ padLeft: [Function: padLeft],
padRight: [Function: padRight],
toHex: [Function: toHex],
toDecimal: [Function: toDecimal],
fromDecimal: [Function: fromDecimal],
toUtf8: [Function: toUtf8],
toAscii: [Function: toAscii],
fromUtf8: [Function: fromUtf8],
fromAscii: [Function: fromAscii],
transformToFullName: [Function: transformToFullName],
extractDisplayName: [Function: extractDisplayName],
extractTypeName: [Function: extractTypeName],
toWei: [Function: toWei],
fromWei: [Function: fromWei],
toBigNumber: [Function: toBigNumber],
toTwosComplement: [Function: toTwosComplement],
toAddress: [Function: toAddress],
isBigNumber: [Function: isBigNumber],
isStrictAddress: [Function: isStrictAddress],
isAddress: [Function: isAddress],
isChecksumAddress: [Function: isChecksumAddress],
toChecksumAddress: [Function: toChecksumAddress],
isFunction: [Function: isFunction],
isString: [Function: isString],
isObject: [Function: isObject],
isBoolean: [Function: isBoolean],
isArray: [Function: isArray],
isJson: [Function: isJson] },
Method: [Function: Method],
Property: [Function: Property] } }
>
> web3.isConnected()
false
>
what options are you using to launch geth?
something like --rpc --rpcport 8293 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcapi "eth,web3"
?
i am surprised that you are able to get grabber.js to work though, because it is running the exact same commands.
@elaineo Now it says that web3 is connected but still gives me the same error:
w0lfie@instance-1:~/explorer$ node
> var Web3 = require("web3");
undefined
> var web3;
undefined
>
> if (typeof web3 !== "undefined") {
... web3 = new Web3(web3.currentProvider);
... } else {
... web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8293"));
... }
Web3 {
_requestManager:
RequestManager {
provider: HttpProvider { host: 'http://localhost:8293', timeout: 0 },
polls: {},
timeout: null },
currentProvider: HttpProvider { host: 'http://localhost:8293', timeout: 0 },
eth:
Eth {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
getBalance: { [Function: send] request: [Function: bound ], call: 'eth_getBalance' },
getStorageAt: { [Function: send] request: [Function: bound ], call: 'eth_getStorageAt' },
getCode: { [Function: send] request: [Function: bound ], call: 'eth_getCode' },
getBlock: { [Function: send] request: [Function: bound ], call: [Function: blockCall] },
getUncle: { [Function: send] request: [Function: bound ], call: [Function: uncleCall] },
getCompilers: { [Function: send] request: [Function: bound ], call: 'eth_getCompilers' },
getBlockTransactionCount:
{ [Function: send]
request: [Function: bound ],
call: [Function: getBlockTransactionCountCall] },
getBlockUncleCount:
{ [Function: send]
request: [Function: bound ],
call: [Function: uncleCountCall] },
getTransaction:
{ [Function: send]
request: [Function: bound ],
call: 'eth_getTransactionByHash' },
getTransactionFromBlock:
{ [Function: send]
request: [Function: bound ],
call: [Function: transactionFromBlockCall] },
getTransactionReceipt:
{ [Function: send]
request: [Function: bound ],
call: 'eth_getTransactionReceipt' },
getTransactionCount: { [Function: send] request: [Function: bound ], call: 'eth_getTransactionCount' },
call: { [Function: send] request: [Function: bound ], call: 'eth_call' },
estimateGas: { [Function: send] request: [Function: bound ], call: 'eth_estimateGas' },
sendRawTransaction: { [Function: send] request: [Function: bound ], call: 'eth_sendRawTransaction' },
sendTransaction: { [Function: send] request: [Function: bound ], call: 'eth_sendTransaction' },
sign: { [Function: send] request: [Function: bound ], call: 'eth_sign' },
compile: { solidity: [Object], lll: [Object], serpent: [Object] },
submitWork: { [Function: send] request: [Function: bound ], call: 'eth_submitWork' },
getWork: { [Function: send] request: [Function: bound ], call: 'eth_getWork' },
coinbase: [Getter],
getCoinbase: { [Function: get] request: [Function: bound ] },
mining: [Getter],
getMining: { [Function: get] request: [Function: bound ] },
hashrate: [Getter],
getHashrate: { [Function: get] request: [Function: bound ] },
syncing: [Getter],
getSyncing: { [Function: get] request: [Function: bound ] },
gasPrice: [Getter],
getGasPrice: { [Function: get] request: [Function: bound ] },
accounts: [Getter],
getAccounts: { [Function: get] request: [Function: bound ] },
blockNumber: [Getter],
getBlockNumber: { [Function: get] request: [Function: bound ] },
protocolVersion: [Getter],
getProtocolVersion: { [Function: get] request: [Function: bound ] },
iban:
{ [Function: Iban]
fromAddress: [Function],
fromBban: [Function],
createIndirect: [Function],
isValid: [Function] },
sendIBANTransaction: [Function: bound transfer] },
db:
DB {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
putString: { [Function: send] request: [Function: bound ], call: 'db_putString' },
getString: { [Function: send] request: [Function: bound ], call: 'db_getString' },
putHex: { [Function: send] request: [Function: bound ], call: 'db_putHex' },
getHex: { [Function: send] request: [Function: bound ], call: 'db_getHex' } },
shh:
Shh {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
post: { [Function: send] request: [Function: bound ], call: 'shh_post' },
newIdentity: { [Function: send] request: [Function: bound ], call: 'shh_newIdentity' },
hasIdentity: { [Function: send] request: [Function: bound ], call: 'shh_hasIdentity' },
newGroup: { [Function: send] request: [Function: bound ], call: 'shh_newGroup' },
addToGroup: { [Function: send] request: [Function: bound ], call: 'shh_addToGroup' } },
net:
Net {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
listening: [Getter],
getListening: { [Function: get] request: [Function: bound ] },
peerCount: [Getter],
getPeerCount: { [Function: get] request: [Function: bound ] } },
personal:
Personal {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
newAccount: { [Function: send] request: [Function: bound ], call: 'personal_newAccount' },
unlockAccount: { [Function: send] request: [Function: bound ], call: 'personal_unlockAccount' },
sendTransaction:
{ [Function: send]
request: [Function: bound ],
call: 'personal_sendTransaction' },
lockAccount: { [Function: send] request: [Function: bound ], call: 'personal_lockAccount' },
listAccounts: [Getter],
getListAccounts: { [Function: get] request: [Function: bound ] } },
trace:
Trace {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
call: { [Function: send] request: [Function: bound ], call: 'trace_call' },
rawTransaction: { [Function: send] request: [Function: bound ], call: 'trace_rawTransaction' },
replayTransaction: { [Function: send] request: [Function: bound ], call: 'trace_replayTransaction' },
block: { [Function: send] request: [Function: bound ], call: 'trace_block' },
filter: { [Function: send] request: [Function: bound ], call: 'trace_filter' },
get: { [Function: send] request: [Function: bound ], call: 'trace_get' },
transaction: { [Function: send] request: [Function: bound ], call: 'trace_transaction' } },
bzz:
Swarm {
_requestManager: RequestManager { provider: [Object], polls: {}, timeout: null },
blockNetworkRead: { [Function: send] request: [Function: bound ], call: 'bzz_blockNetworkRead' },
syncEnabled: { [Function: send] request: [Function: bound ], call: 'bzz_syncEnabled' },
swapEnabled: { [Function: send] request: [Function: bound ], call: 'bzz_swapEnabled' },
download: { [Function: send] request: [Function: bound ], call: 'bzz_download' },
upload: { [Function: send] request: [Function: bound ], call: 'bzz_upload' },
retrieve: { [Function: send] request: [Function: bound ], call: 'bzz_retrieve' },
store: { [Function: send] request: [Function: bound ], call: 'bzz_store' },
get: { [Function: send] request: [Function: bound ], call: 'bzz_get' },
put: { [Function: send] request: [Function: bound ], call: 'bzz_put' },
modify: { [Function: send] request: [Function: bound ], call: 'bzz_modify' },
hive: [Getter],
getHive: { [Function: get] request: [Function: bound ] },
info: [Getter],
getInfo: { [Function: get] request: [Function: bound ] } },
settings: Settings { defaultBlock: 'latest', defaultAccount: undefined },
version:
{ api: '0.18.4',
node: [Getter],
getNode: { [Function: get] request: [Function: bound ] },
network: [Getter],
getNetwork: { [Function: get] request: [Function: bound ] },
ethereum: [Getter],
getEthereum: { [Function: get] request: [Function: bound ] },
whisper: [Getter],
getWhisper: { [Function: get] request: [Function: bound ] } },
providers:
{ HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider] },
_extend:
{ [Function: ex]
formatters:
{ inputDefaultBlockNumberFormatter: [Function: inputDefaultBlockNumberFormatter],
inputBlockNumberFormatter: [Function: inputBlockNumberFormatter],
inputCallFormatter: [Function: inputCallFormatter],
inputTransactionFormatter: [Function: inputTransactionFormatter],
inputAddressFormatter: [Function: inputAddressFormatter],
inputPostFormatter: [Function: inputPostFormatter],
outputBigNumberFormatter: [Function: outputBigNumberFormatter],
outputTransactionFormatter: [Function: outputTransactionFormatter],
outputTransactionReceiptFormatter: [Function: outputTransactionReceiptFormatter],
outputBlockFormatter: [Function: outputBlockFormatter],
outputLogFormatter: [Function: outputLogFormatter],
outputPostFormatter: [Function: outputPostFormatter],
outputSyncingFormatter: [Function: outputSyncingFormatter] },
utils:
{ padLeft: [Function: padLeft],
padRight: [Function: padRight],
toHex: [Function: toHex],
toDecimal: [Function: toDecimal],
fromDecimal: [Function: fromDecimal],
toUtf8: [Function: toUtf8],
toAscii: [Function: toAscii],
fromUtf8: [Function: fromUtf8],
fromAscii: [Function: fromAscii],
transformToFullName: [Function: transformToFullName],
extractDisplayName: [Function: extractDisplayName],
extractTypeName: [Function: extractTypeName],
toWei: [Function: toWei],
fromWei: [Function: fromWei],
toBigNumber: [Function: toBigNumber],
toTwosComplement: [Function: toTwosComplement],
toAddress: [Function: toAddress],
isBigNumber: [Function: isBigNumber],
isStrictAddress: [Function: isStrictAddress],
isAddress: [Function: isAddress],
isChecksumAddress: [Function: isChecksumAddress],
toChecksumAddress: [Function: toChecksumAddress],
isFunction: [Function: isFunction],
isString: [Function: isString],
isObject: [Function: isObject],
isBoolean: [Function: isBoolean],
isArray: [Function: isArray],
isJson: [Function: isJson] },
Method: [Function: Method],
Property: [Function: Property] } }
>
> web3.isConnected()
true
>
(To exit, press ^C again or type .exit)
>
w0lfie@instance-1:~/explorer$ node app.js
/home/w0lfie/explorer/routes/web3relay.js:27
throw "No connection";
^
No connection
hmm.. it's exactly the same code :
if (web3.isConnected())
console.log("Web3 connection established");
else
throw "No connection";
The port # is updated in web3relay.js?
@elaineo thanks alot! that worked :)
Edit: Managed to change everything apart from the site title.
Thanks, Onni
glad you got it working. i was gonna say "no need to donate", but it looks like you deleted the offer anyway :b
I came across this while having some issues with connection.
Note: If you modify host or port (or both) for RPC connection, you must modify the config file for grabber, and also the hardcoded value that's in routes/web3relay.js
After these are adjusted for your rpc host:port, you should get Web3 connection established