Smart Contract Bytecode Preprocessing for Execution Speed

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current blockchain platforms face inefficiencies in executing smart contracts due to the need for repeated parsing and decoding of bytecode during invocation, which hampers execution speed and overall platform performance.

Innovation Solution

Preprocessing bytecode during deployment to generate a cacheable data structure that includes executable instruction codes and function index tables, allowing direct execution without additional parsing or decoding during invocation, and reusing this structure for multiple executions of the same smart contract.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If bytecode is parsed and decoded during each contract invocation, then the smart contract can be executed, but execution speed decreases due to repeated processing overhead

Engineering Contradiction:
Improvesmart contract execution speedVSAvoidtime spent on repeated parsing and decoding
Core Design Contradiction:
SpeedVSLoss of time

Solution Approach 1:

The patent applies preliminary action by preprocessing the bytecode during the contract deployment phase. The virtual machine parses and decodes the bytecode once during deployment, converting it into executable instructions and storing them in cache memory. This eliminates the need for repeated parsing and decoding during subsequent contract invocations, directly resolving the technical contradiction by preparing the execution environment in advance.

Inventive Principle:
Principle #10Preliminary action

2Productivity

If bytecode is preprocessed during deployment phase, then execution efficiency improves, but deployment phase complexity increases

Engineering Contradiction:
Improvesmart contract execution efficiencyVSAvoiddeployment phase processing complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent performs bytecode parsing and decoding as a preliminary action during the deployment phase. The virtual machine processes the bytecode once, generates executable instructions, and caches them for rapid execution. This shifts the processing complexity to the deployment phase while achieving significant productivity gains during execution, accepting temporary complexity increase for long-term efficiency improvement.

Inventive Principle:
Principle #10Preliminary action

3Speed

If bytecode is cached in memory during deployment, then invocation speed increases, but memory usage increases

Engineering Contradiction:
Improvecontract invocation speedVSAvoidcache memory consumption
Core Design Contradiction:
SpeedVSQuantity of substance

Solution Approach 1:

The patent applies the copying principle by creating a cached copy of the parsed and decoded bytecode instructions in the virtual machine's memory. Instead of repeatedly processing the original bytecode during each invocation, the system stores and reuses the executable instruction copy. This trade-off increases memory consumption but dramatically improves invocation speed by eliminating repeated parsing operations.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS11307990B2Deploying a smart contract
Publication Date: 2022.04.19 ADVANCED NEW TECHNOLOGIES CO LTD
  • US11307990B2 patent drawing
  • US11307990B2 patent drawing
  • US11307990B2 patent drawing

AI summary

Implementations of the present specification provide a method for deploying a smart contract. According to one implementation the method includes: receiving a transaction request for invoking a first contract; obtaining a first instruction code and a function index table, wherein the function index table is used to indicate a memory address of an instruction code corresponding to each of import and export functions in the first contract; determining a first memory address corresponding to the invocation function based on the function index table; and executing the first instruction code in the first memory address based on the determined first memory address.