Skip to content

Python wrapper for accessing and processing information stored on the Cardano blockchain using Blockfrost API.

License

Notifications You must be signed in to change notification settings

attadje/py-cardano-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Cardano Explorer

Python wrapper for accessing and processing information stored on the Cardano blockchain using Blockfrost API.


Table of contents


Install

pip install cardano_explorer

Usage

from cardano_explorer import blockfrost_api

Api Key

If you have an API key, you can either set it as environment variable BLOCKFROST_API_KEY or set it manually.

You can quickly create your api key on Blockfrost.
The free account allow you up to 50,000 requests a day and 10 requests per second, which is more that enough.

cardano_mainnet = blockfrost_api.Auth() # API Key is set in a env variable name BLOCKFROST_API_KEY
#or
cardano_mainnet = blockfrost_api.Auth(api_key=blockfrost_api_key)

Using With Proxy

proxies = {
 "http": "http://user:password@server:port",
 "https": "https://user:password@server:portt",
}

cardano_mainnet = blockfrost_api.Auth(proxies=proxies)

Network

You can specify the cardano network with the class parameter network.

cardano_mainnet = blockfrost_api.Auth() # mainnet by default
#or
cardano_mainnet = blockfrost_api.Auth(network='mainnet')
#or
cardano_mainnet = blockfrost_api.Auth(network='testnet')

Network Informations

Network Info

Return detailed about the network.

cardano_mainnet.network_info()
{'supply': {'max': '45000000000000000',
  'total': '33250650235236357',
  'circulating': '32921356877345090',
  'locked': '14342846495117',
  'treasury': '643991464810237',
  'reserves': '11749349764763643'},
 'stake': {'live': '23461249229811191', 'active': '23411124422164299'}}

Stake

Stake Informations

Obtain information about a specific stake account.

cardano_mainnet.stake_informations(stake_address)
{'stake_address': 'stake1uyttshgm6jtejckv48tll58hfw3fg2ffrcc4d5qvcc4yc7q9jsalf',
 'active': True,
 'active_epoch': 271,
 'controlled_amount': '3015398847',
 'rewards_sum': '33831666',
 'withdrawals_sum': '21239707',
 'reserves_sum': '97317',
 'treasury_sum': '0',
 'withdrawable_amount': '12591959',
 'pool_id': 'pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288ys5kumqce5'}

Stake Reward History

Obtain information about the reward history of a specific account.

cardano_mainnet.stake_reward_history(stake_address, 
                                     data_order='asc', # Optional: Data order (default: Ascending)
                                     nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                     pandas=True) # Optional: Return a pandas dataframe
epoch amount pool_id
0 273 587159 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
1 274 715853 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
2 275 902199 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
3 276 824733 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
4 277 1056705 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...

Stake Rewards History Analysis

Add extra informations to the stake reward history.

cardano_mainnet.stake_rewards_corr(stake_address,
                                   pandas=True) # Optional: Return a pandas dataframe 
epoch rewards_amount stake_amount pool_id epoch_start_time epoch_end_time epoch_first_block_time epoch_last_block_time epoch_block_count epoch_tx_count epoch_output epoch_fees epoch_active_stake stake_pool_blocks stake_pool_active_stake stake_pool_active_size stake_pool_delegators_count stake_pool_rewards stake_pool_fees
15 288 1768631 2866605326 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 1630619091 1631051091 1630619101 1631051088 21136 475383 120564869080762073 99992854778 23136223153988390 49 55449417952886 0.002397 1439 34863643156 685236431
16 289 2390373 2868437494 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 1631051091 1631483091 1631051131 1631483087 21195 501443 30450853050129419 105082493097 23311196777534712 66 55724573270655 0.002390 1443 47200199605 808601996
17 290 1878132 3002707784 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 1631483091 1631915091 1631483266 1631915089 21320 423156 28653067841498377 88193252097 23253494675755279 49 54675837934319 0.002351 1440 34877628423 685376284
18 291 2059700 3004575519 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 1631915091 1632347091 1631915193 1632347076 21261 415399 27614827533993432 88508486990 23219858534473043 54 54806809508971 0.002360 1451 38286415852 719464158
19 292 2173115 3006965892 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 1632347091 1632779091 1632347163 1632779076 21264 448774 19991338650818976 94575307119 23325839206372436 60 57943587612745 0.002484 1451 42628197872 762881978

Stake Amount History

Obtain information about the history of a specific account.

cardano_mainnet.stake_amount_history(stake_address, 
                                     data_order='asc', # Optional: Data order (default: Ascending)
                                     nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                     pandas=True) # Optional: Return a pandas dataframe
active_epoch amount pool_id
0 273 998824863 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
1 274 998824863 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
2 275 1618824863 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
3 276 1619412022 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...
4 277 1620127875 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...

Stake Delegation History

Obtain information about the delegation of a specific account.

cardano_mainnet.stake_delegation(stake_address, 
                                 data_order='asc', # Optional: Data order (default: Ascending)
                                 nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                 pandas=True) # Optional: Return a pandas dataframe
active_epoch tx_hash amount pool_id
0 273 97a774aa60a2926c9949bfe1edf1dcc2f2297d36633e14... 497824863 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288...

Stake Registrations And Deregistrations History

Obtain information about the registrations and deregistrations of a specific account.

cardano_mainnet.stake_registration_deregistrations(stake_address, 
                                                   data_order='asc', # Optional: Data order (default: Ascending)
                                                   nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                                   pandas=True) # Optional: Return a pandas dataframe
tx_hash action
0 97a774aa60a2926c9949bfe1edf1dcc2f2297d36633e14... registered

Stake Withdrawal History

Obtain information about the withdrawals of a specific account.

cardano_mainnet.stake_withdrawal_history(stake_address, 
                                         data_order='asc', # Optional: Data order (default: Ascending)
                                         nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                         pandas=True) # Optional: Return a pandas dataframe
tx_hash amount
0 80b09b61d2da86f5847d0b9a5f72d32224fcd7e1aa1716... 21239707

Stake MIR History

Obtain information about the MIRs of a specific account.

cardano_mainnet.stake_mir_history(stake_address, 
                                  data_order='asc', # Optional: Data order (default: Ascending)
                                  nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                  pandas=True) # Optional: Return a pandas dataframe
tx_hash amount
0 c041e475d161444a6a8ca9005ef3deb36ebd579c347d90... 74456
1 9ede69b0ebd0903b1cc6a914a79fabd9a5d6dd94e8c110... 22861

Stake Associated Addresses

Obtain information about the MIRs of a specific account.

cardano_mainnet.stake_associated_addresses(stake_address, 
                                           data_order='asc', # Optional: Data order (default: Ascending)
                                           nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                           pandas=True) # Optional: Return a pandas dataframe 
address
0 addr1qx96yn08e5u7hthawh63ss6269dkzxekq85elrthw...
1 addr1q9u0kfvd57parl03j8v9fz52xqz8yjkcu47lcy8hw...
2 addr1q8m6tn3edl333c8yzms8dzrkkckm0vn0dkvq436au...
3 addr1q9py3k58fmyu896charn6mey8c5f22uq830m4udsy...
4 addr1q8mk7kft30hwmj2yttltm8j5f4ccuguxr9z3werwm...

Stake Assets Associated Addresses

Obtain information about assets associated with addresses of a specific account.

cardano_mainnet.stake_assets_associated_addresses(stake_address, 
                                                  data_order='asc', # Optional: Data order (default: Ascending)
                                                  nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                                  pandas=True) # Optional: Return a pandas dataframe 
unit quantity
0 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 1

Address

Specific Address

Obtain information about a specific address.

cardano_mainnet.address_info(address)
{'address': 'addr1q8z24xgrlj3m2qjh2vxyqg2fh33y3tegufkll5c4lu8u35gkhpw3h4yhn93ve2whllg0wjazjs5jj8332mgqe332f3uq8m7m6h',
 'amount': [{'unit': 'lovelace', 'quantity': '350000000'}],
 'stake_address': 'stake1uyttshgm6jtejckv48tll58hfw3fg2ffrcc4d5qvcc4yc7q9jsalf',
 'type': 'shelley'}

Address Details

Obtain details about an address.

cardano_mainnet.address_details(address)
{'address': 'addr1q8z24xgrlj3m2qjh2vxyqg2fh33y3tegufkll5c4lu8u35gkhpw3h4yhn93ve2whllg0wjazjs5jj8332mgqe332f3uq8m7m6h',
 'received_sum': [{'unit': 'lovelace', 'quantity': '350000000'}],
 'sent_sum': [{'unit': 'lovelace', 'quantity': '0'}],
 'tx_count': 1}

Address UTXOs

UTXOs of the address.

cardano_mainnet.address_utxo(address,
                             pandas=True) # Optional: Return a pandas dataframe 
tx_hash tx_index output_index amount block data_hash
0 996ff0a57282ef943ecdbc263cf9c41c178d65587d70d9... 4 4 [{'unit': 'lovelace', 'quantity': '350000000'}] 73768f4ca2a0c96611a1fbd7f53a3b1b573fb0371012e5... None

Address Transactions

Transactions on the address.

cardano_mainnet.address_transaction(address, 
                                    pandas=True) # Optional: Return a pandas dataframe 
tx_hash tx_index block_height
0 996ff0a57282ef943ecdbc263cf9c41c178d65587d70d9... 45 6095572

Epoch

Latest Epoch

Obtain the information about the latest epoch.

cardano_mainnet.latest_epoch()
{'epoch': 288,
 'start_time': 1630619091,
 'end_time': 1631051091,
 'first_block_time': 1630619101,
 'last_block_time': 1630695809,
 'block_count': 3867,
 'tx_count': 77200,
 'output': '41529702474109934',
 'fees': '16021622015',
 'active_stake': '23136223153988390'}

Latest Epoch Protocol Parameters

Return the protocol parameters for the latest epoch.

cardano_mainnet.latest_epoch_protocol_parameters()
{'epoch': 288,
 'min_fee_a': 44,
 'min_fee_b': 155381,
 'max_block_size': 65536,
 'max_tx_size': 16384,
 'max_block_header_size': 1100,
 'key_deposit': '2000000',
 'pool_deposit': '500000000',
 'e_max': 18,
 'n_opt': 500,
 'a0': 0.3,
 'rho': 0.003,
 'tau': 0.2,
 'decentralisation_param': 0,
 'extra_entropy': None,
 'protocol_major_ver': 4,
 'protocol_minor_ver': 0,
 'min_utxo': '1000000',
 'min_pool_cost': '340000000',
 'nonce': 'bf3b52ab86e152b392cbf095c1d0f07aaeda956eecfdb44b09bcb85a0ecae36a'}

Specific Epoch

Obtain informations about a specific epoch.

cardano_mainnet.specific_epoch(287)
{'epoch': 287,
 'start_time': 1630187091,
 'end_time': 1630619091,
 'first_block_time': 1630187230,
 'last_block_time': 1630619085,
 'block_count': 21065,
 'tx_count': 401343,
 'output': '74754307451589173',
 'fees': '86536781869',
 'active_stake': '23041097075076811'}

Epochs History

Obtain informations about sevrals epochs.

cardano_mainnet.epochs_history([270, 271, 272],
                               pandas=True) # Optional: Return a pandas dataframe 
epoch start_time end_time first_block_time last_block_time block_count tx_count output fees active_stake
0 270 1622843091 1623275091 1622843183 1623275038 21395 174334 12213404538685056 36489177917 22893778548073522
1 271 1623275091 1623707091 1623275098 1623707059 21410 145244 12686700012872148 30802442909 22970909569111347
2 272 1623707091 1624139091 1623707123 1624139087 21499 135373 10640794327820158 29593210504 23020000415780615

Pool

List Of Stake Pools

List of registered stake pools.

cardano_mainnet.registered_polls(nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                 pandas=True) # Optional: Return a pandas dataframe 
registered_polls_id
0 pool1z5uqdk7dzdxaae5633fqfcu2eqzy3a3rgtuvy087f...
1 pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0na...
2 pool1c8k78ny3xvsfgenhf4yzvpzwgzxmz0t0um0h2xnn2...
3 pool1q80jjs53w0fx836n8g38gtdwr8ck5zre3da90peux...
4 pool1ddskftmsscw92d7vnj89pldwx5feegkgcmamgt5t0...

Specific Stake Pool Informations

Pool informations.

cardano_mainnet.pool_informations(pool_id)
{'pool_id': 'pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288ys5kumqce5',
 'hex': 'cdae4a1a08974113e77ea332cb1da97d9e3fca5cf797f9394739214b',
 'vrf_key': '5517fbeb4c6a5a613835808de183345eaf85ab0e251210e493e088afa41d9ab0',
 'blocks_minted': 3454,
 'live_stake': '63777749141588',
 'live_size': 0.002722243022656593,
 'live_saturation': 0.9701750363479381,
 'live_delegators': 1411,
 'active_stake': '880520384',
 'active_size': 8.842681417401523e-05,
 'declared_pledge': '200000000000',
 'live_pledge': '205263294816',
 'margin_cost': 0.01,
 'fixed_cost': '340000000',
 'reward_account': 'stake1u8uzevd539lxn40jt60g72a649zdphe9e8hrye4nf5jv0js9uzhzg',
 'owners': ['stake1u9qsgte62jau0qu6kjy8zch8aynt55gql6jsxe05464n99gsqd7ra',
  'stake1u8uzevd539lxn40jt60g72a649zdphe9e8hrye4nf5jv0js9uzhzg'],
 'registration': ['b1bfffc26b6210ced9cc679781922e8b1ac70a2f7719523528639da4ab7f2d88',
  'be5b798897f5b83e5bf562df6fc68a94d5528acc80ab8e999ce866aa63a4d06a',
  '0f4781efd649f91e37847cb2699a8a41632ee94df1465e255577772f362339bf',
  '630c7195fdc1c5c14bb12c460059c5adb11b3cd6d3e576628aee0a8338f1b6ad',
  '119fe23a35e0ddcbb5778f17ad2371228a53b5ced037c12083a0c77b5711e1d4',
  'f1fe58c30ec7f5193476694fafc46dcdb11c3408e114e8fa2a95425243907ed4',
  '09c2c3d34de116365c9cf9a6e75f45856013388d962dbd5584c27b7d0bb36eed'],
 'retirement': []}

Stake Pool History

History of stake pool over epochs.

cardano_mainnet.stake_pool_history(pool_id,
                                   pandas=True).tail() # Optional: Return a pandas dataframe 
epoch blocks active_stake active_size delegators_count rewards fees
81 291 54 54806809508971 0.002360 1451 38286415852 719464158
82 292 60 57943587612745 0.002484 1451 42628197872 762881978
83 293 70 63400551099817 0.002710 1440 49751668542 834116685
84 294 49 62772203979076 0.002685 1431 0 0
85 295 34 63837104114656 0.002727 1416 0 0

Assets

Assets List

List of assets.

cardano_mainnet.assets(data_order='asc', # Optional: Data order (default: Ascending)
                       nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                       pandas=True).head() # Optional: Return a pandas dataframe 
asset quantity
0 00000002df633853f6a47465c9496721d2d5b1291b8398... 1
1 3a9241cd79895e3a8d65261b40077d4437ce71e9d7c8c6... 1
2 02f68378e37af4545d027d0a9fa5581ac682897a3fc1f6... 1000000
3 e8e62d329e73190190c3e323fb5c9fb98ee55f0676332b... 1
4 ac3f4224723e2ed9d166478662f6e48bae9ddf0fc5ee58... 10000000

Specific Asset

Information about a specific asset.

cardano_mainnet.specific_asset(policy_id+asset_name)
{'asset': '40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728436c61794e6174696f6e33393836',
 'policy_id': '40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728',
 'asset_name': '436c61794e6174696f6e33393836',
 'fingerprint': 'asset1ay3atwzy3hrdnn74v05jusgsycl344nquyq9nq',
 'quantity': '1',
 'initial_mint_tx_hash': '117f97ccf6e98a16697e7cc205daf2d0bfe83d849a63df2f40d10bef235848e7',
 'mint_or_burn_count': 1,
 'onchain_metadata': {'name': 'Clay Nation #3986',
  'image': 'ipfs://QmYREMX1uTQAFScJD4Xv5tUPnWimKyLzBTBFLv1oCyzMj2',
  'body': 'Brown Clay',
  'eyes': 'Big Eyes',
  'brows': 'Normal Eyebrows',
  'mouth': 'Normal Mouth',
  'Project': 'Clay Nation by Clay Mates',
  'clothes': 'Tshirt Green',
  'background': 'Cyan',
  'accessories': 'Flower Necklace',
  'hats and hair': 'Fringe'},
 'metadata': None}

Asset History

History of a specific asset.

cardano_mainnet.asset_history(policy_id+asset_name,
                               data_order='asc', # Optional: Data order (default: Ascending)
                               nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                               pandas=True) # Optional: Return a pandas dataframe
tx_hash action amount
0 117f97ccf6e98a16697e7cc205daf2d0bfe83d849a63df... minted 1

Asset Transactions

List of a specific asset transactions.

cardano_mainnet.asset_addresses(policy_id+asset_name,
                                data_order='asc', # Optional: Data order (default: Ascending)
                                nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                pandas=True) # Optional: Return a pandas dataframe 
address quantity
0 addr1q9vzk47zqxj54kew38j735n92mncnyhq57uekgn4w... 1

Assets Of A Specific Policy

List of assets mint under a specific policy

cardano_mainnet.assets_policy(policy_id,
                              data_order='asc', # Optional: Data order (default: Ascending)
                              nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                              pandas=True) # Optional: Return a pandas dataframe 
asset quantity
0 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 1
1 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 1
2 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 1
3 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 1
4 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 1

Get Assets Informations

Get informations about the assests mint under a specific policy.
Look here for some examples on how to analyze a CNFT project

assets_info = cardano_mainnet.assets_policy_info(policy_id, # Policy ID
                                                 nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                                                 pandas=True) # Optional: Return a pandas dataframe 
asset policy_id asset_name fingerprint quantity initial_mint_tx_hash mint_or_burn_count onchain_metadata metadata
0 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c282... 436c61794e6174696f6e37383939 asset1xkngd3y2njd3dzhfg25rtfp66gyvke6skqftxc 1 d7e089dce7c170f1af519fab710f9ed5d4d8680978035d... 1 {'name': 'Clay Nation #7899', 'image': 'ipfs:/... None

Transactions

Specific Transaction

Return content of the requested transaction.

cardano_mainnet.specific_tx(tx_hash)
{'hash': '117f97ccf6e98a16697e7cc205daf2d0bfe83d849a63df2f40d10bef235848e7',
 'block': 'ff4399874973f4eda1fe3e57be7bd47a02b610188d41993abac97605a2e7af07',
 'block_height': 6222808,
 'slot': 39646908,
 'index': 1,
 'output_amount': [{'unit': 'lovelace', 'quantity': '39793491'},
  {'unit': '40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728436c61794e6174696f6e33393836',
   'quantity': '1'}],
 'fees': '206509',
 'deposit': '0',
 'size': 924,
 'invalid_before': None,
 'invalid_hereafter': '50000000',
 'utxo_count': 3,
 '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': 1,
 'redeemer_count': 0}

Transaction UTXOs

Return the inputs and UTXOs of the specific transaction.

cardano_mainnet.tx_utxos(tx_hash)
{'hash': '117f97ccf6e98a16697e7cc205daf2d0bfe83d849a63df2f40d10bef235848e7',
 'inputs': [{'address': 'addr1vytxp3vg7gtn27zh8fa8dz677wpd2hvdz3fzzxmtgfhzmfg7d6z6g',
   'amount': [{'unit': 'lovelace', 'quantity': '40000000'}],
   'tx_hash': 'c6b37283f5051cd67338b35867105b0d5f0609430ca31b550c1068ded23a19ed',
   'output_index': 0,
   'collateral': False,
   'data_hash': None}],
 'outputs': [{'address': 'addr1qx0y89lj0tc5uzrdpq565ymcuuctw9w6kzsqrsgjfeg7hfw7rv0m0sssgyy0xaqn0h3fm8szh4hnz9myue7j3djpjf6q9rvj6c',
   'amount': [{'unit': 'lovelace', 'quantity': '37793491'}],
   'output_index': 0,
   'data_hash': None},
  {'address': 'addr1q9ylsfx9cl8npeajmzn82k2qlt6qks6mzefmdu9fh255n90qnc7ytmfse2feyp66wqajvappey935tefg5lrxxfjfcnsuhkt7p',
   'amount': [{'unit': 'lovelace', 'quantity': '2000000'},
    {'unit': '40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c28262fab21728436c61794e6174696f6e33393836',
     'quantity': '1'}],
   'output_index': 1,
   'data_hash': None}]}

Transaction Stake Addresses Certificates

Obtain information about (de)registration of stake addresses within a transaction.

cardano_mainnet.tx_stake_address_cert(stake_tx_hash,
                                      pandas=True) # Optional: Return a pandas dataframe 
cert_index address registration
0 0 stake1uyttshgm6jtejckv48tll58hfw3fg2ffrcc4d5qv... True

Transaction Delegation Certificates

Obtain information about delegation certificates of a specific transaction.

cardano_mainnet.tx_delegation_cert(stake_tx_hash,
                                   pandas=True) # Optional: Return a pandas dataframe 
index cert_index address pool_id active_epoch
0 1 1 stake1uyttshgm6jtejckv48tll58hfw3fg2ffrcc4d5qv... pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 273

Transaction Withdrawal

Obtain information about withdrawals of a specific transaction.

cardano_mainnet.tx_withdrawal_url(stake_withdrawal_tx_hash,
                                  pandas=True) # Optional: Return a pandas dataframe 
address amount
0 stake1uyttshgm6jtejckv48tll58hfw3fg2ffrcc4d5qv... 21239707

Transaction MIRs

Obtain information about Move Instantaneous Rewards (MIRs) of a specific transaction.

cardano_mainnet.tx_transaction_mirs(stake_mir_tx_hash,
                                    pandas=True) # Optional: Return a pandas dataframe
pot cert_index address amount
0 reserve 0 stake1uytqd6u9nv0tme27mew3tfcyysdz38e3v940xmph... 20345
1 reserve 0 stake1uytpqufg9zkmj6lw4t97gtwzqnl5fqfrtyxvyrt3... 102354
2 reserve 0 stake1uytpf8fksuqszgacpfhgdpvpa2phu0r72hyjat9m... 969473
3 reserve 0 stake1uytpsyyj8pz4jmk7psl3z9hclnga05xgvxkh6p70... 602920
4 reserve 0 stake1uytphp0lmjuzagh4x45favh3760dljqxcmgmpyyp... 57335

Transaction Stake Pool Registration And Update Certificates

Obtain information about stake pool registration and update certificates of a specific transaction.

cardano_mainnet.tx_stake_pool_update(stake_pool_registration_tx_hash,
                                     pandas=True) # Optional: Return a pandas dataframe
cert_index pool_id vrf_key pledge margin_cost fixed_cost reward_account owners metadata relays active_epoch
0 0 pool1ekhy5xsgjaq38em75vevk8df0k0rljju77tljw288... 5517fbeb4c6a5a613835808de183345eaf85ab0e251210... 90000000000 0.01 380000000 stake1u9qsgte62jau0qu6kjy8zch8aynt55gql6jsxe05... [stake1u9qsgte62jau0qu6kjy8zch8aynt55gql6jsxe0... {'url': 'https://meta.staking.outofbits.com/so... [{'ipv4': None, 'ipv6': None, 'dns': 'toki.rel... 210

Transaction Stake Pool Retirement Certificates

Obtain information about stake pool retirements within a specific transaction.

cardano_mainnet.tx_stake_pool_retirement_cert(tx_hash,
                                              pandas=True) # Optional: Return a pandas dataframe
import pandas as pd
pd.DataFrame.from_dict([{
"cert_index": 0,
"pool_id": "pool1ekly5isgkaq38em75vevk0df0k0rljju77tljw288ys5kumqce5",
"retiring_epoch": 280
}])
cert_index pool_id retiring_epoch
0 0 pool1ekly5isgkaq38em75vevk0df0k0rljju77tljw288... 280

Transaction Metadata

Obtain the transaction metadata.

cardano_mainnet.tx_metadata(tx_hash, 
                            pandas=True) # Optional: Return a pandas dataframe
label json_metadata
0 721 {'40fa2aa67258b4ce7b5782f74831d46a84c59a0ff0c2...

Transaction Metadata In CBOR

Obtain the transaction metadata in CBOR.

cardano_mainnet.tx_cbor_metadata(tx_hash,
                                 pandas=True) # Optional: Return a pandas dataframe
label cbor_metadata metadata
0 721 \xa11902d1a17838343066613261613637323538623463... a11902d1a1783834306661326161363732353862346365...

Transaction Redeemers

Obtain the transaction redeemers of a script.

cardano_mainnet.tx_redeemers(script_redeemer_tx_hash,
                             pandas=True)# Optional: Return a pandas dataframe
tx_index purpose unit_mem unit_steps fee
0 3 spend 8879521 2890961166 2899840687

Scripts

List Of Sripts

Obtain the list of scripts.

cardano_mainnet.scripts_list(data_order='asc', # Optional: Data order (default: Ascending)
                             nb_of_results=100, # Optional: Return max 100 results at the time (default: None), None for get all the data available.
                             pandas=True) # Optional: Return a pandas dataframe)
script_hash
0 f55dfaa24ac08874405206588859ec2804b722a51eb716...
1 1fa88319dd2d0883c1a958d26da1d358444ca95a7eef6d...
2 4f590a3d80ae0312bad0b64d540c3ff5080e77250e9dbf...
3 cc7888851f0f5aa64c136e0c8fb251e9702f3f6c9efcf3...
4 81e9ffa364de993fbf2034f6db139adfd65eb69669b361...

Specific Script

Information about a specific script.

cardano_mainnet.specific_script(script_tx_hash)
{'script_hash': 'cc7888851f0f5aa64c136e0c8fb251e9702f3f6c9efcf3a60a54f419',
 'type': 'plutus',
 'serialised_size': 3046}

Redeemers Of A Specific Script

List of redeemers of a specific script

cardano_mainnet.redeem_specific_script(script_hash)
{'tx_hash': {0: 'e9d20746cec2d506a5ae201adbfec13ef20279b689f0612cc3802274ce4da2ce'},
 'tx_index': {0: 0},
 'purpose': {0: 'mint'},
 'unit_mem': {0: '1106480'},
 'unit_steps': {0: '397329109'},
 'fee': {0: '398435589'}}

Developing

Tests run assuming you have set the API key in the environment variable BLOCKFROST_API_KEY, otherwise they will error.

python setup.py pytest

Credit

Donate

If this wrapper has been useful to you, feel free to put a star or donate (ADA) at this address 😊.

wallet address

Thank you.

Disclaimer

The project is still under development, If you find bugs or want additional features, open an issue and/or create a pull request.

About

Python wrapper for accessing and processing information stored on the Cardano blockchain using Blockfrost API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published