Introduction
Some projects do not accept an RPC endpoint with basic authentication.
As a workaround, you can use the Chainstack eth-proxy Docker container to proxy the basic authentication requests.
Step-by-step
Deploy an EVM mainnet node with Chainstack
Deploy the node as described in Join a public network.
Get the RPC endpoint and access credentials of your deployed node as described in View node access and credentials.
Run the Docker container
Run:
docker run -d --name eth-proxy -p 8545:8545 -p 8546:8546 -e RPC_ENDPOINT=<rpc-endpoint> -e WS_ENDPOINT=<ws-endpoint> -e USERNAME=<username> -e PASSWORD=<password> chainstack/eth-proxy
where
- RPC_ENDPOINT - RPC enpoint of the node deployed on Chainstack.
- WS_ENDPOINT - WebSocket endpoint of the node deployed on Chainstack.
- USERNAME, PASSWORD - basic auth credentials to access the node deployed on Chainstack.
Example:
docker run -d --name eth-proxy -p 8545:8545 -p 8546:8546 -e RPC_ENDPOINT=nd-123-456-789.p2pify.com -e WS_ENDPOINT=ws-nd-123-456-789.p2pify.com -e USERNAME=awesome-username -e PASSWORD=awesome-password chainstack/eth-proxy
Get the latest block through the proxy:
curl 'http://localhost:8545' -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0","method": "eth_blockNumber","params": [],"id": 01}'
Comments
0 comments
Article is closed for comments.