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.
To access this Hedera network statistic (and others) via Hgraph's GraphQL & REST APIs, get started here.
Methodology
-
Data Source
- TVL data is retrieved from the DeFiLlama API.
-
HTTP Retrieval & JSON Parsing
- The procedure calls
http_get('https://api.llama.fi/v2/historicalChainTvl/Hedera')
and parses the JSON to extractdate
(in seconds) andtvl
.
- The procedure calls
-
Timestamp Conversion & Daily Range Calculation
- Each
date_sec
is converted withto_timestamp(date_sec)
, and a daily time range is computed using theint8range
function.
- Each
-
Insertion into Metrics Table
- Each record is inserted into the table. If a matching record exists, the TVL value is updated.
-
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
Dependencies
- Hedera mirror node
- Internet access (to fetch data via
http_get
from DeFiLlama)