brucesong2020@gmail.com

golang icon

How to Install Go on Ubuntu via Snap

Go (Golang) is an open-source programming language developed by Google. Known for its simplicity, concurrency support, and high performance, Go is widely used for modern backend systems, cloud-native applications, and Web3 projects. If you’re running Ubuntu 24.04 LTS, here’s how to install the latest Go version step by step. Step1. Verify if snap list command […]

How to Install Go on Ubuntu via Snap Read More »

solidity logo

Question: How do you handle exceptions and errors in Solidity? Please describe Solidity’s exception handling mechanisms and related keywords.

In Solidity, exception handling is an essential mechanism for ensuring the security and stability of smart contracts. When an exception occurs, the current transaction is reverted (rolled back), and the state of the blockchain remains unchanged. Solidity provides several built-in keywords and techniques to handle errors effectively. Here are the main tools available: 1. require

Question: How do you handle exceptions and errors in Solidity? Please describe Solidity’s exception handling mechanisms and related keywords. Read More »

Question: What are Function Modifiers in Solidity? Provide Examples of Their Application in Smart Contracts.

In Solidity, function modifiers are code blocks that can change or extend the behavior of functions. They allow developers to add preconditions or post-processing logic to functions without rewriting the same code repeatedly. Function modifiers are very useful when writing smart contracts, as they help ensure that certain conditions are met before executing a function,

Question: What are Function Modifiers in Solidity? Provide Examples of Their Application in Smart Contracts. Read More »

EIP explained

EIP-7702: 让普通钱包(EOA)拥有智能合约能力

以太坊上的账户主要分为两类: 传统上,EOA 没有能力执行智能合约逻辑,这限制了用户体验和 UX 创新。EIP-7702 的目标就是让普通 EOA 也可以“半智能化”,无需迁移到合约钱包。 为什么需要 EIP-7702? 尽管智能合约钱包越来越强大,普通用户大多仍使用 EOA,但这导致以下限制: EIP-7702 提供了针对 EOA 的 短期功能扩展,解决这些痛点。 核心功能 1. 批量交易(Batching) 通过一次交易执行多个操作,例如: 传统上需要两笔交易,现在可以一次完成,减少用户操作和 gas 成本。 2. 代付交易(Sponsorship) 允许第三方账户为 EOA 支付交易费,例如: 3. 子权限(Privilege De-escalation) 允许用户签署子 key,限制其权限范围,例如: 技术实现原理 EIP-7702 引入了 新交易类型:Set Code Transaction(类型 0x04)。 交易结构如下: 核心流程 如果目标地址为 0x0,表示清空委托,恢复普通 EOA。 Delegation Indicator 工作机制 安全与注意事项 Gas 成本 交易发送者支付所有授权 gas,无论授权是否有效 简单示例(伪代码)

EIP-7702: 让普通钱包(EOA)拥有智能合约能力 Read More »

solidity logo

Question: What is the mapping Data Structure in Solidity? Provide an Example of How to Use Mapping to Store and Retrieve Data.

In Solidity, the mapping data structure functions like a hash table. It is a collection of key-value pairs, where the key serves as the index and the value is the associated data. Mappings can be arbitrarily large, and their size does not need to be known at compile time. Key Characteristics of mapping Example: Storing

Question: What is the mapping Data Structure in Solidity? Provide an Example of How to Use Mapping to Store and Retrieve Data. Read More »

solidity logo

Question: What Is Inheritance in Solidity and How Is It Applied in Smart Contracts? Provide an Example of Extending a MultiSigWallet Contract.

In Solidity, inheritance allows one contract to reuse the code of another contract. This promotes modularity, reusability, and readability in smart contract development. Solidity supports multiple inheritance, meaning a contract can inherit from more than one parent contract. Child contracts can override parent functions or call parent functions to extend their logic. Inheritance is commonly

Question: What Is Inheritance in Solidity and How Is It Applied in Smart Contracts? Provide an Example of Extending a MultiSigWallet Contract. Read More »

solidity logo

Question: How are Events Implemented in Solidity, and What Are Their Role and Advantages in Smart Contracts?

In Solidity, events are a lightweight mechanism used to log specific actions or states that occur during the execution of a smart contract. They make it easier to track and monitor contract behavior by storing data in the transaction receipts, which can later be queried on a blockchain explorer. Implementing events involves three main steps:

Question: How are Events Implemented in Solidity, and What Are Their Role and Advantages in Smart Contracts? Read More »

solidity logo

Question: What are State Variables in Solidity, and how do they differ from Local Variables?

In Solidity, state variables are a special type of variable used to store the permanent data of a smart contract. They are stored on the Ethereum blockchain, meaning their values persist until explicitly modified. State variables are defined inside a contract and can be accessed by any function within that contract. Characteristics of State Variables

Question: What are State Variables in Solidity, and how do they differ from Local Variables? Read More »

Question: What Is Inter-Contract Communication? How Contracts Interact and Collaborate?

Summary: Inter-contract communication allows different smart contracts to call each other, exchange data, and collaborate. This mechanism enables developers to build complex decentralized applications (DApps), as no single contract can handle all functionality on its own. Multiple contracts working together can implement richer application logic. What Is Inter-Contract Communication? Inter-contract communication refers to the ability

Question: What Is Inter-Contract Communication? How Contracts Interact and Collaborate? Read More »

Hand of anonymous female on touchpad of laptop while surfing internet lying on mat at home during workout

Exploring EIP-7702: Practical Applications and Hands-on Tutorial

Git Repo viem project: https://github.com/songb2/ts-eip7702foundry project: https://github.com/songb2/eip7702 Introduction EIP-7702 introduces account delegation on Ethereum, allowing externally owned accounts (EOAs) to delegate certain operations to smart contracts or relayers. This feature enables gas sponsorship, meta-transactions, and more flexible account management, improving developer experience and user onboarding. In this article, we will explore the concept of EIP-7702,

Exploring EIP-7702: Practical Applications and Hands-on Tutorial Read More »