2

I am following the MyEtherWallet: Use Your Own Server Guide to use MyEtherWallet on my private ethereum network. I am doing this setup on my node, where my ethereum node runs.

I have done first 4 steps.

In response.js file: I have set host as:

host: '127.0.0.1'

In runLocalServer.js file: I have set app.use as:

app.use(vhost('127.0.0.1', require('./index.js').app));

Since port 80 is occupied, I have changed port number 80 to my free port number as 8000;

  • httpServer.listen(80); in runLocalServer.js.

  • httpServer.listen(80); in runServer.js

As recommended on Step-2 I run:

[~]$ node runLocalServer.js
//waits

But on Step-3, when I navigate to http://localhost/api.mew inside my node, I do have 404 or timeout errors. I was not able to end up on a empty/white page.

I was not able to figure out how to overcome this problem or where I am doing something wrong/missing. Any valuable guidance will be appreciated.

Thank you for your valuable time and help.

q9f
  • 32,913
  • 47
  • 156
  • 395
alper
  • 8,395
  • 11
  • 63
  • 152

1 Answers1

2

As you changed port from 80 to 8000, you need to navigate to http://localhost:8000/api.mew

Also later when changing SERVERURL you should put the same http://localhost:8000/api.mew

Please note that currently Use Your Own Server Guide does not correspond with recent release (3.4.2):

  • you need to change addresses in nodeIP.json, not response.js
  • when changing etherwallet-master.js it is easier to search for rpc.myetherwallet.com to get the line with SERVERURL

You can serve both api.mew and index.html from single port. Just edit json_relay_node/index.js and add app.use(express.static('../dist'));:

app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(express.static('../dist'));
app.get('/api.mew', function(req, res) {
    wait.launchFiber(handleRequest, req, res);
});
app.post('/api.mew', function(req, res) {
    wait.launchFiber(handleRequest, req, res);
});
max taldykin
  • 2,966
  • 19
  • 27
  • It works one small question. As ip address I used: 127.0.0.1. I can only open index.html inside my local machine. But later on can I do something like: :8000/index.html using nodejs? for clients to reach the website. – alper Jan 08 '17 at 16:50
  • Yep, you need to change SERVERURL in etherwallet-master.js to :8000/api.mew and ensure that port 8000 is accessible from internet. – max taldykin Jan 08 '17 at 17:33
  • Changed Line: mewServer.prototype.SERVERURL = "http://<my_ip>:8000/api.mew"; I replaced 127.0.0.1 with my server's IP address in nodeIP.json and I do face with following error when I try to navigate into http://<my_ip>:8000/index.html error: Cannot GET /index.html and navigate into http://<my_ip>:8000/api.mew error: Cannot GET /api.mew – alper Jan 08 '17 at 17:41
  • Please note that port 8000 is accessible from internet. – alper Jan 08 '17 at 17:46
  • 1
    Sorry, I misunderstood the question. You need to serve index.html and etherwallet-master.js separately. E.g. with nginx or python -m SimpleHTTPServer 8000. In this case you need two ports: one to serve api.mew and another one to serve index.html. Another option is to rewrite runLocalServer.js to serve both. – max taldykin Jan 08 '17 at 17:49
  • Thank you. But shouldn't http://<my_ip>:8000/api.mew return an empty page like in http://localhost:8000/api.mew instead of Cannot GET /api.mew. – alper Jan 08 '17 at 18:03
  • I also updated app.use(vhost('<my_ip>', require('./index.js').app)); in runLocalServer.js and blank page show up for http://<my_ip>:8000/api.mew (please ignore my previous comment). Do you have any suggestion about to re-write runLocalServer.js to serve but since I only have one port available. – alper Jan 08 '17 at 18:13
  • Thank you very much everything works under your guidance. But I do get following message from node runLocalServer.js => Error: connect ECONNREFUSED] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect' when I refresh the website on http://<my_ip>:8000 . – alper Jan 08 '17 at 19:07
  • 1
    seems like it can't find your eth node – max taldykin Jan 08 '17 at 19:08