Skip to content

cardano-apexpool/koios-api-python

Repository files navigation

koios-api-python

A python package for the Cardano Blockchain Koios API.

Install

To install the module, type the following command:

pip3 install koios_api

Environment

By default, koios_api works with mainnet, but it can also work with the preview and preprod testnets, and even with custom Api URLs (because anyone can install an own Koios Api). To use a testnet you can set the environment variable:

#preprod
export CARDANO_NET=preprod
#preview
export CARDANO_NET=preview

To work with a custom Api URL, set the environment variable:

export API_BASE_URL=https://custom.url/api/v1

By default, the requests are unauthenticated (public tier), and there is a low limit of requests you can make. In order to increase the number of requests, you can authenticate using an API Token that you can obtain from the pricing page after connecting your wallet and signing a message to prove the ownership on the wallet. There is also a free tier with 10x more requests than the public tier. You need to set the API Token in the KOIOS_API_TOKEN environment variable in order to use it, otherwise the public tier is used.

export KOIOS_API_TOKEN="your Koios API Token here"

Other environment variables that can be set, and their default versions, are:

SLEEP_TIME=1
API_RESP_COUNT=1000
REQUEST_TIMEOUT=60

SLEEP_TIME is the time between retries after an API errors. API_RESP_COUNT is the maximum number of records the API should return (1000 is the absolute maximum supported by the Koios API). REQUEST_TIMEOUT is the timeout for get and post requests to the Koios API.

Using the module

Importing the complete module:

import koios_api
koios_api.get_tip()

The result will be like this:

[
  {
    "hash": "442765ab5660346a6af3ba7667bbd35934e6219a52f0f53a80f28d27a70309c1",
    "epoch_no": 381,
    "abs_slot": 79265882,
    "epoch_slot": 37082,
    "block_no": 8129347,
    "block_time": 1670832173
  }
]

Import only specific functions:

from koios_api.network import get_tip
get_tip()

The result will be identical.

Modules

Network
get_tip Get the tip info about the latest block seen by chain
get_genesis Get the Genesis parameters used to start specific
era on chain
get_totals Get the circulating utxo, treasury, rewards, supply and reserves in lovelace for specified epoch, all epochs if empty
get_param_updates Get all parameter update proposals submitted to the chain starting Shelley era
get_reserve_withdrawals List of all withdrawals from reserves against stake accounts
get_treasury_withdrawals List of all withdrawals from treasury against stake accounts

Epoch
get_epoch_info Get the epoch information, all epochs if no epoch specified
get_epoch_params Get the protocol parameters for specific epoch, returns information about all epochs if no epoch specified
get_epoch_block_protocols Get the information about block protocol distribution in epoch

Block
get_blocks Get summarised details about all blocks (paginated, the latest first)
get_block_info Get detailed information about a specific block
get_block_txs Get a list of all transactions included in provided blocks

Transactions
get_utxo_info Get UTxO set for requested UTxO references
get_tx_info Get detailed information about transaction(s)
get_tx_metadata Get metadata information (if any) for given transaction(s)
get_tx_metalabels Get a list of all transaction metadata labels
submit_tx Submit an already serialized transaction to the network
get_tx_status Get the number of block confirmations for a given transaction hash list\

Stake Account
get_account_list Get a list of all accounts
get_account_info Get the account information for given stake addresses (accounts)
get_account_info_cached Get the cached account information for given stake addresses (accounts)
get_account_utxos Get a list of all Txs for a given stake address (account)
get_account_txs Get a list of all UTxOs for a given stake address (account)
get_account_rewards Get the full rewards history (including MIR) for given stake addresses (accounts)
get_account_updates Get the account updates (registration, deregistration, delegation and withdrawals) for given stake addresses (accounts)
get_account_addresses Get all addresses associated with given staking accounts
get_account_assets Get the native asset balance of given accounts
get_account_history Get the staking history of given stake addresses (accounts)

Address
get_address_info Get the transaction hash list of input address array, optionally filtering after specified block height (inclusive)
get_address_utxos Get UTxO set for given addresses
get_credential_utxos Get a list of UTxO against input payment credential array including their balances
get_address_txs Get the transaction hash list of input address array, optionally filtering after specified block height (inclusive)
get_credential_txs Get the transaction hash list of input payment credential array, optionally filtering after specified block height (inclusive)
get_address_assets Get the list of all the assets (policy, name and quantity) for given addresses

Asset
get_asset_list Get the list of all native assets (paginated)
get_policy_asset_list Get the list of asset under the given policy (including balances)
get_asset_token_registry Get a list of assets registered via token registry on github
get_asset_info Get the information of a list of assets including first minting & token registry metadata
get_asset_utxos Get the UTXO information of a list of assets
get_asset_history Get the mint/burn history of an asset
get_asset_addresses Get the list of all addresses holding a given asset
get_asset_nft_address Get the address where specified NFT currently reside on.
get_policy_asset_addresses Get the list of addresses with quantity for each asset on the given policy
get_policy_asset_info Get the information for all assets under the same policy
get_asset_summary Get the summary of an asset (total transactions exclude minting/total wallets include only wallets with asset balance)
get_asset_txs Get the list of all asset transaction hashes (the newest first)\

Pool
get_pool_list A list of all currently registered/retiring (not retired) pools
get_pool_info Current pool statuses and details for a specified list of pool ids
get_pool_stake_snapshot Returns Mark, Set and Go stake snapshots for the selected pool, useful for leaderlog calculation
get_pool_delegators Returns information about live delegators for a given pool
get_pool_delegators_history Returns information about active delegators (incl. history) for a given pool and epoch number (all epochs if not specified)
get_pool_blocks Returns information about blocks minted by a given pool for all epochs (or _epoch_no if provided)
get_pool_history Returns information about pool stake, block and reward history in a given epoch (or all epochs that pool existed for, in descending order if no epoch number was provided)
get_pool_updates Returns all pool updates for all pools or only updates for specific pool if specified
get_pool_registrations Return all pool registrations initiated in the requested epoch
get_pool_retirements Return all pool retirements initiated in the requested epoch
get_pool_relays A list of registered relays for all currently registered/retiring (not retired) pools
get_pool_metadata A list of registered relays for all currently registered/retiring (not retired) pools
get_retiring_pools Get the retiring stake pools list

Script
get_script_info List of script information for given script hashes
get_native_script_list The list of all existing native script hashes along with their creation transaction hashes
get_plutus_script_list The list of all existing native script hashes along with their creation transaction hashes
get_script_redeemers The list of all redeemers for a given script hash
get_script_utxos List of all UTXOs for a given script hash
get_datum_info The list of datum information for given datum hashes

Stake_Account

get_account_list

Get a list of all accounts
Parameters:
The offset (optional) to start from, default 0
The maximum number of accounts to return (optional), default 0 (no limit)
Returns: The list of accounts dictionaries
This takes a very long time to execute (about one hour), because the total number of accounts is in the millions range.
Example:
account_list = get_account_list()
Example response:

[
  {
    "id": "stake1uyfmzu5qqy70a8kq4c8rw09q0w0ktfcxppwujejnsh6tyrg5c774g"
  },
  {
    "id": "stake1uydhlh7f2kkw9eazct5zyzlrvj32gjnkmt2v5qf6t8rut4qwch8ey"
  },
  {
    "id": "stake1uxsgkz6fvgws5wn80vckwvghzapnhfmf0672nmmkm2tt9fcaau5sw"
  },
  ...
]

get_account_info

Get the account information for given stake addresses (accounts)
Parameters: Stake address(es), as a string (for one address) or a list (for multiple addresses)
Returns: The list of account information dictionaries
Example:
account_info = get_account_info('stake1uy4jj73pfyejl4d2rs6nc70eykkhhu56p3y2rj2tdayfzeqnjyh0j')
Example response:

[
  {
    "stake_address": "stake1uy4jj73pfyejl4d2rs6nc70eykkhhu56p3y2rj2tdayfzeqnjyh0j",
    "status": "registered",
    "delegated_pool": "pool18r2y72aue5nmv489xtnfxl36vzusq95qst6urd87yd5hgzms04c",
    "total_balance": "20418617",
    "utxo": "20418617",
    "rewards": "0",
    "withdrawals": "0",
    "rewards_available": "0",
    "reserves": "0",
    "treasury": "0"
  }
]

get_account_info_cached

Get the cached account information for given stake addresses (accounts)
Parameters: Stake address(es), as a string (for one address) or a list (for multiple addresses)
Returns: The list of account information dictionaries
Example:
account_info_cached = get_account_info_cached('stake1uy4jj73pfyejl4d2rs6nc70eykkhhu56p3y2rj2tdayfzeqnjyh0j')
Example response:

[
  {
    "stake_address": "stake1uy4jj73pfyejl4d2rs6nc70eykkhhu56p3y2rj2tdayfzeqnjyh0j",
    "status": "registered",
    "delegated_pool": "pool18r2y72aue5nmv489xtnfxl36vzusq95qst6urd87yd5hgzms04c",
    "total_balance": "20418617",
    "utxo": "20418617",
    "rewards": "0",
    "withdrawals": "0",
    "rewards_available": "0",
    "reserves": "0",
    "treasury": "0"
  }
]

get_account_utxos

Get a list of all UTxOs for given stake addresses (account)s
Parameters: Stake address
Returns: The list of all UTxOs at all payment addresses associated with the stake address
Example:
account_utxos = get_account_utxos('stake1ux5r7myfhycj234wpqyhh3h8skgwvq0hsstpw52f66857uq95cas6') Example response:

[
  {
    "tx_hash": "215bcaa7b13c491db28d5525d9b2a13a7d8ddabd563da8113a449ab33a6a60be",
    "tx_index": 2,
    "address": "addr1q9dwzug2qzdsqvpvrn886nqdtwr02n9kxtwqsxce2gacvedg8akgnwf3y4r2uzqf00rw0pvsucql0pqkzag5n450facqeuerev",
    "value": "85813474",
    "block_height": 8214437,
    "block_time": 1672580966
  },
  {
    "tx_hash": "1eb26dce2f471fbe32aa8cb303f5e8d8078d1da4dbbb78a7bc135036bb3f2f9c",
    "tx_index": 0,
    "address": "addr1q88u9gz83nhs9p5pud9kyucx8sg0ygae2p9a4g2p2y55c4ag8akgnwf3y4r2uzqf00rw0pvsucql0pqkzag5n450facqqyd2n7",
    "value": "110094569",
    "block_height": 8406870,
    "block_time": 1676555396
  },
  {
    "tx_hash": "d530de851c2f867f2174c1073b04bdb9f2e2d16029fcfb488e8150ba66976d43",
    "tx_index": 0,
    "address": "addr1qxyp2wsafavj47dpc6uqgqx8se3969jn4crfk7y4zwd7vfag8akgnwf3y4r2uzqf00rw0pvsucql0pqkzag5n450facqlyvudm",
    "value": "1249900",
    "block_height": 8489290,
    "block_time": 1678248733
  },
  ...
  {
    "tx_hash": "d8e3ca8b36f9a785ff33f01aa5460f9248ea94acd621ea187093206b04aa6e30",
    "tx_index": 0,
    "address": "addr1q8txa88kt6rpdv3zzn8ghx7u4udf6rpj690rfdvlqn35fldg8akgnwf3y4r2uzqf00rw0pvsucql0pqkzag5n450facqplx97u",
    "value": "54000000",
    "block_height": 8759577,
    "block_time": 1683809438
  }
]

get_account_txs

Get a list of all Txs for a given stake address (account)
Parameters: Stake address
Returns: The list of all transaction hashes for all payment addresses associated with the stake address
Example:
account_txs = get_account_txs('stake1uyrx65wjqjgeeksd8hptmcgl5jfyrqkfq0xe8xlp367kphsckq250') Example response:

[
  {
    "tx_hash": "5e209eee15637645198ddf22f84f905d50b6103661da98597eb6da0ef7245fa1",
    "epoch_no": 251,
    "block_height": 5427308,
    "block_time": 1615051845
  },
  {
    "tx_hash": "a6981b394e5cf9b801d2c81b81b5aecaf556abd8eca5a00067e2d53c2f6eebab",
    "epoch_no": 251,
    "block_height": 5427334,
    "block_time": 1615052248
  },
  {
    "tx_hash": "e9504ad3c28120abb0fab3504f09a4f9f203c62159a53d74eb8e206fda2cd4b5",
    "epoch_no": 252,
    "block_height": 5431176,
    "block_time": 1615130928
  },
  {
    "tx_hash": "7605d6442d46bb2de29f251f893b8ddccd424ad107240e787dda0bfcb552713c",
    "epoch_no": 252,
    "block_height": 5433510,
    "block_time": 1615179291
  },
  {
    "tx_hash": "645ed2e34370b0d8c1385c07d3a85b337ef6982e2686528c4b90ecaef6b3c35b",
    "epoch_no": 252,
    "block_height": 5436849,
    "block_time": 1615247429
  },
  ...
]

get_account_rewards

Get the full rewards history (including MIR) for given stake addresses (accounts)
Parameters:
Stake address(es), as a string (for one address) or a list (for multiple addresses)
Epoch (optional), default: current epoch
Returns: The list of rewards dictionaries by account (stake address)
Example:
account_rewards = get_account_rewards('stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z')
Example response:

[
  {
    "stake_address": "stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z",
    "rewards": [
      {
        "earned_epoch": 233,
        "spendable_epoch": 235,
        "amount": "3990414",
        "type": "member",
        "pool_id": "pool1jdhjfcu34lq88rypdtslzwyf27uh0h3apcr9mjd68zhc69r29fy"
      },
      {
        "earned_epoch": 234,
        "spendable_epoch": 236,
        "amount": "2792902",
        "type": "member",
        "pool_id": "pool1jdhjfcu34lq88rypdtslzwyf27uh0h3apcr9mjd68zhc69r29fy"
      },
      ...
      {
        "earned_epoch": 379,
        "spendable_epoch": 381,
        "amount": "6496870",
        "type": "member",
        "pool_id": "pool12wpfng6cu7dz38yduaul3ngfm44xhv5xmech68m5fwe4wu77udd"
      }
    ]
  }
]

get_account_updates

Get the account updates (registration, deregistration, delegation and withdrawals) for given stake addresses (accounts)
Parameters: Stake address(es), as a string (for one address) or a list (for multiple addresses)
Returns: The list of account updates dictionaries by account (stake address)
Example:
account_updates = get_account_updates('stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z')
Example response:

[
  {
    "stake_address": "stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z",
    "updates": [
      {
        "action_type": "withdrawal",
        "tx_hash": "487bc75f00fe934dad33683271cca8540fe868eef7025962678f179a1a111ecc",
        "epoch_no": 324,
        "epoch_slot": 70687,
        "absolute_slot": 54675487,
        "block_time": 1646241778
      },
      {
        "action_type": "withdrawal",
        "tx_hash": "eb3ffa01f434e210716151fd9001af82529e371a91c20af02512942f988a2119",
        "epoch_no": 269,
        "epoch_slot": 339679,
        "absolute_slot": 31184479,
        "block_time": 1622750770
      },
      ...
      {
        "action_type": "withdrawal",
        "tx_hash": "b056dcbff9b908e1bd3ed015466f64486538058ba3553dbf885b216d88343370",
        "epoch_no": 252,
        "epoch_slot": 58375,
        "absolute_slot": 23559175,
        "block_time": 1615125466
      }
    ]
  }
]

get_account_addresses

Get all addresses associated with given staking accounts
Parameters:
Stake address(es), as a string (for one address) or a list (for multiple addresses)
First Only boolean (optional): Only return the first result (default False)
Empty boolean (optional): Include zero quantity entries (default True)
Returns: The list of addresses dictionaries by account (stake address)
Example:
account_addresses = get_account_addresses('stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z')
Example response:

[
  {
    "stake_address": "stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z",
    "addresses": [
      "addr1qxwjxvzv8rmyutcjp0647w4n05wv7aez9jdmqcxn8a9sshll0qre4udr9ny9sj8020uxher08k44ssl9pxlk3w5f4x2qjyz9yf"
    ]
  }
]

get_account_assets

Get the native asset balance of given accounts
Parameters: Stake address(es), as a string (for one address) or a list (for multiple addresses)
Returns: The list of account assets dictionaries by account (stake address)
Example:
account_assets = get_account_assets('stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z')
Example response:

[
  {
    "stake_address": "stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z",
    "asset_list": [
      {
        "policy_id": "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913",
        "asset_name": "6c70202302",
        "fingerprint": "asset1awuysx8hc686uz0dykmvmc7jfut2ulceucf6yc",
        "quantity": "418089787"
      },
      {
        "policy_id": "0029cb7c88c7567b63d1a512c0ed626aa169688ec980730c0473b913",
        "asset_name": "6c7020f302",
        "fingerprint": "asset1mcq0awl6awlaqg0ywukf94q0mnau263l9rght5",
        "quantity": "586811406"
      },
      ...
      {
        "policy_id": "ea2d23f1fa631b414252824c153f2d6ba833506477a929770a4dd9c2",
        "asset_name": "4d414442554c",
        "fingerprint": "asset1q0kwjy669gmsqpvxp4lr0sp26pdm0dafme3qp2",
        "quantity": "500"
      }
    ]
  }
]

get_account_history

Get the staking history of given stake addresses (accounts)
Parameters: Stake address(es), as a string (for one address) or a list (for multiple addresses)
Returns: The list of staking history dictionaries by account (stake address)
Example:
account_history = get_account_history('stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z')
Example response:

[
  {
    "stake_address": "stake1u8lhspu67x3jejzcfrh487rtu3hnm26cg0jsn0mgh2y6n9q9ve26z",
    "history": [
      {
        "pool_id": "pool1jdhjfcu34lq88rypdtslzwyf27uh0h3apcr9mjd68zhc69r29fy",
        "epoch_no": 233,
        "active_stake": "4655706122"
      },
      {
        "pool_id": "pool1jdhjfcu34lq88rypdtslzwyf27uh0h3apcr9mjd68zhc69r29fy",
        "epoch_no": 234,
        "active_stake": "5020706122"
      },
      ...
      {
        "pool_id": "pool12wpfng6cu7dz38yduaul3ngfm44xhv5xmech68m5fwe4wu77udd",
        "epoch_no": 381,
        "active_stake": "10247851319"
      }
    ]
  }
]

Network

get_tip

Get the tip info about the latest block seen by chain
Parameters: none
Returns: The tip information as a list of one dictionary
Example:
tip = get_tip()
Example response:

[
  {
    "hash": "442765ab5660346a6af3ba7667bbd35934e6219a52f0f53a80f28d27a70309c1",
    "epoch_no": 381,
    "abs_slot": 79265882,
    "epoch_slot": 37082,
    "block_no": 8129347,
    "block_time": 1670832173
  }
]

get_genesis

Get the Genesis parameters used to start specific era on chain
Parameters: none
Returns: Genesis parameters used to start each era on chain as a list of one dictionary
Example:
genesis = get_genesis()
Example response:

[
  {
    "networkmagic": "764824073",
    "networkid": "Mainnet",
    "activeslotcoeff": "0.05",
    "updatequorum": "5",
    "maxlovelacesupply": "45000000000000000",
    "epochlength": "432000",
    "systemstart": 1506203091,
    "slotsperkesperiod": "129600",
    "slotlength": "1",
    "maxkesrevolutions": "62",
    "securityparam": "2160",
    "alonzogenesis": "{\"lovelacePerUTxOWord\":34482,\"executionPrices\":{\"prSteps\":{\"numerator\":721,\"denominator\":10000000},\"prMem\":{\"numerator\":577,\"denominator\":10000}},\"maxTxExUnits\":{\"exUnitsMem\":10000000,\"exUnitsSteps\":10000000000},\"maxBlockExUnits\":{\"exUnitsMem\":50000000,\"exUnitsSteps\":40000000000},\"maxValueSize\":5000,\"collateralPercentage\":150,\"maxCollateralInputs\":3,\"costModels\":{\"PlutusV1\":{\"sha2_256-memory-arguments\":4,\"equalsString-cpu-arguments-constant\":1000,\"cekDelayCost-exBudgetMemory\":100,\"lessThanEqualsByteString-cpu-arguments-intercept\":103599,\"divideInteger-memory-arguments-minimum\":1,\"appendByteString-cpu-arguments-slope\":621,\"blake2b-cpu-arguments-slope\":29175,\"iData-cpu-arguments\":150000,\"encodeUtf8-cpu-arguments-slope\":1000,\"unBData-cpu-arguments\":150000,\"multiplyInteger-cpu-arguments-intercept\":61516,\"cekConstCost-exBudgetMemory\":100,\"nullList-cpu-arguments\":150000,\"equalsString-cpu-arguments-intercept\":150000,\"trace-cpu-arguments\":150000,\"mkNilData-memory-arguments\":32,\"lengthOfByteString-cpu-arguments\":150000,\"cekBuiltinCost-exBudgetCPU\":29773,\"bData-cpu-arguments\":150000,\"subtractInteger-cpu-arguments-slope\":0,\"unIData-cpu-arguments\":150000,\"consByteString-memory-arguments-intercept\":0,\"divideInteger-memory-arguments-slope\":1,\"divideInteger-cpu-arguments-model-arguments-slope\":118,\"listData-cpu-arguments\":150000,\"headList-cpu-arguments\":150000,\"chooseData-memory-arguments\":32,\"equalsInteger-cpu-arguments-intercept\":136542,\"sha3_256-cpu-arguments-slope\":82363,\"sliceByteString-cpu-arguments-slope\":5000,\"unMapData-cpu-arguments\":150000,\"lessThanInteger-cpu-arguments-intercept\":179690,\"mkCons-cpu-arguments\":150000,\"appendString-memory-arguments-intercept\":0,\"modInteger-cpu-arguments-model-arguments-slope\":118,\"ifThenElse-cpu-arguments\":1,\"mkNilPairData-cpu-arguments\":150000,\"lessThanEqualsInteger-cpu-arguments-intercept\":145276,\"addInteger-memory-arguments-slope\":1,\"chooseList-memory-arguments\":32,\"constrData-memory-arguments\":32,\"decodeUtf8-cpu-arguments-intercept\":150000,\"equalsData-memory-arguments\":1,\"subtractInteger-memory-arguments-slope\":1,\"appendByteString-memory-arguments-intercept\":0,\"lengthOfByteString-memory-arguments\":4,\"headList-memory-arguments\":32,\"listData-memory-arguments\":32,\"consByteString-cpu-arguments-intercept\":150000,\"unIData-memory-arguments\":32,\"remainderInteger-memory-arguments-minimum\":1,\"bData-memory-arguments\":32,\"lessThanByteString-cpu-arguments-slope\":248,\"encodeUtf8-memory-arguments-intercept\":0,\"cekStartupCost-exBudgetCPU\":100,\"multiplyInteger-memory-arguments-intercept\":0,\"unListData-memory-arguments\":32,\"remainderInteger-cpu-arguments-model-arguments-slope\":118,\"cekVarCost-exBudgetCPU\":29773,\"remainderInteger-memory-arguments-slope\":1,\"cekForceCost-exBudgetCPU\":29773,\"sha2_256-cpu-arguments-slope\":29175,\"equalsInteger-memory-arguments\":1,\"indexByteString-memory-arguments\":1,\"addInteger-memory-arguments-intercept\":1,\"chooseUnit-cpu-arguments\":150000,\"sndPair-cpu-arguments\":150000,\"cekLamCost-exBudgetCPU\":29773,\"fstPair-cpu-arguments\":150000,\"quotientInteger-memory-arguments-minimum\":1,\"decodeUtf8-cpu-arguments-slope\":1000,\"lessThanInteger-memory-arguments\":1,\"lessThanEqualsInteger-cpu-arguments-slope\":1366,\"fstPair-memory-arguments\":32,\"modInteger-memory-arguments-intercept\":0,\"unConstrData-cpu-arguments\":150000,\"lessThanEqualsInteger-memory-arguments\":1,\"chooseUnit-memory-arguments\":32,\"sndPair-memory-arguments\":32,\"addInteger-cpu-arguments-intercept\":197209,\"decodeUtf8-memory-arguments-slope\":8,\"equalsData-cpu-arguments-intercept\":150000,\"mapData-cpu-arguments\":150000,\"mkPairData-cpu-arguments\":150000,\"quotientInteger-cpu-arguments-constant\":148000,\"consByteString-memory-arguments-slope\":1,\"cekVarCost-exBudgetMemory\":100,\"indexByteString-cpu-arguments\":150000,\"unListData-cpu-arguments\":150000,\"equalsInteger-cpu-arguments-slope\":1326,\"cekStartupCost-exBudgetMemory\":100,\"subtractInteger-cpu-arguments-intercept\":197209,\"divideInteger-cpu-arguments-model-arguments-intercept\":425507,\"divideInteger-memory-arguments-intercept\":0,\"cekForceCost-exBudgetMemory\":100,\"blake2b-cpu-arguments-intercept\":2477736,\"remainderInteger-cpu-arguments-constant\":148000,\"tailList-cpu-arguments\":150000,\"encodeUtf8-cpu-arguments-intercept\":150000,\"equalsString-cpu-arguments-slope\":1000,\"lessThanByteString-memory-arguments\":1,\"multiplyInteger-cpu-arguments-slope\":11218,\"appendByteString-cpu-arguments-intercept\":396231,\"lessThanEqualsByteString-cpu-arguments-slope\":248,\"modInteger-memory-arguments-slope\":1,\"addInteger-cpu-arguments-slope\":0,\"equalsData-cpu-arguments-slope\":10000,\"decodeUtf8-memory-arguments-intercept\":0,\"chooseList-cpu-arguments\":150000,\"constrData-cpu-arguments\":150000,\"equalsByteString-memory-arguments\":1,\"cekApplyCost-exBudgetCPU\":29773,\"quotientInteger-memory-arguments-slope\":1,\"verifySignature-cpu-arguments-intercept\":3345831,\"unMapData-memory-arguments\":32,\"mkCons-memory-arguments\":32,\"sliceByteString-memory-arguments-slope\":1,\"sha3_256-memory-arguments\":4,\"ifThenElse-memory-arguments\":1,\"mkNilPairData-memory-arguments\":32,\"equalsByteString-cpu-arguments-slope\":247,\"appendString-cpu-arguments-intercept\":150000,\"quotientInteger-cpu-arguments-model-arguments-slope\":118,\"cekApplyCost-exBudgetMemory\":100,\"equalsString-memory-arguments\":1,\"multiplyInteger-memory-arguments-slope\":1,\"cekBuiltinCost-exBudgetMemory\":100,\"remainderInteger-memory-arguments-intercept\":0,\"sha2_256-cpu-arguments-intercept\":2477736,\"remainderInteger-cpu-arguments-model-arguments-intercept\":425507,\"lessThanEqualsByteString-memory-arguments\":1,\"tailList-memory-arguments\":32,\"mkNilData-cpu-arguments\":150000,\"chooseData-cpu-arguments\":150000,\"unBData-memory-arguments\":32,\"blake2b-memory-arguments\":4,\"iData-memory-arguments\":32,\"nullList-memory-arguments\":32,\"cekDelayCost-exBudgetCPU\":29773,\"subtractInteger-memory-arguments-intercept\":1,\"lessThanByteString-cpu-arguments-intercept\":103599,\"consByteString-cpu-arguments-slope\":1000,\"appendByteString-memory-arguments-slope\":1,\"trace-memory-arguments\":32,\"divideInteger-cpu-arguments-constant\":148000,\"cekConstCost-exBudgetCPU\":29773,\"encodeUtf8-memory-arguments-slope\":8,\"quotientInteger-cpu-arguments-model-arguments-intercept\":425507,\"mapData-memory-arguments\":32,\"appendString-cpu-arguments-slope\":1000,\"modInteger-cpu-arguments-constant\":148000,\"verifySignature-cpu-arguments-slope\":1,\"unConstrData-memory-arguments\":32,\"quotientInteger-memory-arguments-intercept\":0,\"equalsByteString-cpu-arguments-constant\":150000,\"sliceByteString-memory-arguments-intercept\":0,\"mkPairData-memory-arguments\":32,\"equalsByteString-cpu-arguments-intercept\":112536,\"appendString-memory-arguments-slope\":1,\"lessThanInteger-cpu-arguments-slope\":497,\"modInteger-cpu-arguments-model-arguments-intercept\":425507,\"modInteger-memory-arguments-minimum\":1,\"sha3_256-cpu-arguments-intercept\":0,\"verifySignature-memory-arguments\":1,\"cekLamCost-exBudgetMemory\":100,\"sliceByteString-cpu-arguments-intercept\":150000}}}"
  }
]

get_totals

Get the circulating utxo, treasury, rewards, supply and reserves in lovelace for specified epoch, all epochs if empty
Parameters: Epoch (optional)
Returns: Supply/reserves/utxo/fees/treasury stats as a list of one dictionary (if the epoch is specified) or a list of all available epochs (if the epoch parameter is not specified)
Example:
totals = get_totals(380)
Example response:

[
  {
    "epoch_no": 380,
    "circulation": "33505907705011256",
    "treasury": "1085266054287657",
    "reward": "635180192555825",
    "supply": "35230640457275590",
    "reserves": "9769359542724410"
  }
]

get_param_updates

Get all parameter update proposals submitted to the chain starting Shelley era
Parameters: none
Returns: All parameter update proposals
Example:
param_updates = get_param_updates()

[
  {
    "tx_hash": "b516588da34b58b7d32b6a057f513e16ea8c87de46615631be3316d8a8847d46",
    "block_height": 4533644,
    "block_time": 1596923351,
    "epoch_no": 210,
    "data": {
      "decentralisation": 0.9
    }
  },
  {
    "tx_hash": "784902982af484f78d10f1587072f5a6b888ed0c1296d4ecf1e21c0251696ca1",
    "block_height": 4558648,
    "block_time": 1597425824,
    "epoch_no": 211,
    "data": {
      "decentralisation": 0.8
    }
  },
  ...
]

get_reserve_withdrawals

List of all withdrawals from reserves against stake accounts
Parameters: none
Returns: The list of withdrawals from reserves against stake accounts
Example:\

reserve_withdrawals = get_reserve_withdrawals()

[
  {
    "epoch_no": 298,
    "epoch_slot": 60492,
    "tx_hash": "03b02cff29a5f2dfc827e00345eaab8b29a3d740e9878aa6e5dd2b52da0763c5",
    "block_hash": "7650ae0c9508fd236f370f1ac329b2d4ae0f8bcf583f2878dbb568c311d08c7c",
    "block_height": 6407962,
    "amount": "66000000000000",
    "stake_address": "stake1uykws5pmwjxktdhlkz0pac3cu2guw6fjys2zaanmdew6xrs5lgv4n"
  }
]

get_treasury_withdrawals

List of all withdrawals from treasury against stake accounts
Parameters: none
Returns: The list of withdrawals from treasury against stake accounts
Example:\

treasury_withdrawals = get_treasury_withdrawals()

[
  {
    "epoch_no": 441,
    "epoch_slot": 152858,
    "tx_hash": "d689bee077e69269ea7e9e8f5b09f5f93af887c117cd7a1157d09bec209900dd",
    "block_hash": "18add9785eeaacbe0534cf362cd49e78170f23a3a91b862ef5ba2ad444bc2766",
    "block_height": 9394726,
    "amount": "50000000000000",
    "stake_address": "stake1uxv9hwk8523p3asgnnjv0t49qvmlj96j22dw434j2gyks2qn9x52u"
  }
]

Epoch

get_epoch_info

Get the epoch information, all epochs if no epoch specified
Parameters: Epoch (optional)
Returns: The list of epoch info dictionaries
Example:
epoch_info = get_epoch_info(448)
Example response:

[
  {
    "epoch_no": 448,
    "out_sum": "118059162440190062",
    "fees": "102026957711",
    "tx_count": 293835,
    "blk_count": 21134,
    "start_time": 1699739091,
    "end_time": 1700171091,
    "first_block_time": 1699739174,
    "last_block_time": 1700171052,
    "active_stake": "22973647281453944",
    "total_rewards": "10027944051413",
    "avg_blk_reward": "474493425"
  }
]

get_epoch_params

Get the protocol parameters for specific epoch, returns information about all epochs if no epoch specified
Parameters: Epoch (optional)
Returns: The list of epoch protocol parameters dictionaries
Example:
epoch_params = get_epoch_params(448)
Example response:

[
  {
    "epoch_no": 448,
    "min_fee_a": 44,
    "min_fee_b": 155381,
    "max_block_size": 90112,
    "max_tx_size": 16384,
    "max_bh_size": 1100,
    "key_deposit": "2000000",
    "pool_deposit": "500000000",
    "max_epoch": 18,
    "optimal_pool_count": 500,
    "influence": 0.3,
    "monetary_expand_rate": 0.003,
    "treasury_growth_rate": 0.2,
    "decentralisation": 0,
    "extra_entropy": null,
    "protocol_major": 8,
    "protocol_minor": 0,
    "min_utxo_value": "0",
    "min_pool_cost": "170000000",
    "nonce": "d58c8fdf57a9d20b4e72fce94056ad2ed2b62e40a7b0b35e1f37f267f9546c07",
    "block_hash": "a74c031d215542d19fdafee6a28fde865c5961d296759e0ae9d19d50aa6f8a12",
    "cost_models": {
      "PlutusV1": [
        205665,
        812,
        1,
        1,
        1000,
        571,
        0,
        1,
        1000,
        24177,
        4,
        1,
        1000,
        32,
        117366,
        10475,
        4,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        100,
        100,
        23000,
        100,
        19537,
        32,
        175354,
        32,
        46417,
        4,
        221973,
        511,
        0,
        1,
        89141,
        32,
        497525,
        14068,
        4,
        2,
        196500,
        453240,
        220,
        0,
        1,
        1,
        1000,
        28662,
        4,
        2,
        245000,
        216773,
        62,
        1,
        1060367,
        12586,
        1,
        208512,
        421,
        1,
        187000,
        1000,
        52998,
        1,
        80436,
        32,
        43249,
        32,
        1000,
        32,
        80556,
        1,
        57667,
        4,
        1000,
        10,
        197145,
        156,
        1,
        197145,
        156,
        1,
        204924,
        473,
        1,
        208896,
        511,
        1,
        52467,
        32,
        64832,
        32,
        65493,
        32,
        22558,
        32,
        16563,
        32,
        76511,
        32,
        196500,
        453240,
        220,
        0,
        1,
        1,
        69522,
        11687,
        0,
        1,
        60091,
        32,
        196500,
        453240,
        220,
        0,
        1,
        1,
        196500,
        453240,
        220,
        0,
        1,
        1,
        806990,
        30482,
        4,
        1927926,
        82523,
        4,
        265318,
        0,
        4,
        0,
        85931,
        32,
        205665,
        812,
        1,
        1,
        41182,
        32,
        212342,
        32,
        31220,
        32,
        32696,
        32,
        43357,
        32,
        32247,
        32,
        38314,
        32,
        57996947,
        18975,
        10
      ],
      "PlutusV2": [
        205665,
        812,
        1,
        1,
        1000,
        571,
        0,
        1,
        1000,
        24177,
        4,
        1,
        1000,
        32,
        117366,
        10475,
        4,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        23000,
        100,
        100,
        100,
        23000,
        100,
        19537,
        32,
        175354,
        32,
        46417,
        4,
        221973,
        511,
        0,
        1,
        89141,
        32,
        497525,
        14068,
        4,
        2,
        196500,
        453240,
        220,
        0,
        1,
        1,
        1000,
        28662,
        4,
        2,
        245000,
        216773,
        62,
        1,
        1060367,
        12586,
        1,
        208512,
        421,
        1,
        187000,
        1000,
        52998,
        1,
        80436,
        32,
        43249,
        32,
        1000,
        32,
        80556,
        1,
        57667,
        4,
        1000,
        10,
        197145,
        156,
        1,
        197145,
        156,
        1,
        204924,
        473,
        1,
        208896,
        511,
        1,
        52467,
        32,
        64832,
        32,
        65493,
        32,
        22558,
        32,
        16563,
        32,
        76511,
        32,
        196500,
        453240,
        220,
        0,
        1,
        1,
        69522,
        11687,
        0,
        1,
        60091,
        32,
        196500,
        453240,
        220,
        0,
        1,
        1,
        196500,
        453240,
        220,
        0,
        1,
        1,
        1159724,
        392670,
        0,
        2,
        806990,
        30482,
        4,
        1927926,
        82523,
        4,
        265318,
        0,
        4,
        0,
        85931,
        32,
        205665,
        812,
        1,
        1,
        41182,
        32,
        212342,
        32,
        31220,
        32,
        32696,
        32,
        43357,
        32,
        32247,
        32,
        38314,
        32,
        35892428,
        10,
        57996947,
        18975,
        10,
        38887044,
        32947,
        10
      ]
    },
    "price_mem": 0.0577,
    "price_step": 7.21e-05,
    "max_tx_ex_mem": 14000000,
    "max_tx_ex_steps": 10000000000,
    "max_block_ex_mem": 62000000,
    "max_block_ex_steps": 20000000000,
    "max_val_size": 5000,
    "collateral_percent": 150,
    "max_collateral_inputs": 3,
    "coins_per_utxo_size": "4310"
  }
]

get_epoch_block_protocols

Get the information about block protocol distribution in epoch
Parameters: Epoch (optional)
Returns: The list of epoch protocol distribution dictionaries
Example:
epoch_block_protocols = get_epoch_block_protocols(380)
Example response:

[
  {
    "proto_major": 7,
    "proto_minor": 0,
    "blocks": 8930
  },
  {
    "proto_major": 8,
    "proto_minor": 0,
    "blocks": 12340
  }
]

Block

get_blocks

Get summarised details about all blocks (paginated - latest first)
Parameters: The maximum number of blocks to return
Returns: The list of block dictionaries (the newest first)
Example:
blocks = get_blocks(3)
Example response:

[
  {
    "hash": "8e33bb588feff6414469779d724923064688615535280f8982c9981410cd06f6",
    "epoch_no": 381,
    "abs_slot": 79266935,
    "epoch_slot": 38135,
    "block_height": 8129401,
    "block_size": 49025,
    "block_time": 1670833226,
    "tx_count": 19,
    "vrf_key": "vrf_vk1pj8n7cv07gn4s83vnxgnh3l4m0uqunud2hfmn6d203v6gjvn6jfq9yanjy",
    "pool": "pool1qqq6qqa0hpzvumv5p87ynczfmdj557xuwlc3289ke42g72z7f74",
    "proto_major": 8,
    "proto_minor": 0,
    "op_cert_counter": 10
  },
  {
    "hash": "6464132c9227e39f2a9bca27d738a28d9cd64aba37f55277d75e7e8e0aa5d892",
    "epoch_no": 381,
    "abs_slot": 79266917,
    "epoch_slot": 38117,
    "block_height": 8129400,
    "block_size": 88807,
    "block_time": 1670833208,
    "tx_count": 52,
    "vrf_key": "vrf_vk1hnkdcm6y67amyfnhu4gv2n77496wxmnznke6fqdan53j20mc6jjq7q98e6",
    "pool": "pool1nhd907krga9dh69kf0jg4tl0764rravepy337gptvsknxyyx94k",
    "proto_major": 8,
    "proto_minor": 0,
    "op_cert_counter": 20
  },
  {
    "hash": "7ba6d760e576d3b078dedd931284e0f818306fd71bdba47a0fc6b8b9b7c22dbc",
    "epoch_no": 381,
    "abs_slot": 79266839,
    "epoch_slot": 38039,
    "block_height": 8129399,
    "block_size": 10031,
    "block_time": 1670833130,
    "tx_count": 7,
    "vrf_key": "vrf_vk1kchxdfjqfew7vt88e7l6q2eg3nylf5arahhp8pzfn5z2eyy0z4tsg7sr5k",
    "pool": "pool15yyxtkhz64p7a8cnax9l7u82s9t9hdhyxsa3tdm977qhgpnsuhq",
    "proto_major": 7,
    "proto_minor": 0,
    "op_cert_counter": 30
  }
]

get_block_info

Get detailed information about a specific block
Parameters: Block hash as string (for one block) or list of block hashes (for multiple blocks)
Returns: The list of block dictionaries
Example:
block_info = get_block_info('8e33bb588feff6414469779d724923064688615535280f8982c9981410cd06f6')
Example response:

[
  {
    "hash": "8e33bb588feff6414469779d724923064688615535280f8982c9981410cd06f6",
    "epoch_no": 381,
    "abs_slot": 79266935,
    "epoch_slot": 38135,
    "block_height": 8129401,
    "block_size": 49025,
    "block_time": 1670833226,
    "tx_count": 19,
    "vrf_key": "vrf_vk1pj8n7cv07gn4s83vnxgnh3l4m0uqunud2hfmn6d203v6gjvn6jfq9yanjy",
    "op_cert": "9dac36a4e413be97bcc4d34341023d3ee9d825e27a45beac739270f6e344d478",
    "op_cert_counter": 10,
    "pool": "pool1qqq6qqa0hpzvumv5p87ynczfmdj557xuwlc3289ke42g72z7f74",
    "proto_major": 8,
    "proto_minor": 0,
    "total_output": "45569728258134",
    "total_fees": "5966381",
    "num_confirmations": 10,
    "parent_hash": null,
    "child_hash": null
  }
]

get_block_txs

Get a list of all transactions included in provided blocks
Parameters: Block(s) hash(es) as string (for one block) or list of block hashes (for multiple blocks)
Returns: The list of transaction dictionaries by block
Example:
block_txs = get_block_txs('8e33bb588feff6414469779d724923064688615535280f8982c9981410cd06f6')
Example response:

[
  {
    "block_hash": "8e33bb588feff6414469779d724923064688615535280f8982c9981410cd06f6",
    "tx_hashes": [
      "d1c7496398b02cb2833c3e164947e1ec171819b7ec056fc6b798e2ee122af862",
      "6fe4152a34ee23ccdb5b42e9397ec1c960e51eb28d101b7a59645ce8299fa553",
      "2982bdebe8425c19a275416331cdb54d71409e9107e0add51784a37735fc2316",
      "bf685dde61d36b8acd259b2bd00a69a2e8359d2a69b75aa3a0eff9d38ca1f2ef",
      "291b5533227331999eca2e63934c1061e5f85993e77747a90d9901413d7bb937",
      "505057f2ce7e9cc2442c6dd2339e476e916f1d7b03888110c455082a808e47f5",
      "1b4cab1352b8f5b91f97a05c05244ad654282ece5b5f118a0302bc90c86e7476",
      "9f38998d3ef516f3150a1dc1f8a3f96ca8aa98636b63d835b4f480712d010474",
      "99f2aefba2a4a5a550aeed9d91d3adabe77a286ec45c345c7980a208364f76c6",
      "0eec38dc1d2d021f477a890d754e66c49fe74a9fd972793076587496c9850060",
      "a42ee1a5685ff6953464c32af6221b43732a8550d40f2b7f67f6d2250dfdcbb2",
      "63f99851ff566f801552aed538f8edd2eb4d20b9b66d475f2d51b075595443e7",
      "ecc46903435f89dde0e65865404a1c3a3af0ec78e08ff6e771e410539037f35e",
      "1515e444851c9c7d3abe85ff275c5fd5af8d4844da04f1472d343bcc27f7e58c",
      "12ad9fd5bb7482ee08de25d748288c41df4b05ac079d307a36b6159980fa4b03",
      "c99ed71da7c20d34ceba491c68e60a94c898db0c4b4360f54da09f7ae09370f0",
      "a061003549062114645dfd5d7a353189edb2b6d0f9049f8b1a52ee42d5397247",
      "57619d9198ac449cda755e255ed639d43c82a0e38ec001194f373a151d05a159",
      "6a4adc1e4ef496dc5fadb01641cc849633a13524ac63800a1e1c2e4e87238777"
    ]
  }
]

Transactions

get_utxo_info

Get UTxO set for requested UTxO references
Parameters: UTxO(s) hash(es) and index(es) as a string (for one transaction) or list (for multiple transactions), with "#" between the UTxO hash and the index
Returns: The list of complete UTxO information
Example:
utxo_info = get_utxo_info('99f2aefba2a4a5a550aeed9d91d3adabe77a286ec45c345c7980a208364f76c6#0')
Example response:

[
  {
    "tx_hash": "99f2aefba2a4a5a550aeed9d91d3adabe77a286ec45c345c7980a208364f76c6",
    "tx_index": 0,
    "address": "addr1qy59gr3ylt0us3xj7tawpxfn6ccauxa2upwv04m8mg5jehujfkxey5y9v6huj69rp39fk8zh3gpvrmc0mc4fr0j379kqp865ns",
    "value": "4817999",
    "stake_address": "stake1uxfymrvj2zzkdt7fdz3scj5mr3tc5qkpau8au253heglzmqjatts0",
    "payment_cred": "28540e24fadfc844d2f2fae09933d631de1baae05cc7d767da292cdf",
    "epoch_no": 381,
    "block_height": 8129401,
    "block_time": 1670833226,
    "datum_hash": null,
    "inline_datum": null,
    "reference_script": null,
    "asset_list": null,
    "is_spent": true
  }
]

get_tx_info

Get detailed information about transaction(s)
Parameters: Transaction(s) hash(es) as a string (for one transaction) or list (for multiple transactions)
Returns: The list of transactions details dictionaries
Example:
tx_info = get_tx_info('99f2aefba2a4a5a550aeed9d91d3adabe77a286ec45c345c7980a208364f76c6')
Example response:

[
  {
    "tx_hash": "99f2aefba2a4a5a550aeed9d91d3adabe77a286ec45c345c7980a208364f76c6",
    "block_hash": "8e33bb588feff6414469779d724923064688615535280f8982c9981410cd06f6",
    "block_height": 8129401,
    "epoch_no": 381,
    "epoch_slot": 38135,
    "absolute_slot": 79266935,
    "tx_timestamp": 1670833226,
    "tx_block_index": 8,
    "tx_size": 436,
    "total_output": "4817999",
    "fee": "182001",