Method and device for improving bytecode reverse engineering effect of smart contract

A reverse engineering, smart contract technology, applied in reverse engineering, software maintenance/management, etc., can solve problems such as difficulty in understanding programs, inability to recover function signatures, inability to recover variable types, etc., to achieve the effect of increasing transparency and improving effects

Active Publication Date: 2021-10-15
UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, Erays cannot recover neither function signatures nor variable types, and its output contains a lot of code generated by the compiler to access parameters, which makes the program difficult to understand

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for improving bytecode reverse engineering effect of smart contract
  • Method and device for improving bytecode reverse engineering effect of smart contract
  • Method and device for improving bytecode reverse engineering effect of smart contract

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0027] We use Erays + (the application method) and Erays (the prior art method) the result of reverse engineering the same bytecode. Erays+ adds the function signature (EarysABI) provided by SigRec (line 1). Since the restored function signature does not include the function name and parameter names, Erays + The function id is used, and argN is used for the Nth argument. Figure 4 Lines 7 and 8 in correspond to lines 4 and 5 in the source code. In addition, Erays + The code generated by the compiler to check ether transfers (line 2), array overflow (lines 3-6), and terminate program execution (line 10) is preserved. Note that Erays simplifies the lower dimension bounds checks to true (Lines 4-6), since the sizes of the lower dimensions are known, so the results of these bounds checks can be determined without being performed. Then we explain. Erays + How to simplify the result of Erays. First, Erays + Replace the meaningless variable name m[$s5] with num(arg1), indica...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention relates to the technical field of block chain smart contracts, and provides a method and a device for improving a bytecode reverse engineering effect of a smart contract. According to the method, under the condition that a function signature is known, a compiler can be better improved, and the readability of the reverse engineering result of the smart contract is improved. According to a main scheme in the invention, the method comprises the following steps: S1, conducting reverse engineering on a contract bytecode through Erays so as to obtain a reversed code; S2, according to the known function signature in the contract bytecode, adding a function id and a parameter type to each common / external function of the code obtained after reverse engineering, and generating a parameter list; S3, for each function in the contract bytecode in the step S1, replacing a meaningless variable name with a meaningful parameter name; S4, for an assignment statement, if the parameter of the corresponding function is assigned to a variable, adding the type of the corresponding parameter to the variable; and S5, replacing the code, which is generated by the compiler and is used for accessing the parameter, with a simple assignment statement.

Description

technical field [0001] The invention belongs to the technical field of block chain smart contracts, specifically a method for improving the reverse engineering effect of smart contract byte codes, the processing object is smart contract byte code files, which can improve the readability of smart contract byte code reverse engineering results sex. Background technique [0002] More than 30 million smart contracts are deployed on Ethereum, the largest smart contract host chain. An Ethereum smart contract is a program (that is, a collection of data and instructions) running on the Ethereum Virtual Machine (EVM), and an Ethereum smart contract can be accessed through its contract address. Smart contracts are typically written in a high-level language (such as Solidity) and then compiled into EVM bytecode. After the smart contract is deployed on the chain, the public and external methods of the contract can be called. In order to call a smart contract function, the caller need...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F8/74
CPCG06F8/74Y02D10/00
Inventor 陈厅李子豪罗夏朴王晓峰王挺贺哲远房可昭张愉菲朱航李洪伟程岩张小松金峥卉
Owner UNIV OF ELECTRONICS SCI & TECH OF CHINA
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products