node icon indicating copy to clipboard operation
node copied to clipboard

Connection refused

Open 0xZangetsudev opened this issue 3 years ago • 18 comments

Hello I have a problem running the base node, here is my docker.yml :

services:
  geth: # this is Optimism's geth client
    build: .
    ports:
      - 8555:8545       # RPC
      - 8556:8546       # websocket
      - 30304:30304     # P2P TCP (currently unused)
      - 30304:30304/udp # P2P UDP (currently unused)
      - 7301:6060       # metrics
    command: [ "sh", "./geth-entrypoint" ]
    env_file:
      # select your network here:
#      - .env.goerli
      - .env.mainnet
  node:
    build: .
    depends_on:
      - geth
    ports:
      - 7545:8545     # RPC
      - 9222:9222     # P2P TCP
      - 9222:9222/udp # P2P UDP
      - 7300:7300     # metrics
      - 6060:6060     # pprof
    command: [ "sh", "./op-node-entrypoint" ]
    env_file:
      # select your network here:
#      - .env.goerli
      - .env.mainnet

my geth node is running on port 8545 and 8546 but I get :

      node-node-1  | t=2023-08-18T05:16:43+0000 lvl=info msg="Initializing Rollup Node"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=warn msg="Unknown env var"          prefix=OP_NODE env_var="OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=info msg="Rollup Config"            l2_chain_id=8453 l2_network="unknown L2" l1_chain_id=1 l1_network=mainnet l2_start_time=1,686,789,347 l2_block_hash=0xf712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd l2_block_number=0 l1_block_hash=0x5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771 l1_block_number=17,481,768 regolith_time="@ genesis"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=eror msg="Error initializing the rollup node" err="Post \"http://localhost:8545\": dial tcp 127.0.0.1:8545: connect: connection refused"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=eror msg="Unable to create the rollup node"   error="Post \"http://localhost:8545\": dial tcp 127.0.0.1:8545: connect: connection refused"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=crit msg="Application failed"                 message="Post \"http://localhost:8545\": dial tcp 127.0.0.1:8545: connect: connection refused"

my geth is fully synced and all port are opened

0xZangetsudev avatar Aug 18 '23 05:08 0xZangetsudev

I've also encountered this issue. Have you already resolved it? Could you please provide me with the specific solution?

myuniswap2000 avatar Aug 24 '23 04:08 myuniswap2000

Hey @myuniswap2000, unfortunately I've not solved it yet, someone on twitter has pointed out to maybe a solution but it isn't working for me I guess, maybe you can have a look for you : https://twitter.com/0xZangetsudev/status/1694328078934167993

0xZangetsudev avatar Aug 24 '23 08:08 0xZangetsudev

I may have a workaround (the node is syncing for now so maybe its finally working)

My changes :

docker-compose.yml file :

version: '3.8'

services:
  geth: # this is Optimism's geth client
    build: .
    ports:
      - 8549:8545       # RPC
      - 8547:8546       # websocket
      - 30304:30303     # P2P TCP (currently unused)
      - 30304:30303/udp # P2P UDP (currently unused)
      - 7301:6060       # metrics
    command: [ "sh", "./geth-entrypoint" ]
    env_file:
      # select your network here:
#      - .env.goerli
      - .env.mainnet
  node:
    build: .
    depends_on:
      - geth
    ports:
      - 7545:8545     # RPC
      - 9222:9222     # P2P TCP
      - 9222:9222/udp # P2P UDP
      - 7300:7300     # metrics
      - 6060:6060     # pprof
    command: [ "sh", "./op-node-entrypoint" ]
    env_file:
      # select your network here:
#      - .env.goerli
      - .env.mainnet

and in the .env.mainnet file, if your using MacOs or Windows

# [recommended] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=http://host.docker.internal:8545

I'm using Manjaro (Linux dist) so host.docker.internal was not working so I did in my terminal : docker run --rm alpine ip route | awk 'NR==1 {print $3}'

that give me an addr like 121.0.1.33

then in the .env.mainnet file :

# [recommended] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=http://121.0.1.33:8545

Btw I'm not so sure about all this config but it's the first time my node is finally syncing so I guess it works, will keep you updated

0xZangetsudev avatar Aug 24 '23 08:08 0xZangetsudev

your 8545 port conflict

driverZK avatar Aug 25 '23 02:08 driverZK

your 8545 port conflict

Its working now with the latest change I've made through my last comment here

0xZangetsudev avatar Aug 26 '23 12:08 0xZangetsudev

Same issue for me. I cannot sync with my local eth node because of the port binding from the configuration.

dandavid3000 avatar Sep 17 '23 12:09 dandavid3000

@0xZangetsudev Thanks for sharing your workaround in case it helps others. 🤝

@dandavid3000 What is your L1 RPC defined as? Have you tried changing the port to deconflict?

wbnns avatar Sep 18 '23 23:09 wbnns

@0xZangetsudev Thanks for sharing your workaround in case it helps others. 🤝

@dandavid3000 What is your L1 RPC defined as? Have you tried changing the port to deconflict?

Yes I tried different ports but did not solve my issue. I'm using Ubuntu on a physical PC. docker cannot recognize the localhost network. Issue is exactly like this from the first post

node-node-1  | t=2023-08-18T05:16:43+0000 lvl=info msg="Initializing Rollup Node"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=warn msg="Unknown env var"          prefix=OP_NODE env_var="OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=info msg="Rollup Config"            l2_chain_id=8453 l2_network="unknown L2" l1_chain_id=1 l1_network=mainnet l2_start_time=1,686,789,347 l2_block_hash=0xf712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd l2_block_number=0 l1_block_hash=0x5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771 l1_block_number=17,481,768 regolith_time="@ genesis"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=eror msg="Error initializing the rollup node" err="Post \"http://localhost:8545\": dial tcp 127.0.0.1:8545: connect: connection refused"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=eror msg="Unable to create the rollup node"   error="Post \"http://localhost:8545\": dial tcp 127.0.0.1:8545: connect: connection refused"
node-node-1  | t=2023-08-18T05:16:43+0000 lvl=crit msg="Application failed"                 message="Post \"http://localhost:8545\": dial tcp 127.0.0.1:8545: connect: connection refused"

There is a solution to setup network_mode: host in the docker compose config to use PC localhost instead of docker's one. However, this will have conflicts with port binding from your configuration. Both cannot run at the same time https://github.com/base-org/node/blob/main/docker-compose.yml#L21

"host" network_mode is incompatible with port_bindings

Please help and provide a proper solution. Many people on Discord have the same issue and no one has a solution to this. Thank you

dandavid3000 avatar Sep 19 '23 07:09 dandavid3000

@dandavid3000

Can you please share your docker-compose.yml so we can take a closer look?

wbnns avatar Oct 03 '23 15:10 wbnns

@wbnns Hi Please find the config files below.

I'm running my local Ethereum node and its websocket is at ws://127.0.0.1:8946 Ethereum node and Arbitrum node (using ws://127.0.0.1:8946) are running perfectly

If I change localhost to some node providers such as Infura, quicknode pro or Alchemy. It's running correctly.

I changed my Ethereum nodes to different ports and same issue with Connection refused.

OP_NODE_L1_ETH_RPC=wss://infuranode

docker-compose.yml

version: '3.8'
services:
  geth: # this is Optimism's geth client
    build: .
    ports:
      - 8545:8545       # RPC
      - 8546:8546       # websocket
      - 30305:30305     # P2P TCP (currently unused)
      - 30305:30305/udp # P2P UDP (currently unused)
      - 7302:6060       # metrics
    command: [ "sh", "./geth-entrypoint" ]
    volumes:
      - /media/dvo/0E20ECBA42049AE21/base/base-mainnet-archive-1695509926/data:/data
    env_file:
      # select your network here:
#      - .env.goerli
      - .env.mainnet
  node:
    build: .
    depends_on:
      - geth
    ports:
      - 7545:8545     # RPC
      - 9222:9222     # P2P TCP
      - 9222:9222/udp # P2P UDP
      - 7305:7305     # metrics
      - 6060:6060     # pprof
    command: [ "sh", "./op-node-entrypoint" ]
    env_file:
      # select your network here:
#      - .env.goerli
      - .env.mainnet

_env.mainnet

OP_GETH_GENESIS_FILE_PATH=mainnet/genesis-l2.json
OP_GETH_SEQUENCER_HTTP=https://mainnet-sequencer.base.org

# [optional] used to enable geth stats:
# OP_GETH_ETH_STATS=nodename:secret@host:port

# [recommended] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=ws://127.0.0.1:8946

# auth secret used by op-geth engine API:
OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
OP_NODE_L2_ENGINE_RPC=http://geth:8551
OP_NODE_LOG_LEVEL=info
OP_NODE_METRICS_ADDR=0.0.0.0
OP_NODE_METRICS_ENABLED=true
OP_NODE_METRICS_PORT=7305
OP_NODE_P2P_AGENT=base
OP_NODE_P2P_BOOTNODES=enr:-J24QNz9lbrKbN4iSmmjtnr7SjUMk4zB7f1krHZcTZx-JRKZd0kA2gjufUROD6T3sOWDVDnFJRvqBBo62zuF-hYCohOGAYiOoEyEgmlkgnY0gmlwhAPniryHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQKNVFlCxh_B-716tTs-h1vMzZkSs1FTu_OYTNjgufplG4N0Y3CCJAaDdWRwgiQG,enr:-J24QH-f1wt99sfpHy4c0QJM-NfmsIfmlLAMMcgZCUEgKG_BBYFc6FwYgaMJMQN5dsRBJApIok0jFn-9CS842lGpLmqGAYiOoDRAgmlkgnY0gmlwhLhIgb2Hb3BzdGFja4OFQgCJc2VjcDI1NmsxoQJ9FTIv8B9myn1MWaC_2lJ-sMoeCDkusCsk4BYHjjCq04N0Y3CCJAaDdWRwgiQG,enr:-J24QDXyyxvQYsd0yfsN0cRr1lZ1N11zGTplMNlW4xNEc7LkPXh0NAJ9iSOVdRO95GPYAIc6xmyoCCG6_0JxdL3a0zaGAYiOoAjFgmlkgnY0gmlwhAPckbGHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQJwoS7tzwxqXSyFL7g0JM-KWVbgvjfB8JA__T7yY_cYboN0Y3CCJAaDdWRwgiQG,enr:-J24QHmGyBwUZXIcsGYMaUqGGSl4CFdx9Tozu-vQCn5bHIQbR7On7dZbU61vYvfrJr30t0iahSqhc64J46MnUO2JvQaGAYiOoCKKgmlkgnY0gmlwhAPnCzSHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQINc4fSijfbNIiGhcgvwjsjxVFJHUstK9L1T8OTKUjgloN0Y3CCJAaDdWRwgiQG,enr:-J24QG3ypT4xSu0gjb5PABCmVxZqBjVw9ca7pvsI8jl4KATYAnxBmfkaIuEqy9sKvDHKuNCsy57WwK9wTt2aQgcaDDyGAYiOoGAXgmlkgnY0gmlwhDbGmZaHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQIeAK_--tcLEiu7HvoUlbV52MspE0uCocsx1f_rYvRenIN0Y3CCJAaDdWRwgiQG
OP_NODE_P2P_LISTEN_IP=0.0.0.0
OP_NODE_P2P_LISTEN_TCP_PORT=9222
OP_NODE_P2P_LISTEN_UDP_PORT=9222
OP_NODE_ROLLUP_CONFIG=mainnet/rollup.json
OP_NODE_RPC_ADDR=0.0.0.0
OP_NODE_RPC_PORT=8545
OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log
OP_NODE_VERIFIER_L1_CONFS=4

# OP_NODE_L1_TRUST_RPC allows for faster syncing, but should be used *only* if your L1 RPC node
# is fully trusted. It also allows op-node to work with clients such as Erigon that do not
# support storage proofs:
OP_NODE_L1_TRUST_RPC=true

Thanks for your help

dandavid3000 avatar Oct 03 '23 21:10 dandavid3000

@dandavid3000

Thanks! Can you please try via HTTP instead of WebSocket and let me know the results?

wbnns avatar Oct 03 '23 23:10 wbnns

@dandavid3000

Thanks! Can you please try via HTTP instead of WebSocket and let me know the results?

With the configuration below. The same issue. It seems that docker cannot recognize local network on the same PC. Please check the log below. Thanks.

OP_NODE_L1_ETH_RPC=http://127.0.0.1:8945

node-geth-1  | INFO [10-04|09:20:39.006] HTTP server started                      endpoint=[::]:8545 auth=false prefix= cors=* vhosts=*
node-geth-1  | INFO [10-04|09:20:39.006] WebSocket enabled                        url=ws://[::]:8546
node-geth-1  | INFO [10-04|09:20:39.006] WebSocket enabled                        url=ws://[::]:8551
node-geth-1  | INFO [10-04|09:20:39.006] HTTP server started                      endpoint=[::]:8551 auth=true  prefix= cors=localhost vhosts=*
node-node-1  | t=2023-10-04T09:20:41+0000 lvl=info msg="Initializing Rollup Node"
node-node-1  | t=2023-10-04T09:20:41+0000 lvl=warn msg="Unknown env var"          prefix=OP_NODE env_var="OP_NODE_L2_ENGINE_AUTH_RAW=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a"
node-node-1  | t=2023-10-04T09:20:41+0000 lvl=info msg="Rollup Config"            l2_chain_id=8453 l2_network="unknown L2" l1_chain_id=1 l1_network=mainnet l2_start_time=1,686,789,347 l2_block_hash=0xf712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd l2_block_number=0 l1_block_hash=0x5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771 l1_block_number=17,481,768 regolith_time="@ genesis"
node-node-1  | t=2023-10-04T09:20:41+0000 lvl=eror msg="Error initializing the rollup node" err="Post \"http://127.0.0.1:8945\": dial tcp 127.0.0.1:8945: connect: connection refused"
node-node-1  | t=2023-10-04T09:20:41+0000 lvl=eror msg="Unable to create the rollup node"   error="Post \"http://127.0.0.1:8945\": dial tcp 127.0.0.1:8945: connect: connection refused"
node-node-1  | t=2023-10-04T09:20:41+0000 lvl=crit msg="Application failed"                 message="Post \"http://127.0.0.1:8945\": dial tcp 127.0.0.1:8945: connect: connection refused"
node-node-1 exited with code 1

dandavid3000 avatar Oct 04 '23 09:10 dandavid3000

@dandavid3000

Thanks! I see you have your server endpoints opened on 8545 and 8551, but localhost is trying to post to 8945. Can you please check that the L1 node is running and listening on port 8945 and let me know how you're confirming this?

wbnns avatar Oct 04 '23 15:10 wbnns

  • 8545:8545 # RPC - 8546:8546 # websocket

@wbnns Yes. Base node is supposed to expose http and websocket on 8545, 8546 according to the config. Those ports are free.

L1 (Ethereum node) is running on the same PC perfectly as I stated above. I'm using it for Ethereum data and syncing my Arbitrum node at the same time.

 curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' localhost:8945
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x116e840"
}
//blockNumber: 18278464

dandavid3000 avatar Oct 04 '23 16:10 dandavid3000

@dandavid3000

I see, thanks for confirming. Are you running the Arbitrum node at the same time you're trying to run the Base node? If so, can you please stop the Arbitrum node, then restart the Base node within the Docker container and let me know the results?

Also, we're in the process of adding a guide for running L1/L2 nodes in tandem in case you'd like to compare. https://github.com/base-org/guides/pull/12/files

wbnns avatar Oct 04 '23 23:10 wbnns

@dandavid3000

I see, thanks for confirming. Are you running the Arbitrum node at the same time you're trying to run the Base node? If so, can you please stop the Arbitrum node, then restart the Base node within the Docker container and let me know the results?

Also, we're in the process of adding a guide for running L1/L2 nodes in tandem in case you'd like to compare. https://github.com/base-org/guides/pull/12/files

@wbnns I confirm that shutdowning arbitrum node does not help. The same issue. The issue must relate to docker compose config

I walked through the link you sent above. It seems a good one that does not use docker and it should solve the issue. I'm waiting for the official doc when it's finished. Thanks for helping the community.

dandavid3000 avatar Oct 05 '23 01:10 dandavid3000

localhost inside the docker container is the docker container's network, not the host's network... so op-node running inside a container won't be able to access a geth running on your local machine. Try using http://72.17.0.1:8545 or http://host.docker.internal:8545 for your OP_NODE_L1_ETH_RPC value.

mdehoog avatar Oct 11 '23 19:10 mdehoog

localhost inside the docker container is the docker container's network, not the host's network... so op-node running inside a container won't be able to access a geth running on your local machine. Try using http://72.17.0.1:8545 or http://host.docker.internal:8545 for your OP_NODE_L1_ETH_RPC value.

This does not work in my case where local node is placed on a home PC. It could work on cloud PC for some people. The same issue with Optimism node using docker.

My suggestion is that if anyone wants to use local host on their home PC, you should use same technique from the post from wbnns above. Run op-geth and op-node manually by scripts and do not use docker.

dandavid3000 avatar Oct 16 '23 17:10 dandavid3000