CN113486915A - Multi-platform-based intelligent contract classification method and system and electronic equipment - Google Patents

Multi-platform-based intelligent contract classification method and system and electronic equipment Download PDF

Info

Publication number
CN113486915A
CN113486915A CN202110452238.8A CN202110452238A CN113486915A CN 113486915 A CN113486915 A CN 113486915A CN 202110452238 A CN202110452238 A CN 202110452238A CN 113486915 A CN113486915 A CN 113486915A
Authority
CN
China
Prior art keywords
intelligent contract
transaction
platform
intelligent
classification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110452238.8A
Other languages
Chinese (zh)
Inventor
罗少龙
连松彬
马良峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhai Mobile Technology Co ltd
Original Assignee
Shenzhen Qianhai Mobile Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhai Mobile Technology Co ltd filed Critical Shenzhen Qianhai Mobile Technology Co ltd
Priority to CN202110452238.8A priority Critical patent/CN113486915A/en
Publication of CN113486915A publication Critical patent/CN113486915A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/243Classification techniques relating to the number of classes
    • G06F18/24323Tree-organised classifiers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Accounting & Taxation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an intelligent contract classification method, system and electronic equipment based on multiple platforms, which are characterized in that intelligent contracts and corresponding class labels on multiple platforms are obtained, codes and transaction data are obtained aiming at the intelligent contracts, the intelligent contracts are converted into transaction characteristic vectors and code characteristic vectors, the transaction characteristic vectors and the code characteristic vectors are combined to obtain final characteristic vectors, the final characteristic vectors and the class labels are input into an XGboost model to be trained to obtain a classification model, and the intelligent contracts of different platforms can be classified based on the classification model. Meanwhile, the method fully utilizes the transaction and code characteristics of one intelligent contract, improves the accuracy of the problem of multi-classification of the intelligent contract, and can be expanded to a plurality of platforms.

Description

Multi-platform-based intelligent contract classification method and system and electronic equipment
Technical Field
The invention relates to the field of a classification method of a block chain intelligent contract, in particular to a multi-platform-based intelligent contract classification method, a multi-platform-based intelligent contract classification system and electronic equipment.
Background
The blockchain technique is a completely new distributed infrastructure and computing paradigm that utilizes blockchain data structures to verify and store data, utilizes consensus algorithms to update data and ensure data consistency, utilizes cryptography to ensure security of data transmission and access, and utilizes intelligent contracts composed of automated script code to program and manipulate data. The block chain technology is an emerging technology which is accompanied by a bitcoin system, and is a point-to-point distributed ledger technology based on a cryptographic algorithm. Since early blockchain platforms (e.g., Bingson systems) did not support the well-behaved programming paradigm, the development of blockchain technology was greatly limited. Therefore, most of the subsequent block chain platforms support smart contracts with complete graphics so as to meet the requirements of various business scenarios. By introducing intelligent contracts and programming logic into the blockchain system, one can place custom execution logic on the blockchain to run, rather than just simple transaction transfers. With the advent of intelligent contracts, the application of the blockchain system is richer, and the practicability of the blockchain system also enters a new stage. The intelligent contract capable of customizing the program function enables the function of the block chain system to be enhanced and more flexible. Various applications based on intelligent contracts such as lotteries, games, tokens and the like are as if bamboo shoots are continuously emerging in the spring after rain. The programming ecology and tool chains of the intelligent contracts of different blockchain platforms are different, for example, different programming languages are supported, different compilers and virtual machines are adopted, and the like; this can satisfy the development requirements of developers with different programming preferences or different application scenarios. The code format in which intelligent contracts are deployed onto chains is also different, for example, the contract code on the etherhouse is the bytecode running on the EVM, and the contract code of the EOSIO is the WASM bytecode running on the EOS virtual machine.
At present, researches related to intelligent contract classification and identification are all carried out on an Etherhouse, and the proposed identification framework cannot be expanded to other block chain platforms to classify intelligent contracts, because feature extraction is specific to the Etherhouse system, but instruction sets of the Etherhouse and the other platforms are different, so that the scheme cannot be applied to intelligent contract classification on the other platforms.
Disclosure of Invention
The invention provides an intelligent contract classification method, an intelligent contract classification system and electronic equipment based on multiple platforms, and aims to solve the problem that the existing intelligent contract classification method cannot be suitable for multi-platform classification.
According to the embodiment of the application, the intelligent contract classification method based on multiple platforms is provided, and comprises the following steps: step S1: acquiring a plurality of intelligent contracts on different platforms and acquiring a category label of each intelligent contract; step S2: acquiring linked data on a corresponding platform, including codes and transaction data, aiming at each intelligent contract; step S3: counting transaction data and codes in all intelligent contracts to obtain corresponding transaction characteristic vectors and code characteristic vectors; step S4: merging the transaction characteristic vector and the code characteristic vector to obtain a final characteristic vector, and inputting the category label and the final characteristic vector into an XGboost model to obtain a classification model; and step S5: and classifying the intelligent contract based on the classification model obtained by training.
Preferably, step S2 specifically includes: step S21: respectively deploying a node on a platform of each block chain, and synchronizing data on the chains; and step S22: and preprocessing and screening the data on the chain to obtain the transaction data and codes of all intelligent contracts.
Preferably, the step S3 specifically includes: step S31: counting transaction data in all intelligent contracts, dividing the types of the transaction data into a plurality of characteristics, obtaining a transaction characteristic matrix, and converting the transaction characteristic matrix into a transaction characteristic vector; step S32: collecting an instruction set of a virtual machine of each block chain platform, and establishing an intelligent contract instruction library of each platform; and step S33: and counting codes in all intelligent contracts, combining the instruction library, counting the occurrence frequency of each instruction in each intelligent contract, establishing a code characteristic matrix, and converting the code characteristic matrix into a code characteristic vector.
Preferably, in step S4, the XGboost model is trained based on a training set and a test set 2: 8 scale pattern.
Preferably, step S5 specifically includes: step S51: inputting an intelligent contract on any platform based on a classification model obtained by training; step S52: the classification model outputs a multi-dimensional vector, and the dimensionality of the multi-dimensional vector is the same as the number of the class labels; and step S53: and obtaining a classification result of the intelligent contract based on the multi-dimensional vector.
The invention also provides an intelligent contract classification system based on multiple platforms, which comprises: the contract acquisition unit is used for acquiring a plurality of intelligent contracts on different platforms and acquiring a category label of each intelligent contract; the data acquisition unit is used for acquiring linked data on the corresponding platform, including codes and transaction data, aiming at each intelligent contract; the vector calculation unit is used for counting transaction data and codes in all intelligent contracts to obtain corresponding transaction characteristic vectors and code characteristic vectors; the model training unit is used for merging the transaction characteristic vector and the code characteristic vector to obtain a final characteristic vector, and inputting the category label and the final characteristic vector into the XGboost model to obtain a classification model; and the contract classification unit is used for classifying the intelligent contracts based on the classification models obtained by training.
Preferably, the data acquisition unit further includes: the node deployment unit is used for respectively deploying a node on the platform of each block chain and synchronizing data on the chain; and the data screening unit is used for preprocessing and screening the data on the chain to obtain the transaction data and codes of all the intelligent contracts.
Preferably, the vector calculation unit further includes: the transaction vector calculation unit is used for counting transaction data in all intelligent contracts, dividing the types of the transaction data into a plurality of characteristics, obtaining a transaction characteristic matrix, and converting the transaction characteristic matrix into a transaction characteristic vector; the instruction base establishing unit is used for collecting the instruction set of the virtual machine of each block chain platform and establishing an intelligent contract instruction base of each platform; and the code vector calculation unit is used for counting codes in all intelligent contracts, combining the instruction library, counting the occurrence frequency of each instruction in each intelligent contract, establishing a code characteristic matrix, and converting the code characteristic matrix into a code characteristic vector.
The invention also provides electronic equipment, which comprises a memory and a processor, wherein the memory stores a computer program which is set to execute the multi-platform-based intelligent contract classification method in any one of the above methods when running; the processor is configured to execute the multi-platform based intelligent contract classification method of any one of the above via the computer program.
The intelligent contract classification method, the intelligent contract classification system and the electronic equipment based on multiple platforms have the following beneficial effects:
the intelligent contract classification method is suitable for intelligent contract multi-classification models of platforms of a plurality of block chains and can be used for classification and function recognition of intelligent contracts, the true purpose of the intelligent contracts is informed to users, and the risk of contract fraud of the users is reduced. Meanwhile, the method extracts general transaction characteristics of intelligent contracts suitable for different block chain platforms, establishes intelligent contract instruction libraries of different block chain platforms, and finally extracts code characteristics of the contracts for classification and identification of the intelligent contracts, makes full use of the transaction and code characteristics of one intelligent contract, improves the accuracy of the multi-classification problem of the intelligent contracts, and can be expanded to a plurality of platforms. Furthermore, the intelligent contract multi-classification method provided by the method is not specific to a certain block chain platform, the related features of the proposed transaction can be collected on most of the main flow block chain platforms, and meanwhile, the intelligent contract instruction base of different platforms is gradually established, so that the method can be used for intelligent contract classification of more block chain platforms. The scheme provided by the method has stronger universality and higher expandability.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a multi-platform based intelligent contract classification method according to a first embodiment of the present invention.
Fig. 2 is a flowchart of step S2 in the multi-platform based intelligent contract classification method according to the first embodiment of the present invention.
Fig. 3 is a flowchart of step S3 in the method for classifying intelligent contracts based on multiple platforms according to the first embodiment of the present invention.
Fig. 4 is a flowchart of step S5 in the multi-platform based intelligent contract classification method according to the first embodiment of the present invention.
Fig. 5 is a block diagram of a multi-platform based intelligent contract classification system provided by a second embodiment of the present invention.
Fig. 6 is a block diagram of a data acquisition unit in the multi-platform based intelligent contract classification system according to the second embodiment of the invention.
Fig. 7 is a block diagram of a vector computing unit in the multi-platform based intelligent contract classification system according to the second embodiment of the present invention.
Fig. 8 is a block diagram of an electronic device according to a third embodiment of the present invention.
Description of reference numerals:
1. a contract acquisition unit; 2. a data acquisition unit; 3. a vector calculation unit; 4. a model training unit; 5. a contract classification unit;
21. a node deployment unit; 22. a data screening unit;
31. a transaction vector calculation unit; 32. an instruction library establishing unit; 33. a code vector calculation unit;
10. a memory; 20. a processor.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items and includes such combinations.
Referring to fig. 1, a first embodiment of the present invention discloses a method for classifying intelligent contracts based on multiple platforms, including the following steps:
step S1: a plurality of intelligent contracts on different platforms are obtained, and a category label of each intelligent contract is obtained.
Step S2: and acquiring the on-chain data on the corresponding platform, including codes and transaction data, aiming at each intelligent contract.
Step S3: and counting the transaction data and codes in all the intelligent contracts to obtain corresponding transaction characteristic vectors and code characteristic vectors.
Step S4: and combining the transaction characteristic vector and the code characteristic vector to obtain a final characteristic vector, and inputting the category label and the final characteristic vector into an XGboost model to obtain a classification model. And
step S5: and classifying the intelligent contract based on the classification model obtained by training.
It is understood that in step S1, contract data with tags are crawled from three websites dappwreview, Dapp, and dappwrad. The data includes the platform corresponding to each contract, its on-chain address and the class label of the contract, mainly include six categories: exchange, gambling, gaming, finance, high risk and others. Of course, in other embodiments, other categories may be used, such as by the area of the transaction.
It is understood that in step S2, transaction data of corresponding codes are collected on different platforms of the blockchain, so as to use multiple data on multiple platforms as the basis of subsequent classification identification, which includes the features of multiple platforms.
It is understood that in step S3, the collected transaction data is divided into a plurality of features according to data types, for example, the transaction data includes contract balance, transaction transfer amount, transaction number, etc., and n features below each contract are calculated, that is, a vector X ═ X1, X2, X3,..... times.n ], and the semantics of the 18 features are applicable to different blockchain platforms and can be extracted from the transaction data and calculated. Similarly, in the collected codes, each code corresponds to one instruction, and based on the number of times the instruction appears in the contract, a vector Y is established [ Y1, Y2, Y3,....... ym ], wherein ym represents the number of times the mth instruction appears in the contract, and the size of m depends on the virtual machine design of the platform, for example, 147 instructions are designed by the virtual machine of the etherhouse, and then m is 147.
It is to be understood that, in step S4, the transaction feature vector X and the code feature vector Y are merged, that is, Z ═ X1, X2, x3... ang.. xn, Y1, Y2, y3... ang.. ym, and finally, the Z and the tags collected in step S1 are input into the XGBoost model, and are trained by using the proportion mode of the training set and the test set 2: 8, and finally, an intelligent contract multi-classification model is obtained, and the classification model can input intelligent contracts from a plurality of different platforms and perform recognition classification.
The method is suitable for intelligent contract multi-classification models of platforms of a plurality of block chains and can be used for classification and function recognition of intelligent contracts, the true purpose of the intelligent contracts is informed to users, and the risk of contract fraud of the users is reduced. Meanwhile, the method extracts general transaction characteristics of intelligent contracts suitable for different block chain platforms, establishes intelligent contract instruction libraries of different block chain platforms, and finally extracts code characteristics of the contracts for classification and identification of the intelligent contracts, makes full use of the transaction and code characteristics of one intelligent contract, improves the accuracy of the multi-classification problem of the intelligent contracts, and can be expanded to a plurality of platforms. Furthermore, the intelligent contract multi-classification method provided by the method is not specific to a certain block chain platform, the related features of the proposed transaction can be collected on most of the main flow block chain platforms, and meanwhile, the intelligent contract instruction base of different platforms is gradually established, so that the method can be used for intelligent contract classification of more block chain platforms. The scheme provided by the method has stronger universality and higher expandability.
Referring to fig. 2, step S2 specifically includes:
step S21: and respectively deploying a node on the platform of each block chain, and synchronizing data on the chain. And
step S22: and preprocessing and screening the data on the chain to obtain the transaction data and codes of all intelligent contracts.
It is understood that in step S21, a node is deployed on the platform of each blockchain, and the node is used to synchronize the data on the chain, mainly including the data on the chain such as the blocks, transactions and codes.
It is understood that, in the data on the chain acquired in step S21, data having a plurality of different contracts are mainly filtered in step S22 for simplifying calculation, and the transaction data and codes in step S1 that meet the category label are mainly filtered, that is, the category label acquired in step S1 determines the condition range for filtering the data in step S22.
Referring to fig. 3, the step S3 specifically includes:
step S31: and counting the transaction data in all the intelligent contracts, dividing the types of the transaction data into a plurality of characteristics, obtaining a transaction characteristic matrix, and converting the transaction characteristic matrix into a transaction characteristic vector.
Step S32: and collecting the instruction set of the virtual machine of each block chain platform, and establishing an intelligent contract instruction library of each platform. And
step S33: and counting codes in all intelligent contracts, combining the instruction library, counting the occurrence frequency of each instruction in each intelligent contract, establishing a code characteristic matrix, and converting the code characteristic matrix into a code characteristic vector.
It is understood that, in step S31, the collected contract-related transaction data is calculated to obtain 18 features of each contract, that is, a vector X ═ X1, X2, X3,......... times, X18], where the semantics of the 18 features are applicable to different blockchain platforms and can be extracted and calculated from the transaction data, and in this embodiment, the features of the transaction data mainly include: the method is characterized in that: the balance of the contract. And (2) feature: the amount transferred in the external transaction of the contract. And (3) feature: the amount transferred in the contract internal transaction. And (4) feature: the amount transferred in the contract internal transaction. And (5) feature: contract trade strokes. And (6) feature: the number of transactions is transferred in the external transaction of the contract. And (7) feature: and transferring the transaction stroke number in the contract internal transaction. And (2) characteristic 8: export transaction count feature in contract internal transactions 9: the address number of the transfer-in transaction is generated by the contract in the external transaction of the contract. The characteristics are as follows: the address number of the transfer-in transaction is generated in the contract internal transaction and the contract. And (2) characteristic 11: the address number of the roll-out transaction generated with the contract in the contract internal transaction. And (2) feature 12: the contract averages the transaction amount per transaction. And (2) characteristic 13: average value of the amount of transfer in the contract internal transaction. Feature 14: average of the amount transferred in the contract internal transaction. And (2) feature 15: average value of the amount of transfer in the external transaction of the contract. And (4) feature 16: variance of the amount of transfer in a contract internal transaction. And (2) feature 17: variance of the amount transferred in the contract internal transaction. Feature 18: variance of the amount of transfer in the contract external transaction.
It is to be understood that, in step S31, each feature corresponds to a feature matrix, and the feature matrices of all transaction data are converted into feature vectors to obtain vectors X.
It is to be understood that, in step S32, each code has a corresponding instruction set, and the instruction set of each blockchain platform virtual machine is collected according to the virtual machine design of each blockchain platform and the related white paper, and an intelligent contract instruction library is established for each platform, where the instruction library includes all instructions that may be used by the virtual machine during the operation process.
It is to be understood that in step S33, the collected contract-related code data is processed, and the number of times of occurrence of each instruction in each intelligent contract is counted in conjunction with the instruction library established in step S32, so as to obtain a code feature vector.
Referring to fig. 4, step S5 specifically includes:
step S51: and inputting an intelligent contract on any platform based on the classification model obtained by training.
Step S52: the classification model outputs a multi-dimensional vector, and the dimension of the multi-dimensional vector is the same as the number of the class labels. And
step S53: and obtaining a classification result of the intelligent contract based on the multi-dimensional vector.
It is understood that in step S51, in the classification model after training, the intelligent contract on any platform can be used as input for recognition and classification.
It can be understood that, in step S52, the output multidimensional vector is determined by the number of the category labels preset in step S1, in this embodiment, the multidimensional vector is a six-dimensional vector, each dimension takes the value of 0 or 1, and if the value is 1, the category represented by the dimension is the most likely category of the contract to be detected.
Referring to fig. 5, a second embodiment of the present invention provides a multi-platform-based intelligent contract classification system, which adopts the multi-platform-based intelligent contract classification method provided in the first embodiment, and includes:
the contract obtaining unit 1 is used for obtaining a plurality of intelligent contracts on different platforms and obtaining a category label of each intelligent contract.
And the data acquisition unit 2 is used for acquiring the linked data on the corresponding platform, including the codes and the transaction data, aiming at each intelligent contract.
And the vector calculation unit 3 is used for counting the transaction data and codes in all the intelligent contracts to obtain corresponding transaction characteristic vectors and code characteristic vectors.
And the model training unit 4 is used for merging the transaction characteristic vector and the code characteristic vector to obtain a final characteristic vector, and inputting the category label and the final characteristic vector into the XGboost model to obtain a classification model. And
and the contract classification unit 5 is used for classifying the intelligent contracts based on the classification models obtained by training.
Referring to fig. 6, the data obtaining unit 2 further includes:
the node deployment unit 21 is configured to deploy a node on the platform of each block chain, and synchronize data on the chain. And
and the data screening unit 22 is used for preprocessing and screening the data on the chain to obtain the transaction data and codes of all the intelligent contracts.
Referring to fig. 7, the vector calculating unit 3 further includes:
and the transaction vector calculation unit 31 is configured to count transaction data in all intelligent contracts, divide the types of the transaction data into a plurality of features, and obtain a transaction feature matrix, where the transaction feature matrix is converted into a transaction feature vector.
And the instruction library establishing unit 32 is configured to collect an instruction set of the virtual machine of each blockchain platform, and establish an intelligent contract instruction library of each platform. And
and the code vector calculation unit 33 is configured to count codes in all intelligent contracts, count the occurrence frequency of each instruction in each intelligent contract in combination with the instruction library, and establish a code feature matrix, where the code feature matrix is converted into a code feature vector.
Referring to fig. 8, a third embodiment of the present invention provides an electronic device, where the electronic device includes a memory 10 and a processor 20, and the memory 10 stores therein an arithmetic machine program, where the arithmetic machine program is configured to execute, when running, the steps in any one of the embodiments of the multi-platform based intelligent contract classification method. The processor 20 is configured to execute the steps of any of the above embodiments of the multi-platform based intelligent contract classification method by the computing machine program.
Optionally, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of an operating machine network.
The intelligent contract classification method, the intelligent contract classification system and the electronic equipment based on multiple platforms have the following beneficial effects:
the intelligent contract classification method is suitable for intelligent contract multi-classification models of platforms of a plurality of block chains and can be used for classification and function recognition of intelligent contracts, the true purpose of the intelligent contracts is informed to users, and the risk of contract fraud of the users is reduced. Meanwhile, the method extracts general transaction characteristics of intelligent contracts suitable for different block chain platforms, establishes intelligent contract instruction libraries of different block chain platforms, and finally extracts code characteristics of the contracts for classification and identification of the intelligent contracts, makes full use of the transaction and code characteristics of one intelligent contract, improves the accuracy of the multi-classification problem of the intelligent contracts, and can be expanded to a plurality of platforms. Furthermore, the intelligent contract multi-classification method provided by the method is not specific to a certain block chain platform, the related features of the proposed transaction can be collected on most of the main flow block chain platforms, and meanwhile, the intelligent contract instruction base of different platforms is gradually established, so that the method can be used for intelligent contract classification of more block chain platforms. The scheme provided by the method has stronger universality and higher expandability.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (9)

1. An intelligent contract classification method based on multiple platforms is characterized in that: the method comprises the following steps:
step S1: acquiring a plurality of intelligent contracts on different platforms and acquiring a category label of each intelligent contract;
step S2: acquiring linked data on a corresponding platform, including codes and transaction data, aiming at each intelligent contract;
step S3: counting transaction data and codes in all intelligent contracts to obtain corresponding transaction characteristic vectors and code characteristic vectors;
step S4: merging the transaction characteristic vector and the code characteristic vector to obtain a final characteristic vector, and inputting the category label and the final characteristic vector into an XGboost model to obtain a classification model; and
step S5: and classifying the intelligent contract based on the classification model obtained by training.
2. The multi-platform based intelligent contract classification method according to claim 1, characterized in that: step S2 specifically includes:
step S21: respectively deploying a node on a platform of each block chain, and synchronizing data on the chains; and
step S22: and preprocessing and screening the data on the chain to obtain the transaction data and codes of all intelligent contracts.
3. The multi-platform based intelligent contract classification method according to claim 1, characterized in that: the step S3 specifically includes:
step S31: counting transaction data in all intelligent contracts, dividing the types of the transaction data into a plurality of characteristics, obtaining a transaction characteristic matrix, and converting the transaction characteristic matrix into a transaction characteristic vector;
step S32: collecting an instruction set of a virtual machine of each block chain platform, and establishing an intelligent contract instruction library of each platform; and
step S33: and counting codes in all intelligent contracts, combining the instruction library, counting the occurrence frequency of each instruction in each intelligent contract, establishing a code characteristic matrix, and converting the code characteristic matrix into a code characteristic vector.
4. The multi-platform based intelligent contract classification method according to claim 1, characterized in that: in step S4, the XGBoost model is trained based on the training set and the test set in a 2: 8 ratio mode.
5. The multi-platform based intelligent contract classification method according to claim 1, characterized in that: step S5 specifically includes:
step S51: inputting an intelligent contract on any platform based on a classification model obtained by training;
step S52: the classification model outputs a multi-dimensional vector, and the dimensionality of the multi-dimensional vector is the same as the number of the class labels; and
step S53: and obtaining a classification result of the intelligent contract based on the multi-dimensional vector.
6. The utility model provides an intelligent contract classification system based on many platforms which characterized in that: the method comprises the following steps:
the contract acquisition unit is used for acquiring a plurality of intelligent contracts on different platforms and acquiring a category label of each intelligent contract;
the data acquisition unit is used for acquiring linked data on the corresponding platform, including codes and transaction data, aiming at each intelligent contract;
the vector calculation unit is used for counting transaction data and codes in all intelligent contracts to obtain corresponding transaction characteristic vectors and code characteristic vectors;
the model training unit is used for merging the transaction characteristic vector and the code characteristic vector to obtain a final characteristic vector, and inputting the category label and the final characteristic vector into the XGboost model to obtain a classification model; and
and the contract classification unit is used for classifying the intelligent contract based on the classification model obtained by training.
7. The multi-platform based intelligent contract classification system according to claim 6, wherein: the data acquisition unit further includes:
the node deployment unit is used for respectively deploying a node on the platform of each block chain and synchronizing data on the chain; and
and the data screening unit is used for preprocessing and screening the data on the chain to obtain the transaction data and codes of all the intelligent contracts.
8. The multi-platform based intelligent contract classification system according to claim 6, wherein: the vector calculation unit further includes:
the transaction vector calculation unit is used for counting transaction data in all intelligent contracts, dividing the types of the transaction data into a plurality of characteristics, obtaining a transaction characteristic matrix, and converting the transaction characteristic matrix into a transaction characteristic vector;
the instruction base establishing unit is used for collecting the instruction set of the virtual machine of each block chain platform and establishing an intelligent contract instruction base of each platform; and
and the code vector calculation unit is used for counting codes in all intelligent contracts, combining the instruction library, counting the occurrence frequency of each instruction in each intelligent contract, establishing a code characteristic matrix, and converting the code characteristic matrix into a code characteristic vector.
9. An electronic device comprising a memory and a processor, characterized in that: the memory having stored therein a computer program arranged to execute, when executed, the multi-platform based intelligent contract classification method of any one of claims 1 to 5;
the processor is arranged to execute the multi-platform based intelligent contract classification method of any one of claims 1 to 5 by means of the computer program.
CN202110452238.8A 2021-04-26 2021-04-26 Multi-platform-based intelligent contract classification method and system and electronic equipment Pending CN113486915A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110452238.8A CN113486915A (en) 2021-04-26 2021-04-26 Multi-platform-based intelligent contract classification method and system and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110452238.8A CN113486915A (en) 2021-04-26 2021-04-26 Multi-platform-based intelligent contract classification method and system and electronic equipment

Publications (1)

Publication Number Publication Date
CN113486915A true CN113486915A (en) 2021-10-08

Family

ID=77933415

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110452238.8A Pending CN113486915A (en) 2021-04-26 2021-04-26 Multi-platform-based intelligent contract classification method and system and electronic equipment

Country Status (1)

Country Link
CN (1) CN113486915A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113900665A (en) * 2021-12-09 2022-01-07 众连智能科技有限公司 Security detection method and device for intelligent contract

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778882A (en) * 2016-12-23 2017-05-31 杭州云象网络技术有限公司 A kind of intelligent contract automatic classification method based on feedforward neural network
CN109308413A (en) * 2018-11-28 2019-02-05 杭州复杂美科技有限公司 Feature extracting method, model generating method and malicious code detecting method
CN109614093A (en) * 2018-11-01 2019-04-12 播金信息科技(上海)有限公司 The processing method of visual intelligent contract system and intelligent contract
US20190332966A1 (en) * 2018-04-27 2019-10-31 Seal Software Ltd. Generative adversarial network model training using distributed ledger
CN110782346A (en) * 2019-10-09 2020-02-11 山东科技大学 Intelligent contract classification method based on keyword feature extraction and attention
CN112015628A (en) * 2020-09-01 2020-12-01 北京物资学院 Intelligent contract function level dynamic monitoring and analyzing system and implementation method
CN112035090A (en) * 2020-07-13 2020-12-04 翼帆数字科技(苏州)有限公司 Intelligent contract management system and method based on containerization technology
CN112115326A (en) * 2020-08-19 2020-12-22 北京交通大学 Multi-label classification and vulnerability detection method for Ether house intelligent contracts
US20200410460A1 (en) * 2018-03-18 2020-12-31 Valid Network Ltd Method and system for assessing future execution of a smart contract based on previous executions on a blockchain-based platform
CN112631611A (en) * 2021-01-06 2021-04-09 中山大学 Intelligent Pompe deception contract identification method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778882A (en) * 2016-12-23 2017-05-31 杭州云象网络技术有限公司 A kind of intelligent contract automatic classification method based on feedforward neural network
US20200410460A1 (en) * 2018-03-18 2020-12-31 Valid Network Ltd Method and system for assessing future execution of a smart contract based on previous executions on a blockchain-based platform
US20190332966A1 (en) * 2018-04-27 2019-10-31 Seal Software Ltd. Generative adversarial network model training using distributed ledger
CN109614093A (en) * 2018-11-01 2019-04-12 播金信息科技(上海)有限公司 The processing method of visual intelligent contract system and intelligent contract
CN109308413A (en) * 2018-11-28 2019-02-05 杭州复杂美科技有限公司 Feature extracting method, model generating method and malicious code detecting method
CN110782346A (en) * 2019-10-09 2020-02-11 山东科技大学 Intelligent contract classification method based on keyword feature extraction and attention
CN112035090A (en) * 2020-07-13 2020-12-04 翼帆数字科技(苏州)有限公司 Intelligent contract management system and method based on containerization technology
CN112115326A (en) * 2020-08-19 2020-12-22 北京交通大学 Multi-label classification and vulnerability detection method for Ether house intelligent contracts
CN112015628A (en) * 2020-09-01 2020-12-01 北京物资学院 Intelligent contract function level dynamic monitoring and analyzing system and implementation method
CN112631611A (en) * 2021-01-06 2021-04-09 中山大学 Intelligent Pompe deception contract identification method and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
NINGYU HE等: "Security Analysis of EOSIO Smart Contracts", 《ARXIV》, pages 1 - 16 *
王灿等: "基于Bi-LSTM和Attention的智能合约分类", 《软件导刊》, vol. 20, no. 2, pages 40 - 43 *
高飞: "基于区块链技术的智能合约自动分类系统设计", 《高原科学研究》, no. 4, pages 51 - 59 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113900665A (en) * 2021-12-09 2022-01-07 众连智能科技有限公司 Security detection method and device for intelligent contract

Similar Documents

Publication Publication Date Title
CN111461164B (en) Sample data set capacity expansion method and model training method
CN112418360B (en) Convolutional neural network training method, pedestrian attribute identification method and related equipment
CN104679818A (en) Video keyframe extracting method and video keyframe extracting system
CN113705462B (en) Face recognition method, device, electronic equipment and computer readable storage medium
CN110163111A (en) Method, apparatus of calling out the numbers, electronic equipment and storage medium based on recognition of face
CN110442510A (en) A kind of page properties acquisition methods, device and computer equipment, storage medium
CN109033955A (en) A kind of face tracking method and system
CN112085088A (en) Image processing method, device, equipment and storage medium
CN110276369A (en) Feature selection approach, device, equipment and storage medium based on machine learning
CN113283446A (en) Method and device for identifying target object in image, electronic equipment and storage medium
CN110506281A (en) The unified insertion of study
EP4070207A1 (en) Systems and methods for product identification using image analysis from image mask and trained neural network
CN111311702A (en) Image generation and identification module and method based on BlockGAN
CN113792089A (en) Illegal behavior detection method, device, equipment and medium based on artificial intelligence
CN113486915A (en) Multi-platform-based intelligent contract classification method and system and electronic equipment
CN113222668A (en) Value-added service pushing method, device, equipment and storage medium
CN114639152A (en) Multi-modal voice interaction method, device, equipment and medium based on face recognition
Kukharev et al. Face recognition using two-dimensional CCA and PLS
CN112819510A (en) Fashion trend prediction method, system and equipment based on clothing multi-attribute recognition
JP2021124979A (en) Method for operating neural network and data classification system
CN112915539B (en) Virtual object detection method and device and readable storage medium
CN104778373A (en) Method and device for identifying tactic of physical exercise
CN109815793A (en) Micro- expression describes method, apparatus, computer installation and readable storage medium storing program for executing
CN114494978A (en) Pipeline-based parallel video structured inference method and system
CN113569070A (en) Image detection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination