Gas Optimization In Solidity: Strategies For Cost-Effective Smart Contracts
Gas is the “fuel” that powers smart contract execution. This article offers practical strategies for Solidity gas optimization.
🇺🇦 Hacken stands with Ukraine!Learn more
Any country that wants to prosper financially must set up solid economic and monetary policies. These policies will become structures to ensure the smooth running of the economy.
A similar idea happens in crypto. To make a project successful, it needs a good plan for how its tokens will work to keep it afloat. Any project with bad tokenomics will sink.
Tokenomics is the concept behind how the law of demand and supply plays out in crypto and NFT. It emerged from two words: token and economics.
A token is a unit of an asset on the blockchain. It can exist in the form of a fungible or non-fungible token. Economics studies scarcity, consumer behavior, and efficient use of resources.
The key difference between traditional economics and tokenomics is how the latter is spelled out in code.
The tokenomics of any crypto or NFT project should address some key features. Here are a few of them:
1. Minting. The Central Banks create money through “minting” in the traditional banking system. Hence, new notes of a dollar or any currency are called “new mints.” Similarly, protocols also mint new tokens on the blockchain. The main question is, “How can the tokens be minted and remain valuable?”
This is where the concept of supply comes into play. Tokenomics revolves around maximizing the potential of a crypto token through the law of demand and supply. Some projects have an unlimited token minting term but checkmate the surplus with other measures. In contrast, some mint a maximum amount per time and gradually release them into their ecosystem.
2. Utility. Utility refers to the benefits a token offers to the token holders. How does it add value? What do people stand to gain by holding the token? That is the utility. The utility is an important factor to consider when analyzing crypto tokenomics. For example, an utility of MATIC is how Polygon users can pay transaction fees with it.
The utility can also exist in the form of access. For instance, holding 400 CODE tokens gives anyone access to become a member of Developer DAO. If the token has nothing to offer, it might not fly. Or even if it does, it will fall flat shortly. At the same time, utility is relative as it means different things to different people.
3. Distribution. Distribution deals with the rationale behind how a token is issued and allocated. Projects often have categories of token holders, either the core team or the general public. Meanwhile, the mode of launch is a huge factor in distribution. This depends on whether the team wants to raise some funds with the tokens or launch immediately.
In cases where they need to gather funds, they often do pre-sale. In token pre-sale, the team distributes some percentage of the token to early investors before it goes public. But there would be no early token distribution if they were to launch immediately, otherwise called a fair launch. All the distributions will be after they have gone public.
4. Vesting and Release. A token could have been distributed yet unreleased. Some projects adopt the vesting term in their smart contracts. Vesting is a practice where allocated tokens cannot be immediately available. Instead, they will be released gradually over some time. Vested tokens are often allocated to the core team or early-stage members. The plan can be to release 7% of the tokens every 2 months. The main idea is so the core team will not suddenly dump their tokens.
5. Token Burns. The value of a thing goes up when it is scarce. This is the rationale behind burns in crypto. The community might do it when they notice an excessive total circulating supply. In practice, the core team burns some tokens by sending them to an address no one can access.
By doing so, those tokens will forever be ejected out of circulation. For example, Solana carries out an ongoing token-burning mechanism. It burns 50% of each transaction fee. Others, like BNB, burn periodically. Note that token burn is not an essential utility. It is only a control mechanism.
6. Incentivization Models. Incentivization models are more relevant to blockchains and DeFi protocols. Any protocol that will thrive for long must have an established method of rewarding those at the core of its tokenomics. Who are those behind how the token is created? If they are not properly compensated, the structure of the crypto tokenomics will fall face-flat.
How blockchains approach incentivization often depends on their consensus mechanisms. For instance, Bitcoin utilizes the proof-of-work mechanism. It incentivizes its miners by giving them some cuts from the gas fees. Ethereum, a PoS-based blockchain, rewards its validators for their stakings. Incentivization works quite differently with DeFi protocols. Protocols such as UniSwap offer liquidity provision programs. They reward their liquidity providers with yields.
However, protocols should focus on creating tangible values that attract users instead of enticing them with undue incentivization.
7. Inflationary and Deflationary Models. Tokenomics designers have two major approaches to follow. These are inflationary and deflationary models. The main goal of the deflationary tokenomics model is to ensure a limited total amount in circulation concerning its price. Burning mechanisms are the lifeblood of maintaining deflationary tokenomics.
The first method of burning is to burn some percentage on each transaction. This is how Solana operates. The second method is for the team to burn the tokens at appointed periods. The inflationary model increases the number of tokens circulating over time. It does not place a stringent capitalization on token minting.
Polkadot and Ethereum are two popular examples of blockchains using the inflationary approach. There are various ways a protocol can introduce inflationary tokens. They can either mint on demand or with a schedule. The inflationary model requires caution. The tokenomics designers must ensure availability does not lead to market surplus and lower token value.
This is why some protocols have a hybrid of both inflationary and deflationary models. It is even better for robust adaptability in more diverse market conditions.
Profitable crypto traders should be able to analyze the project’s tokenomics. How can the general tokenomics features be merged to assess a project’s token? As mentioned earlier, tokenomics rest on the law of demand and supply.
Beyond the surface level, there is more to tokenomics analysis. Here is a brief insight into token supply.
Unavailable tokens cannot be analyzed. This is why token supply is the first precursor of tokenomics. Token supply appears in different forms, and here are some of them:
A token’s supply system is not the only reason to bag it. It must be balanced with a corresponding token demand mechanism. If the demand mechanisms are faulty, the tokenomics will crumble with time. The hard question of token demand is, “What realistic reasons would people want to part with their funds in exchange for the token?”
Although a project can fail for many reasons, bad tokenomics is a major pointer. Certain factors make up bad tokenomics. Once these factors are in a project, they are potential red flags. Here are 3 of them:
It is time to consider some examples for a real-time overview.
Avalanche is a layer-1 blockchain network that was launched in 2020. It uses the proof-of-stake consensus mechanism and boasts close to 1,000 validators. AVAX is the native and governance token of Avalanche.
Utility. AVAX has two major utilities. It serves as:
Incentives. Validators can earn up to 11% APY when they stake AVAX.
Supply. Although it has a maximum supply of 720,000,000 AVAX, only 324,781,476 circulates. All the vested AVAX would have been released by 2030.
Distribution. 50% of the tokens are directed towards staking rewards. The remaining 50% is partitioned among community efforts, public sales, and airdrops.
It is the native token of Chainlink, a decentralized oracle in Web3.
Utility. Its main use case is for development purposes. Developers pay with LINK to tap into the oracle infrastructure of Chainlink.
Incentives. Chainlink incentivizes its stakers by giving them around some percentage of tokens.
Supply. It has a maximum and total supply of 1,000,000,000 LINK. But only 491,599,971 LINK are in circulation at the moment. It has a regular supply of 250,000,000 LINK over time.
Distribution. Moving on to its distribution, it has an initial distribution in this proportion:
It was one of the earliest blockchains after Bitcoin. As a major L1, it powers a lot of other L2 and has a vibrant ecosystem. Several NFTs, crypto projects, and DApps are running on Ethereum.
The native token of Ethereum is Ether, with a market cap of $200,068,354,228.
Utility. The use cases of Ether include:
Incentives. Ethereum rewards those who stake ETH with more ETH. Anyone who stakes up to 32 ETH in the Ethereum protocol also has the power to become a validator.
Supply. Although it has no maximum supply, its total supply is 120,482,198. The total supply is currently in circulation. A new Ether will be minted through the PoS mechanism.
Distribution. This was the initial distribution of Ether:
DeFi protocols coordinate their community through on-chain agreements. They reach these on-chain agreements with the tokens. With the setting of blockchain, the main community behind any protocol is its DAO. As DAOs are on-chain organizations, they also need tokens to vote on-chain.
In tokenomics, the relevance of a token in terms of governance is a crucial aspect of tokenomics. How many tokens can a member have before joining the decision-making process? Will the members with more tokens have more voting power?
The importance of a token is beyond its native use cases; governance purposes are equally vital. For example, Aave has a DAO where it discusses its communal issues. Their governance token is AAVE.
Tokenomics remains a vital aspect of research before investors bag any token. Similarly, an NFT and crypto project must design befitting tokenomics to thrive. Nowadays, tokenomics is not necessarily enough.
There must be proof of how the designs on the paper correlate with the smart contract terms. Double-check if a notable smart contracts auditor confirms the tokenomics design and considers it safe for investors.
Tokenomics is the design of a token’s issuance, distribution, and structural management.
Tokenomics is important in cryptocurrency because if the design of a token is flawed, it will bite the dust eventually.
Tokenomics in NFT means the structure behind the demand and supply of an NFT.
Ether, a project with a market cap of $199,438,083,134, is an example of a project with solid tokenomics. Its initial allocation was 16.7% for the foundation and 83.3% for the crowdsale. It also has a total supply of 1,000,000,000 ETH and a supply schedule of 25,000,000 ETH over time.