Lightweight Node Smart Contract Verification via Merkle Trees
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Lightweight nodes in blockchain networks, such as mobile clients, face challenges in verifying the execution results of smart contracts due to limited storage space and bandwidth, making it impractical to synchronize complete block data and repeatedly execute smart contracts locally.
Innovation Solution
A method and apparatus that acquire block head information and transaction lists from a blockchain network, using Merkle trees to verify the root nodes and execution results without requiring complete block data synchronization, allowing lightweight nodes to determine the validity of smart contract execution results efficiently.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If complete block data is synchronized to lightweight nodes in real time, then the validity of blocks can be determined correctly, but the storage space and bandwidth requirements become excessive and impractical
Solution Approach 1:
The patent segments the block data into essential components (block header, transaction list with execution results) and optional components (complete block data). Lightweight nodes only need to store and process the essential components for validity determination, while full nodes maintain complete data. This segmentation resolves the contradiction by enabling reliable validation without requiring all data to be stored and processed at lightweight nodes.
Solution Approach 2:
The patent introduces full nodes as intermediaries that maintain complete block data and perform comprehensive verification. Lightweight nodes query essential information from full nodes through the blockchain network. This intermediary approach allows lightweight nodes to achieve reliable block validity determination without directly storing or processing complete block data, thus reducing their storage and bandwidth requirements.
2Reliability
If smart contracts are repeatedly executed locally at lightweight nodes for verification, then execution result consistency can be verified, but the hardware capability requirements and execution costs become excessive
Solution Approach 1:
The patent uses Merkle trees to create a cryptographic copy structure of the block data. The Merkle root and transaction list with execution results serve as condensed copies that contain all necessary verification information. Lightweight nodes can verify execution result consistency by checking these copied structures against the blockchain data, without needing to re-execute smart contracts locally. This copying approach maintains verification reliability while dramatically reducing hardware and execution resource requirements.
Solution Approach 2:
The patent replaces the mechanical process of local smart contract execution with a cryptographic verification system using Merkle trees and hash functions. Instead of mechanically re-executing contracts to verify consistency, the system uses cryptographic proofs (Merkle proofs) to verify execution results. This substitution maintains verification reliability while eliminating the need for repeated local executions, thus reducing hardware capability requirements and execution costs.
3Measurement precision
If lightweight nodes store and process complete block data, then verification accuracy is improved, but the system complexity and resource consumption increase significantly
Solution Approach 1:
The patent applies partial action by having lightweight nodes process only the essential components of block data (block header, transaction list with execution results) rather than complete block data. The verification mechanism uses selective processing where lightweight nodes verify only the necessary cryptographic proofs (Merkle roots, transaction hashes) against the blockchain, rather than processing all block components. This partial action maintains sufficient verification accuracy while significantly reducing system complexity and resource consumption at lightweight nodes.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A method and apparatus for verifying smart contracts in a blockchain, and a storage medium are provided according to embodiments of the application. The method includes: acquiring block head information and a transaction list of a designated block from a first node in a blockchain network, wherein the transaction list includes transaction identifications and execution results of the smart contracts; and the block head information includes: a root node of a first Merkle tree, a root node of a second Merkle tree, and an identification of a previous block of the designated block; verifying the root node of the first Merkle tree and the transaction identifications; verifying the root node of the second Merkle tree and the execution results of the smart contracts; verifying whether the identification of the previous block of the designated block is in a pre-stored block head chain structure; and determining that the execution results of the smart contracts are valid, if the above verifications are passed. According to the embodiments of the application, it is not required to download or store the complete block information, nor is it required to repeatedly execute smart contracts locally on a lightweight client, which can help the lightweight node determine the validity of the execution results of the smart contracts, thereby saving system resources and improving the efficiency.