{"id":8162,"library":"fireblocks-sdk","title":"Fireblocks Python SDK","description":"The Fireblocks Python SDK provides a robust interface to interact with the Fireblocks platform for secure digital asset operations, including managing vault accounts and executing transactions. It is actively maintained with frequent updates and bug fixes, currently at version 2.17.0, and follows a regular release cadence.","status":"active","version":"2.17.0","language":"en","source_language":"en","source_url":"https://github.com/fireblocks/fireblocks-sdk-py","tags":["financial","blockchain","cryptocurrency","sdk","api","web3"],"install":[{"cmd":"pip install fireblocks-sdk","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The PyPI package is `fireblocks-sdk`, but the main class is imported from `fireblocks_sdk`.","wrong":"import fireblocks","symbol":"FireblocksSDK","correct":"from fireblocks_sdk import FireblocksSDK"}],"quickstart":{"code":"import os\nfrom fireblocks_sdk import FireblocksSDK\nfrom fireblocks_sdk.sdk import FireblocksApiException\n\n# Ensure environment variables are set for API Key and Secret\n# export FIREBLOCKS_API_KEY=\"<your_api_key>\"\n# export FIREBLOCKS_SECRET_KEY_PATH=\"./fireblocks_secret.key\" (or content in FIREBLOCKS_SECRET_KEY env var)\n# export FIREBLOCKS_BASE_PATH=\"https://sandbox-api.fireblocks.io/v1\" (or production URL)\n\ntry:\n    api_key = os.environ.get('FIREBLOCKS_API_KEY', '')\n    # It's recommended to load the private key from a file, not directly from an env var\n    # For simplicity, using a placeholder here; in production, load securely.\n    # For this quickstart, let's assume the secret key is in an environment variable \n    # or a known path for demonstration, but typically it's a file path.\n    secret_key_path = os.environ.get('FIREBLOCKS_SECRET_KEY_PATH')\n    if secret_key_path and os.path.exists(secret_key_path):\n        with open(secret_key_path, 'r') as f:\n            private_key = f.read()\n    else:\n        private_key = os.environ.get('FIREBLOCKS_SECRET_KEY', '')\n        print(\"Warning: Loading private key directly from environment variable. Consider using a file path for security.\")\n\n    base_url = os.environ.get('FIREBLOCKS_BASE_PATH', 'https://sandbox-api.fireblocks.io/v1')\n\n    if not api_key or not private_key:\n        raise ValueError(\"FIREBLOCKS_API_KEY and FIREBLOCKS_SECRET_KEY/FIREBLOCKS_SECRET_KEY_PATH must be set.\")\n\n    fireblocks = FireblocksSDK(private_key=private_key, api_key=api_key, base_url=base_url)\n    \n    # Fetch and print vault accounts\n    vault_accounts = fireblocks.get_vault_accounts()\n    print(\"Successfully connected to Fireblocks and fetched vault accounts.\")\n    if vault_accounts:\n        print(f\"First vault account name: {vault_accounts[0].name}\")\n    else:\n        print(\"No vault accounts found.\")\n\nexcept FireblocksApiException as e:\n    print(f\"Fireblocks API Error: {e.status_code} - {e.message}\")\nexcept ValueError as e:\n    print(f\"Configuration Error: {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"Initializes the Fireblocks SDK using API key and secret, then fetches a list of vault accounts. It demonstrates secure loading of credentials via environment variables and basic error handling."},"warnings":[{"fix":"Review the GitHub release notes and API documentation for `fireblocks-sdk-py` for affected API endpoints and adjust your request/response models accordingly. Pay close attention to schema changes for `CreateVaultAccountRequest`, `AddAssetToExternalWalletRequest`, and TAP-related operations.","message":"Recent minor versions within the 2.x series have included 'Maintenance - Breaking Changes' related to API schema updates (e.g., TAP endpoints, `addAssetToExternalWallet` request schema). While SDK method signatures generally remain stable, changes to request/response Data Transfer Objects (DTOs) may require adjustments to your code.","severity":"breaking","affected_versions":"2.x.x (starting ~v2.9.0, check release notes for specific versions)"},{"fix":"Always load the private key securely, preferably from a file specified by an environment variable (e.g., `FIREBLOCKS_SECRET_KEY_PATH`) and ensure proper file permissions. Avoid exposing it directly in source code or insecure environment variables.","message":"The `private_key` (API Secret Key) is crucial for cryptographically signing all API requests. Improper handling (e.g., hardcoding, incorrect file path, or insufficient permissions on the key file) can lead to `403 Forbidden` errors or critical security vulnerabilities.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development and deployment environments are running Python 3.8 or a later supported version. Upgrade Python if necessary.","message":"The Fireblocks Python SDK officially requires Python 3.8 or newer. Using older Python versions might lead to compatibility issues, unexpected errors, or missing features.","severity":"gotcha","affected_versions":"< 3.8"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the package correctly using `pip install fireblocks-sdk` and ensure your Python code uses `from fireblocks_sdk import FireblocksSDK`.","cause":"The `fireblocks-sdk` package is either not installed, or the import statement uses an incorrect module name (e.g., `import fireblocks` instead of `from fireblocks_sdk import FireblocksSDK`).","error":"ModuleNotFoundError: No module named 'fireblocks_sdk'"},{"fix":"Verify that `FIREBLOCKS_API_KEY` and the content of your private key (from `FIREBLOCKS_SECRET_KEY_PATH` or `FIREBLOCKS_SECRET_KEY`) are correct. Check the Fireblocks Console under 'Developer Center > API Users' to ensure the API user has the required workspace roles and permissions.","cause":"The provided `api_key` or `private_key` (secret key) is incorrect, malformed, or the API user associated with the credentials lacks the necessary permissions for the requested operation.","error":"FireblocksApiException: 403 Forbidden - Authentication Error: Invalid API Key or Signature"},{"fix":"Confirm network connectivity. Verify that `FIREBLOCKS_BASE_PATH` is set to the correct Fireblocks environment endpoint (e.g., `https://sandbox-api.fireblocks.io/v1` for sandbox, `https://api.fireblocks.io/v1` for production). Review your request payload for correctness. If persistent, check the Fireblocks system status page or contact Fireblocks support with the `x-request-id` from the error response if available.","cause":"This often indicates a network connectivity issue, an incorrect `base_url` for the Fireblocks API, or a transient server-side problem on the Fireblocks platform. It could also mean an invalid request body leading to a server error.","error":"requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) or similar 500 Internal Server Error"}]}