Pragma Empowers Starknet Sequencer with the Launch of Pragma API

We're thrilled to announce a new addition to our product suite – the Pragma API, with Starknet as its first user.


For over a year and a half, Pragma has been a driving force on Starknet, contributing to the ever-growing DeFi landscape. Powering cutting-edge products like NostraZkLendCarmine, or Nimbora. Pragma v2 is on the horizon, targeting 200ms latency and near-infinite computation while maintaining the provability of data feeds. Recognising the need for certain apps and projects to leverage our network of data providers and high-quality data through an API, we introduce the Pragma API.

Introducing the Pragma API

We're glad to introduce the Pragma API, meeting the evolving needs of the DeFi space. The API leverages our extensive network of top-tier data providers to deliver unparalleled low-latency data feeds. By decoupling from on-chain constraints, Pragma API ensures high availability and performance, providing developers and projects with a versatile solution for seamless data queries.

Key Features

  • Low-Latency Data Feeds: Pragma API taps into our extensive network of data providers to deliver the lowest latency in the DeFi landscape.

  • Premium Data: The API utilizes our network of data providers, offering the best financial data available.

  • High Availability: Access an always-available API for financial data with high accuracy.

  • Seamless Integration: Easily integrate Pragma API into your projects and applications.

First use case: ETH/STRK price feed

With the long-awaited STRK token, Starknet announced that users will be able to cover gas fees using the STRK token. As the prime oracle on Starknet, the Starknet foundation gave us their trust and will be the first user of the Pragma API.

We built a customized solution for Starknet's needs, in order to ensure the best user experience for users choosing to pay gas prices in STRK. Here is a high-level breakdown of how transactions V3 will work on Starknet. The sequencer quotes the gas price in wei (eth_l1_gas_price) at each block and queries the Pragma API to get the amount of fri (smallest unit of STRK) corresponding to the wei amount. It then stores this amount in strk_l1_gas_price, enabling users to cover gas prices either in ETH, or STRK.

Flowchart of the interaction between Users, Pragma API & Starknet Sequencer
Flowchart of the interaction between Users, Pragma API & Starknet Sequencer

If you want to learn more about the API itself, go to the docs.

Price Robustness

In developing the STRK price feed, we have adhered to our comprehensive and rigorous methodology, while incorporating greater flexibility due to enhanced off-chain computational capabilities. Before we explore this further, Matteo Georges, the CEO of Pragma, has authored an insightful article. In it, he discusses the integration of type 3 transactions on Starknet, aiming to augment the decentralisation of its token protocol and simplify the conversion process between STRK and ETH for sequencer fees.

The price construction process unfolds in two main phases:

The initial phase involves selecting high-quality data publishers & sources. This is particularly crucial for assets like STRK, whose liquidity is distributed across both off-chain and on-chain platforms. Following this, the second phase employs the Time Weighted Average Price (TWAP) methodology, known for its robustness in price calculation.

Understanding Data Publishers & Data Sources

Before we delve into the specifics of data sources, it's important to differentiate between data publishers and data sources. Data publishers fall into two categories:

  1. First-party publishers, who generate prices using their infrastructure, including Market Makers, data providers, Solvers, and DEX aggregators

  2. Third-party publishers, who depend on external APIs to relay information, acting as intermediaries.

Data sources, on the other hand, are the origins of this data. For example, first-party publishers provide a singular, consolidated price, whereas third-party publishers aggregate multiple prices from various sources (e.g., Binance, OKX, Bitstamp, etc.).

With this distinction clarified, we can now explore the methodology behind the Pragma STRK price construction in more detail.

As mentioned earlier, the data publishers are as important as the data sources. Let's have a look at the publishers and where they collect their data from.

  • Data Providers

Fourleaf indexes prices from both on-chain and off-chain sources. They aggregate prices from multiple sources and then consolidate them into a single final price.

  • Solvers

Avnu and Propeller-Heads are three prominent entities known as 'Solvers'.

'Solvers are algorithms or agents tasked with finding the optimal execution strategy for trade orders. They play a crucial role in the ecosystem by analysing the current state of the blockchain, the liquidity available across various pools, and the specific requirements of trade orders, such as minimal slippage, best price, or fastest execution time.'

Thanks to their constant monitoring of on-chain activities, they can consolidate the mid-price of any assets traded on-chain using their infrastructure.

  • Market Makers

Flowdesk and Skynet Trading are two notorious market makers.

'Market makers provide liquidity to financial markets by offering to buy and sell assets at quoted prices, ensuring that assets can be traded smoothly and efficiently.'

As market makers quote prices across several exchanges, they stay informed of the latest traded price of the asset. Furthermore, market makers (like other actors) benefit from on-chain/off-chain price arbitrage, which minimises the difference between the price of these two markets.


Pragma indexes prices from various APIs including EkuboGeckoTerminal, DeFiLlama, Binance, Bybit and Kucoin. Additionally, we index prices from the most liquid DEXs on Starknet. Each of these sources of price indexing is considered a single data source point.

TWAP Calculation

Given the anticipated high volatility of STRK, it was essential to develop a system to reduce the influence of extreme outliers. Although several methods are available, each with its own pros and cons, we chose to implement the Time-Weighted Average Price (TWAP) calculations based on its effectiveness in minimising outlier impact and accurately reflecting market conditions.

'TWAP is determined by calculating the average prices of an asset at fixed intervals throughout a chosen timeframe'

TWAP=ΣPtn{TWAP} = {\frac{\Sigma{P_t}}{n}}


  • PtP_t denotes the price of STRK

  • tt represents the time interval

  • nn is the total number of price points within that interval

The design of the Pragma API allows StarkWare to specify the time interval.

Your Turn to Integrate

As we embark on this new chapter, we extend an invitation to developers and projects to explore the possibilities unlocked by the Pragma API. Whether you're building the next DeFi powerhouse or enhancing your existing project, our API is here to empower your journey.

Get Started Today: Explore Pragma API

Join us in shaping the future of DeFi and building the web of integrity: Join our Discord or our Telegram chat.

The Pragma Team

Stay tuned for more updates and subscribe:

Subscribe to Pragma
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
This entry has been permanently stored onchain and signed by its creator.