Tezos for Newbies 3: How to Develop an App on Tezos

Tezos for Newbies 3: How to Develop an App on Tezos

Blockchain application development differs from conventional application development in that the backend uses smart contracts.

This post is about simple explanations without code or complex examples to cover the basics and tell you which way to dig. Let’s talk about useful tools and what you need to know to develop a blockchain app on Tezos.

Theoretical Background

How are decentralized applications structured? In centralized products, the user interacts with the front end (site or application), which sends data to the backend on a centralized server. The backend processes the data and stores the results of operations in a centralized database.

Decentralized applications, on the other hand, process transactions using smart contracts and store data on the blockchain. They can also store some data outside the blockchain, such as replicating users’ transaction history to a separate database to display it on a website or tokenized digital objects in the IPFS (Interplanetary File System).

Although almost all decentralized applications have a GUI front end, experienced users can work directly with the applications’ smart contracts. A simple way to do this is to use Better Call Dev, while the hard way is to call the contract yourself from the command line using the tezos client.

What language should I use to write smart contracts in Tezos? Smart contracts are done by a virtual machine. The Tezos VM only understands the low-level Michelson language, which looks like Assembler from Terminator.

There are high-level languages for convenient development: the object-oriented SmartPy and the imperative LIGO. SmartPy is similar to Python, and LIGO has several dialects: PascaLIGO, JsLIGO, CameLIGO, and ReasonLIGO.

Where to write smart contracts in Tezos? The most convenient way is to install a plugin to highlight the syntax of the corresponding language in your favorite development environment.

Still, you can also try online IDEs first:

  • LIGO Playground for LIGO. It allows you to check the compilation, test the operation of functions and generate a script to deploy a contract to the blockchain. It also has several examples of contracts in different dialects;
  • SmartPy IDE for SmartPy. There’s also Michelson compilation, testing, and lots of templates, from calculators to simple games;
  • VisualTez, which is a visual development environment for SmartPy contracts. We believe it’s perfect if you haven’t figured out the syntax yet.

What should a smart contract include? First, any contract must have storage, which is its own database on the blockchain. Second, it must have functions (entry points) that will change the state of the storage. See more in our course on development on Tezos.

How to check if a smart contract works? First, you need to test it with a “rehearsal” (dry run). During the rehearsal, the developer calls the right entry point, gives it the parameters to execute, and gets the result: the new state of the storage.

The contracts also need to be tested to make sure the functions work as intended. Check out the testing workshop.

What to do with the smart contract code? It has to be embedded in the blockchain so that it gets its own address and other users can access it. To do that you need to generate a script and set the initial state of the storage, e.g. token issuance or administrator address. For more details about the deployment check out our course.

To test the contract first you should upload it to the test network. It’s free and if you find any bugs in the contract, the potential users will not be harmed. See the Tezos documentation for more details.

How do you work with a smart contract from the frontend? You can use the Taquito library and the Beacon module.

Taquito is a TypeScript library with features like requesting on-chain data from the node, interacting with smart contracts, and signing operations with the user’s private key.

Beacon is a module for connecting Tezos wallet according to the TZIP-10 standard. Works with all wallets.

Where will the app take the on-chain data from? The tricky way is to use Taquito to request the right data directly from a node. It’s complicated since it will take time for the app to retrieve the information.

The easy way is to use indexers. These are separate search-optimized databases that store data about the Tezos blockchain. You can request the data you need via API, or run the indexer on your machine. The most popular are the TzKT indexer and the DipDup framework.

Can I write smart contracts any way I want? No, it’s better to stick to standards. For example, Tezos has two standards for tokens (Financial Assets), FA1.2 and FA2. Implementations of these standards can be found in the online IDE templates or Github repositories of Tezos teams.

More standards and suggestions are on GitLab.

Where can I find answers to my questions? You can ask developers on the Tezos Stack Exchange or in the community of the relevant tool or team.

Also, feel free to ask questions in our communities. We’ll give you an answer or at least tell you where to find it:

  1. Telegram channel
  2. Facebook
  3. Twitter in Russian and Ukrainian
  4. Twitter in English
  5. YouTube channel
  6. Instagram
  7. LinkedIn
  8. hub at ForkLog


How to Develop and Launch Your Own Project: Tezos Accelerator Rounded Up

Read similar posts

Starlords: a new phase of generative NFTs from outer worlds

Starlords: a new phase of generative NFTs from outer worlds

Development after the accelerator: how to apply for a grant to launch the project

Development after the accelerator: how to apply for a grant to launch the project

Privacy in Tezos: are zk-SNARKS there yet?

Privacy in Tezos: are zk-SNARKS there yet?

Read our blog and never miss news about TezosRead Blog