Getting AssetID and private keys

You can use the account_info method to retrieve all account information including assets created by the account. The assets created lives under "thisassettotal" in the account info json.

from algosdk import algod

# set up client using your credentials
algod_client = algod.AlgodClient("<algod_token>", "<algod_address>")

# retrieve account info
account_info = algod_client.account_info("<ADDRESS>")

# retrieve all assets created by this account
assets_created = account_info.get("thisassettotal")

# this returns a dictionary keyed by the asset ID. Asset IDs are ordered - the higher the ID the more recently it was created - so if you want the latest created asset, pick the max ID. 
last_created_asset = max([int(id) for id in assets_created.keys()])

# get asset info for latest created asset
asset_info = assets_created.get(str(last_created_asset))
print(asset_info)

I’ve added a note to add this to the docs as well.

1 Like