---
title: Blogpost - Michelson views
tags: protocol
---
Time publish: not decice yet
# Michelson Views
On December 3th 2021, the Tezos blockchain successfully upgraded by adopting Hangzhou at block $1,916,929$. In this upgrade, [Michelson views](https://www.marigold.dev/post/hangzhou-the-latest-tezos-upgrade-is-live) has been introduced. Views are a new kind of entrypoints for smart contracts, which make internal state information more easily accessible to other smart contracts. In this article, we would like to give a statistic of views that have been used since then.
## Overview
TODO:
Post would provide a reminder just after the intro on "how use a view in ligo contract with Tezos.call_view" and "how use the view offchain with run_script_view RPC"
Call-back view ...
In [Ligo](https://ligolang.org/docs/reference/current-reference/#on-chain-views), this feature of views is implemented in a primitive `Tezos.call_view`, this will generate a Michelson code for views.
## Data
There are $153,621$ total contracts that have been deployed onto Mainnet from genesis block until the time of writing this post, 14th November 2022. The total of contracts containing codes declare views is $2212$ (~$1.44$% of total contracts). We use ["Tezos blockchain explorer"](https://tzkt.io/) for our experiement.
| Contracts before views | Contracts has views | Contracts after views (excluded views) | Total contracts |
| ---------------------- | ------------------- | -------------------------------------- | --------------- |
| $67,100$ (~$43.67$%) | $2212$ (~$1.44$%) | $84,309$ (~$54.89$%) | $153,621$ |
Below is a table showing the number of views entrypoints that declared in contracts:
| Number of views in contract | Number of contracts |
| --------------------------- | ------------------- |
| 1 | 1561 |
| 2 | 103 |
| 3 | 77 |
| 4 | 38 |
| 5 | 308 |
| 6 | 21 |
| 7 | 14 |
| 8 | 24 |
| 9 | 42 |
| 10 | 0 |
| 11 | 3 |
| 12 | 10 |
| 13 | 1 |
| 14 -- 19 | 0 |
| 20 | 10 |
## Analysis
TODO: need interesting ideas to analyze
- Market and Oracle contracts group(s)
- Specific contract(s)?
- etc.
Let's take look at several contracts:
- At the address [KT19B8uSfiQ8Cxk99ELc7MPccQ9ihyy7jhDU](https://tzkt.io/KT19B8uSfiQ8Cxk99ELc7MPccQ9ihyy7jhDU/info) is ["Harbinger Price Oracle"](https://medium.com/@keefertaylor/introducing-views-in-the-harbinger-price-oracle-aeee793e4577), the first contract that uses views. This contract declares $1$ view entrypoint.
- At the address [KT1Xag669km4EXaQPi3GH9fcofjvPnJneuaL](https://tzkt.io/KT1Xag669km4EXaQPi3GH9fcofjvPnJneuaL/info) is the contract "tz1 and is a virtual world and NFT marketplace". This contract declares $5$ views entrypoints.
- At the address [KT1FsJ6F4y1gKtyXvVg5caF9soUSRR9meRVF](https://tzkt.io/KT1FsJ6F4y1gKtyXvVg5caF9soUSRR9meRVF/info), this contract related to "akaDAO" from the ["AluanClub"](https://ipfs.io/ipfs/QmV81XKX1gDiDd3V3oUSn3Kwe11G4yhE7G1puKbmNxEW2h), where it contracts has $9$ views entrypoints.
- At the address [KT1BMWkNX3zRDH1a6A4PJ1uHjhAm44jhQvrB](https://tzkt.io/KT1BMWkNX3zRDH1a6A4PJ1uHjhAm44jhQvrB/info) and [KT1LjmAdYQCLBjwv4S2oFkEzyHVkomAf5MrW](https://tzkt.io/KT1LjmAdYQCLBjwv4S2oFkEzyHVkomAf5MrW/info) are the contracts "The Versum market (auction, swap, offer) used for all tokens, parcels and planets". These contracts declare $13, 12$ views entrypoints respectively.
- At the address [KT1JmfujyCYTw5krfu9bSn7YbLYuz2VbNaje](https://tzkt.io/KT1JmfujyCYTw5krfu9bSn7YbLYuz2VbNaje/info) is the contract "Youves USDt token storage". This contract declares $20$ views entrypoints.
- ...