XTZ Contract statistics - announcement
To latest articles

August 15, 2022 8:30 AM

XTZ Contract statistics - announcement

>>

The tezos smart contract dashboards have been extended with another new set of charts. With the data pipelines we've started to look into on-chain xtz volumes across the full chain and at the individual contract, as well as contract entrypoint level.

This means that now, statistics such as the ones below, are ready to be explored on tezos smart contract dashboards.


Model chart

The above chart shows the median xtz sale price through the fulfill_ask mechanism of the Objkt.com marketplace contract. The median is the middle value when you sort all values from lowest to highest. As can be seen in the chart the median fulfilled ask price generally is either 1 or 2 xtz for objkt.com. Meaning at least half of NFT sales through this mechanism go for this value or below.


Model chart

Another interesting xtz metric to look at is the max fulfilled ask and offer on objkt. This immediately shows the days at which big xtz transactions took place through the objkt.com ask and offer mechanisms and how much larger they are in proportion to a regular day.


Model chart

Of course the simple sum of all xtz going in and out of a contract per entrypoint is also available.


For this brief preview we've only looked at the Objkt.com marketplace v2 contract. The data pipeline has computed these statistics for every smart contract which is receiving and/or sending xtz. This is done through a bottom-up mechanism scanning every transaction sequence for all smart contracts on the blockchain.

The charts on the dashboard pages show the full output generated from this bottom-up analysis of on-chain data. The naming scheme for this data is fully generated from the given names to entrypoints by the developers of smart contracts. This might come across as fairly technical and can get a bit chaotic.

For example, a full chart showing total xtz volume per day, in/out from all entrypoints at once for objkt.com marketplace v2 looks like this:

Model chart

By using the labels on the left within the chart, individual xtz volume going into or out of the contract can be highlighted like so:

Toggle data columns to zoom in on specific entrypoints.


XTZ Transaction attribution

How is xtz being counted and attributed towards different smart contract entry points?

XTZ can be transferred in a couple of transaction forms:

  • Direct from one wallet to another
  • From a wallet to a contract in a direct xtz transfer
  • XTZ attached to a contract call
  • From a contract to another account via smart contract code

The charts that have been added visualize the xtz volume that is coming from the latter three transaction forms. That is, all xtz transfers going into or coming out of a smart contract in one form or another.

These kinds of stats are somewhat interesting at the smart contract level but become really meaningful when tracked per smart contract entrypoint. Such as the charts above, which zoom in specifically to xtz statistics on fulfilled ask NFT listings on the Objkt.com marketplace contract.

Xtz transfers going into a smart contract through a smart contract call are labeled as [entrypoint]_xtz_in. Direct xtz transfers are captured in the data column __direct_xtz_xtz_in. These xtz transfer amounts are directly attributable to either the smart contract calls or direct transfers to the contract.

For xtz transfers going out of the contract, this is a little bit less straightforward. A smart contract can transfer xtz out of its own balance by generating new transactions in smart contract code that is executed in relation to a smart contract call. These xtz transfers are grouped together in an operation group with the original smart contract call. In the data pipeline we look at every xtz transfer coming out of a contract, and figure out what the latest smart contract call was that was triggered within that operation group. Within the current statistics calculation, all of the outgoing xtz transfers that were found for a single smart contract call are then summed together to get the full xtz_out amount for that single smart contract call.

This data table of smart contract calls with xtz_in and xtz_out amounts for every entrypoint call is then used to produce daily time series datasets with a common set of statistics:

  • sum
  • median
  • mean
  • max

Charts of daily time series for each of these statistics split by entrypoint are now available within the xtz statistics section on tezos smart contract dashboards.


The xtz token

The xtz (or tez) token is the native token to the Tezos blockhain. It is the only token that can be transferred using direct transactions and is used for many chain-native so-called tokenomics such as rewarding block bakers, paying for gas, storage and fees for transactions. As of writing it is also the token which is used in a lot of cases by smart contracts to do things like buying or selling nfts and trading into and out of various defi/dao tokens. This is currently the dominant token in which many transactions are denominated. In the future as dApp developers start to deploy more advanced smart contracts, the xtz token might become less relevant to day-to-day use and be replaced by xtz wrapping tokens such as ctez, oXTZ or various stable coins as payment mechanism.

With the current pipeline, only transfers of this native Tezos token are being ingested. Future work will be to further trace non-native smart contract-generated tokens.


Analysis caveats

As mentioned before, these charts come from a fully bottom-up full-chain analysis of contract calls and xtz transactions on the Tezos blockchain. All of these numbers are attributable to transactions that actually happened on the chain. But the meaning of the transactions, and therefore the numbers, still require further context and interpretation. In many cases the naming of the contract entrypoint, together with a general understanding of the dApp, the contract is connected to already give a sufficient hint. But it is fully up to the developer of a smart contract to give those entrypoints meaningful, or not so meaningful names, or in some cases developers are even pro-actively obfuscating functionality with generic entrypoint names. It is therefore always good when looking at charts from an unfamiliar contract, to also take a look at the direct transactions using block & transaction explorers such as [tzkt.io][https://tzkt.io].

dApp revenue & volume calculations

To calculate the total revenue for a dApp it is tempting to just sum up all the individual xtz transfer volumes in and out of the contract for all entrypoints. However in a lot of cases this will likely lead to double-counting or even include transactions that shouldn't be calculated as revenue at all. For example in the case of the objkt.com marketplace, contract calls such as offers being placed and retracted only pass xtz back and forth between the contract and the offerer, only offers being fulfilled should be counted towards actual xtz volume being exchanged between different accounts.

Current thestackreport.xyz dashboarding functionalities are still focussed on the smart contract unit of abstraction. Keep an eye out on future announcements as these dataset and visualization capabilities are being further built out.


These newly added charts currently reside below the contract usage charts on the tezos smart contract dashboards. Navigate to any of the individual dashboard pages and scroll down to discover and explore these newly added xtz statistics graphs in the xtz statistics section of the dashboards.

Tezos smart contract dashboards are continuously being extended with new data, charts and visualizations.

Read previous announcements for features that have been added so far:

Dashboards announcement

Transaction flow visualization