fix: RPC server unreachable from outside Docker container
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- docker, python
- Domain
- backend, devops, networking
Research direction
Start in main.py around line 659 and inspect the existing CLI argument handling, then review the Dockerfile CMD, HEALTHCHECK, and EXPOSE declarations. Reproduce the issue with the provided docker run and curl commands. Done means the RPC host is configurable, Docker binds it externally, port 8545 is declared, and the container remains healthy.
Written by the indexing model from the issue text.
Description
Problem
The RPC server is hardcoded to 127.0.0.1 in main.py:659:
await rpc_server.start(host="127.0.0.1", port=rpc_port)
The Dockerfile correctly passes --host 0.0.0.0 for the P2P
server via CMD, but the RPC server ignores the --host flag
entirely — it is hardcoded in Python code.
This creates a contradiction:
| Config | Result | |
|---|---|---|
| P2P server | --host 0.0.0.0 via CMD |
reachable from outside |
| RPC server | hardcoded 127.0.0.1 |
connection refused |
| HEALTHCHECK | hits 127.0.0.1:8545 |
passes inside container |
EXPOSE |
only declares 9000 |
8545 not declared |
Steps to Reproduce
docker run -p 8545:8545 -p 9000:9000 ghcr.io/stabilitynexus/minichain
curl http://localhost:8545
# connection refused
Expected Behaviour
RPC server should be reachable from outside the container
when -p 8545:8545 is passed.
Proposed Fix
Three small changes:
- Add
--rpc-hostCLI argument tomain.py(default
127.0.0.1for bare metal safety) - Use
args.rpc_hostinstead of hardcoded"127.0.0.1"
on line 659 - Pass
--rpc-host 0.0.0.0in Dockerfile CMD and add
EXPOSE 8545
- Dominant language
- Python
- Stars
- 11
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StabilityNexus/MiniChain
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 68/100
StabilityNexus/MiniChain#135 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
StabilityNexus/MiniChain#68 · 2 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
StabilityNexus/MiniChain#65 · 2 comments ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
StabilityNexus/MiniChain#26 ·
All issues in StabilityNexus/MiniChain
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100