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
Blockchain isn’t the only distributed ledger technology out there. A few alternative DLTs do exist. One of them has attracted a lot of social media frenzy lately, especially after a laconic tweet by Elon Musk that consisted of a single italic “h.”
Yes, we’re talking about Hedera Hashgraph. Musk might be bad at geopolitics, but he remains one of the loudest voices in the crypto community. Is Hashgraph a promising technology? Where does it stand in the current Web3 landscape? Is there any chance it will soon replace blockchain as a superior rival? The opinions differ.
Both ledgers, blockchain and hashgraph, have the same intended use. They allow any user to make a transaction that will spread throughout the entire network. The DLT will record and store data about each transaction.
PoW is the most widely used consensus algorithm in the blockchain. In PoW (Proof of Work), transaction verification is done using complicated math calculations. The whole process involves the following:
Sadly, this algorithm is environmentally unfriendly because it requires enormous energy due to the increased number of users. For example, BTC is 885,000 times less energy efficient than Hedera.
Since PoW will soon become an unviable approach due to the energy costs involved, more and more blockchain projects are choosing PoS, a proof-of-stake consensus algorithm much greener than PoW. The biggest blockchain that uses PoS, the Ethereum blockchain, made a final shift to PoS on Sept. 15, 2022.
Hashgraph also uses the PoS algorithm. However, its consensus approach is entirely different as it’s based on the “gossip protocol.” Once a node in the chain receives new data, it randomly selects another node on the network and shares this unique piece of information. The next node informed about the transaction does the same: select the next node randomly. This process is repeated until all nodes on the network have the new data. As soon as the data gets shared with peer nodes, an event with a time stamp is created.
Hashgraph solves the same problems that blockchain does but tends to do it faster so that a typical transaction gets validated within 3-5 sec. The processing capacity on the Hashgraph network is over 10,000 transactions per second, which is virtually unattainable on the blockchain.
Moreover, the storage required for maintaining the live ledger takes up to 1 GB. Also, AI works better with this technology.
Hedera doesn’t need miners to solve the problems and validate transactions, which explains why its fees are much lower than those on the blockchain. Network congestion isn’t an issue for Hashgraph, so you will never have to pay extra for a busier network.
Hashgraph utilizes Byzantine Fault Tolerance (BFT) to ensure the security of all the participants of the system. This scares away malicious players, guaranteeing that all transaction details can’t be tempered even if some malicious code is in the network.
Nothing. Except for the fact that it can hardly be called decentralized at the moment. 10% of all the profits generated by Hedera goes to Swirlds, a company that patented this technology allegedly to prevent its users from creating hard forks.
The board (Hedera Global Governing Council) which makes all decisions about the chain, consists of 39 representatives from multi-million-dollar companies. To run your dApp on Hashgraph, you currently need to get their permission. Fortunately, the people behind Hedera realized they needed to transform their brainchild into an open-source permissionless network to encourage broader community adoption. Hashgraph consensus is expected to become open source under an Apache 2.0 license after the next mainnet upgrade. The patents won’t be needed.
No. The future is still vague for Hashgraph as many factors might prevent it from replacing the blockchain DLT altogether. After all, many blockchains can follow suit and shift to PoS consensus just like Ethereum did.
Compared to other PoS-based blockchains, Hashgraph might not seem an absolute champion in terms of efficiency, speed, and low costs. Still, Hedera’s coin HBAR is highly likely to stay genuinely bullish for quite a while. Anyway, making Hashgraph open-source is a smart move that might make this technology spread like fire, or it’s better to say spread like epidemics taking into account the way their consensus algorithm is built.