04/01/2023 5 Minutes read

TezDev conference : Nice tools for nice dev

This piece is a feedback from the TezDev conference that occured in Paris in July 2022. Some information may be a bit outdated, but most of the tools are still available!

The success of a blockchain technology is not only determined by technicals aspects of its protocol but also by the diversity, the synergy and the quality of its Dapp ecosystem. Most people use the Ethereum blockchain not for the beauty of the protocol but for amazing Dapps it contains: Uniswap, Cryptokitties, Aave, OpenSea, Dai …

All these Dapp have contributed to Ethereum ecosystem growth and massive adoption. To develop amazing Dapps, you need an involved developer community and efficient tools that allow to save time and focus on business stuff. As we could see at the TezDev conference that occurred from 21 to 23 July 2022, Tezos has a lot of nice and enthusiast developers, but what about tools? Ethereum has Truffle, Hardhat, Ganache, OpenZeppelin …

What about Tezos? The TezDev conference was the occasion to familiarize with some nice Tezos development tools. Let’s discover some of them!

Factori

When developing a smart contract, we usually write a lot of boilerplate code to deploy, interact and test it according to our needs. An important part of this side code is just a replication of the smart contract interface (entry points, types) written in another, sometime several other, languages. The pain point here is that each time we need to bring some changes to our contract, we also have to rewrite more or less of this side code, depending on how much the smart contract interface has been modified. This is a cumbersome and repetitive task that can discourage developers from bringing changes to their contract which, at the end of the day, can results in lower quality code.

Factori is a tool developed by Functori Company to automate the generation of this boilerplate code by generating an interface in typescript or OCaml (java and python are also expected in the roadmap) for each smart contract. We can then use these interfaces in our deployment and testing scripts (see tutorial). When we change our contract, we just have to regenerate these interfaces (like artifacts on Truffle and HardHat) from Michelson files (or even from the KT1 address of an already deployed contract) and bring slight modifications to our scripts. When creating a new project, Factori also provide a Makefile to facilitate deploying and interacting with smart contracts.

Factori is still in development, and new features are expected such as static analysis of Michelson smart contracts, dynamic web page from a Michelson smart contract generation, …

DIP{DUP}

Retrieving data from blockchain can take a lot of api call and hence can be very time consuming specially for heavy data load. Blockchain explorers usually use indexers to retrieve and store large amount of on chain data in a more conventional and easy to read database. These indexers usually expose an API that allows third parties to access these data in a more performant still less trustless way. These indexers provide general data but our Dapp may only need specific data relative to our own smart contracts.

DipDup is a framework developed by Baking Bad, allowing to build custom indexers indexing specific on chain data and converting them to business domain-specific data model.

The developer has to:

  • Set all the inventory and indexing rules in the dipdup.yml configuration file. It’s the place where we can define on chain data we want to index, the data source (depending our needs, we usually have to use TzKT), the database
  • Describe the domain specific data models and implement the logic allowing to convert blockchain data to them. This is done in python.
  • Deploy, indexers, the sql database and the Hasura service allowing to expose a GraphQL.
  • Generate GraphQL client and use it in the frontend to access data from indexers.

Taqueria

Developing smart contracts, compiling them from maybe multiple languages, testing, launching a sandbox local network, deploying contracts on several networks…

There are a lot of recurrent tasks to handle when developing Dapps. These tasks can be simplified via framework in order to let the developer be focused on the project logic. On Ethereum ecosystem, we have for example Truffle and Hardhat frameworks.

However, on Tezos ecosystem, until now, most projects handle these tasks via custom scripts and workflow. This works but it can be time consuming and not very developer friendly.

Taqueria is a plugin based framework developed by ECAD Lab for tezos Dapps building. Its workflow and global structure is similar to Truffle and Hardhat.

These are some of its features:

  • Compile contracts present in the « contract » folder, no mater their language (smartpy, ligo, archetype). Resulting .tz files are stored in the « artifact » directory.
  • Run a local flextesa sandbox.
  • Originate contracts on a local network, public testnet and main net.
  • Publishing content on IPFS
  • Testing the Dapp

These features are not available by default in a new project. For each project we have to install corresponding plugins according to our needs and hence benefit only from features that are required for our Dapp development. This is the meaning of « plugin based » framework. We can even install a Taqueria VS Code plugin that allows to use previously described features in a GUI mode from our IDE rather than using the CLI.

Smart Contract Templates

Smart contract development is a very critical and risky part of Dapp building. Even little vulnerabilities can cause users to lose a huge amount of money. It’s really important to implement good practice in term of security and optimisation. That’s why public libraries like OpenZeppelin in the Ethereum ecosystem are very useful. They implement secure and optimized smart contracts template that can be reused by developer and customized according to their needs.

In the Tezos ecosystem, we can find several smartpy templates on the Smartpy online IDE.

At the TezDev conference Ligolang team have presented the ligo template library they were working on. They aim at providing a list of several tzip (7,12,17,…) developed following good practices.

These are some of them:

  • Token (FA1.2, FA2 variations)
  • Permit
  • Multi sign
  • Randomness
  • Lambda pattern (anti-pattern used for changing smart contract code with lambda functions)
  • DAO

These templates are a great resource for developer as it’s time saving, more secure and constitute good implementation examples for learning.

Conclusion

Conferences like TezDev are the occasion for developer to improve their knowledge and discover useful tools in order to enhance the global ecosystem. The more a technology is mature, the more user and developer experience should be improved. Several other tools, services and resources have been presented during this conference, by developers themselves. For more informations on this topic, you can watch the replay of TezDev presentations on Tezos Youtube channel.


TezDev conference : Nice tools for nice dev was originally published in ekino-france on Medium, where people are continuing the conversation by highlighting and responding to this story.