# Lesson 01 - Introduction to Zilliqa Protocol ## 1.1 Property of the Zilliqa Protocol by Han Wen (Ecosystem, Zilliqa) and Jaryl (Senior Web Dev, Shopify) ### Zilliqa Zilliqa is a Singapore-based blockchain entity and aims to focus its expansion within ASEAN. Why Zilliqa (why blockchain)? > High level of security without compromising computational power Zilliqa products (which form the core of this blockchain): - Zilliqa (smart contract _platform_) - Scilla (smart contract _language_) ### Open Finance Solution Stack :computer: ###### tags: `consensus` `sharding` `proof of work` `super majority` Open toolkit that supports dApp developers in Fintech. **Highly modular and transparent:** Since everything is open in blockchain environment, people can just plug anyone's solution to improve their own solution. **Decentralized Finance vs OpenFinance:** Decentralized just means that there is no regulations in creating the FinTech (==ideal== scenario where there is no fraud in the ecosystem). OpenFinance refers to a real-life implementation of Decentralizd Finance (with certain regulations, e.g. limit the level of anonymity). Readup: [The Block Crypto](https://www.theblockcrypto.com/) #### Zilliqa :heavy_dollar_sign: It takes 10 minutes/block for Bitcoin to reach consensus About 20 seconds/block for Ethereum to reach consensus And 1-2 minutes/block for Zilliqa to reach verification (Zilliqa doesn't do proof-of-work to reach consensus) How to make it faster? ==Sharding== ##### Network Sharding Group networks into smaller groups of nodes, allowing for greater capacity to process transactions and linear scalability: ~3000 TPS.[Truth capacity ?] Ultimately preventing congestion like what Ethereum and Bitcoin are facing now. ##### Proof of Work Unlike Bitcoin that uses Nakamoto consensus, Zilliqa uses proof of work as an "entry ticket" to allow nodes to join the network. It is to prevent people with high computing power from attacking the network (since there is now a way to do identification). **How it works :** 1. The fastest node within each shard is selected to be the "leader"(Directory Service C). However, every 1.5 hours, the DSC will keep rotating (round robin). At the end of epoch, there will be a pseudo random selection to select the next "leader". 2. The responsibility of the DSC is to give a mathematical puzzle to the other nodes inside the shard. 3. Afterwards, the nodes will be redistributed to other shards :arrow_right: allow fairer distribution to miners (how ?) Each shard needs 2/3 of nodes + 1 (super majority) to reach a consensus. ##### Practical Byzantine Fault Tolerance How to ensure that the message is not intercepted? When there is a transaction made: 1. Leader announces next record with "pre-prepare" message 2. Each node validates the record and multicasts a "prepare" message (check that the leader is correct) 3. Upon receipt of "prepare", a "commit" message is sent to the group 4. With supermajority of "commits", transaction is deemed confirmed (nodes that are unresponsive / falsely rejects or accepts are considered Byzantine (malicious)) #### Scilla Language How to ensure our contract has no bug? Scilla. => built in security (ensure that the contracts are not violated. how?) #### Infrastructure Partners Building a scalable ecosystem that allows partners to build upon each other's solutions. ### ZilHive The ecosystem built upon Zilliqa and Scilla. ZilHive supports developers with grants and accelerator programs to kickstart their development process. ## 1.2 Smart contracts with Scilla by Jaryl (Senior WebDev @ Shopify) ### Less Features By design, Scilla does not have a lot of features to prevent attacks. Possible attacks that Scilla prevents: 1. Contracts that leak funds 2. Unexpected change to blockchain state (usually language bugs) 3. Contracts that are killed Scilla also provides a "checker" that allows us to verify that the output is as expected (data validation) ### OCAML based Scilla is based on OCAML - a functional programming language. Documentation of OCAML is more encompassing. ### Interpreted Language Scilla is currently an interpreted language (easier to build), but is moving to compiled language, which is more efficient (faster execution, lower memory usage). Re-entrancy attack: when the smart contract calls another smart contract, in real time, it is open to attacks that cause the contract to go into an undetermined state. Scilla prevents that. ## 1.3 Working with Zilliqa wallets Zilliqa used to have the same encoding as Ethereum (`base16` checksum). Now, it uses the `bech32` checksum. Internally, in Zilliqa JS implementation, we can get both `base16` and `bech32` encodings. To view the blocks and transactions in Zilliqa wallets: [Viewblock.io](viewblock.io/zilliqa) ## 1.4 Using the ZilPay Wallet ### Assignment 1A Getting familiar with ZilPay (instructions in handout) ## 1.5 Hello World with Neo Savant IDE ### Assignment 1B Getting familiar with Neo Savant IDE (instructions in handout) ### Parallels between dApp APIs and REST APIs | REST API | dAPP API | | ---------------- | -------- | | Function|Transition| |API Route| Contract| ### Differences between dApp APIs and REST APIs Rest APIs are usually free to call (there is no "cost" incurred when calling the API), while dApp APIs require `gas` as the currency to rate-limit people from excessively using the APIs. ## 1.6 Zilliqa JavaScript library ### [Documentation](https://github.com/Zilliqa/Zilliqa-JavaScript-Library) ZilPay library is the modified version of the Zilliqa JS library. We can use this library injected by the extension to talk to the blockchain. Cannot trust the server to do it on our behalf because it defeats the purpose of blockchain. hence, client communicates directly with the blockchain. transition calls: basically like function calls in the blockchain blockchain governance: makerdao, compound BG: how to do voting with anonimity. Linking a self-sovereign identity to a "governmental identity" is a challenge. J: iCloud has a different approach in identity (keyring). It is only accessable on the local devices. ## Miscellaneous Notes
{"metaMigratedAt":"2023-06-15T11:14:35.719Z","metaMigratedFrom":"Content","title":"Lesson 01 - Introduction to Zilliqa Protocol","breaks":true,"contributors":"[{\"id\":\"b6132d21-6c01-412e-ac90-6811b2fa08c4\",\"add\":6198,\"del\":9}]"}
Expand menu