Skip to main content

Key Management

Never Expose Private Keys

Never commit private keys or mnemonics to version control, logs, or client-side code.
Bad:
Good:

Use Environment Variables

.env

Separate API Keys

Create different API keys for different purposes:
  • Trading: Limited to order placement
  • Withdrawals: Separate key for withdrawals
  • Read-only: For monitoring only

Operational Security

Validate Inputs

Implement Rate Limiting

Monitor Margin Health

Network Security

Use HTTPS Endpoints

Always use HTTPS for API endpoints:

Verify TLS Certificates

Ensure your environment verifies TLS certificates (enabled by default in Node.js).

Error Handling

Handle errors gracefully

Wallets Guide

Secure wallet management