Skip to content

Security and Best Practices

Security Notice

While QubiPy provides tools to interact with the Qubic network, users are responsible for implementing proper security measures in their applications.

Best Practices

API Usage

Rate Limiting

  • Implement proper rate limiting in your applications
  • Handle API errors gracefully
  • Don't spam the network with unnecessary requests
  • Cache responses when appropriate

Error Handling

Proper Error Management

try:
    response = rpc_client.get_transaction_status(tx_id)
except QubiPy_Exceptions as e:
    # Handle QubiPy specific errors
    logger.error(f"QubiPy error: {e}")
except Exception as e:
    # Handle unexpected errors
    logger.error(f"Unexpected error: {e}")

Transaction Safety

Critical Considerations

  • Always verify transaction data before broadcasting
  • Double-check addresses and amounts
  • Keep private keys secure and never share them
  • Don't store sensitive information in code or version control

Configuration Management

Environment Variables

  • Use environment variables for sensitive configuration
  • Don't hardcode API endpoints or credentials
  • Keep production and development configurations separate

Logging

Logging Best Practices

  • Implement comprehensive logging
  • Don't log sensitive information
  • Use appropriate log levels
  • Include relevant context in log messages

Common Pitfalls to Avoid

Don'ts

  • Don't ignore API response validation
  • Don't catch all exceptions without proper handling
  • Don't store sensitive data in plaintext
  • Don't use deprecated methods