The transactions to transaction groups ratio - Tezos chain analysis
To latest articles

May 25, 2022 7:30 AM

The transactions to transaction groups ratio - Tezos chain analysis

>>

Transactions are where the action is at, on the Tezos blockchain. Smart contract blockchains allow for complex transactions between human-controlled wallets and smart contract code, enabling an emergent network of user-generated connections between people and digital entities. Or that is the idea at least, how complex are these transactions actually on the live chain and how much is just swapping xtz between wallets? In this article we take a rough first attempt at measuring transaction complexity by looking at transaction group size.

Let's take a look at the charts first before we dig into the underlying technicalities of these metrics. The first chart below shows the total number of transactions and transaction groups per day. The chart after that shows the ratio between those two.



There is a clear evolution with distinct phases over time, from the launch of the chain to today. In the initial weeks and months of the chain the ratio of transactions to transaction groups was pretty much 1 to 1. Then there is a period where the ratio of transactions to transaction groups starts to fluctuate at a regular ~3 day interval.

(By using the timeline brush below the chart you can zoom in to inspect the day-by-day values)

In the valleys, the ratio drops to almost 1, whereas in the peaks the ratio goes up to around ~5 transactions per transaction group, or for some days even above 10 transactions to every transaction group for example on 12 November 2020. Over the past year the daily ratio has started to stabilize at around an average of ~4 transactions per transaction group per day.

So what does this mean?

For that we need to go into the details of what transactions are, and how they can be grouped together in on-chain operations.


Operations, Transactions & Transaction groups

The most basic transaction on the Tezos chain is a simple transfer of xtz from one wallet to another. More complex transactions are mints of NFTs, trades of tokens, votes in DAOs and so forth. These transactions are enabled by smart contract code, which lets users trigger a number of transactions in a transaction group together, to achieve multiple ledger changes at once. These complex transactions are where a smart contract blockchain really differentiates itself from the original bitcoin blockchain.

Now let's get a little bit formal with definitions on the data structures for analysis.

Operations

Blocks on the Tezos blockchain store operations.

Transactions

A transaction is a type of operation on the Tezos blockchain.

A transaction operation is initiated by a wallet account.

A transaction operation can target another wallet account for a basic transfer of xtz or a smart contract account for a more complex transaction operation.

Wallet account

A wallet account is one controlled by an end-user through a public/private key pair. On Tezos the addresses for these accounts start with tz.

Smart contract account

A smart contract account is an account that is "originated" onto the blockchain itself and can contain code. Through the smart contract code, a smart contract can have various public endpoints which can be called by wallet accounts as well as other smart contract accounts to execute the smart contract code.

Transaction groups

A transaction is a ‘type’ of operation, at the same time a transaction operation can actually contain multiple transactions. This can happen in multiple ways. Operations are injected to the blockchain by first constructing the JSON description of the transaction, then signing it and sending it to one of the RPC endpoints of a node in the Tezos network. In constructing the JSON description you are already able to include a list of transactions.

When a transaction targets a smart contract it can call one of the contract endpoints. This then executes the code within the smart contract. The code in the smart contract can trigger other transactions which become part of the same transaction operation.

For example a simplified nft swap transaction can be a transaction to transfer the xtz and a transaction to transfer the token. (In reality nft swaps are more complex already, with locking & unlocking of funds etc)

The point for now is, atransaction operation can actually contain multiple transactions. These transactions can be arbitrarily combined by end users at the injection phase as well as by smart contract code creating multiple transactions or secondary smart contract calls.

So is the basic ratio between transactions and transaction groups actually saying something about transaction complexity?

Unfortunately not actually. In the 2020 phase of the Tezos blockchain the transaction to transaction group ratio fluctuates widely. What kind of transaction groups are actually causing this fluctuation?

Staking reward payouts

By zooming in to that previously mentioned date of 12 November, 2020 we can find a number of transaction groups that are very large in size.

This is for example a transaction operation group that includes one hundred staking rewards payouts: https://tzkt.io/oo7fqhTAicPvTgN8muKV16RRK8GbkS3RLwqEMwTbb8pRHXQSgpQ

The team behind StakingFacilities most likely has some scripts that inject transactions directly to an RPC endpoint to combine these payouts into one operation. Staking reward payouts happen at a regular ~3-day interval which matches up with the fluctuations.

This approach to injecting transactions is not something that the average user, manually interacting with dApps through a web interface will likely do. (Although it is possible for dApp developers to program features that make use of the possibility to inject multiple transactions in one transaction operation).


Can we get a closer measure of transaction complexity coming from smart contract calls by filtering out transaction groups that are grouped user-side? From the pure blockchain data it is not immediately apparent why transactions were grouped. But the staking reward payout transaction group above does give a hint towards how to at least further narrow it down. The transaction group does not include any contract call.

What would the ratio look like if we only look at transaction groups that include smart contract calls?

In the above chart the black line shows the ratio of transactions to transaction groups, solely for transaction groups that include contract call transactions.

This ratio filters out the large fluctuations coming from grouped staking reward payout transactions. It is still possible that these transaction groups include manually combined transactions but the ratio does seem to be more consistent.


Analysis

What are some takeaways from these transactions to transaction group ratios?

When the ratio is close to one it most likely means that most chain activity is basic transfer of xtz between wallets or very basic contract calls.

The adoption of NFTs on Tezos in 2021 is most likely the cause for transaction group size to rise because of more complex operations such as minting & trading of NFTs.

Transactions shouldn't be needlessly complex just for the sake of it. From that perspective this ratio shouldn't be a metric to steer on.

At the same time grouping transactions into one transaction group operation has efficiency advantages... See the conclusion for what this might mean for the future of Tezos.


Future work

In this analysis a rough & relatively in-accurate approach was taken to look at which transactions are connected to each other. A future analysis into transaction groups might look further into the smart contract code itself. Through analysis of the smart contract code it might be possible to further trace which transactions triggered other transactions through smart contracts and which transactions were "manually" grouped together at injection by scripts & users.

The transaction complexity metric using transactions to transaction groups ratio will be added in the near future to the Tezos contracts dashboards to evaluate transaction complexity per contract:

https://thestackreport.xyz/dashboards/tezos


Conclusion

The current structure in which transactions are added to the Tezos blockchain is still relatively simple. It will get more complex in the near future.

This current approach to storing every transaction in the chain is the main bottleneck for transaction throughput on the chain. The tezos development teams are preparing for future upgrades to the chain to include something called rollups. In a rollup architecture, multiple transactions and state changes are processed together off-chain on what is called a layer 2, with intermittent hashed receipts of that process being added to the main chain.

For further reading on the Tezos scaling proposals in development, continue here:

https://research-development.nomadic-labs.com/tezos-is-scaling.html

For a detailed explanation of Tezos operations, transactions and accounts, see:

https://opentezos.com/tezos-basics/operations