Blockchain Native Contract Execution via Bytecode Type Indicators
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current blockchain systems are limited by requiring smart contracts to be written in Solidity, lacking support for native contracts written in other languages like C++ or Python, which restricts development and application potential.
Innovation Solution
Implementing a method to execute native contracts on blockchain by using dynamic libraries, where bytecode includes an indicator to determine the contract type, allowing execution through a corresponding virtual machine, child process, or Docker container, enabling support for non-Solidity languages.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If blockchain systems require contracts to be written in Solidity and executed on EVM, then the system maintains simplicity and consistency, but the adaptability and versatility of the blockchain system are limited
Solution Approach 1:
The patent implements a universal contract execution system that can handle multiple contract types (Solidity contracts on EVM and native contracts in C++/Python) through a unified bytecode interface. The system uses a contract type indicator in the bytecode to determine whether to execute on EVM or invoke a native virtual machine, allowing the blockchain to support multiple programming languages and execution environments without requiring separate systems for each language.
Solution Approach 2:
The patent introduces an intermediary mechanism (the contract type indicator in bytecode and the corresponding execution dispatcher) that mediates between the blockchain system and different contract execution environments. This intermediary allows the system to seamlessly route contracts to the appropriate execution engine (EVM or native VM) based on the contract type, enabling multi-language support while maintaining system coherence.
2Productivity
If the blockchain system supports only Solidity contracts on EVM, then the system maintains ease of operation, but the productivity and application range are restricted
Solution Approach 1:
The system achieves multi-functionality by enabling the blockchain to execute both Solidity contracts (with gas-based fee mechanisms) and native contracts (with unlimited execution and sandbox escaping capabilities). This allows developers to choose the most appropriate language and execution model for each application scenario, thereby improving overall productivity while maintaining operational simplicity through automated contract type detection and routing.
3Speed
If native contracts are executed with unlimited gas and without EVM constraints, then the execution speed and flexibility improve, but the system reliability and security may be compromised
Solution Approach 1:
The patent applies local quality by implementing different execution constraints for different contract types: Solidity contracts on EVM are subject to gas limits and strict safety constraints, while native contracts in C++/Python execute with unlimited gas and sandbox escaping capabilities. This localized differentiation allows each contract type to operate with the appropriate level of freedom and constraint for its specific requirements, optimizing both speed and reliability for each execution context.
Data Source
AI summary
A computer-implemented method for implementing native contract on blockchain comprises: obtaining combined bytecode associated with a blockchain contract, wherein the combined bytecode comprises an indicator representing a type of the blockchain contract; determining the type of the blockchain contract based at least on the indicator; and executing the blockchain contract based on the determined type of the blockchain contract.


