Blockfrost api.transaction_metadata returning blank list

Hello all, I am a noob trying to dive into learning the blockfrost api via python,

I have a script I want to make, which requires me to call api.transaction_metadata, but it is returning a blank list. I am wondering why this is? (edit: my goal is to get transaction cost metadata)

Here is my code:

    pastTx = api.transaction_metadata('a34a3b08309f39809fcc3f9778886081f8d40220a425b9c4239475ad90f66698')
    print("past tx metadata:", pastTx)

Im unsure why it doesnt want to work for me. I have imported BlockFrostApi.

also, is there anywhere I can find the python specific documentation for this package? quite often it is confusing to try and find which name the different quereys listed here ( ~ API Documentation) are in python.

Also, do any video tutorials for this exist?


That transaction ( just has no metadata at all. Empty array is absolutely the correct result.

If you do:


(that is the SUNDAE minting transaction, just for example) you get a lot of metadata.

Yes, the Python version of the Blockfrost API is not documented well. You just have to look in the source (or in help(blockfrost.BlockFrostApi) on the Python REPL), which functions exist.

1 Like

Thank you for the reply! Thats why it was blank. whoops,

For some reason I thought metadata would include stuff like transaction fees (which is what I am after) is there an api call for getting that information? :slight_smile:

Just api.transaction will give you an object with a fees field:

>>> tx = api.transaction('a34a3b08309f39809fcc3f9778886081f8d40220a425b9c4239475ad90f66698')
>>> tx
Namespace(hash='a34a3b08309f39809fcc3f9778886081f8d40220a425b9c4239475ad90f66698', block='d6f258e38b0bfa7863310593a3e7e793db60b10dfcab80efac04cac7e3cfe8d5', block_height=6669082, block_time=1640365261, slot=48798970, index=20, output_amount=[Namespace(unit='lovelace', quantity='50343858'), Namespace(unit='50dfcc6f4ce897eac827bb182e4bfe33d2f07af33ddc0859602ca1b842756c6c69736830333838', quantity='1'), Namespace(unit='9dec676c8acc5f2791ac0c73741f92ae9d4b61c243fd9971b4cbc2a843617264616e6f50656e6775696e4a6f6c6c794265696765', quantity='1')], fees='186753', deposit='0', size=570, invalid_before=None, invalid_hereafter='48806152', utxo_count=5, withdrawal_count=0, mir_cert_count=0, delegation_count=0, stake_cert_count=0, pool_update_count=0, pool_retire_count=0, asset_mint_or_burn_count=0, redeemer_count=0, valid_contract=True)
>>> tx.fees
1 Like

Thank you very much for the help! :slight_smile: