Skip to main content

Total Value Locked (TVL)

Total Value Locked (TVL) represents the total amount of assets locked within decentralized finance (DeFi) protocols on the Hedera network. This metric provides insights into liquidity, ecosystem adoption, and capital efficiency within Hedera’s DeFi landscape.

Hedera Data Access

To access this Hedera network statistic (and others) via Hgraph's GraphQL & REST APIs, get started here.

Methodology

  1. Data Source

    • TVL data is retrieved from the DeFiLlama API.
  2. HTTP Retrieval & JSON Parsing

    • The procedure calls http_get('https://api.llama.fi/v2/historicalChainTvl/Hedera') and parses the JSON to extract date (in seconds) and tvl.
  3. Timestamp Conversion & Daily Range Calculation

    • Each date_sec is converted with to_timestamp(date_sec), and a daily time range is computed using the int8range function.
  4. Insertion into Metrics Table

    • Each record is inserted into the table. If a matching record exists, the TVL value is updated.
  5. Final Output

    • Each row represents a daily TVL measurement with its corresponding time range.

Use Case Example

Monitoring TVL helps gauge overall network health by reflecting the amount of capital engaged in Hedera's DeFi ecosystem. For example, a rising TVL indicates increasing liquidity and user confidence.

SQL Implementation

Below is a link to the Hedera Stats GitHub repository. The repo contains the SQL function that calculates the Total Value Locked statistic outlined in this methodology.

SQL Function: ecosystem.dashboard_network_tvl

View GitHub Repository →

Dependencies

  • Hedera mirror node
  • Internet access (to fetch data via http_get from DeFiLlama)