I am using Latest fireblock Python SDK to integrate with fireblocks api. With some trial and error i successfully created new vault account and BTC_TEST asset wallet.
But when i tried to create a Transfer transaction from one wallet to another i could not do it. Documentation did not help.
When tried code on this link it gives error that this function does not even exist.
Tried to follow this second link that gives different function and parameters to create transaction:
After looking at core library functions of the python SDK this is the code i have for create transaction:
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.base_path import BasePath
from fireblocks.models.create_vault_account_request import CreateVaultAccountRequest
from fireblocks.models.transaction_request_amount import TransactionRequestAmount
from fireblocks.models.source_transfer_peer_path import SourceTransferPeerPath
from fireblocks.models.destination_transfer_peer_path import DestinationTransferPeerPath
from fireblocks.models.transfer_peer_path_type import TransferPeerPathType
from fireblocks.models.transfer_peer_path_sub_type import TransferPeerPathSubType
my_api_key="correct-api-key"
with open('./fireblocks_secret.key', 'r') as file:
secret_key_value = file.read()
configuration = ClientConfiguration(
api_key=my_api_key,
secret_key=secret_key_value,
base_path=BasePath.Sandbox
)
with Fireblocks(configuration) as fireblocks:
assetId = "BTC_TEST"
amount = TransactionRequestAmount("0.00001")
src_id = "1"
dest_id = "2"
transaction_request = {
"asset_id": assetId,
"amount": amount,
"source": {"type": TransferPeerPathType.VAULT_ACCOUNT, "name": "My First Vault Account", "id": src_id},
"source_address": "tb1qlfpgs37anpa4w6l2jkhtklpdz700gt6k9e00j9",
"destination_address": "tb1qc4mxszs9kv8whxdsfj4xyzt534r77qz8apyrdz",
"destination": {"type": TransferPeerPathType.VAULT_ACCOUNT, "name": "Default", "id": dest_id},
}
x_end_user_wallet_id = "tb1qc4mxszs9kv8whxdsfj4xyzt534r77qz8apyrdz"
future = fireblocks.transactions.create_transaction(transaction_request=transaction_request, x_end_user_wallet_id=x_end_user_wallet_id)
api_response = future.result() # Wait for the response
print("The response of VaultsApi->create_transaction:\n")
pprint(api_response.data)
But this gives me unauthorised error :
fireblocks.exceptions.UnauthorizedException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Thu, 08 May 2025 12:42:52 GMT’, ‘Content-Type’: ‘application/json; charset=utf-8’, ‘Content-Length’: ‘61’, ‘Connection’: ‘keep-alive’, ‘X-Powered-By’: ‘Express’, ‘X-Request-ID’: ‘fe1cda63b5c4d611c0b37f6f62483932’, ‘x-reason’: ‘{“message”:“Unauthorized: Token was not accepted.”,“code”:-7}’, ‘ETag’: ‘W/“3d-zomXnAy0H/hxycUcfr0PgHC7HLw”’, ‘Strict-Transport-Security’: ‘max-age=31536000; includeSubDomains’, ‘cf-cache-status’: ‘DYNAMIC’, ‘Server’: ‘cloudflare’, ‘CF-RAY’: ‘93c90a1bbb75421d-EWR’})
HTTP response body: message=‘Unauthorized: Token was not accepted.’ code=-7
I checked the error code “-7” which is for incorrect Api Key if you are using SDK, but i double check that Api Key is correct. I can still create Vault accounts and Asset wallets, just create transaction is failing.