7

I use docker nodes. CLI is work well. but when I use this. does't work. at doc say --- it is disabled by default. but don't know how to enable rpc with docker node

enter image description here

I go to docker. find the config.json but 8732 or 18732 is not work. enter image description here I use ./alphanet.sh start docker node

2 Answers 2

6

At the moment the following appears to work: alphanet.sh start --rpc-port 127.0.0.1:8732.

Note --rpc-port and NOT --rpc-addr, this is a special case option in alphanet.sh.

This will insert a entry:

  ports:
    - "127.0.0.1:8732:8732"

into the generated docker-compose.yaml, causing the RPC to be exposed to localhost at the specified port -- it was already exposed as usual with --rpc-addr in the tezos-node itself, but only inside the container.

This is documented, sort of:

./scripts/alphanet.sh start [--rpc-port <int>] [OPTIONS]
   Launch a full Tezos alphanet node in a docker container
   automatically generating a new network identity.
   OPTIONS (others than --rpc-port) are directly passed to the
   Tezos node, see './scripts/alphanet.sh shell tezos-node config --help'
   for more details.
   By default, the RPC port is not exported outside the docker
   container. WARNING: when exported some RPCs could be harmful
   (e.g. 'inject_block', 'force_validation', ...), it is
   advised not to export them publicly.

Even though a port was expected (<int>), --rpc-port 127.0.0.1:8732 happens to work, and should be generally safer.

0

To start rpc at 8732 port use

./alphanet.sh start --rpc-port 8732

As mentioned in alphanet.sh script file, you can use --rpc-port option in the start command as mentioned below, specifying the port.

./alphanet.sh start [--rpc-port <int>] [OPTIONS]"

Launch a full Tezos alphanet node in a docker container" automatically generating a new network identity." OPTIONS (others than --rpc-port) are directly passed to the" Tezos node, see '$0 shell tezos-node config --help'" for more details." By default, the RPC port is not exported outside the docker" container. WARNING: when exported some RPCs could be harmful" (e.g. 'inject_block', 'force_validation', ...), it is" advised not to export them publicly."

1
  • 1
    As I said in my answer, it is generally going to be safer to use --rpc-port 127.0.0.1:8732, when the RPC need not be accessible from any other host besides the docker host.
    – Tom
    Mar 22, 2019 at 22:05

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.