Advantages of building Defi on the Internet Computer

blockpunk
Advantages of building Defi on the Internet Computer
Table of Contents
Table of Contents

There are several advantages of building Defi on the Internet Computer over other blockchains. This article will outline why the migration of decentralized finance to the Internet Computer is inevitable in the coming years.

DEFI originated from Ethereum

Most of the DEFI applications we know presently are based on EVM virtual machines. Therefore, most of the DEFI-related content and technical materials that are popular are related to EVM and Solidity. The first step in building DEFI applications on the Internet Computer is understanding the difference between EVMs and the Internet Computer. This document will introduce the differences between the Internet Computer and EVM from five perspectives:

  • Differences between EVM and Internet Computer structures
  • Performance differences
  • Storage
  • Reverse Gas Model
  • Development Languages

Structure

As we all know, transactions exist in the blockchain structure of Ethereum, which is a classic structure in the blockchain industry; however, the Internet Computer adopted a completely different technology, there is no main chain data structure in the Internet Computer.

For example, the main token on the Internet Computer, ICP, runs in a Canister called Ledger, which is a very important Canister on the Internet Computer (i.e., the smart contract on the Internet Computer), and all its functions and data are implemented inside this Canister.

To build DEFI applications on the Internet Computer, it is critical to understand the mechanism of Ledger Canisters, how the original token, ICP, makes transfers, and how transactions are confirmed.

In addition, Ethereum and the Internet Computer are similar in structure as they both use “account structure.” The difference is that the Internet Computer’s account structure consists of “Principal ID” and “Account ID,” both of which are user accounts. The “Account ID” is equivalent to the sub-account of “Principal ID”; it is used as the user’s identity to record information about the number of ICPs in the user’s account.

Performance

Ethereum confirms a transaction in a block between 12–15 seconds. The throughput of Ethereum is measured to be between 12 and 15 batches of transactions per second. Both of the above make it difficult to apply such performance requirements for applications with high immediacy requirements.

In contrast, there are two types of transactions on IC, of which the query type can reach about 200 ms, and the transaction type can reach about 2s. Such performance is relatively close to the performance of the Internet, which provides the basis for building most types of Internet experience applications on the Internet Computer.

Based on these performance advantages, the Internet Computer will be the preferred future option for DEFI applications below to implement building activities:

  1. DEX applications
  2. Enhanced versions of GameFI
  3. NFTs

Storage

Ethereum is the first blockchain to have smart contracts. But its storage, which is also primarily stored on the main chain, is over 9T of data. As described in the previous structure section, all of ETH’s smart contract data and transaction data together make up a total volume of 9T on the main chain, which is very large.

In contrast, there is no main chain data on the Internet Computer. Each Canister (smart contract) is stored independently, and the storage limit for a single Canister is currently 8G.

When you see this number, you may have a question: will the upper limit of Internet Computer storage be a limitation for smart contract development, while there is no need to consider the upper limit of data storage when developing an Ethereum contract?

First of all, every storage has an upper limit. The so-called no data storage cap of Ethereum is because the storage of each contract is created through transactions, and the main chain will store the data of transactions. Therefore, transaction data will not be capped in the main chain; there will only be increasing blocks and blocks of transaction data. But the aggregation of all smart contracts will create a considerable amount of data, which is currently seen as a total volume of 9T on the main chain.

The EVM mechanism has limited capability in storage and can only store structured data, and the size of a single byte of data cannot exceed 32 bytes. But the Internet Computer is capable of multiple types of data storage, similar to Blob. Therefore, applications like Tiktok, which requires video storage, can run on the Internet Computer. Such applications cannot be built on EVM, but it is perfectly feasible on the Internet Computer.

The most discussed solution for scaling in the Ethereum community is expanding via sharding. The Internet Computer does not have similar problems in this area. While the storage limit for a single Canister is 8G, there are different solutions for expanding storage on the Internet Computer. For example, to achieve the effect of scaling, the storage can be classified according to business type and index structure technology.

In addition, business data can be allocated into multiple Canisters by hash sharding, range sharding technology, by which way to reach an unlimited scaling target. At present, there are more than 15,000 Canisters on the Internet Computer, and in the long run, its capacity of expansion will be much higher than that of the Ethereum.

For example, an IPFS evangelist mentioned earlier that NFTs that are not stored on IPFS is not an NFT of your own, which graphically expressed that the storage content of NFTs built on EVM is stripped to other infrastructure settings, such as IPFS. So it is an enormous extra burden for developers to link two different public chains for one application. Therefore, the development of applications, such as NFTs and GameFi, will be perfectly supported by the Internet Computer.

Reverse Gas Model

While using any Dapp on EVM, any of your interactions requires you to pay ETH as a Gas fee. A problem often encountered is the explosion of Gas fees brought about by the soaring price of ETH, which has dramatically increased the barrier to entry for Ethereum.

First, we start by introducing the two original tokens on the Internet Computer, ICP, and Cycles.

ICP is the primary token on IC and is the primary token for governance, voting, etc., on the Internet Computer. But the Internet Computer also has another primary token, Cycles, which is the Gas token on the Internet Computer.

So what is Reverse Gas Model? Firstly, let’s introduce how Cycles are obtained. The only way to get Cycles is to burn ICP to get Cycles, and this burning is one-way, i.e., Cycles cannot be converted to ICP.

A critical factor in this process is the price at which ICP can be exchanged for Cycles? The price is floating and is determined by the cost of ICP. Cycles have a stable value and can be considered a stable currency, and the ICP price divided by the stable value of Cycles is the number of Cycles that can be exchanged for ICP. And the overhead of any Canister call is Cycles-priced. People will no longer encounter problems like the gas fee speedily increasing when ETH price pumps high on the Internet Computer.

Users on Ethereum need to buy ETH to enter Dapps before interacting with the application. At the same time, the payer of Cycles on IC is the publisher of smart contracts, so users do not need to hold ICP to use the application, which significantly reduces the threshold of entry for users.

Development Language

Developing smart contracts with Solidity is similar to developing smart contracts with JavaScript, both of which have ordinary expressiveness, limited data types, and poor support for complex data structures. A problem that developers often encounter is Stack too deep, depending on the complexity of the expression inside the function. A function with more than 16 local variables will not work, so developers need to be concerned about controlling the number of variables.

Theoretically, any language that can be compiled into WASM can be written on the Internet Computer. So far, the most popular languages on the Internet Computer are Rust and Motoko. Both have better expressiveness and better data type support.

  • Motoko is quite simplified, but its category library is not adequate.
  • Rust is difficult to get started with, but with a diverse category library.

If your team has experience with Rust, you can choose Rust. If you are new to Rust, Motoko is your best starting point.

Website | Discord | Telegram

*Note: This article has been published at the request of Blockpunk of ICP League

  • Disclaimer: The views and opinions expressed on this website are solely those of the original author and other contributors. These views and opinions do not necessarily represent those of the Dfinity Community staff and/or any/all contributors to this site.
Connect with the author: Twitter | Email | Distrikt

Write_a_guest_post-2



Comments are for members only. Join the conversation by subscribing 👇.

Great! Check your inbox and click the link
Great! Next, complete checkout for full access to Dfinity Community ∞
Welcome back! You've successfully signed in
You've successfully subscribed to Dfinity Community ∞
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated