Tagged with web3

Browse all tags

Structs in Solidity: Mastering Data Organization in Ethereum Smart Contracts

The Solidity programming language for Ethereum smart contracts, offers a robust feature known as structs that is indispensable in organizing and structuring information. These user-defined data types allow us to bundle variables under a single name, effectively creating blocks of organized data with set boundaries. Not only do structs enhance code readability and maintainability, but they also offer flexibility in instantiation. There are three ways to instantiate a struct in Solidity, each with advantages and use cases. In this blog post, we'll explore the nitty-gritty of Solidity structs, exploring their significance.

Read more

Beyond Default Messages: Mastering Custom Errors in Solidity

Aug 11, 2023

Solidity's custom errors offer significant advantages in blockchain development, enhancing smart contract robustness and clarity. These errors provide detailed and precise error messages, improving the ease of issue diagnosis. Additionally, they strengthen code readability by allowing for clear naming of error conditions and improve gas efficiency by enabling compact encoding of error information. Embracing these custom errors can revolutionize your Solidity development experience. Let's see how we can use custom errors in our Ethereum smart contracts.

Read more

Leveraging the Set Structure in Solidity

Jul 25, 2023

A Set structure, as used in many programming languages, is a collection of distinct elements where each item is unique, and no duplicates are allowed. This data structure is especially valuable when you need to efficiently check the existence of an item, maintain an organized collection of items without repetition, or quickly retrieve unique elements. Solidity programming language for Ethereum smart contract development does not natively support the Set data structure. Developers need to create their own structures or utilize external libraries to replicate Set functionalities, such as ensuring the uniqueness of elements within a collection.

Read more

Exploring the Features and Benefits of Azuki's ERC-721A NFT Standard

NFT minting on Ethereum can be expensive due to the high gas fees associated with executing intelligent contract transactions on the blockchain. Previously we learned how to use the ERC-721 standard, but there is an improved standard, ERC-721A, by Azuki. It gives enormous gas savings when minting multiple NFTs in one transaction. Minting five NFTs can save 7.2 times gas compared to the original ERC-721 standard. Let's check it out in this article.

Read more

Programmatically Verifying Solidity Smart Contract Code with Hardhat

In a previous blog post, we discussed the importance of verifying Solidity smart contracts before deploying them onto the blockchain. However, there is a way to automate that process and make it more efficient. With the help of Hardhat, a popular development environment for Ethereum, developers can now verify their smart contract code programmatically as part of the deployment process. This means the verification process can be integrated into the development pipeline, ensuring the code is verified automatically each time the contract is deployed. This blog post will explore how to use Hardhat to verify smart contract code and streamline the verification process programmatically.

Read more

How Hardhat Simplifies Smart Contract Verification on Ethereum

Smart contract verification is crucial for ensuring transparency, trust, and safety for users in the blockchain ecosystem. Smart contracts are immutable. Once deployed on the blockchain, they cannot be modified or deleted, making verification an essential process to ensure their correctness and safety. Verifying smart contracts with Hardhat tooling is a straightforward process that can be done quickly and easily. It provides a simple and effective way to verify smart contracts on the Ethereum network.

Read more

Implementing the ERC-2981 NFT royalty standard with Solidity - a game-changer for creators to receive income from every sale

Mar 28, 2023

With the rise of NFTs on the Ethereum blockchain, creators can now monetize their digital art, music, videos, and other media in ways previously considered impossible. However, with the ownership and transfer of NFTs comes the question of royalties when creators receive payments for subsequent sales of their work. In this article, we will explore the concept of royalties in NFTs on Ethereum and how they are changing the landscape of digital ownership and creation.

Read more

Understanding the Signing Process of Solidity Transactions with Ethers.js

In the previous post, we discussed meta transactions and the EIP-712 standard. This time we will check out how to sign the transaction with Ethers.js library and execute it in a smart contract. That means that the gas fee will be paid by someone else.

Read more

What are meta transactions, the EIP-712 standard, and how to sign a message with Metamask?

Meta transactions in Ethereum blockchain is an approach that removes the complexity for our users to deal with gas fees. The gas fee is a transaction fee paid to validators for proof of stake (POS) or miners for proof of work (POW) blockchains. With this approach, users sign a transaction, which is sent to a smart contract. It keeps all the security aspects upon which the Ethereum blockchain was created. This article will examine the EIP-712 standard and how to sign transactions with Metamask.

Read more

What are an NFT and the ERC-721 standard?

Dec 30, 2022

The non-fungible tokens, or in short NFTs, have one the most influential roles in the crypto and Web3 scene. These are digital assets that can represent digital art, virtual collectibles, assets in games, and more. Ethereum Foundation introduced the ERC-721 standard in 2017, which helped all the crypto wallets, brokers, and protocols to use this feature in a translatable way between any crypto solution. In this post, we will look more deeply into the ERC-721 standard and explore how it is used in the Solidity programming language for the Ethereum blockchain.

Read more

How do Bytes live in Solidity and coexist with Strings?

Nov 22, 2022

Bytes and Strings have a special place in the Solidity programming language. Both of these types work quite similarly yet differently. Even bytes have two kinds of ways - fixed or dynamic size. Bytes and strings can be converted and vice versa according to our needs to work with them. Let's look more profound in this blog post.

Read more

Exploring ERC20 fungible token standard in Solidity

This time let's talk about fungible tokens, one of the main building blocks in DeFi. These tokens can represent coins, gold, grain, and other assets that can be exchanged for them. We will look into one of the first Ethereum Improvement Proposal with number 20. This token standard is widely known as ERC20 and describes an interface for tokens within smart contracts. Functions like token transferring, approving spending, creating, and others are defined by this ERC20 standard.

Read more

Absence of null in Solidity

Aug 31, 2022

One of the weirdest Solidity programming language's quirks is the absence of null. Coming from Swift, where nullability is one of the core building blocks, it felt foreign. At first, I didn't understand how to code without such a useful feature. This post elaborates on how to find a way around that in Solidity when building smart contracts.

Read more

Mistery revealed about delegatecall in Solidity

This time we will talk about the critical lower-level function delegatecall. It is widely used in a proxy pattern, for instance, when using OpenZepplin upgrades pattern. Essentially this function executes code in another contract but uses data from the caller concept. Let's dig deeper and explore more.

Read more

Storage and memory secrets in Solidity

This time, we will talk about storage locations in Solidity programming language, specifically about the storage and memory locations. Not knowing what they represent and how they work can cause issues in our smart contracts.

Read more

How events in Solidity work, and why are they needed

Events in Solidity programming language help inform when something has happened in the smart contract. Parties like a web frontend, data gathering tools, and more can listen to specific events and react accordingly. In this post, we will dig deeper into Events and how to use them when developing smart contracts on Ethereum-like blockchains.

Read more

The Story behind Mapping in Solidity

Mappings in Solidity programming language play a significant role. These are hash tables that can have a key and value. When we use them, there are some caveats, especially from other programming languages. Let's explore them in this article.

Read more

Mastering Arrays in Solidity

Arrays in Solidity programming language can hold primitive data types like integers, boolean, and string. An array can be initialized with a fixed or dynamic size. If we compare them to other more advanced programming languages, there are pretty limited functions available to work with arrays. Despite that, we can add, remove, get the size of the array, and more.

Read more

Accessibility and visibility in Solidity

Jan 29, 2022

Solidity language allows specifying accessibility for contract functions and state variables. That will enable us to set constraints on constructing the smart contract and whether other contracts or addresses can access the data. Contract state variables and functions have a slight difference that we're going to check out. I want to mention that accessibility and visibility are different things in blockchain development context.

Read more

Solidity for Swift developers: File Structure and Functions

Dec 16, 2021

Solidity is an object-oriented language to write smart contracts that can be deployed on the blockchain, for instance, Ethereum. The syntax is similar to Javascript, but on the other hand, semantics is closer to C++. We will dig into Solidity language structure and functions from a Swift developer's perspective.

Read more