Advanced Topics
Deep dives into advanced features, optimization, and best practices.
Gas Management
Optimize transaction costs by managing gas prices and fees intelligently.
Gas Settings:
- Standard: Normal transaction speed, optimal cost
- Fast: Higher priority, increased gas fee
- Slow: Lower priority, minimized costs for non-urgent txns
- Custom: Manually specify gas price and limit
Example: Send transaction with custom gas settings
curl -X POST https://api.verexbase.com/api/v1/transactions/transactions/transfer_native/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"vault_id": "your-vault-id",
"to_address": "0xRecipientAddress",
"amount": "1.0",
"gas_price": "50",
"gas_limit": "21000"
}'Tip: Monitor gas prices via external APIs and batch transactions during low-gas periods to reduce costs.
Transaction Sweeping
Automatically transfer funds from multiple addresses to a central vault for consolidation.
Sweep Configuration:
- Source Accounts: Hot wallet addresses to sweep from
- Target Account: Cold storage or main vault
- Trigger: Manual, time-based, or amount-based
- Threshold: Minimum balance before sweep initiates
Example: Configure automated sweep policy
curl -X POST https://api.verexbase.com/api/v1/policies/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Daily Sweep to Cold Storage",
"policy_type": "sweep",
"rules": {
"source_vaults": ["vault_hot_1", "vault_hot_2"],
"target_vault": "vault_cold_storage",
"min_balance": "0.1",
"schedule": "0 2 * * *"
}
}'Rate Limits
API rate limits are enforced to maintain platform stability.
Rate Limit Tiers:
| Plan | Requests/Min | Requests/Day |
|---|---|---|
| Free | 10 | 1,000 |
| Pro | 100 | 100,000 |
| Enterprise | Unlimited | Unlimited |
Handle rate limit responses with retry logic:
# Check rate limit headers
curl -v https://api.verexbase.com/api/v1/vaults/accounts/ \
-H "X-API-Key: YOUR_API_KEY"
# Response headers show limits:
# X-RateLimit-Limit: 100
# X-RateLimit-Remaining: 95
# X-RateLimit-Reset: 1736421600
# If rate limited (429):
# Retry-After: 60Error Handling
Understand and handle API errors gracefully.
Common Error Codes:
- 400 - Bad Request: Invalid parameters
- 401 - Unauthorized: Invalid credentials
- 403 - Forbidden: Insufficient permissions
- 404 - Not Found: Resource doesn't exist
- 429 - Rate Limited: Too many requests
- 500 - Server Error: Temporary issue
Error response format:
{
"error": "insufficient_balance",
"error_code": "VAULT_ERR_001",
"message": "Account balance is insufficient for this transaction",
"details": {
"required": "2.5",
"available": "1.2",
"token": "ETH"
}
}Security Best Practices
Follow these guidelines to keep your Verex integration secure.
API Token Management
- • Never commit tokens to version control
- • Rotate tokens regularly (every 90 days minimum)
- • Use environment variables to store tokens
- • Create read-only tokens for non-sensitive operations
Webhook Security
- • Always verify webhook signatures using the provided secret
- • Use HTTPS for all webhook endpoints
- • Implement idempotency checks (duplicate detection)
- • Set appropriate timeouts on webhook handlers
Transaction Security
- • Always require approval for transactions above thresholds
- • Use multi-signature wallets for high-value accounts
- • Implement rate limiting on transaction endpoints
- • Keep address whitelists for automatic transfers
Monitoring & Logging
- • Log all API calls with timestamps and user info
- • Monitor for unusual patterns (rapid transactions, new addresses)
- • Set up alerts for failed transactions or security events
- • Regularly audit webhook delivery and error logs
