Smart contract and zero-knowledge programming languages
April 5th, 2023

I share My experience journey in learning regular programming, smart contracts programming, ZK circuit programming.

Regular programming:

It is easy to switch and learn new programming paradigms. I learned procedural, Object-oriented programming(OOP), and functional paradigms. Each paradigm has its principles to be followed to program a solution. It was quick to adapt and become familiar with a new paradigm. It is also easy to be familiar with web or desktop application development and learn different programming languages: java, python, JavaScript, etc.

Smart contracts programming: 

I began smart contract programming with Bitcoin script. It is a simple language, not Turing complete, meaning it lacks several logical functions, including loops. It is a limited programming language. You cannot do advanced things because the Bitcoin blockchain specification influences it. Quickly then, I moved to Ethereum when I was a student in 2018. The smart contract is developed in bytecode. Writing programs in bytecode is challenging, so there is a high-level programming language like Solidity (the most used one) or Vyper for developers.

Adapting and becoming familiar with this new philosophy to build the smart contract-based computer program was challenging. It takes a while to become familiar with it. It comes with new philosophy and concepts:

  • New security attacks vectors like reentrancy or overflow underflow Attacks

  • An account is identified by an address that is derived from a private key.

  • A smart contract is a computer program deployed to a Blockchain.

  • Smart contracts are deterministic computer programs. They are executed in a black box environment that can not get data from the real world except using oracles.

  • An ABI is used to facilitate the interaction with your program because the transaction must be encoded in the language known by the EVM: function selector and function parameters.

  • Transaction gas fees

  • Storage on-chain is very costly.

  • And many, many of new other new concepts

It was efficient to read Openzeppelin and popular smart contract codes such as Uniswap.

I also tried the smart contract programming provided by EOS Blockchain in my end-study internship. After a long journey experiencing many aspects, I have become familiar with developing a smart contract-based computer program. SC programming is a new way to think about a computer program that redefines it from the first principle.

ZK circuit programming

Currently, I pass with the same experience I had before with learning Smart contracts programming. When you write ZK programs, you think differently from regular and smart contract development.

With ZKP, you convince a verifier that you know some information without revealing any details. From the theoretical point of view, you need to program your statement into an arithmetic circuit. When you program what you want to prove, you need to think in terms of computation trace(witness) and constraints in mind. We need languages to describe what we want to prove to a verifier.

In the last couple of years, there has been an exploration of ZK programming languages that allows you to describe the statement you want to prove.

Those programming languages differ from compiling directly into a computation trace and constraints, and others pass by an intermediate representation(IR).

A different ZK programming language approach allows direct control over the computation trace and constraints and other abstracts the complexity behind that.

ZK programs are also a new way to think about a computer program and its capability. It fundamentally changes how we think about a computer program.

Smart contracts and zero-knowledge proof fundamentally redefine a computer program's capability from the first principle.

Subscribe to Walid Khemiri
Receive the latest updates directly to your inbox.
Nft graphic
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from Walid Khemiri

Skeleton

Skeleton

Skeleton