2

What Iam trying to achieve is to run an ethereum/client-go on an aws EC2 instance and being able to access it from remote client side, for playing around with Rinkeby test network

I am trying to run an geth docker image on ec2 instance on aws.
When I run the docker using the below command, I am getting the following error.

sudo docker run -it -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rinkeby --syncmode "fast" --rpc --rpcapi 'db,eth,net,web3,personal' --rpcaddr XXX.XX.XXX.XXX --cache=1024

Where --rpcaddr XXX.XX.XXX.XXX is my Elastic IP

INFO [04-17|10:24:08] Maximum peer count                       ETH=25 LES=0 total=25
INFO [04-17|10:24:08] Starting peer-to-peer node               instance=Geth/v1.8.4-unstable-92c6d130/linux-amd64/go1.10.1
INFO [04-17|10:24:08] Allocated cache and file handles         database=/root/.ethereum/rinkeby/geth/chaindata cache=768 handles=1024
INFO [04-17|10:24:08] Writing custom genesis block 
INFO [04-17|10:24:08] Persisted trie from memory database      nodes=355 size=65.27kB time=1.082517ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [04-17|10:24:08] Initialised chain configuration          config="{ChainID: 4 Homestead: 1 DAO: <nil> DAOSupport: true EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 1035301 Constantinople: <nil> Engine: clique}"
INFO [04-17|10:24:08] Initialising Ethereum protocol           versions="[63 62]" network=4
INFO [04-17|10:24:08] Loaded most recent local header          number=0 hash=6341fd…67e177 td=1
INFO [04-17|10:24:08] Loaded most recent local full block      number=0 hash=6341fd…67e177 td=1
INFO [04-17|10:24:08] Loaded most recent local fast block      number=0 hash=6341fd…67e177 td=1
INFO [04-17|10:24:08] Regenerated local transaction journal    transactions=0 accounts=0
INFO [04-17|10:24:08] Starting P2P networking 
INFO [04-17|10:24:10] UDP listener up                          self=enode://350e33a2680260f24bd1837e59610173769023f6cf609ab59b1aca63dc867cce5d7cb520343ed9a04b8a98d5a7d08f57f9e2ee258502312fafad42d005179aab@[::]:30303
INFO [04-17|10:24:10] IPC endpoint opened                      url=/root/.ethereum/rinkeby/geth.ipc
INFO [04-17|10:24:10] IPC endpoint closed                      endpoint=/root/.ethereum/rinkeby/geth.ipc
INFO [04-17|10:24:10] Blockchain manager stopped 
INFO [04-17|10:24:10] Stopping Ethereum protocol 
INFO [04-17|10:24:10] RLPx listener up                         self=enode://350e33a2680260f24bd1837e59610173769023f6cf609ab59b1aca63dc867cce5d7cb520343ed9a04b8a98d5a7d08f57f9e2ee258502312fafad42d005179aab@[::]:30303
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa6e76b]

goroutine 76 [running]:
github.com/ethereum/go-ethereum/eth/filters.(*EventSystem).eventLoop(0xc42c694d00)
    /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/eth/filters/filter_system.go:434 +0x2eb
created by github.com/ethereum/go-ethereum/eth/filters.NewEventSystem
    /go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/eth/filters/filter_system.go:113 +0x104
  1. Can anyone help, what is causing the above issue?
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa6e76b]

When I run the same docker with --rpcaddr 127.0.0.1 it works fine, but cannot access from remote client,

sudo docker run -it -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rinkeby --syncmode "fast" --rpc --rpcapi 'db,eth,net,web3,personal' --rpcaddr 127.0.0.1 --cache=1024

I have tried using,

  • Public DNS (IPv4),
  • IPv4 Public IP and
  • Elastic IP

for the --rpcaddr values

Also I have given the security permission in aws TCP inbound and outbound ports.

Am i doing this right? Is this the right way to run web3 provider?

Siv
  • 1,026
  • 19
  • 29
  • 1
    can you do? `--rpcaddr "0.0.0.0"` you need allow all (0.0.0.0) to connect from a remote client. – Sudharsan Sivasankaran Apr 17 '18 at 11:43
  • It removed the panic: runtime error: invalid memory address or nil pointer dereference, but when I am trying to connect to the provider from the same instance (using Web3) I am getting Error: Invalid JSON RPC response: undefined @SudharsanSivasankaran – Siv Apr 17 '18 at 11:50
  • `docker run -it -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rinkeby --syncmode "fast" --rpc --rpcapi 'db,eth,net,web3,personal' --rpcaddr 0.0.0.0 --cache=1024` can you check your command? its does work for me. – Sudharsan Sivasankaran Apr 17 '18 at 11:55
  • sudo docker ps doesn't show any container runnig. – Siv Apr 17 '18 at 11:58
  • sudo docker ps -a gives this details for the last command 31a421e78d30 ethereum/client-go "geth --rpc --rinkeb…" 12 minutes ago Exited (2) 10 minutes ago – Siv Apr 17 '18 at 12:00
  • can you check the logs for the exit error with `docker logs`? – Sudharsan Sivasankaran Apr 17 '18 at 12:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/169165/discussion-between-siv-and-sudharsan-sivasankaran). – Siv Apr 17 '18 at 12:02

1 Answers1

1

You should be using volumes in my opinion because the client will try download the ethereum blockchain, but with your current setup there is nowhere to save the blockchain.

Have a look at this page: https://github.com/ethereum/go-ethereum/wiki/Running-in-Docker "To persist downloaded blockchain data between container starts, use Docker data volumes. Replace /path/on/host with the location you want to store the data in."

$ docker run -it -p 30303:30303 -v /path/on/host:/root/.ethereum ethereum/client-go

Try see if this helps. If you still have issues I'll be happy to try help or consider looking over the issues on github for geth. I saw someone got a similar error in 2017 and logged an issue see here: https://github.com/ethereum/go-ethereum/issues/15079

OpenBSDNinja
  • 1,037
  • 10
  • 18