StabilityNexus / StabilityNexus/MiniChain
fix: RPC server unreachable from outside Docker container
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
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
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.
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.
Assessment
- Tech stack
- docker, python
- Domain
- backend, devops, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100