Posts

Showing posts with the label Solidity

Building L1 Blockchains with EigenLayer AVS: A Guide for Substrate Developers

Image
In the ever-evolving blockchain ecosystem, scalability, validator incentives, and network security remain core challenges for Layer 1 (L1) blockchain developers. Substrate provides the perfect foundation for building customizable L1 blockchains, but integrating newer technologies like EigenLayer’s Autonomous Verifiable Service  (AVS) can help bring additional value to a project. This article will explain how Substrate developers can leverage EigenLayer's AVS for validator selection while keeping project tokens on Ethereum for liquidity. We will explore the major components of building a Substrate-based L1 blockchain with EigenLayer integration, focusing on how to choose validators, distribute rewards, and interact with Ethereum. This guide assumes you’re using Substrate Frame 2 and have a basic understanding of Substrate development. Introduction to EigenLayer AVS EigenLayer’s Active Validator Selection (AVS) system allows blockchain projects to leverage Ethereum validators thr...

Solidity Gas Optimisation

Image
If you are familiar with a language like JavaScript, you tend to never think about how your variable is stored, except to deal with the scope of the variable. When you are making programs to run on a distributed system like a blockchain, you have to think about things a bit differently. Solidity works as a compiled language where each operation gets converted to a lower level opco which the EVM can understand an interpret. Every operation that you write on your program gets executed on every computer in the network, which is why every operation costs 'gas' to prevent spamming and infinite loops. In solidity, getting to know the machine readable operations and their associated cost literally saves you money. Gas optimization is a challenge that is unique to developing Ethereum smart contracts. To be successful, we need to learn how Solidity handles our variables and functions under the hood. Some of the techniques we cover will violate well known code patterns. Before opt...

Solidity Static Analysis

Image
A growing number of industries are using blockchain platforms to perform trustless computation using smart contracts. Applications ranging from financial services to supply chains, and from logistics to healthcare are being developed to rely on blockchain technologies. One of the most popular underlying technologies is the Ethereum smart contact, whitten in Solidity, which are then compiled to Ethereum Virtual Machine (EVM) assembly instructions for blockchain deployment. Often, or more likely usually, the deployed smart contract’s code is insecure: software vulnerabilities are regularly identified, and have been exploited by malicious actors, resulting in millions of dollars in damages and harm to the reputation of blockchain systems. While modern compilers, offer various APIs on top of which third-party analyzers can be built, the Solidity compiler fails to offer the same features. However, there are several tools that you can use, of which the today's article will tal...

Multi-sig Deployment

Image
What is multisig Multi-signature is a digital signature scheme, that allows a group of users to sign a single transaction. The transaction could be a governance proposal, a snapshot vote, or even a simple fund transfer instruction. A common terminology to describe a multisig setup is m-of-n multisig. Given n parties with their own private keys, at least m of the private keys must sign a transaction to perform a transaction. For example, a multisig that has 7 members in the group and requires 4 signatures for a transaction to be fully signed — will be termed 4-of-7 multisig. The need for a multisig administration Before we answer the question — why do we need multisig administration? — let us first understand how it supplements the deployment management. The smart contract that is being deployed onto the chain, holds logic - sometimes worth millions of dollars. Think about swapping contracts in the decentralized exchange managing all the business logic. And in order to deplo...

Contract upgrade anti-patterns

Image
A popular trend in smart contract design is to promote the development of upgradable contracts . To be fair, existing techniques to upgrade contracts have flaws, increase the complexity of the contract significantly, and ultimately introduce bugs - even in the Zeppelin contract upgrade strategy. In this article, we are going to detail our analysis of existing smart contract upgrade strategies, describe the weaknesses we have observed in practice, and provide recommendations for contracts that require upgrades. In a follow-up blog post, we will detail a method, contract migration, that achieves the same benefits with few of the downsides. An overview of upgradable contracts Two ‘families’ of patterns have emerged for upgradable smart contracts: Data separation, where logic and data are kept in separate contracts. The logic contract owns and calls the data contract. Delegatecall-based proxies, where logic and data are kept in separate contracts, also, but the data contr...