Avalanche
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Avalanche
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Every request you send to the Avalanche C-Chain through TheRPC must include an API key — it identifies your account, applies your plan's limits, and keeps your endpoint private. This guide walks you through generating a key in the dashboard, attaching it to requests with the Bearer scheme, securing it with environment variables and good rotation hygiene, and reading the error responses TheRPC returns when a key is missing or invalid.
https://avalanche.therpc.io/YOUR_API_KEY and send it in the Authorization header.Pass your key in the Authorization header using the Bearer scheme: Authorization: Bearer YOUR_API_KEY. Every single call to the Avalanche C-Chain must include this header — there is no session or cookie that carries it for you, so each JSON-RPC POST, whether reading a balance or broadcasting an AVAX transfer, sends the header again.
.env files to .gitignore.When authentication fails, the Avalanche C-Chain API returns a JSON-RPC error object instead of a result, carrying a numeric code and a message such as Invalid authentication credentials. The usual causes are a missing Authorization header, a malformed key or wrong header format, a key that has been expired or revoked in the dashboard, or a request that exceeded your plan's rate limit. Check the message, confirm the header is present and correctly formed, and verify the key is still active.
The safest way to use your Avalanche C-Chain key is to load it from an environment variable at runtime rather than hardcoding it into your source. Store the value in a .env file that stays out of version control, then read it through process.env in Node.js or os.getenv in Python. This keeps the secret out of your committed code and lets you swap keys per environment without touching the application.