0

trying to connect dapp through browser,when doing the same through the browser on machine which has running geth node is getting connect through public ip (eg :http175.xxx.xxx.xx:xxxxlogin) but the same when trying to connect through different browser specifically different machine it is throwing error in console

Error: CONNECTION ERROR: Couldn't connect to node http://192.xxx.x.xx:8484

geth command :-geth --rpccorsdomain "*" --rpc --rpcport "8484"  --rpcaddr "192.xxx.x.xx" --datadir="xxxx" --port "30302" --networkid 65535 --rpcapi="db,eth,net,web3,personal,web3"  --nodiscover console

web3 code

var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://192.xxxx.x.xx:8484'));
web3.eth.defaultAccount = "0x6f3ae17a20d3367d649f8774a42a15xxxxxxxxxx";

192.xxx.x.xx:8484 is ip of the node

waiting for suggestions ..

3 Answers 3

1

For me, that sounds like a Firewall issue somewhere in the network. if you access the node from the local machine even through the public IP doesn't mean it is accessible from anywhere.

For example, if I run geth (using the same parameters as you) on my Windows 10 machine. I would be able to access the JSON-RPC endpoint from this machine using the external network interface 192.168.x.x but not from my phone, which is on the same network. Because the Windows firewall is enabled. After disabling it, it works.


About the Thomas's answer, I agree with the fact that decentralization is a new paradigm in term of network architecture [peer2p VS client-server]. But the JSON-RPC WebService and the Web3 library are useful for any devices which cannot host a node locally (such as IOTs, Personal computers, ...).

I don't believe that every devices in the world that interact with the blockchain will be a node before a long time. It's still early days ...

In my case for example, I have multiple devices at home (computers, laptops, mobiles, NAS, smart TVs, game consoles, raspberryPi) and one of my RaspberryPi is hosting a full Ethererum node. I think this trustful "node" is self-sufficient for my home:

  • My browser can interact with the blockchain using Metamask (attach to this node)
  • My console and my smart-TV could connect to this node and pay for games or Netfix subscription
  • ...

I guess, it's part of the debate !

0

The problem you're having is exactly what it say and exactly what you indicate. The dapp is trying to connect to a node that isn't present.

This is a perfect illustration of what we mean by decentralization. It's not like in the Web 2.0 world where you could go out to a remote server. There's no remote servers. There's locally running nodes each and every one of them verifying and agreeing to all the data.

Decentralization, in my opinion, is the most important point and one many people either miss or compromise on.

0

Try to run ngrok and use this domain as rpccors domain, and localhost for ip.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.