Blockchain Node AoT Compilation for Smart Contract Execution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing blockchain technologies face challenges in efficiently executing smart contracts across different hardware and software environments due to differences in processor architectures and instruction sets, leading to inefficiencies and increased storage overheads from compiling multiple machine codes.

Innovation Solution

Implementing an ahead-of-time (AoT) compilation method where a blockchain node compiles smart contract bytecode into machine code before deployment, allowing each node to execute the machine code directly, reducing the need for multiple machine code versions and minimizing storage requirements.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If blockchain nodes compile smart contract bytecode into machine code for execution, then execution speed is improved, but storage overheads increase due to needing multiple machine code versions for different processor architectures

Engineering Contradiction:
Improveexecution speedVSAvoidstorage overheads
Core Design Contradiction:
SpeedVSQuantity of substance

Solution Approach 1:

The patent applies ahead-of-time (AoT) compilation where the bytecode is compiled into machine code before deployment and execution. This preliminary compilation action allows the machine code to be directly executable by the CPU during contract execution, significantly improving execution speed compared to interpretation-based approaches.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent employs a virtual machine architecture that enables a single bytecode version to be executed across multiple different processor architectures and operating systems. This universal approach allows one bytecode to serve multiple platforms without requiring separate machine code versions for each architecture, thereby reducing storage overheads while maintaining fast execution.

Inventive Principle:
Principle #6Universality (Multi-functionality)

2Adaptability or versatility

If blockchain nodes compile multiple versions of machine code for different processor architectures, then compatibility across environments is improved, but device complexity and storage requirements increase

Engineering Contradiction:
ImprovecompatibilityVSAvoiddevice complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent introduces a virtual machine as an intermediary layer between the bytecode and the underlying hardware. This virtual machine acts as a mediator that translates and executes bytecode across different processor architectures and operating systems, enabling compatibility without requiring nodes to maintain multiple machine code versions. The virtual machine abstracts away the hardware differences, simplifying the node design while preserving adaptability.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Ease of manufacture

If blockchain nodes use interpretation-based execution for smart contracts, then ease of deployment is improved, but execution speed decreases

Engineering Contradiction:
Improveease of deploymentVSAvoidexecution speed
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The patent applies ahead-of-time (AoT) compilation where the bytecode is compiled into machine code before deployment and execution. This preliminary compilation action allows the machine code to be directly executable by the CPU during contract execution, significantly improving execution speed compared to interpretation-based approaches.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentEP3961391B1Method for executing smart contract, blockchain node, and storage medium
Publication Date: 2023.08.02 ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
  • EP3961391B1 patent drawingFigure 1
  • EP3961391B1 patent drawingFigure 2~3
  • EP3961391B1 patent drawingFigure 4~5

AI summary

The present specification provides a method for executing a smart contract, a blockchain node, and a storage medium. An implementation of a method for executing a smart contract includes: receiving, by a blockchain node, a request for creating a smart contract, the request including a bytecode of the smart contract; starting, by the blockchain node after completing deployment of the smart contract, to compile the bytecode of the smart contract into a machine code by using ahead of time (AoT) and storing the machine code; and during execution of the deployed smart contract, executing, by the blockchain node, the machine code of the smart contract in response to the machine code being locally stored. According to the above implementations of the present application, the blockchain node can greatly increase a speed of executing a smart contract, and reduce storage overheads on the blockchain node.