{"id":18794448,"url":"https://github.com/chainstacklabs/proxy-server-rpc-nodejs","last_synced_at":"2025-12-29T17:30:14.137Z","repository":{"id":145838551,"uuid":"574342898","full_name":"chainstacklabs/proxy-server-rpc-nodejs","owner":"chainstacklabs","description":"This project shows a simple proxy server to send post requests to a blockchian using the Web3.js library, hiding your endpoint URL","archived":false,"fork":false,"pushed_at":"2024-04-10T10:56:21.000Z","size":402,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-29T16:33:06.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chainstacklabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-05T05:00:54.000Z","updated_at":"2023-12-01T12:34:37.000Z","dependencies_parsed_at":"2024-12-29T16:40:27.850Z","dependency_job_id":null,"html_url":"https://github.com/chainstacklabs/proxy-server-rpc-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fproxy-server-rpc-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fproxy-server-rpc-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fproxy-server-rpc-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fproxy-server-rpc-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chainstacklabs","download_url":"https://codeload.github.com/chainstacklabs/proxy-server-rpc-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239718465,"owners_count":19685749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T21:29:27.972Z","updated_at":"2025-12-29T17:30:14.096Z","avatar_url":"https://github.com/chainstacklabs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"1200\" alt=\"Labs\" src=\"https://user-images.githubusercontent.com/99700157/213291931-5a822628-5b8a-4768-980d-65f324985d32.png\"\u003e\n\n\u003cp\u003e\n \u003ch3 align=\"center\"\u003eChainstack is the leading suite of services connecting developers with Web3 infrastructure\u003c/h3\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/build-better-with-ethereum/\"\u003e\u003cimg src=\"https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Ethereum.svg\" /\u003e\u003c/a\u003e\u0026nbsp;  \n  \u003ca target=\"_blank\" href=\"https://chainstack.com/build-better-with-bnb-smart-chain/\"\u003e\u003cimg src=\"https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/BNB.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/build-better-with-polygon/\"\u003e\u003cimg src=\"https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Polygon.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/build-better-with-avalanche/\"\u003e\u003cimg src=\"https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Avalanche.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/build-better-with-fantom/\"\u003e\u003cimg src=\"https://github.com/soos3d/blockchain-badges/blob/main/protocols_badges/Fantom.svg\" /\u003e\u003c/a\u003e\u0026nbsp;\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  • \u003ca target=\"_blank\" href=\"https://chainstack.com/\"\u003eHomepage\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/protocols/\"\u003eSupported protocols\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/blog/\"\u003eChainstack blog\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://docs.chainstack.com/quickstart/\"\u003eChainstack docs\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://docs.chainstack.com/quickstart/\"\u003eBlockchain API reference\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://console.chainstack.com/user/account/create\"\u003eStart for free\u003c/a\u003e •\n\u003c/p\u003e\n\n# Proxy server for RPC endpoint using Express\n\nThis project shows how to protect your RPC URL by creating a back-end server where you store the endpoint. Then, when you click the button to check the balance, the front end will send a request to the back-end server using the `eth_getBalance` method via the `web3.js` library. \n\nRead the full guide on the Chainstack developer portal\n* [How to store your Web3 DApp secrets: Guide to environment variables](https://docs.chainstack.com/docs/how-to-store-your-web3-dapp-secrets-guide-to-environment-variables#the-rest-api-proxy-server)\n\n## Project details\n\nFor this use case, we built a simple app that allows you to input an Ethereum address and returns the address balance by sending an `eth_getBalance` request to an Ethereum node.\n\nIt is built using the `Express.js` framework, and the main server code is in the `index.js` file that you can find in the root directory.\n\n## Quickstart\n\nClone the repository:\n\n```sh\ngit clone https://github.com/soos3d/node-proxy-server-to-protect-your-rpc-url-endpoint.git\n```\n\nEdit the `.env.sample` file to include your node RPC URL key and rename it to `.env`.\n\n```env\nETHEREUM_RPC_URL=\"YOUR_CHAINSTACK_ENDPOINT_URL\"\n```\n\nInstall  dependencies:\n\n```sh\nnpm install\n```\n\nRun page in dev mode with:\n\n```sh\nnpm run dev\n```\n\nThe page is now running in `http://localhost:5000/`. Open it in your browser to see it, then:\n\n1. Insert the address you want to query in the input field.\n1. Click **Check balance** to send a request to your RPC node and retrieve the address' balance.\n\nIf you check the source code from the browser, you won't be able to find the API key used! \n\n## Prerequisites\n\n* Node.js: ^16.17.0— [install Node](https://nodejs.org/en/download/)\n* A node RPC endpoint.\n\nDeploy a node with Chainstack:\n\n1. [Sign up with Chainstack](https://console.chainstack.com/user/account/create).  \n1. [Deploy a node](https://docs.chainstack.com/platform/join-a-public-network).  \n1. [View node access and credentials](https://docs.chainstack.com/platform/view-node-access-and-credentials). \n\n## Dependencies\n\n* cors: ^2.8.5\n* dotenv: ^16.0.3\n* express: ^4.18.2\n* express-rate-limit: ^6.7.0\n* web3: ^1.8.1\n* nodemon: ^2.0.20\n\n## Install\n\nClone this repository\n\n```sh\ngit clone https://github.com/soos3d/node-proxy-server-to-protect-your-rpc-url-endpoint.git\n```\n\nInstall dependencies\n\n```sh\nnpm ci\n```\n\n\u003e Use `npm ci` to launch a `clean install` of the dependencies, this will install the same version as in the `package.json` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainstacklabs%2Fproxy-server-rpc-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainstacklabs%2Fproxy-server-rpc-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainstacklabs%2Fproxy-server-rpc-nodejs/lists"}