This project demonstrates how to protect node provider API keys (e.g., for services like Alchemy) in frontend dApps using JWTs. By leveraging short-lived JWTs, we can securely manage access to node providers without exposing API keys directly in the frontend. For a detailed explanation, check out the blog post here, and see the solution in action in the demo app.
Follow these steps to set up the project locally:
Create a .env
file in the root of the project and add the following environment variables. You can find the explanations for these variables in the blog post.
ALCHEMY_PRIVATE_KEY_PKCS8=<Your PKCS8 Private Key>
ALCHEMY_KEY_ID=<Your Key ID>
NEXT_PUBLIC_WC_PROJECT_ID=<Your WalletConnect Project ID>
To run the application locally, run:
npm install
npm run dev