<style> .reveal { font-size: 2.5em; } </style> ## Developing on Tezos <!-- slide: https://hackmd.io/p/GvuFp1VtSgS8DrrT_4UAqA --> <img style="height:30vh" src="https://hackmd.io/_uploads/rJZ0UKYc5.png"> CRYPTO <img style="height:10vh" src="https://lh3.googleusercontent.com/ALdGKE7FInsc986r-8p5rnXB18FFYifi7sneKntG56c7czRDLbnb1EAwzCk44E4V6E3F_0EkiBZzqkJS52-SST4TY8Q5iAXRnB7Tng=w600">, NFT <img style="height:9vh" src="https://uploads-ssl.webflow.com/5b97453c8f2b579c7e60aaa3/5c26fbec58a0ba4e912bb8fd_sutu_reel_10.gif">, DEFI and much more <img style="height:4vh" src="https://hackmd.io/_uploads/ByjOweQqq.png">&nbsp; &nbsp; --- ## Who am I? <img style="height:20vh" src="https://hackmd.io/_uploads/S1bCGool5.png"> Tech Lead @ Marigold Tezos lover <img style="height:15vh" src="https://media1.giphy.com/media/Q5pVd08X8G5IqztOum/200w.gif?cid=82a1493by2fhf9178h11nipihb1hcvxu3ayrqlsrscn2yeah&rid=200w.gif&ct=g"> <img style="height:20vh" src="https://i0.wp.com/thelowdown.momentum.asia/wp-content/uploads/2022/06/web3.gif?fit=728%2C380&ssl=1"> @benji_fuentes --- # What is Tezos ? --- ## Definition ```diff + decentralized open-source blockchain + Smart contracts (on several languages) + XTZ native cryptocurrency (pronounced "Tez" or "Tezzies") + eco-friendly proof-of-stake consensus + on-chain governance model + smart contract formal verification + NFT top ranking crypto - no hard forks, done with protocol amendments - no centralized governance - unstoppable - no high fees ``` ---- ## Networks ```diff + 1 public network, called `mainnet` (and its `ghostnet` testnet) + several additional testnets - Jakartanet (previous version, since June 28th 2022) - Kathmandu (current version, since September 23rd 2022) - Lima (next version, around Xmas 2022) + validator nodes called bakers who can create blocks (=== Bitcoin miners) + as simple user not holding a node, you can delegate Tz to bakers and get rewards for staking (~6% interest) + no certificate authority node, no centralization ``` ---- ## Consensus ```diff + Liquid proof of stake - PREVIOUS : Emmy* (nakamoto-style): stake Tz for a period of time (cycles) where bakers are randomly choosen to bake blocks and get rewarding if not accused of fraud - CURRENT : Tenderbake (BFT-style): deterministic finality, use 2 phases of endorsements among a quorum of random bakers who get rewarded(or punished) for their participation + unique elected baker is executing transactions for a new block - no multiple execution = no parallelism issue ``` ---- ## Smart contracts ```diff + execution is sandboxed at node level, no external calls + cost predictability, deterministic execution - require oracles - native low-level stack language named Michelson + high level language named Ligo that compiles to Michelson - jsligo : Javascript-like - pascalligo : Pascal-like - camelligo : OCaml-like - pyligo : Python-like (coming soon...) - time : `now` funtion refers the time of the block execution + onchain events ``` ---- ## Smart contracts ```diff + read operations are free of charge + write operation are very cheap (~few USD cents) + inter-contract calls via callbacks and views + each contract has a balance like any *implicit* user account + DEFI : FA2 are ERC20-like fungible tokens & ERC721-like non-fungible tokens + metadata : two ways to storage heavy content - on-chain storage - off-chain using IPFS or HTTP(S) + smart contract formalization as a theorem (Coq and Mi-Cho-Coq library) ``` ---- ## Limitations & solutions :cry: ```diff - slow TPS (but still better than other Layer1 blockchains) + Smart Rollups : Optimistic Layer2 validating transactions leveraging the consensus of the main chain - limited storage size and quick exponential cost + metadata storage : links pointing to IPFS or other - low level node RPC API, no joins + indexers : providing rich API, caching on top of RPC node ``` --- # DApp Architecture ---- ## Example of a voting application ![](https://hackmd.io/_uploads/HybVY6ixc.png) ---- ## Example of DApp structure <img style="position:absolute;float:left;left:-8vw" src="https://hackmd.io/_uploads/SkFqbjvuc.png" /> <img style="position:absolute;float:right;height:18vh;right:-8vw" src="http://pa1.narvii.com/6176/7b65a0cce90d11fd9b93e0be4ce7910a2fbff149_00.gif" /> ```diff - smart contract files -- *.*ligo : source files (to compile/transpile to Michelson) -- *.tz : generated Michelson files (to deploy to tezos) + client app ++ any web application ++ preference for Typescript frameworks (to include Taquito library) ``` => use TAQUERIA !!! <img style="position:absolute;float:right;height:18vh;right:-8vw" src="https://hackmd.io/_uploads/SydYdG1uo.png"/> ---- #### Example of Smart contract code ```jsligo [40|13-17|40|19|41|42|2-6|43|21-26|22|23-23|24] type parameter = | ["Participate",string ] //optional email | ["Reset"] | ["Close"] ; type Status = | ["OPEN"] | ["CLOSE"] ; type storage = { participants : map<address,string>, admin : address, status : Status }; type return_ = [list<operation>, storage]; const participate = ([email,store]:[string,storage]) : return_ => { return match(store.status, { CLOSE : () => failwith("Tombola is closed, come back later"), OPEN : () => [list([]),{...store,participants : Map.add(Tezos.source,email,store.participants)}] }); }; const reset = (store:storage) : return_ => { if(store.admin != Tezos.sender) failwith("Only admin can reset Tombola"); return [list([]),{...store,participants : Map.empty as map<address,string>,status:OPEN()}]; }; const close = (store:storage) : return_ => { if(store.admin != Tezos.sender) failwith("Only admin can close Tombola"); return [list([]),{...store,status:CLOSE()}]; }; // MAIN const main = (params:[parameter , storage]): return_ => { let [action , store] : [parameter , storage] = params; return match (action, { Participate : (email : string) => participate([email,store]), Reset : () => reset(store), Close : () => close(store) }) }; ``` ---- ## Indexer ```diff - Problem : Tezos RPC does not provide indexes + Solution : Index Tezos data to provide fast information and enrich RPC API - TZKT.io, Nomadic labs indexer , etc ... there are plenty of Tezos indexers + Example : - instead of querying 10 times a node to get last 10th transaction, query the indexer that will return you all in 1 call - if you want to get all contract from a particular user, it is an indexer join operation ``` ---- ## Oracle ```diff - Problem : smart contract execution is sandboxed + Solution : bring data on-chain via an off-chain push 1. deploy oracle smart contract 2. push data to the oracle 3. access oracle data via inter smartcontract calls ``` ---- ## Metadata storage ```diff - Problem : Tezos blockchain cannot store huge amount of data (~some Ko) - and it is costly + Solution : Provide external cheap storage - IPFS “Interplanetary File System” : commonly used for DAPPs because Data is exchanged in a peer-to-peer network, every file is accessed by its hash, since every node can copy/cache files hosted on IPFS, it can be stored stored in a decentralized way - Any other Cloud storage could work too ``` --- # Ecosystem ---- ## Tezos blockchain explorer (TZKT.io) ![](https://hackmd.io/_uploads/BkvLAaLVs.png) ---- ## Tezos statistics (TzStats.com) ![](https://hackmd.io/_uploads/r1pj0pIVs.png) ---- ## Tezos Agora Forum, submitting proposals (TezosAgora.org) ![](https://hackmd.io/_uploads/rJay1ALNo.png) ---- ## Baking bad, choose your baker (baking-bad.org) ![](https://hackmd.io/_uploads/B1-FZCUEi.png) ---- ## Ligo tooling (ligolang.org) ![](https://hackmd.io/_uploads/S1cP1CU4i.png) ---- ## Taquito, the Typescript client SDK ![](https://hackmd.io/_uploads/BJUfeRI4s.png) ---- ## Taqueria, the Tezos project manager ![](https://hackmd.io/_uploads/SJGgeCU4s.png) --- # Thank you ## Question ? :thinking_face:
{"metaMigratedAt":"2023-06-16T20:29:05.495Z","metaMigratedFrom":"YAML","title":"Developing on Tezos","breaks":true,"description":"slides to discover Tezos development","slideOptions":"{\"parallaxBackgroundSize\":\"100vw 100vh\",\"parallaxBackgroundImage\":\"https://www.fireworks-videos.com/wp-content/uploads/2020/06/2020-06-06_dark-night-sky_stars-and-slight-silky-clouds_2160p.jpg\"}","contributors":"[{\"id\":\"18f573e4-2b21-4446-a1ef-99e1328c1bab\",\"add\":16831,\"del\":8380},{\"id\":\"fbd2a9a4-ff78-4466-8356-17a33c030910\",\"add\":10,\"del\":6}]"}
    904 views
   owned this note