WO2022100063A1 - Method and apparatus for generating and storing logs of smart contract, device, and storage medium - Google Patents

Method and apparatus for generating and storing logs of smart contract, device, and storage medium Download PDF

Info

Publication number
WO2022100063A1
WO2022100063A1 PCT/CN2021/096859 CN2021096859W WO2022100063A1 WO 2022100063 A1 WO2022100063 A1 WO 2022100063A1 CN 2021096859 W CN2021096859 W CN 2021096859W WO 2022100063 A1 WO2022100063 A1 WO 2022100063A1
Authority
WO
WIPO (PCT)
Prior art keywords
smart contract
log
compilation
test
public key
Prior art date
Application number
PCT/CN2021/096859
Other languages
French (fr)
Chinese (zh)
Inventor
代健武
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022100063A1 publication Critical patent/WO2022100063A1/en

Links

Images

Classifications

    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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

Definitions

  • This application relates to the field of blockchain, and in particular, to a method, device, device and storage medium for log generation and storage of smart contracts.
  • a smart contract is a computer protocol designed to disseminate, verify or execute contracts in an information-based manner. Smart contracts allow for trusted transactions without third parties that are traceable and irreversible.
  • the logs generated during the testing or deployment of smart contracts are critical for developers. Developers usually need to use these logs to check for some problems in the smart contract development process. Therefore, generating logs of smart contracts and saving logs to ensure log security are also crucial steps.
  • a log generation and storage method for a smart contract comprising:
  • the original log content is encrypted to obtain the encrypted log content
  • a log generation and storage device for smart contracts comprising:
  • the log document generation module is used to generate the log document of the smart contract
  • a first generation submodule for generating a first private key and a first public key matching the first private key
  • the first writing submodule is used to write the first public key into the log file of the smart contract
  • the second generation submodule is used to generate a pair of the second public key and the second private key
  • the third generating submodule is used to generate the first shared secret key according to the first encryption algorithm, the first private secret key and the second public secret key;
  • an encryption sub-module for encrypting the original log content to obtain the encrypted log content according to the first shared secret key and the second encryption algorithm
  • the second writing submodule is used to write the encrypted log content into the log file of the smart contract
  • the saving sub-module is used to save the smart contract log file including the first public key and the encrypted log content.
  • a computer device comprising a memory and a processor
  • the memory stores computer-readable instructions
  • the processor executes a log generation and a smart contract.
  • the steps of the preservation method, the steps of the log generation and preservation method of the smart contract executed by the processor include:
  • the original log content is encrypted to obtain the encrypted log content
  • a storage medium storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of a method for generating and saving a log of a smart contract, so that the The steps of the log generation and storage method of the smart contract executed by the processor include:
  • the original log content is encrypted to obtain the encrypted log content
  • the above-mentioned smart contract log generation and storage method, device, computer equipment and storage medium improve the timeliness and accuracy of smart contract log generation, and provide an effective solution for developers to obtain smart contract logs in a timely and accurate manner.
  • the level is higher, and the log generation and acquisition results are no longer affected by factors such as personnel's subjectivity and mistakes; and since the first private key is generated according to the random function, the generated first shared secret key used to encrypt the original log content It is different, which greatly increases the difficulty of cracking by illegal users, thereby improving the protection of the logs of the smart contract, thus improving the security, and solving the problem of using the same key for encryption and decryption in the prior art, which has security Less technical issues.
  • Fig. 1 is the flow chart of the log generation and preservation method of the smart contract provided in one embodiment
  • FIG. 2 is a flow chart of a smart contract pipeline provided in one embodiment
  • FIG. 3 is a detailed flow chart of a smart contract pipeline provided in another embodiment
  • Fig. 4 is the flow chart of step S10 in the embodiment corresponding to Fig. 1;
  • Fig. 5 is the flow chart of step S20 in the embodiment corresponding to Fig. 1;
  • FIG. 6 is a structural block diagram of a log generation and storage device of a smart contract in one embodiment
  • FIG. 7 is a structural block diagram of a computer device in one embodiment.
  • Smart contract sharing creation platform including smart contract development platform, smart contract code management library, smart contract pipeline platform and smart contract test network.
  • the smart contract development platform includes user rights management, smart contract project management, smart contract development, review, approval, etc.
  • the user rights management includes the user's access control to the smart contract development platform, the access control to the smart contract project, and the control of the development rights, audit rights and approval rights of specific smart contracts.
  • the smart contract code management library includes smart contract code management.
  • the smart contract pipeline platform includes a series of automated operations such as scanning, compiling, deploying, and testing smart contracts, as well as collecting, storing, and processing related information (such as status, results, logs, etc.) of these operations.
  • the smart contract test network is used to test smart contracts and simulate the real blockchain network.
  • the smart contract pipeline platform will generate a new pipeline execution ID for the smart contract, and maintain a pipeline execution history based on the pipeline execution ID, including the status, results and logs of each pipeline execution.
  • the smart contract pipeline platform provides the following functions: query the pipeline execution history of the smart contract according to the smart contract ID; query the execution status and result of the pipeline according to the smart contract ID and its pipeline execution ID; query the pipeline execution status and results according to the smart contract ID and its pipeline execution ID; query Execution results of different stages of the pipeline, log.
  • the smart contract pipeline platform includes a smart contract scanning module, a smart contract compilation module, a smart contract deployment module and a smart contract testing module.
  • the smart contract scanning module is used to perform smart contract scanning operations and obtain smart contract scanning logs.
  • the smart contract compilation module is used to perform smart contract compilation operations and obtain smart contract compilation logs.
  • the smart contract deployment module is used to perform smart contract deployment operations and obtain smart contract deployment logs.
  • the smart contract testing module is used to perform smart contract testing operations and obtain smart contract testing logs.
  • the log generation and storage method for a smart contract includes the following steps:
  • the smart contract pipeline After the smart contract pipeline starts running, it will perform automated operations such as scanning, compiling, deploying, and testing the smart contract, and merge the smart contract scanning log, smart contract compilation log, smart contract deployment log, and smart contract test log together. The logs that make up the smart contract.
  • Step S10 includes:
  • step S101 includes:
  • the smart contract scanning module After the smart contract scanning module receives the smart contract scanning request, it records the scanning request log.
  • the smart contract scanning module executes the scanning task, records the scanning process log, and generates a scanning result report.
  • Executing the scanning task includes: reading the smart contract, persistently storing the smart contract and its execution status and execution result, and scanning the persistently stored smart contract with a preset scanning frequency and preset scanning time.
  • the preset scan frequency and preset scan time can be set according to actual needs.
  • the smart contract scanning module completes the recording of logs related to this scan, and uses the scan request log, the download log and the scan process log to form a smart contract scan log.
  • step S102 includes:
  • the smart contract compilation module After the smart contract compilation module receives the smart contract compilation request, it starts to record the logs related to the compilation request;
  • the smart contract compilation module analyzes the smart contract code, builds the corresponding compilation environment, performs compilation operations, records compilation logs and compilation results;
  • the step of performing a compilation operation includes:
  • Lexical analysis and syntax analysis Parse the smart contract code into an abstract syntax tree, which is implemented using the Crystal macro mechanism.
  • the code can be directly embedded in the Crystal code as a macro, or the abstract syntax tree can be directly input without using the macro language description. , but pass in the object directly in the form of a method call.
  • Crystal is a compiled programming language with features including:
  • Ruby-like syntax no need to specify variable types and method parameter types, callable C code, compile-time code simulation and generation, compiled into efficient native code.
  • Semantic analysis check whether the abstract syntax tree constitutes legal semantics (for example, whether the smart contract API parameter type is compliant), any wrong lexical and grammar will report a syntax error, not all abstract syntax trees are legal, Semantic analysis will check, and if the check fails, a semantic error will be triggered.
  • the compilation environment may be a front-end browser environment; performing compilation operations, including:
  • the official compiler warehouse of Fangfang regularly compares the version list and updates the latest compiler in time;
  • the WASM format file of the latest and stable Solidity compiler is built into the browser script. Specifically: Compile the C++ version compiler through Emscripten or other LLVM tools into The WASM file in binary bytecode format supported by the browser, and then package the WASM file into the front-end script code through front-end packaging tools such as Webpack.
  • the WASM format file can be run directly in the browser without interpretation by the browser script engine compile. Whether to use the built-in WASM file compiler is judged by the version number declared in the Solidity file in the browser. This compiler is used when the version matches correctly or the Solidity file does not declare a version number.
  • the source code will be sent to the Node.js back-end service through the client-server request, and the back-end service will send the source code to the Node.js back-end service.
  • Compile the Solidity source code and then return the compilation result to the front-end browser; specifically: synchronize all Solidity compilers in the domestic server or CDN node in the back-end Node.js, and periodically compare the compiler version list. Go and pull the latest Solidity compiler in the server.
  • a client-server request will be temporarily sent to send the Solidity source file code to the Node.js service, and executed in the Node.js service Compile operation, return the compiled result to the browser side, and use the loaded compiler to perform the compilation operation after the compiler on the browser side is loaded.
  • the smart contract compilation module stores the generated smart contract executable file according to the request ID, and records relevant logs;
  • the smart contract compilation module completes the log of this smart contract compilation request.
  • step S103 includes:
  • the smart contract deployment module After the smart contract deployment module receives the smart contract deployment request, it starts to record the logs related to the deployment request.
  • the smart contract deployment module sends smart contract deployment requests to each node of the smart contract test network, records relevant logs, and returns the deployment results, and obtains the corresponding deployment logs through the interface provided by the test network nodes.
  • the smart contract deployment module finishes recording the logs related to this deployment request.
  • step S104 includes:
  • the smart contract test module After the smart contract test module receives the smart contract test request, it starts to record the relevant logs of the test request;
  • the smart contract test module sends smart contract test requests to each node of the smart contract test network in turn, records relevant logs and returns the test results, and passes the test The interface provided by the network node obtains the corresponding test log.
  • the method for each node of the smart contract test network to test the smart contract includes:
  • the smart contract testing module can automatically generate the corresponding calling interface according to the obtained smart contract, instead of obtaining the calling interface pre-written by the developer in the related art. In this way, for any smart contract to be tested, the calling interface can be automatically generated to realize the automatic processing of calling and testing.
  • At least one account required for the test can be queried from the account information.
  • the number of the at least one account may be one or multiple.
  • the multiple accounts may include user accounts and platform accounts.
  • a test case can be generated to trigger the smart contract and execute corresponding functions, so as to judge whether the smart contract can run correctly and whether the business logic of the smart contract is correct.
  • This test case can be used to instruct asset transfers between accounts.
  • the generation process of the test case can also be implemented by the target programming language, and the smart contract testing module can generate the test case of the target programming language, and then trigger the smart contract to execute the subsequent test steps.
  • the target programming language may be World Wide Web 3.java script (World Wide Web 3.javascript, Web3.js).
  • the smart contract can be triggered to test the smart contract.
  • the smart contract testing module may determine that the test result is abnormal in response to the test result of any test case being different from the expected result included in the test case.
  • the smart contract testing module may determine that the test result is normal in response to the test result of any test case being the same as the expected result included in the test case.
  • the smart contract testing module can also generate a test report according to the test result of testing the smart contract, and subsequent relevant technical personnel can learn the situation of the smart contract according to the test report.
  • the smart contract deployment module finishes recording the logs related to this test request.
  • the generated logs can be used for presentation, so that developers can obtain information about each stage of the pipeline.
  • the display process is as follows:
  • the smart contract development platform can query the pipeline execution history of the smart contract through the interface provided by the smart contract pipeline platform (including pipeline ID, pipeline execution time, pipeline execution status , pipeline execution results and other information), the execution history list can be displayed on the smart contract development platform.
  • the smart contract development platform can query the execution information of different pipeline stages (scanning, compiling, deploying, and testing) through the interface provided by the smart contract pipeline platform (including the execution time of each stage). , execution status and execution result).
  • the smart contract development platform can query the execution log of the pipeline stage through the interface provided by the smart contract pipeline platform, related reports (such as scan reports, test reports), and more Multi-chain logs (such as smart contract deployment logs on test network nodes, smart contract execution logs, smart contract query logs, etc.).
  • related reports such as scan reports, test reports
  • Multi-chain logs such as smart contract deployment logs on test network nodes, smart contract execution logs, smart contract query logs, etc.
  • step S20 includes:
  • a first private key is generated using a random function.
  • random functions such as rand and srand() can be used, which can be set according to actual needs, such as rounding, remainder, and logical operations.
  • the first public key is generated using a first encryption algorithm (eg RSA, DSA, ECC, DH).
  • the first encryption algorithm requires two keys: a public key and a private key.
  • the public key and the private key are a pair. If the data is encrypted with the public key, it can only be decrypted with the corresponding private key. For example, if the data is encrypted with the private key, only the corresponding public key can be used to decrypt the data. decrypt.
  • the generated first public key is written into the log file of the smart contract, so as to obtain the first public key according to the log file of the smart contract.
  • the first public key can be saved according to a preset mark format, so as to facilitate obtaining the address of the first public key according to the log file of the smart contract.
  • the preset mark format can be a special mark or a number, for example, "*&!@&#" can be used, and when the above mark is read, the first public key can be obtained.
  • a second private key can be generated based on the user device ID and device type.
  • the first encryption algorithm is used to generate the first shared key.
  • generating the first shared key according to the first encryption algorithm, the first private key and the second public key includes:
  • S206 Encrypt the original log content according to the first shared secret key and the second encryption algorithm to obtain encrypted log content.
  • the original log content may be encrypted according to the first shared secret key and the second encryption algorithm to generate encrypted log content.
  • the second encryption algorithm is a preset encryption algorithm.
  • the first shared secret key is the key value KEY that is finally used to encrypt the original log content.
  • the log content when generating the log content, in order to facilitate the storage and analysis of the log content, the log content can be written into the log file of the smart contract, and the log file of the smart contract can be set according to the actual situation, such as data files, text files Wait.
  • a second shared key is generated according to the first encryption algorithm, the second private key and the first public key, wherein the second shared key matches the first shared key.
  • the first private key is generated according to the random function
  • the first public key paired with the first private key is generated according to the first encryption algorithm
  • the first encryption algorithm, the first private key and the second public key are generated according to the first encryption algorithm.
  • a shared secret key and then encrypt the original log content according to the first shared secret key and the second encryption algorithm. Since the first private key is generated according to the random function, the generated first shared key used to encrypt the original log content is different, which greatly increases the difficulty of cracking by illegal users, thereby improving the protection of the logs of smart contracts Therefore, the security is improved, and the technical problem of using the same secret key for encryption and decryption in the prior art, which has low security, is solved.
  • a log generation and storage device for smart contracts is provided, as shown in FIG. 6 , including:
  • the log document generation module 10 is used to generate the log document of the smart contract
  • the encrypted storage sub-module 20 is used to encrypt and save the log of the smart contract obtained by the log document generation module.
  • the encrypted storage sub-module 20 includes:
  • a first generation submodule for generating a first private key and a first public key matching the first private key
  • the first writing submodule is used to write the first public key into the log file of the smart contract
  • the second generation submodule is used to generate a pair of the second public key and the second private key
  • the third generation submodule is used to generate the first shared secret key according to the first encryption algorithm, the first private secret key and the second public secret key;
  • an encryption sub-module for encrypting the original log content to obtain the encrypted log content according to the first shared secret key and the second encryption algorithm
  • the second writing submodule is used to write the encrypted log content into the log file of the smart contract
  • the saving sub-module is used to save the smart contract log file including the first public key and the encrypted log content.
  • the third generation sub-module includes:
  • a creation unit is used to create an interface of the RSA first encryption algorithm
  • the parameter setting unit, the second public key is used as the first parameter of the RSA first encryption algorithm interface, and the first private key is used as the second parameter of the RSA first encryption algorithm interface;
  • the secret key generation unit is used for invoking the RSA first encryption algorithm interface to generate a secret key, and the secret key is used as the first shared secret key.
  • the log document generation module 10 includes an acquisition sub-module and a merge sub-module.
  • the acquisition submodule is used to acquire smart contract scan logs, smart contract compilation logs, smart contract deployment logs, and smart contract test logs;
  • the merge submodule is used to acquire smart contract scan logs, smart contract compilation logs, and smart contracts acquired by the submodule.
  • the deployment log and the smart contract test log are combined to form the log file of the smart contract.
  • Get submodules include:
  • the scanning unit is used to perform smart contract scanning operations and obtain smart contract scanning logs
  • the compilation unit is used to perform smart contract compilation operations and obtain smart contract compilation logs
  • the deployment unit is used to perform smart contract deployment operations and obtain smart contract deployment logs
  • the test unit is used to perform smart contract test operations and obtain smart contract test logs
  • the scanning unit includes:
  • the download record subunit is used to download the corresponding version of the smart contract from the smart contract code management library according to the received smart contract scan request, and record the download log;
  • the scanning record subunit is used to perform the scanning task and record the scanning process log
  • the scan construction subunit is used to form a smart contract scan log by using the download log and the scan process log.
  • Compilation units including:
  • the compilation and download subunit is used to download the corresponding version of the smart contract from the smart contract code management library according to the received smart contract compilation request, and record the download log;
  • Compile and analyze the subunit analyze the smart contract code, build the corresponding compilation environment, execute the compilation operation, record the compilation process log and compilation result;
  • the compilation and construction subunit is used to form a smart contract compilation log by using the download log, the compilation process log and the compilation result.
  • Deployment unit including:
  • the deployment and acquisition sub-unit is used to acquire the smart contract executable file obtained by executing the smart contract compilation operation according to the received smart contract deployment request, and record the acquisition process log;
  • the sending and obtaining subunit is used to send the smart contract deployment request to each node of the smart contract test network, record the sending log and the returned deployment result, and obtain the corresponding deployment process log through the interface provided by the test network node;
  • the deployment construction sub-unit is used to use the acquisition process log, the sending log, the deployment result and the deployment process log to form the smart contract deployment log.
  • Test unit including:
  • the test sending and obtaining sub-unit is used to send the smart contract test request to each node of the smart contract test network in turn according to the test set, record the sending log and the returned test result, and obtain the corresponding test process log through the interface provided by the test network node;
  • the test construction subunit is used to form a smart contract test log by using the sending log, the test result and the test process log.
  • the scanning unit includes a sub-unit for performing a smart contract scanning operation, the sub-unit is specifically configured to read the smart contract, store the smart contract and its execution status and execution result to preset Scan frequency and preset scan time to scan stored smart contracts.
  • the compiling unit includes a subunit for performing a smart contract compiling operation, and the subunit is specifically used for:
  • the check passes; if not, the check fails, triggering a semantic error.
  • a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the computer
  • the program implements the steps of the log generation and storage method of the smart contract in the above-mentioned embodiments.
  • a storage medium storing computer-readable instructions.
  • the computer-readable instructions are executed by one or more processors, the one or more processors can implement the intelligence in the above-mentioned embodiments.
  • the steps of the log generation and storage method of the contract are provided.
  • the realization of all or part of the processes in the methods of the above embodiments can be accomplished by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the program is During execution, it may include the processes of the embodiments of the above-mentioned methods.
  • the aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.
  • the storage medium may be non-volatile or volatile.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A method and apparatus for generating and storing logs of a smart contract, a device, and a storage medium. The method comprises: generating a log document of a smart contract; generating a first private key and a first public key matching the first private key; writing the first public key into the log document of the smart contract; generating a pair of second public key and second private key; generating a first shared key according to a first encryption algorithm, the first private key, and the second public key; encrypting original log content according to the first shared key and a second encryption algorithm to obtain encrypted log content; writing the encrypted log content into the log document of the smart contract; and storing the log document of the smart contract. The method improves the timeliness and accuracy of generation of the logs of the smart contract, and the generated first shared key used for encrypting the original log content is different, such that difficulty for an illegal user to crack the logs is greatly increased, and the security is improved.

Description

智能合约的日志生成及保存方法、装置、设备和存储介质Log generation and storage method, device, device and storage medium for smart contracts
本申请要求于2020年11月16日提交中国专利局、申请号为202011280585.9,发明名称为“智能合约的日志生成及保存方法、装置、设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 16, 2020 with the application number 202011280585.9 and the invention titled "Method, Device, Equipment and Storage Medium for Log Generation and Storage of Smart Contracts", all of which The contents are incorporated herein by reference.
技术领域technical field
本申请涉及区块链领域,特别是涉及智能合约的日志生成及保存方法、装置、设备和存储介质。This application relates to the field of blockchain, and in particular, to a method, device, device and storage medium for log generation and storage of smart contracts.
背景技术Background technique
智能合约(smart contract)是一种旨在以信息化方式传播、验证或执行合同的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。智能合约的测试或部署过程中产生的日志,对于开发人员来说是至关重要的。开发人员通常需要利用这些日志来检查智能合约开发过程中存在的一些问题。因此,生成智能合约的日志以及对日志进行保存确保日志安全性也是至关重要的步骤。A smart contract is a computer protocol designed to disseminate, verify or execute contracts in an information-based manner. Smart contracts allow for trusted transactions without third parties that are traceable and irreversible. The logs generated during the testing or deployment of smart contracts are critical for developers. Developers usually need to use these logs to check for some problems in the smart contract development process. Therefore, generating logs of smart contracts and saving logs to ensure log security are also crucial steps.
发明人发现,现有的智能合约的测试或部署等过程中生成的日志需要通过测试人员在测试完成后转交给开发人员,不仅存在获取不方便、容易造成信息滞后性等问题,而且在同时进行多个类似开发项目时往往容易出现混淆等人为失误。另外,日志安全性不佳,极容易为非法人员获取。The inventor found that the logs generated during the testing or deployment of the existing smart contracts need to be passed to the developers by the testers after the test is completed, which not only has the problems of inconvenient access, easy information lag, etc. Human errors such as confusion are often prone to occur when multiple similar development projects are involved. In addition, the log security is not good, and it is very easy for illegal persons to obtain it.
发明内容SUMMARY OF THE INVENTION
基于此,有必要针对在进行智能合约的日志生成过程时,日志获取不方便、容易造成信息滞后,并且日志安全性不佳,容易被非法人员获取的问题,提供一种智能合约的日志生成及保存方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide a smart contract log generation and log generation method to solve the problems of inconvenient log acquisition, information lag, poor log security, and easy access by illegal persons during the log generation process of smart contracts. Preservation method, apparatus, computer equipment and storage medium.
一种智能合约的日志生成及保存方法,包括:A log generation and storage method for a smart contract, comprising:
生成智能合约的日志文档;Generate log files for smart contracts;
产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;generating a first private key and a first public key matching the first private key;
将第一公开秘钥写入智能合约的日志文档;Write the first public key into the log file of the smart contract;
生成一对第二公开秘钥和第二私有秘钥;generating a pair of the second public key and the second private key;
根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥;generating a first shared secret key according to the first encryption algorithm, the first private secret key and the second public secret key;
根据第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;According to the first shared secret key and the second encryption algorithm, the original log content is encrypted to obtain the encrypted log content;
将加密日志内容写入智能合约的日志文档;Write the encrypted log content to the log file of the smart contract;
将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。Save the smart contract log file including the first public key and the encrypted log content.
一种智能合约的日志生成及保存装置,包括:A log generation and storage device for smart contracts, comprising:
日志文档生成模块,用于生成智能合约的日志文档;The log document generation module is used to generate the log document of the smart contract;
第一生成子模块,用于产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;a first generation submodule for generating a first private key and a first public key matching the first private key;
第一写入子模块,用于将第一公开秘钥写入智能合约的日志文档;The first writing submodule is used to write the first public key into the log file of the smart contract;
第二生成子模块,用于生成一对第二公开秘钥和第二私有秘钥;The second generation submodule is used to generate a pair of the second public key and the second private key;
第三生成子模块,用于根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥;The third generating submodule is used to generate the first shared secret key according to the first encryption algorithm, the first private secret key and the second public secret key;
加密子模块,用于根据第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;an encryption sub-module for encrypting the original log content to obtain the encrypted log content according to the first shared secret key and the second encryption algorithm;
第二写入子模块,用于将加密日志内容写入智能合约的日志文档;The second writing submodule is used to write the encrypted log content into the log file of the smart contract;
保存子模块,用于将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。The saving sub-module is used to save the smart contract log file including the first public key and the encrypted log content.
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计 算机可读指令被所述处理器执行时,使得所述处理器执行一种智能合约的日志生成及保存方法的步骤,所述处理器执行的所述智能合约的日志生成及保存方法的步骤,包括:A computer device, comprising a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes a log generation and a smart contract. The steps of the preservation method, the steps of the log generation and preservation method of the smart contract executed by the processor, include:
生成智能合约的日志文档;Generate log files for smart contracts;
产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;generating a first private key and a first public key matching the first private key;
将所述第一公开秘钥写入所述智能合约的日志文档;Write the first public key into the log file of the smart contract;
生成一对第二公开秘钥和第二私有秘钥;generating a pair of the second public key and the second private key;
根据第一加密算法、所述第一私有秘钥以及所述第二公开秘钥生成第一共享秘钥;generating a first shared key according to the first encryption algorithm, the first private key and the second public key;
根据所述第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;According to the first shared secret key and the second encryption algorithm, the original log content is encrypted to obtain the encrypted log content;
将加密日志内容写入所述智能合约的日志文档;Write the encrypted log content into the log file of the smart contract;
将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。Save the smart contract log file including the first public key and the encrypted log content.
一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行一种智能合约的日志生成及保存方法的步骤,所述处理器执行的所述智能合约的日志生成及保存方法的步骤,包括:A storage medium storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of a method for generating and saving a log of a smart contract, so that the The steps of the log generation and storage method of the smart contract executed by the processor include:
生成智能合约的日志文档;Generate log files for smart contracts;
产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;generating a first private key and a first public key matching the first private key;
将所述第一公开秘钥写入所述智能合约的日志文档;Write the first public key into the log file of the smart contract;
生成一对第二公开秘钥和第二私有秘钥;generating a pair of the second public key and the second private key;
根据第一加密算法、所述第一私有秘钥以及所述第二公开秘钥生成第一共享秘钥;generating a first shared key according to the first encryption algorithm, the first private key and the second public key;
根据所述第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;According to the first shared secret key and the second encryption algorithm, the original log content is encrypted to obtain the encrypted log content;
将加密日志内容写入所述智能合约的日志文档;Write the encrypted log content into the log file of the smart contract;
将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。Save the smart contract log file including the first public key and the encrypted log content.
上述智能合约的日志生成及保存方法、装置、计算机设备和存储介质,提高了智能合约日志生成的及时性、准确性,为开发人员及时且准确地得到智能合约日志提供了有效解决方案,智能化程度更高,不再受人员的主观和失误等因素影响日志生成及获取结果;并且,由于根据随机函数生成第一私有秘钥,所以生成的用于给原始日志内容加密的第一共享秘钥是不同的,大大增加了非法用户破解的难度,从而可以提高对智能合约的日志的保护力度,故而提高了安全性,解决了现有技术中采用相同的秘钥进行加密和解密,存在安全性较低的技术问题。The above-mentioned smart contract log generation and storage method, device, computer equipment and storage medium improve the timeliness and accuracy of smart contract log generation, and provide an effective solution for developers to obtain smart contract logs in a timely and accurate manner. The level is higher, and the log generation and acquisition results are no longer affected by factors such as personnel's subjectivity and mistakes; and since the first private key is generated according to the random function, the generated first shared secret key used to encrypt the original log content It is different, which greatly increases the difficulty of cracking by illegal users, thereby improving the protection of the logs of the smart contract, thus improving the security, and solving the problem of using the same key for encryption and decryption in the prior art, which has security Less technical issues.
附图说明Description of drawings
图1为一个实施例中提供的智能合约的日志生成及保存方法的流程图;Fig. 1 is the flow chart of the log generation and preservation method of the smart contract provided in one embodiment;
图2为一个实施方式中提供的智能合约流水线的流程图;2 is a flow chart of a smart contract pipeline provided in one embodiment;
图3为另一实施方式中提供的智能合约流水线的详细流程图;3 is a detailed flow chart of a smart contract pipeline provided in another embodiment;
图4为图1所对应实施例中步骤S10的流程图;Fig. 4 is the flow chart of step S10 in the embodiment corresponding to Fig. 1;
图5为图1所对应实施例中步骤S20的流程图;Fig. 5 is the flow chart of step S20 in the embodiment corresponding to Fig. 1;
图6为一个实施例中智能合约的日志生成及保存装置的结构框图;6 is a structural block diagram of a log generation and storage device of a smart contract in one embodiment;
图7为一个实施例中计算机设备的结构框图。FIG. 7 is a structural block diagram of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。It will be understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element.
智能合约共享创建平台,包括智能合约开发平台、智能合约代码管理库和智能合约流水线平台和智能合约测试网络。Smart contract sharing creation platform, including smart contract development platform, smart contract code management library, smart contract pipeline platform and smart contract test network.
智能合约开发平台包括用户权限管理,智能合约项目管理,智能合约开发,审核,批准等。其中用户权限管理包括用户对于智能合约开发平台的访问控制,对于智能合约项目的访问控制,以及对于具体智能合约的开发权限,审核权限以及批准权限的控制。The smart contract development platform includes user rights management, smart contract project management, smart contract development, review, approval, etc. Among them, the user rights management includes the user's access control to the smart contract development platform, the access control to the smart contract project, and the control of the development rights, audit rights and approval rights of specific smart contracts.
智能合约代码管理库包括智能合约代码管理。The smart contract code management library includes smart contract code management.
智能合约流水线平台包括一系列对于智能合约进行扫描、编译、部署、测试等自动化操作,以及对于这些操作的相关信息(比如,状态,结果,日志等)进行收集,存储,处理。The smart contract pipeline platform includes a series of automated operations such as scanning, compiling, deploying, and testing smart contracts, as well as collecting, storing, and processing related information (such as status, results, logs, etc.) of these operations.
智能合约测试网络是用于测试智能合约,模拟真实区块链网络。The smart contract test network is used to test smart contracts and simulate the real blockchain network.
每次智能合约代码更新,webhook被触发,就会向智能合约流水线平台发起流水线执行请求。智能合约流水线平台会为该智能合约生成一个新的流水线执行ID,并基于流水线执行ID维护一个流水线执行历史,包括每次流水线执行的状态,结果和日志。智能合约流水线平台提供如下功能,根据智能合约ID查询该智能合约的流水线执行历史;根据智能合约ID以及其流水线执行ID,查询该流水线执行状态以及结果;根据智能合约ID以及其流水线执行ID,查询该流水线不同阶段的执行结果,日志。Every time the smart contract code is updated, the webhook is triggered, and a pipeline execution request is initiated to the smart contract pipeline platform. The smart contract pipeline platform will generate a new pipeline execution ID for the smart contract, and maintain a pipeline execution history based on the pipeline execution ID, including the status, results and logs of each pipeline execution. The smart contract pipeline platform provides the following functions: query the pipeline execution history of the smart contract according to the smart contract ID; query the execution status and result of the pipeline according to the smart contract ID and its pipeline execution ID; query the pipeline execution status and results according to the smart contract ID and its pipeline execution ID; query Execution results of different stages of the pipeline, log.
智能合约流水线平台包括智能合约扫描模块、智能合约编译模块、智能合约部署模块和智能合约测试模块。The smart contract pipeline platform includes a smart contract scanning module, a smart contract compilation module, a smart contract deployment module and a smart contract testing module.
智能合约扫描模块用于执行智能合约扫描操作,获取智能合约扫描日志。The smart contract scanning module is used to perform smart contract scanning operations and obtain smart contract scanning logs.
智能合约编译模块用于执行智能合约编译操作,获取智能合约编译日志。The smart contract compilation module is used to perform smart contract compilation operations and obtain smart contract compilation logs.
智能合约部署模块用于执行智能合约部署操作,获取智能合约部署日志。The smart contract deployment module is used to perform smart contract deployment operations and obtain smart contract deployment logs.
智能合约测试模块用于执行智能合约测试操作,获取智能合约测试日志。The smart contract testing module is used to perform smart contract testing operations and obtain smart contract testing logs.
本申请一个实施例的智能合约的日志生成及保存方法,如图1所示,包括以下步骤:The log generation and storage method for a smart contract according to an embodiment of the present application, as shown in Figure 1, includes the following steps:
S10、生成智能合约的日志文档。S10. Generate a log document of the smart contract.
具体地,智能合约流水线开始运行后,会对智能合约执行扫描、编译、部署、测试等自动化操作,将智能合约扫描日志、智能合约编译日志、智能合约部署日志和智能合约测试日志合并在一起,构成智能合约的日志。Specifically, after the smart contract pipeline starts running, it will perform automated operations such as scanning, compiling, deploying, and testing the smart contract, and merge the smart contract scanning log, smart contract compilation log, smart contract deployment log, and smart contract test log together. The logs that make up the smart contract.
下面根据智能合约流水线的不同阶段,如图2至图4所示,描述日志的生成过程。步骤S10包括:The following describes the log generation process according to the different stages of the smart contract pipeline, as shown in Figures 2 to 4. Step S10 includes:
S101、执行智能合约扫描操作,获取智能合约扫描日志。S101. Perform a smart contract scanning operation to obtain a smart contract scanning log.
具体地,步骤S101包括:Specifically, step S101 includes:
i.智能合约扫描模块接收到智能合约扫描请求后,记录扫描请求日志。i. After the smart contract scanning module receives the smart contract scanning request, it records the scanning request log.
ii.从智能合约代码管理库下载对应版本智能合约,并记录下载日志。ii. Download the corresponding version of the smart contract from the smart contract code management library and record the download log.
iii.智能合约扫描模块执行扫描任务,记录扫描过程日志,并生成扫描结果报告。iii. The smart contract scanning module executes the scanning task, records the scanning process log, and generates a scanning result report.
执行扫描任务包括:读取智能合约,对智能合约及其执行状态和执行结果进行持久化存储,并且以预设扫描频率和预设扫描时间对持久化存储的智能合约进行扫描。预设扫描频率和预设扫描时间可以根据实际需要进行设置。Executing the scanning task includes: reading the smart contract, persistently storing the smart contract and its execution status and execution result, and scanning the persistently stored smart contract with a preset scanning frequency and preset scanning time. The preset scan frequency and preset scan time can be set according to actual needs.
iv.智能合约扫描模块完成记录此次扫描相关的日志,利用所述扫描请求日志、所述下载日志和所述扫描过程日志,构成智能合约扫描日志。iv. The smart contract scanning module completes the recording of logs related to this scan, and uses the scan request log, the download log and the scan process log to form a smart contract scan log.
S102、执行智能合约编译操作,获取智能合约编译日志。S102. Execute a smart contract compilation operation to obtain a smart contract compilation log.
具体地,步骤S102包括:Specifically, step S102 includes:
i.智能合约编译模块接收到智能合约编译请求后,开始记录此次编译请求相关日志;i. After the smart contract compilation module receives the smart contract compilation request, it starts to record the logs related to the compilation request;
ii.从智能合约代码管理库下载对应版本智能合约,并记录下载日志;ii. Download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
iii.智能合约编译模块分析智能合约代码,构建相应的编译环境,执行编译操作,记录编译日志以及编译结果;iii. The smart contract compilation module analyzes the smart contract code, builds the corresponding compilation environment, performs compilation operations, records compilation logs and compilation results;
在某些实施方式中,执行编译操作的步骤包括:In some embodiments, the step of performing a compilation operation includes:
(1)词法分析和语法分析:将智能合约代码解析成抽象语法树,使用Crystal宏机制实现,代码可以作为宏直接嵌入Crystal代码中,也可以直接输入抽象语法树,不通过宏式的语言描述,而是直接以方法调用的形式将对象传入。Crystal是一个编译型的编程语言,其特性包括:(1) Lexical analysis and syntax analysis: Parse the smart contract code into an abstract syntax tree, which is implemented using the Crystal macro mechanism. The code can be directly embedded in the Crystal code as a macro, or the abstract syntax tree can be directly input without using the macro language description. , but pass in the object directly in the form of a method call. Crystal is a compiled programming language with features including:
语法类似Ruby、无需指定变量类型和方法参数类型、可调用C代码、编译时代码模拟和生成、编译成高效的原生代码。Ruby-like syntax, no need to specify variable types and method parameter types, callable C code, compile-time code simulation and generation, compiled into efficient native code.
(2)语义分析:检查抽象语法树是否构成合法的语义(例如智能合约API参数类型是否合规),任何错误的词法和语法将报出语法错误,并非所有的抽象语法树都是合法的,语义分析将检查,若检查不通过,则触发语义错误。(2) Semantic analysis: check whether the abstract syntax tree constitutes legal semantics (for example, whether the smart contract API parameter type is compliant), any wrong lexical and grammar will report a syntax error, not all abstract syntax trees are legal, Semantic analysis will check, and if the check fails, a semantic error will be triggered.
在某些实施方式中,编译环境可以为前端浏览器环境;执行编译操作,包括:In some embodiments, the compilation environment may be a front-end browser environment; performing compilation operations, including:
将C++版本的编译器通过Emscripten或者其他LLVM工具编译成支持前端浏览器环境以及Node.js环境的asm.js版本文件,并在国内服务器或者CDN节点上部署当前所有Solidity编译器,同时跟国外以太坊官方编译器仓库定期对比版本列表,及时更新最新编译器;Compile the C++ version of the compiler into an asm.js version file that supports the front-end browser environment and Node.js environment through Emscripten or other LLVM tools, and deploy all current Solidity compilers on domestic servers or CDN nodes. The official compiler warehouse of Fangfang regularly compares the version list and updates the latest compiler in time;
向编译环境中输入源文件,此处以Solidity源文件为例,在浏览器脚本中内置最新且稳定的Solidity编译器的WASM格式文件;具体为:将C++版本编译器通过Emscripten或者其他LLVM工具编译成浏览器支持的二进制字节码格式的WASM文件,然后通过Webpack等前端打包工具将该WASM文件打包到前端脚本代码中,WASM格式文件可直接在浏览器中运行,无需通过浏览器脚本引擎的解释编译。通过浏览器中Solidity文件声明的版本号来判断是否使用该内置WASM文件编译器。在版本匹配正确或者Solidity文件没有声明版本号的情况下使用该编译器。直接用内置WASM版本的Solidity编译器编译智能合约文件,在Javascript主线程中返回编译结果;或者通过Javascript代码动态新增一个script标签的方式指定src属性为国内服务器或者CDN节点的路径,从而拉取需要的Solidity编译器,同时在Javascript子线程执行智能合约文件的编译操作,将编译结果返回主线程;在浏览器端中的Solidity文件匹配WASM编译器文件失败的时候,浏览器动态创建一个脚本,在国内服务器或CDN节点中加载当前Solidity文件对应的编译器版本,同时创建一个WebWorker子线程去编译Solidity文件,并将编译结果返回JavaScript主线程,有效防止JavaScript主线程阻塞。Input the source file into the compilation environment. Taking the Solidity source file as an example, the WASM format file of the latest and stable Solidity compiler is built into the browser script. Specifically: Compile the C++ version compiler through Emscripten or other LLVM tools into The WASM file in binary bytecode format supported by the browser, and then package the WASM file into the front-end script code through front-end packaging tools such as Webpack. The WASM format file can be run directly in the browser without interpretation by the browser script engine compile. Whether to use the built-in WASM file compiler is judged by the version number declared in the Solidity file in the browser. This compiler is used when the version matches correctly or the Solidity file does not declare a version number. Compile the smart contract file directly with the built-in WASM version of the Solidity compiler, and return the compilation result in the Javascript main thread; or dynamically add a script tag to the Javascript code to specify the src attribute as the path of the domestic server or CDN node, so as to pull The required Solidity compiler, at the same time, performs the compilation operation of the smart contract file in the Javascript sub-thread, and returns the compilation result to the main thread; when the Solidity file in the browser fails to match the WASM compiler file, the browser dynamically creates a script, Load the compiler version corresponding to the current Solidity file in the domestic server or CDN node, create a WebWorker sub-thread to compile the Solidity file, and return the compilation result to the JavaScript main thread, effectively preventing the JavaScript main thread from blocking.
若在编译智能合约文件时,需要拉取的编译器还未下载完毕,或者拉取失败,则通过客户端服务器请求的方式将源代码发送到Node.js后端服务中,通过后端服务将Solidity源代码编译,然后将编译结果返回给前端浏览器中;具体为:在后端Node.js中同步国内服务器或者CDN节点中的所有Solidity编译器,同时通过比对编译器版本列表的方式定期去拉取在服务器中的最新Solidity编译器。在浏览器中动态创建脚本去拉取编译器还未下载完成或失败的情况下,会临时发送一个客户端服务器请求将Solidity源文件代码发送到Node.js服务中,在Node.js服务中执行编译操作,将编译后的结果返回给浏览器端,在浏览器端的编译器加载完成后则使用加载之后的编译器执行编译操作。If the compiler that needs to be pulled has not been downloaded when compiling the smart contract file, or the pulling fails, the source code will be sent to the Node.js back-end service through the client-server request, and the back-end service will send the source code to the Node.js back-end service. Compile the Solidity source code, and then return the compilation result to the front-end browser; specifically: synchronize all Solidity compilers in the domestic server or CDN node in the back-end Node.js, and periodically compare the compiler version list. Go and pull the latest Solidity compiler in the server. When the script is dynamically created in the browser to pull the compiler before the download is completed or fails, a client-server request will be temporarily sent to send the Solidity source file code to the Node.js service, and executed in the Node.js service Compile operation, return the compiled result to the browser side, and use the loaded compiler to perform the compilation operation after the compiler on the browser side is loaded.
iv.智能合约编译模块按请求ID储存生成的智能合约可执行文件,并记录相关日志;iv. The smart contract compilation module stores the generated smart contract executable file according to the request ID, and records relevant logs;
v.智能合约编译模块完成记录此次智能合约编译请求的日志。v. The smart contract compilation module completes the log of this smart contract compilation request.
S103、执行智能合约部署操作,获取智能合约部署日志。S103. Execute a smart contract deployment operation to obtain a smart contract deployment log.
具体地,步骤S103包括:Specifically, step S103 includes:
i.智能合约部署模块接收到智能合约部署请求后,开始记录此次部署请求相关日志。i. After the smart contract deployment module receives the smart contract deployment request, it starts to record the logs related to the deployment request.
ii.根据请求ID(identity document),从智能合约编译模块获取对应智能合约可执行文件,并记录相关日志。ii. According to the request ID (identity document), obtain the corresponding smart contract executable file from the smart contract compilation module, and record the relevant logs.
iii.智能合约部署模块向智能合约测试网络各节点发送智能合约部署请求,记录相关日志,以及返回的部署结果,并通过测试网络节点提供的接口获取相应的部署日志。iii. The smart contract deployment module sends smart contract deployment requests to each node of the smart contract test network, records relevant logs, and returns the deployment results, and obtains the corresponding deployment logs through the interface provided by the test network nodes.
iv.智能合约部署模块完成记录此次部署请求相关的日志。iv. The smart contract deployment module finishes recording the logs related to this deployment request.
S104、执行智能合约测试操作,获取智能合约测试日志。S104. Execute a smart contract test operation to obtain a smart contract test log.
具体地,步骤S104包括:Specifically, step S104 includes:
i.智能合约测试模块接收到智能合约测试请求后,开始记录此次测试请求相关日志;i. After the smart contract test module receives the smart contract test request, it starts to record the relevant logs of the test request;
ii.智能合约测试模块根据测试集(涉及一系列智能合约执行操作和智能合约查询操作),依次向智能合约测试网络各节点发送智能合约测试请求,记录相关日志以及返回的测试结果,并通过测试网络节点提供的接口获取相应的测试日志。ii. According to the test set (involving a series of smart contract execution operations and smart contract query operations), the smart contract test module sends smart contract test requests to each node of the smart contract test network in turn, records relevant logs and returns the test results, and passes the test The interface provided by the network node obtains the corresponding test log.
在某些实施方式中,智能合约测试网络各节点对智能合约进行测试的方法包括:In some embodiments, the method for each node of the smart contract test network to test the smart contract includes:
(1)根据待测试的智能合约,生成对应于所述智能合约的调用接口。(1) According to the smart contract to be tested, a calling interface corresponding to the smart contract is generated.
通常智能合约编写完成后,该智能合约支持内部调用,而无法外部调用。如果想要对智能合约进行测试,需要通过外部的调用接口,对该智能合约进行调用执行。在本申请实施例中,智能合约测试模块可以根据获取到的智能合约,自动生成对应的调用接口,而非相关技术中获取开发人员预先编写好的调用接口。这样对于任一待测试的智能合约,均能自动生成调用接口,实现调用和测试的自动化处理。Usually, after the smart contract is written, the smart contract supports internal calls, but cannot be called externally. If you want to test the smart contract, you need to call and execute the smart contract through the external calling interface. In the embodiment of the present application, the smart contract testing module can automatically generate the corresponding calling interface according to the obtained smart contract, instead of obtaining the calling interface pre-written by the developer in the related art. In this way, for any smart contract to be tested, the calling interface can be automatically generated to realize the automatic processing of calling and testing.
(2)通过所述调用接口,查询所述智能合约中的至少一个账户。(2) Query at least one account in the smart contract through the calling interface.
调用到账户信息后,可以从账户信息中查询测试所需的至少一个账户。该至少一个账户的数量可以为一个,也可以为多个。当该至少一个账户的数量为多个时,多个账户可以包括用户账户和平台账户。After the account information is called, at least one account required for the test can be queried from the account information. The number of the at least one account may be one or multiple. When the number of the at least one account is multiple, the multiple accounts may include user accounts and platform accounts.
(3)根据所述至少一个账户,生成所述智能合约的测试用例。(3) Generate a test case of the smart contract according to the at least one account.
获取到至少一个账户后,可以生成测试用例,来触发该智能合约,执行实现相应功能,以此来判断该智能合约是否能够正确运行,该智能合约的业务逻辑是否正确。该测试用例可以用于指示在账户之间进行资产转移。After obtaining at least one account, a test case can be generated to trigger the smart contract and execute corresponding functions, so as to judge whether the smart contract can run correctly and whether the business logic of the smart contract is correct. This test case can be used to instruct asset transfers between accounts.
在某些实施方式中,该测试用例的生成过程也可以通过目标编程语言实现,智能合约测试模块可生成目标编程语言的测试用例,进而触发智能合约,执行后续的测试步骤。例如,该目标编程语言可以为全球广域网3.java脚本(World Wide Web 3.javascript,Web3.js)。In some embodiments, the generation process of the test case can also be implemented by the target programming language, and the smart contract testing module can generate the test case of the target programming language, and then trigger the smart contract to execute the subsequent test steps. For example, the target programming language may be World Wide Web 3.java script (World Wide Web 3.javascript, Web3.js).
(4)根据所述测试用例,对所述智能合约进行测试。(4) Test the smart contract according to the test case.
生成测试用例后,即可触发智能合约,实现对智能合约的测试。智能合约测试模块可以响应于该对任一测试用例的测试结果与该测试用例包括的期望结果不相同,确定该测试结果异常。相应的,智能合约测试模块可以响应于该对任一测试用例的测试结果与该测试用例包括的期望结果相同,确定该测试结果正常。After the test case is generated, the smart contract can be triggered to test the smart contract. The smart contract testing module may determine that the test result is abnormal in response to the test result of any test case being different from the expected result included in the test case. Correspondingly, the smart contract testing module may determine that the test result is normal in response to the test result of any test case being the same as the expected result included in the test case.
在某些实施方式中,智能合约测试模块还可以根据对该智能合约进行测试的测试结果,生成测试报告,后续相关技术人员可以根据测试报告来获知该智能合约的情况。In some embodiments, the smart contract testing module can also generate a test report according to the test result of testing the smart contract, and subsequent relevant technical personnel can learn the situation of the smart contract according to the test report.
iii.智能合约部署模块完成记录此次测试请求相关的日志。iii. The smart contract deployment module finishes recording the logs related to this test request.
生成的日志可用于展示,以便开发人员获取流水线各阶段信息。展示过程如下:The generated logs can be used for presentation, so that developers can obtain information about each stage of the pipeline. The display process is as follows:
a)当开发人员查看某一个智能合约的流水线执行信息时,智能合约开发平台通过智能合约流水线平台提供的接口,可查询该智能合约的流水线执行历史(包括流水线ID,流水线执行时间,流水线执行状态,流水线执行结果等信息),该执行历史列表可以在智能合约开发平台展示出来。a) When developers view the pipeline execution information of a smart contract, the smart contract development platform can query the pipeline execution history of the smart contract through the interface provided by the smart contract pipeline platform (including pipeline ID, pipeline execution time, pipeline execution status , pipeline execution results and other information), the execution history list can be displayed on the smart contract development platform.
b)当开发人员查看某一次流水线执行详情时,智能合约开发平台通过智能合约流水线平台提供的接口,可查询到不同流水线阶段(扫描、编译、部署、测试)的执行信息(包括各阶段执行时间,执行状态和执行结果)。b) When developers view the execution details of a certain pipeline, the smart contract development platform can query the execution information of different pipeline stages (scanning, compiling, deploying, and testing) through the interface provided by the smart contract pipeline platform (including the execution time of each stage). , execution status and execution result).
c)当开发人员进一步查看某一个流水线阶段的详情时,智能合约开发平台通过智能合约流水线平台提供的接口,可查询到该流水线阶段的执行日志,相关报告(比如扫描报告,测试报告),更多链上日志(比如测试网络节点上的智能合约部署日志,智能合约执行日志,智能合约查询日志等)。c) When the developer further checks the details of a pipeline stage, the smart contract development platform can query the execution log of the pipeline stage through the interface provided by the smart contract pipeline platform, related reports (such as scan reports, test reports), and more Multi-chain logs (such as smart contract deployment logs on test network nodes, smart contract execution logs, smart contract query logs, etc.).
S105、将所述智能合约扫描日志、所述智能合约编译日志、所述智能合约部署日志和所述智能合约测试日志合并生成所述智能合约的日志文档。S105. Combine the smart contract scan log, the smart contract compilation log, the smart contract deployment log, and the smart contract test log to generate a log file of the smart contract.
S20、对通过步骤S10所得到的智能合约的日志文档进行加密保存。S20. Encrypt and save the log file of the smart contract obtained through step S10.
在某些实施方式中,步骤S20包括:In some embodiments, step S20 includes:
S201、产生第一私有秘钥。S201. Generate a first private key.
利用随机函数产生第一私有秘钥。例如,可以采用rand、srand()等随机函数,具体可以根据实际需要来设置,如求整、取余、逻辑运算等。A first private key is generated using a random function. For example, random functions such as rand and srand() can be used, which can be set according to actual needs, such as rounding, remainder, and logical operations.
S202、生成与第一私有秘钥相匹配的第一公开秘钥。S202. Generate a first public key matching the first private key.
利用第一加密算法(例如RSA、DSA、ECC、DH)生成第一公开秘钥。第一加密算法需要两个秘钥:公开秘钥和私有秘钥。公开秘钥与私有秘钥是一对,如果用公开秘钥对数据进行加密,只有用对应的私有秘钥才能解密,例如用私有秘钥对数据进行加密,那么只有用对应的公开秘钥才能解密。The first public key is generated using a first encryption algorithm (eg RSA, DSA, ECC, DH). The first encryption algorithm requires two keys: a public key and a private key. The public key and the private key are a pair. If the data is encrypted with the public key, it can only be decrypted with the corresponding private key. For example, if the data is encrypted with the private key, only the corresponding public key can be used to decrypt the data. decrypt.
S203、将第一公开秘钥写入智能合约的日志文档。S203, write the first public key into the log file of the smart contract.
在生成第一公开秘钥和第一私有秘钥后,将生成的第一公开秘钥写入智能合约的日志文档中,以便于根据智能合约的日志文档获取第一公开秘钥。After generating the first public key and the first private key, the generated first public key is written into the log file of the smart contract, so as to obtain the first public key according to the log file of the smart contract.
为了更好地标记第一公开秘钥的地址,可以依照预设标记格式来保存第一公开秘钥,从而便于根据智能合约的日志文档获取第一公开秘钥的地址。In order to better mark the address of the first public key, the first public key can be saved according to a preset mark format, so as to facilitate obtaining the address of the first public key according to the log file of the smart contract.
预设标记格式可以是特殊标记或者数字等,例如可以采用“*&!@&#”,当读取到上述标记时,则可以获取第一公开秘钥。The preset mark format can be a special mark or a number, for example, "*&!@&#" can be used, and when the above mark is read, the first public key can be obtained.
S204、调用上述的第一加密算法生成一对第二公开秘钥和第二私有秘钥。S204. Invoke the above-mentioned first encryption algorithm to generate a pair of second public key and second private key.
为了提高安全性,可用根据用户设备ID和设备类型来生成第二私有秘钥。To improve security, a second private key can be generated based on the user device ID and device type.
S205、根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥。S205. Generate a first shared key according to the first encryption algorithm, the first private key, and the second public key.
根据第一私有秘钥、第二公开秘钥,采用第一加密算法生成第一共享秘钥。以RSA第一加密算法为例,根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥包括:According to the first private key and the second public key, the first encryption algorithm is used to generate the first shared key. Taking the RSA first encryption algorithm as an example, generating the first shared key according to the first encryption algorithm, the first private key and the second public key includes:
创建RSA第一加密算法的接口;将第二公开秘钥作为RSA第一加密算法接口的第一参数,将第一私有秘钥作为RSA第一加密算法接口的第二参数;调用RSA第一加密算法接口,生成秘钥,该秘钥作为第一共享秘钥。Create the interface of the RSA first encryption algorithm; use the second public key as the first parameter of the RSA first encryption algorithm interface, and use the first private key as the second parameter of the RSA first encryption algorithm interface; call the RSA first encryption algorithm Algorithm interface to generate a secret key, which is used as the first shared secret key.
S206、根据第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容。S206: Encrypt the original log content according to the first shared secret key and the second encryption algorithm to obtain encrypted log content.
在生成第一共享秘钥后,可以根据第一共享秘钥和第二加密算法对原始日志内容加密,生成加密日志内容。第二加密算法为预先设定的加密算法。After the first shared secret key is generated, the original log content may be encrypted according to the first shared secret key and the second encryption algorithm to generate encrypted log content. The second encryption algorithm is a preset encryption algorithm.
具体来说,该第一共享秘钥即为最终用于对原始日志内容进行加密的键值KEY。Specifically, the first shared secret key is the key value KEY that is finally used to encrypt the original log content.
S207、将加密日志内容写入智能合约的日志文档。S207, write the encrypted log content into the log file of the smart contract.
具体地,在生成日志内容时,为了方便对日志内容进行存储和分析,可以将日志内容写入智能合约的日志文档中,智能合约的日志文档可以根据实际情况进行设置,例如数据文件、文本文件等。Specifically, when generating the log content, in order to facilitate the storage and analysis of the log content, the log content can be written into the log file of the smart contract, and the log file of the smart contract can be set according to the actual situation, such as data files, text files Wait.
S208、将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。S208. Save the smart contract log file including the first public key and the encrypted log content.
根据第一加密算法、第二私有秘钥以及第一公开秘钥生成第二共享秘钥,其中,第二共享秘钥与第一共享秘钥相匹配。A second shared key is generated according to the first encryption algorithm, the second private key and the first public key, wherein the second shared key matches the first shared key.
根据随机函数生成第一私有秘钥、根据第一加密算法生成与第一私有秘钥配对的第一公开秘钥,然后根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥,再根据第一共享秘钥和第二加密算法对原始日志内容加密。由于根据随机函数生成第一私有秘钥,所以生成的用于给原始日志内容加密的第一共享秘钥是不同的,大大增加了非法用户破解的难度,从而可以提高对智能合约的日志的保护力度,故而提高了安全性,解决了现有技术中采用相同的秘钥进行加密和解密,存在安全性较低的技术问题。The first private key is generated according to the random function, the first public key paired with the first private key is generated according to the first encryption algorithm, and then the first encryption algorithm, the first private key and the second public key are generated according to the first encryption algorithm. a shared secret key, and then encrypt the original log content according to the first shared secret key and the second encryption algorithm. Since the first private key is generated according to the random function, the generated first shared key used to encrypt the original log content is different, which greatly increases the difficulty of cracking by illegal users, thereby improving the protection of the logs of smart contracts Therefore, the security is improved, and the technical problem of using the same secret key for encryption and decryption in the prior art, which has low security, is solved.
在另一个实施例中,提供了一种智能合约的日志生成及保存装置,如图6所示,包括:In another embodiment, a log generation and storage device for smart contracts is provided, as shown in FIG. 6 , including:
日志文档生成模块10,用于生成智能合约的日志文档;The log document generation module 10 is used to generate the log document of the smart contract;
加密保存子模块20,用于对通过日志文档生成模块所得到的智能合约的日志进行加密保存。The encrypted storage sub-module 20 is used to encrypt and save the log of the smart contract obtained by the log document generation module.
加密保存子模块20包括:The encrypted storage sub-module 20 includes:
第一生成子模块,用于产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;a first generation submodule for generating a first private key and a first public key matching the first private key;
第一写入子模块,用于将第一公开秘钥写入智能合约的日志文档;The first writing submodule is used to write the first public key into the log file of the smart contract;
第二生成子模块,用于生成一对第二公开秘钥和第二私有秘钥;The second generation submodule is used to generate a pair of the second public key and the second private key;
第三生成子模块,用于根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共 享秘钥;The third generation submodule is used to generate the first shared secret key according to the first encryption algorithm, the first private secret key and the second public secret key;
加密子模块,用于根据第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;an encryption sub-module for encrypting the original log content to obtain the encrypted log content according to the first shared secret key and the second encryption algorithm;
第二写入子模块,用于将加密日志内容写入智能合约的日志文档;The second writing submodule is used to write the encrypted log content into the log file of the smart contract;
保存子模块,用于将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。The saving sub-module is used to save the smart contract log file including the first public key and the encrypted log content.
在某些实施方式中,所述第三生成子模块包括:In certain embodiments, the third generation sub-module includes:
创建单元,用于创建RSA第一加密算法的接口;A creation unit is used to create an interface of the RSA first encryption algorithm;
定参单元,将第二公开秘钥作为RSA第一加密算法接口的第一参数,将第一私有秘钥作为RSA第一加密算法接口的第二参数;The parameter setting unit, the second public key is used as the first parameter of the RSA first encryption algorithm interface, and the first private key is used as the second parameter of the RSA first encryption algorithm interface;
秘钥生成单元,用于调用RSA第一加密算法接口,生成秘钥,该秘钥作为第一共享秘钥。The secret key generation unit is used for invoking the RSA first encryption algorithm interface to generate a secret key, and the secret key is used as the first shared secret key.
日志文档生成模块10包括获取子模块和合并子模块。获取子模块用于获取智能合约扫描日志、智能合约编译日志、智能合约部署日志和智能合约测试日志;合并子模块用于将获取子模块所获取的智能合约扫描日志、智能合约编译日志、智能合约部署日志和智能合约测试日志合并构成所述智能合约的日志文档。The log document generation module 10 includes an acquisition sub-module and a merge sub-module. The acquisition submodule is used to acquire smart contract scan logs, smart contract compilation logs, smart contract deployment logs, and smart contract test logs; the merge submodule is used to acquire smart contract scan logs, smart contract compilation logs, and smart contracts acquired by the submodule. The deployment log and the smart contract test log are combined to form the log file of the smart contract.
获取子模块包括:Get submodules include:
扫描单元,用于执行智能合约扫描操作,获取智能合约扫描日志;The scanning unit is used to perform smart contract scanning operations and obtain smart contract scanning logs;
编译单元,用于执行智能合约编译操作,获取智能合约编译日志;The compilation unit is used to perform smart contract compilation operations and obtain smart contract compilation logs;
部署单元,用于执行智能合约部署操作,获取智能合约部署日志;The deployment unit is used to perform smart contract deployment operations and obtain smart contract deployment logs;
测试单元,用于执行智能合约测试操作,获取智能合约测试日志;The test unit is used to perform smart contract test operations and obtain smart contract test logs;
所述扫描单元,包括:The scanning unit includes:
下载记录子单元,用于根据接收到的智能合约扫描请求,从智能合约代码管理库下载对应版本智能合约,记录下载日志;The download record subunit is used to download the corresponding version of the smart contract from the smart contract code management library according to the received smart contract scan request, and record the download log;
扫描记录子单元,用于执行扫描任务,记录扫描过程日志;The scanning record subunit is used to perform the scanning task and record the scanning process log;
扫描构建子单元,用于利用所述下载日志和所述扫描过程日志,构成智能合约扫描日志。The scan construction subunit is used to form a smart contract scan log by using the download log and the scan process log.
编译单元,包括:Compilation units, including:
编译下载子单元,用于根据接收到的智能合约编译请求,从智能合约代码管理库下载对应版本智能合约,并记录下载日志;The compilation and download subunit is used to download the corresponding version of the smart contract from the smart contract code management library according to the received smart contract compilation request, and record the download log;
编译分析子单元,分析智能合约代码,构建相应的编译环境,执行编译操作,记录编译过程日志以及编译结果;Compile and analyze the subunit, analyze the smart contract code, build the corresponding compilation environment, execute the compilation operation, record the compilation process log and compilation result;
编译构建子单元,用于利用所述下载日志、所述编译过程日志和所述编译结果,构成智能合约编译日志。The compilation and construction subunit is used to form a smart contract compilation log by using the download log, the compilation process log and the compilation result.
部署单元,包括:Deployment unit, including:
部署获取子单元,用于根据接收到的智能合约部署请求,获取执行智能合约编译操作所得到的智能合约可执行文件,并记录获取过程日志;The deployment and acquisition sub-unit is used to acquire the smart contract executable file obtained by executing the smart contract compilation operation according to the received smart contract deployment request, and record the acquisition process log;
发送获取子单元,用于向智能合约测试网络各节点发送所述智能合约部署请求,记录发送日志以及返回的部署结果,并通过测试网络节点提供的接口获取相应的部署过程日志;The sending and obtaining subunit is used to send the smart contract deployment request to each node of the smart contract test network, record the sending log and the returned deployment result, and obtain the corresponding deployment process log through the interface provided by the test network node;
部署构建子单元,用于利用获取过程日志、发送日志、部署结果和部署过程日志,构成智能合约部署日志。The deployment construction sub-unit is used to use the acquisition process log, the sending log, the deployment result and the deployment process log to form the smart contract deployment log.
测试单元,包括:Test unit, including:
测试发送获取子单元,用于根据测试集,依次向智能合约测试网络各节点发送智能合约测试请求,记录发送日志以及返回的测试结果,并通过测试网络节点提供的接口获取相应的测试过程日志;The test sending and obtaining sub-unit is used to send the smart contract test request to each node of the smart contract test network in turn according to the test set, record the sending log and the returned test result, and obtain the corresponding test process log through the interface provided by the test network node;
测试构建子单元,用于利用所述发送日志、所述测试结果和所述测试过程日志,构成智能合约测试日志。The test construction subunit is used to form a smart contract test log by using the sending log, the test result and the test process log.
在某些实施方式中,所述扫描单元包括用于执行智能合约扫描操作的子单元,该子单元具体用于读取智能合约,对智能合约及其执行状态和执行结果进行存储,以预设扫描频率和预设扫描时间对存储的智能合约进行扫描。In some embodiments, the scanning unit includes a sub-unit for performing a smart contract scanning operation, the sub-unit is specifically configured to read the smart contract, store the smart contract and its execution status and execution result to preset Scan frequency and preset scan time to scan stored smart contracts.
在某些实施方式中,所述编译单元包括用于执行智能合约编译操作的子单元,该子单元具体用于:In some embodiments, the compiling unit includes a subunit for performing a smart contract compiling operation, and the subunit is specifically used for:
将智能合约代码解析成抽象语法树;Parse the smart contract code into an abstract syntax tree;
检查所述抽象语法树是否构成合法的语义;checking whether the abstract syntax tree constitutes legal semantics;
若是,则检查通过;若否,则检查不通过,触发语义错误。If so, the check passes; if not, the check fails, triggering a semantic error.
在一个实施例中,提出了一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述各实施方式中的智能合约的日志生成及保存方法的步骤。In one embodiment, a computer device is proposed, the computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the computer The program implements the steps of the log generation and storage method of the smart contract in the above-mentioned embodiments.
在一个实施例中,提出了一种存储有计算机可读指令的存储介质,该计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器实现上述各实施方式中的智能合约的日志生成及保存方法的步骤。In one embodiment, a storage medium storing computer-readable instructions is provided. When the computer-readable instructions are executed by one or more processors, the one or more processors can implement the intelligence in the above-mentioned embodiments. The steps of the log generation and storage method of the contract.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。所述存储介质可以是非易失性,也可以是易失性。Those of ordinary skill in the art can understand that the realization of all or part of the processes in the methods of the above embodiments can be accomplished by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the program is During execution, it may include the processes of the embodiments of the above-mentioned methods. Wherein, the aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like. The storage medium may be non-volatile or volatile.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments can be combined arbitrarily. For the sake of brevity, all possible combinations of the technical features in the above-described embodiments are not described. However, as long as there is no contradiction between the combinations of these technical features, All should be regarded as the scope described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.

Claims (20)

  1. 一种智能合约的日志生成及保存方法,其中,包括:A log generation and storage method for a smart contract, including:
    生成智能合约的日志文档;Generate log files for smart contracts;
    产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;generating a first private key and a first public key matching the first private key;
    将所述第一公开秘钥写入所述智能合约的日志文档;Write the first public key into the log file of the smart contract;
    生成一对第二公开秘钥和第二私有秘钥;generating a pair of the second public key and the second private key;
    根据第一加密算法、所述第一私有秘钥以及所述第二公开秘钥生成第一共享秘钥;generating a first shared key according to the first encryption algorithm, the first private key and the second public key;
    根据所述第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;According to the first shared secret key and the second encryption algorithm, the original log content is encrypted to obtain the encrypted log content;
    将加密日志内容写入所述智能合约的日志文档;Write the encrypted log content into the log file of the smart contract;
    将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。Save the smart contract log file including the first public key and the encrypted log content.
  2. 根据权利要求1所述的方法,其中,所述第一加密算法为RSA公开密钥加密算法;所述根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥包括:The method according to claim 1, wherein the first encryption algorithm is an RSA public key encryption algorithm; the first shared key is generated according to the first encryption algorithm, the first private key and the second public key include:
    创建所述RSA公开密钥加密算法的接口;Create an interface for the RSA public key encryption algorithm;
    将所述第二公开秘钥作为RSA公开密钥加密算法接口的第一参数,将第一私有秘钥作为RSA公开密钥加密算法接口的第二参数;The second public key is used as the first parameter of the RSA public key encryption algorithm interface, and the first private key is used as the second parameter of the RSA public key encryption algorithm interface;
    调用RSA公开密钥加密算法接口,生成秘钥,该秘钥作为第一共享秘钥。Call the RSA public key encryption algorithm interface to generate a secret key, which is used as the first shared secret key.
  3. 根据权利要求1所述的方法,其中,所述生成智能合约的日志文档的方法包括:The method according to claim 1, wherein the method for generating a log file of a smart contract comprises:
    执行智能合约扫描操作,获取智能合约扫描日志;Perform a smart contract scan operation to obtain a smart contract scan log;
    执行智能合约编译操作,获取智能合约编译日志;Execute the smart contract compilation operation to obtain the smart contract compilation log;
    执行智能合约部署操作,获取智能合约部署日志;Execute smart contract deployment operations and obtain smart contract deployment logs;
    执行智能合约测试操作,获取智能合约测试日志;Execute smart contract test operations and obtain smart contract test logs;
    将所述智能合约扫描日志、所述智能合约编译日志、所述智能合约部署日志和所述智能合约测试日志合并生成所述智能合约的日志文档。The smart contract scan log, the smart contract compilation log, the smart contract deployment log, and the smart contract test log are combined to generate a log file of the smart contract.
  4. 根据权利要求3所述的方法,其中,所述执行智能合约扫描操作,获取智能合约扫描日志,包括:The method according to claim 3, wherein the performing a smart contract scanning operation to obtain a smart contract scanning log comprises:
    根据接收到的智能合约扫描请求,从智能合约代码管理库下载对应版本智能合约,记录下载日志;According to the received smart contract scan request, download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
    执行扫描任务,记录扫描过程日志;Perform scanning tasks and record scanning process logs;
    利用所述下载日志和所述扫描过程日志,构成智能合约扫描日志。Using the download log and the scanning process log, a smart contract scanning log is formed.
  5. 根据权利要求3所述的方法,其中,所述执行智能合约编译操作,获取智能合约编译日志,包括:The method according to claim 3, wherein the executing the smart contract compilation operation to obtain the smart contract compilation log comprises:
    根据接收到的智能合约编译请求,从智能合约代码管理库下载对应版本智能合约,并记录下载日志;According to the received smart contract compilation request, download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
    分析智能合约代码,构建相应的编译环境,执行编译操作,记录编译过程日志以及编译结果;Analyze the smart contract code, build the corresponding compilation environment, perform compilation operations, record compilation process logs and compilation results;
    利用所述下载日志、所述编译过程日志和所述编译结果,构成智能合约编译日志。Using the download log, the compilation process log and the compilation result, a smart contract compilation log is formed.
  6. 根据权利要求3所述的方法,其中,所述执行智能合约部署操作,获取智能合约部署日志,包括:The method according to claim 3, wherein the executing the smart contract deployment operation to obtain the smart contract deployment log comprises:
    根据接收到的智能合约部署请求,获取执行智能合约编译操作所得到的智能合约可执行文件,并记录获取过程日志;According to the received smart contract deployment request, obtain the smart contract executable file obtained by executing the smart contract compilation operation, and record the acquisition process log;
    向智能合约测试网络各节点发送所述智能合约部署请求,记录发送日志以及返回的部署结果,并通过测试网络节点提供的接口获取相应的部署过程日志;Send the smart contract deployment request to each node of the smart contract test network, record the sending log and the returned deployment result, and obtain the corresponding deployment process log through the interface provided by the test network node;
    利用获取过程日志、发送日志、部署结果和部署过程日志,构成智能合约部署日志;Use the acquisition process log, the sending log, the deployment result and the deployment process log to form a smart contract deployment log;
    所述执行智能合约测试操作,获取智能合约测试日志,包括:The execution of the smart contract test operation and the acquisition of the smart contract test log include:
    根据测试集,依次向智能合约测试网络各节点发送智能合约测试请求,记录发送日志以及返回的测试结果,并通过测试网络节点提供的接口获取相应的测试过程日志;According to the test set, send the smart contract test request to each node of the smart contract test network in turn, record the sending log and the returned test result, and obtain the corresponding test process log through the interface provided by the test network node;
    利用所述发送日志、所述测试结果和所述测试过程日志,构成智能合约测试日志。Using the sending log, the test result and the test process log, a smart contract test log is formed.
  7. 根据权利要求1所述的方法,其中,所述执行智能合约扫描操作,包括:读取智能合约,对智能合约及其执行状态和执行结果进行存储,以预设扫描频率和预设扫描时间对存储的智能合约进行扫描;The method according to claim 1, wherein the performing the smart contract scanning operation comprises: reading the smart contract, storing the smart contract and its execution status and execution result, and scanning the smart contract with a preset scanning frequency and a preset scanning time. The stored smart contract is scanned;
    所述执行智能合约编译操作,包括:The performing smart contract compilation operation includes:
    将智能合约代码解析成抽象语法树;Parse the smart contract code into an abstract syntax tree;
    检查所述抽象语法树是否构成合法的语义;checking whether the abstract syntax tree constitutes legal semantics;
    若是,则检查通过;若否,则检查不通过,触发语义错误。If so, the check passes; if not, the check fails, triggering a semantic error.
  8. 一种智能合约的日志生成及保存装置,其中,包括:A log generation and storage device for smart contracts, including:
    日志文档生成模块,用于生成智能合约的日志文档;The log document generation module is used to generate the log document of the smart contract;
    第一生成子模块,用于产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;a first generation submodule for generating a first private key and a first public key matching the first private key;
    第一写入子模块,用于将所述第一公开秘钥写入所述智能合约的日志文档;a first writing submodule, used to write the first public key into the log file of the smart contract;
    第二生成子模块,用于生成一对第二公开秘钥和第二私有秘钥;The second generation submodule is used to generate a pair of the second public key and the second private key;
    第三生成子模块,用于根据第一加密算法、所述第一私有秘钥以及所述第二公开秘钥生成第一共享秘钥;a third generating submodule, configured to generate a first shared secret key according to the first encryption algorithm, the first private key and the second public key;
    加密子模块,用于根据所述第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;an encryption submodule, configured to encrypt the original log content to obtain encrypted log content according to the first shared secret key and the second encryption algorithm;
    第二写入子模块,用于将加密日志内容写入所述智能合约的日志文档;The second writing submodule is used to write the encrypted log content into the log file of the smart contract;
    保存子模块,用于将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。The saving submodule is used to save the smart contract log file including the first public key and the encrypted log content.
  9. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行一种智能合约的日志生成及保存方法的步骤,所述处理器执行的所述智能合约的日志生成及保存方法的步骤,包括:A computer device, comprising a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes a log generation and a smart contract. The steps of the preservation method, the steps of the log generation and preservation method of the smart contract executed by the processor, include:
    生成智能合约的日志文档;Generate log files for smart contracts;
    产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;generating a first private key and a first public key matching the first private key;
    将所述第一公开秘钥写入所述智能合约的日志文档;Write the first public key into the log file of the smart contract;
    生成一对第二公开秘钥和第二私有秘钥;generating a pair of the second public key and the second private key;
    根据第一加密算法、所述第一私有秘钥以及所述第二公开秘钥生成第一共享秘钥;generating a first shared key according to the first encryption algorithm, the first private key and the second public key;
    根据所述第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;According to the first shared secret key and the second encryption algorithm, the original log content is encrypted to obtain the encrypted log content;
    将加密日志内容写入所述智能合约的日志文档;Write the encrypted log content into the log file of the smart contract;
    将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。Save the smart contract log file including the first public key and the encrypted log content.
  10. 根据权利要求9所述的计算机设备,其中,所述第一加密算法为RSA公开密钥加密算法;所述处理器执行的所述根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥包括:The computer device according to claim 9, wherein the first encryption algorithm is an RSA public key encryption algorithm; The key generation first shared secret key includes:
    创建所述RSA公开密钥加密算法的接口;Create an interface for the RSA public key encryption algorithm;
    将所述第二公开秘钥作为RSA公开密钥加密算法接口的第一参数,将第一私有秘钥作为RSA公开密钥加密算法接口的第二参数;The second public key is used as the first parameter of the RSA public key encryption algorithm interface, and the first private key is used as the second parameter of the RSA public key encryption algorithm interface;
    调用RSA公开密钥加密算法接口,生成秘钥,该秘钥作为第一共享秘钥。Call the RSA public key encryption algorithm interface to generate a secret key, which is used as the first shared secret key.
  11. 根据权利要求9所述的计算机设备,其中,所述处理器执行的所述生成智能合约的日志文档的方法包括:The computer device according to claim 9, wherein the method of generating a log file of a smart contract executed by the processor comprises:
    执行智能合约扫描操作,获取智能合约扫描日志;Perform a smart contract scan operation to obtain the smart contract scan log;
    执行智能合约编译操作,获取智能合约编译日志;Execute the smart contract compilation operation to obtain the smart contract compilation log;
    执行智能合约部署操作,获取智能合约部署日志;Execute smart contract deployment operations and obtain smart contract deployment logs;
    执行智能合约测试操作,获取智能合约测试日志;Execute smart contract test operations and obtain smart contract test logs;
    将所述智能合约扫描日志、所述智能合约编译日志、所述智能合约部署日志和所述智能合约测试日志合并生成所述智能合约的日志文档。The smart contract scan log, the smart contract compilation log, the smart contract deployment log, and the smart contract test log are combined to generate a log file of the smart contract.
  12. 根据权利要求11所述的计算机设备,其中,所述处理器执行的所述执行智能合约扫描操作,获取智能合约扫描日志,包括:The computer device according to claim 11, wherein the executing the smart contract scanning operation performed by the processor to obtain the smart contract scanning log comprises:
    根据接收到的智能合约扫描请求,从智能合约代码管理库下载对应版本智能合约,记录下载日志;According to the received smart contract scan request, download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
    执行扫描任务,记录扫描过程日志;Perform scanning tasks and record scanning process logs;
    利用所述下载日志和所述扫描过程日志,构成智能合约扫描日志。Using the download log and the scanning process log, a smart contract scanning log is formed.
  13. 根据权利要求11所述的计算机设备,其中,所述处理器执行的所述执行智能合约编译操作,获取智能合约编译日志,包括:The computer device according to claim 11, wherein the executing the smart contract compilation operation performed by the processor to obtain the smart contract compilation log comprises:
    根据接收到的智能合约编译请求,从智能合约代码管理库下载对应版本智能合约,并记录下载日志;According to the received smart contract compilation request, download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
    分析智能合约代码,构建相应的编译环境,执行编译操作,记录编译过程日志以及编译结果;Analyze the smart contract code, build the corresponding compilation environment, perform compilation operations, record compilation process logs and compilation results;
    利用所述下载日志、所述编译过程日志和所述编译结果,构成智能合约编译日志。Using the download log, the compilation process log and the compilation result, a smart contract compilation log is formed.
  14. 根据权利要求11所述的计算机设备,其中,所述处理器执行的所述执行智能合约部署操作,获取智能合约部署日志,包括:The computer device according to claim 11, wherein the executing smart contract deployment operation performed by the processor to obtain a smart contract deployment log comprises:
    根据接收到的智能合约部署请求,获取执行智能合约编译操作所得到的智能合约可执行文件,并记录获取过程日志;According to the received smart contract deployment request, obtain the smart contract executable file obtained by executing the smart contract compilation operation, and record the acquisition process log;
    向智能合约测试网络各节点发送所述智能合约部署请求,记录发送日志以及返回的部署结果,并通过测试网络节点提供的接口获取相应的部署过程日志;Send the smart contract deployment request to each node of the smart contract test network, record the sending log and the returned deployment result, and obtain the corresponding deployment process log through the interface provided by the test network node;
    利用获取过程日志、发送日志、部署结果和部署过程日志,构成智能合约部署日志;Use the acquisition process log, the sending log, the deployment result and the deployment process log to form a smart contract deployment log;
    所述执行智能合约测试操作,获取智能合约测试日志,包括:The execution of the smart contract test operation and the acquisition of the smart contract test log include:
    根据测试集,依次向智能合约测试网络各节点发送智能合约测试请求,记录发送日志以及返回的测试结果,并通过测试网络节点提供的接口获取相应的测试过程日志;According to the test set, send the smart contract test request to each node of the smart contract test network in turn, record the sending log and the returned test result, and obtain the corresponding test process log through the interface provided by the test network node;
    利用所述发送日志、所述测试结果和所述测试过程日志,构成智能合约测试日志。Using the sending log, the test result and the test process log, a smart contract test log is formed.
  15. 一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行一种智能合约的日志生成及保存方法的步骤,所述处理器执行的所述智能合约的日志生成及保存方法的步骤,包括:A storage medium storing computer-readable instructions, when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of a method for generating and saving a log of a smart contract, so that the The steps of the log generation and storage method of the smart contract executed by the processor include:
    生成智能合约的日志文档;Generate log files for smart contracts;
    产生第一私有秘钥及与第一私有秘钥相匹配的第一公开秘钥;generating a first private key and a first public key matching the first private key;
    将所述第一公开秘钥写入所述智能合约的日志文档;Write the first public key into the log file of the smart contract;
    生成一对第二公开秘钥和第二私有秘钥;generating a pair of the second public key and the second private key;
    根据第一加密算法、所述第一私有秘钥以及所述第二公开秘钥生成第一共享秘钥;generating a first shared key according to the first encryption algorithm, the first private key and the second public key;
    根据所述第一共享秘钥和第二加密算法,对原始日志内容进行加密得到加密日志内容;According to the first shared secret key and the second encryption algorithm, the original log content is encrypted to obtain the encrypted log content;
    将加密日志内容写入所述智能合约的日志文档;Write the encrypted log content into the log file of the smart contract;
    将包括第一公开秘钥和写入了加密日志内容的智能合约日志文档保存。Save the smart contract log file including the first public key and the encrypted log content.
  16. 根据权利要求15所述的存储介质,其中,所述第一加密算法为RSA公开密钥加密算法;所述处理器执行的所述根据第一加密算法、第一私有秘钥以及第二公开秘钥生成第一共享秘钥包括:The storage medium according to claim 15, wherein the first encryption algorithm is an RSA public key encryption algorithm; The key generation first shared secret key includes:
    创建所述RSA公开密钥加密算法的接口;Create an interface for the RSA public key encryption algorithm;
    将所述第二公开秘钥作为RSA公开密钥加密算法接口的第一参数,将第一私有秘钥作为RSA公开密钥加密算法接口的第二参数;The second public key is used as the first parameter of the RSA public key encryption algorithm interface, and the first private key is used as the second parameter of the RSA public key encryption algorithm interface;
    调用RSA公开密钥加密算法接口,生成秘钥,该秘钥作为第一共享秘钥。Call the RSA public key encryption algorithm interface to generate a secret key, which is used as the first shared secret key.
  17. 根据权利要求15所述的存储介质,其中,所述处理器执行的所述生成智能合约的日志文档的方法包括:The storage medium according to claim 15, wherein the method of generating a log file of a smart contract executed by the processor comprises:
    执行智能合约扫描操作,获取智能合约扫描日志;Perform a smart contract scan operation to obtain a smart contract scan log;
    执行智能合约编译操作,获取智能合约编译日志;Execute the smart contract compilation operation to obtain the smart contract compilation log;
    执行智能合约部署操作,获取智能合约部署日志;Execute smart contract deployment operations and obtain smart contract deployment logs;
    执行智能合约测试操作,获取智能合约测试日志;Execute smart contract test operations and obtain smart contract test logs;
    将所述智能合约扫描日志、所述智能合约编译日志、所述智能合约部署日志和所述智能合约测试日志合并生成所述智能合约的日志文档。The smart contract scan log, the smart contract compilation log, the smart contract deployment log, and the smart contract test log are combined to generate a log file of the smart contract.
  18. 根据权利要求17所述的存储介质,其中,所述处理器执行的所述执行智能合约扫描操作,获取智能合约扫描日志,包括:The storage medium according to claim 17, wherein the executing the smart contract scanning operation performed by the processor to obtain the smart contract scanning log comprises:
    根据接收到的智能合约扫描请求,从智能合约代码管理库下载对应版本智能合约,记录下载日志;According to the received smart contract scan request, download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
    执行扫描任务,记录扫描过程日志;Perform scanning tasks and record scanning process logs;
    利用所述下载日志和所述扫描过程日志,构成智能合约扫描日志。Using the download log and the scanning process log, a smart contract scanning log is formed.
  19. 根据权利要求17所述的存储介质,其中,所述处理器执行的所述执行智能合约编译操作,获取智能合约编译日志,包括:The storage medium according to claim 17, wherein the executing the smart contract compilation operation performed by the processor to obtain the smart contract compilation log comprises:
    根据接收到的智能合约编译请求,从智能合约代码管理库下载对应版本智能合约,并记录下载日志;According to the received smart contract compilation request, download the corresponding version of the smart contract from the smart contract code management library, and record the download log;
    分析智能合约代码,构建相应的编译环境,执行编译操作,记录编译过程日志以及编译结果;Analyze the smart contract code, build the corresponding compilation environment, perform compilation operations, record compilation process logs and compilation results;
    利用所述下载日志、所述编译过程日志和所述编译结果,构成智能合约编译日志。Using the download log, the compilation process log and the compilation result, a smart contract compilation log is formed.
  20. 根据权利要求17所述的存储介质,其中,所述处理器执行的所述执行智能合约部署操作,获取智能合约部署日志,包括:The storage medium according to claim 17, wherein the executing the smart contract deployment operation performed by the processor to obtain the smart contract deployment log comprises:
    根据接收到的智能合约部署请求,获取执行智能合约编译操作所得到的智能合约可执行文件,并记录获取过程日志;According to the received smart contract deployment request, obtain the smart contract executable file obtained by executing the smart contract compilation operation, and record the acquisition process log;
    向智能合约测试网络各节点发送所述智能合约部署请求,记录发送日志以及返回的部署结果,并通过测试网络节点提供的接口获取相应的部署过程日志;Send the smart contract deployment request to each node of the smart contract test network, record the sending log and the returned deployment result, and obtain the corresponding deployment process log through the interface provided by the test network node;
    利用获取过程日志、发送日志、部署结果和部署过程日志,构成智能合约部署日志;Use the acquisition process log, the sending log, the deployment result and the deployment process log to form a smart contract deployment log;
    所述执行智能合约测试操作,获取智能合约测试日志,包括:The execution of the smart contract test operation and the acquisition of the smart contract test log include:
    根据测试集,依次向智能合约测试网络各节点发送智能合约测试请求,记录发送日志以及返回的测试结果,并通过测试网络节点提供的接口获取相应的测试过程日志;According to the test set, send the smart contract test request to each node of the smart contract test network in turn, record the sending log and the returned test result, and obtain the corresponding test process log through the interface provided by the test network node;
    利用所述发送日志、所述测试结果和所述测试过程日志,构成智能合约测试日志。Using the sending log, the test result and the test process log, a smart contract test log is formed.
PCT/CN2021/096859 2020-11-16 2021-05-28 Method and apparatus for generating and storing logs of smart contract, device, and storage medium WO2022100063A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011280585.9 2020-11-16
CN202011280585.9A CN112419057A (en) 2020-11-16 2020-11-16 Method, device, equipment and storage medium for generating and storing logs of intelligent contracts

Publications (1)

Publication Number Publication Date
WO2022100063A1 true WO2022100063A1 (en) 2022-05-19

Family

ID=74831405

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/096859 WO2022100063A1 (en) 2020-11-16 2021-05-28 Method and apparatus for generating and storing logs of smart contract, device, and storage medium

Country Status (2)

Country Link
CN (1) CN112419057A (en)
WO (1) WO2022100063A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112419057A (en) * 2020-11-16 2021-02-26 平安科技(深圳)有限公司 Method, device, equipment and storage medium for generating and storing logs of intelligent contracts
CN113254964A (en) * 2021-06-02 2021-08-13 杭州趣链科技有限公司 Log security certificate storage method and device, electronic equipment and storage medium
CN113961518B (en) * 2021-09-08 2022-09-23 北京百度网讯科技有限公司 Log visual display method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733783A (en) * 2018-05-09 2018-11-02 深圳明创自控技术有限公司 A kind of student status information management system based on privately owned block chain
US20200019936A1 (en) * 2018-07-12 2020-01-16 International Business Machines Corporation Timestamping changes to smart-contract state
CN110717825A (en) * 2018-06-27 2020-01-21 复旦大学 Distributed data transaction accounting system based on block chain
CN110808999A (en) * 2019-11-12 2020-02-18 中钞信用卡产业发展有限公司杭州区块链技术研究院 Service interaction method, device, equipment and storage medium
CN112419057A (en) * 2020-11-16 2021-02-26 平安科技(深圳)有限公司 Method, device, equipment and storage medium for generating and storing logs of intelligent contracts

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107948212A (en) * 2018-01-10 2018-04-20 武汉斗鱼网络科技有限公司 A kind of processing method and processing device of daily record
CN110633200A (en) * 2018-06-25 2019-12-31 富士通株式会社 Method and device for testing intelligent contracts
CN110661748B (en) * 2018-06-28 2022-01-04 武汉斗鱼网络科技有限公司 Log encryption method, log decryption method and log encryption device
CN110413316B (en) * 2019-07-31 2023-12-05 中国工商银行股份有限公司 Non-invasive testing system and method for intelligent contracts of block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733783A (en) * 2018-05-09 2018-11-02 深圳明创自控技术有限公司 A kind of student status information management system based on privately owned block chain
CN110717825A (en) * 2018-06-27 2020-01-21 复旦大学 Distributed data transaction accounting system based on block chain
US20200019936A1 (en) * 2018-07-12 2020-01-16 International Business Machines Corporation Timestamping changes to smart-contract state
CN110808999A (en) * 2019-11-12 2020-02-18 中钞信用卡产业发展有限公司杭州区块链技术研究院 Service interaction method, device, equipment and storage medium
CN112419057A (en) * 2020-11-16 2021-02-26 平安科技(深圳)有限公司 Method, device, equipment and storage medium for generating and storing logs of intelligent contracts

Also Published As

Publication number Publication date
CN112419057A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
US10303448B2 (en) Systems and methods for graph-based analysis of software
WO2022100063A1 (en) Method and apparatus for generating and storing logs of smart contract, device, and storage medium
US9298924B2 (en) Fixing security vulnerability in a source code
US20200192662A1 (en) Semantic-aware and self-corrective re-architecting system
Hedin et al. JSFlow: Tracking information flow in JavaScript and its APIs
US9152796B2 (en) Dynamic analysis interpreter modification for application dataflow
US8930884B2 (en) Efficient extraction of software dependencies from program code
US11650905B2 (en) Testing source code changes
US20170329693A1 (en) Systems and methods for incremental analysis of software
Livshits Dynamic taint tracking in managed runtimes
US9170908B2 (en) System and method for dynamic analysis bytecode injection for application dataflow
Wittern et al. Opportunities in software engineering research for web API consumption
US9459986B2 (en) Automatic generation of analysis-equivalent application constructs
US9158935B2 (en) Automatic mediation of resource access in mobile applications
US20220198003A1 (en) Detecting added functionality in open source package
Hedin et al. Information-flow security for JavaScript and its APIs
US10481996B2 (en) Hybrid code modification in intermediate language for software application
Duarte et al. An empirical study of docker vulnerabilities and of static code analysis applicability
Chong et al. Code‐level model checking in the software development workflow at Amazon web services
Rodrigues et al. Model-driven fault injection in Java source code
Di Ruscio et al. A model‐driven approach to detect faults in FOSS systems
Wickert et al. Supporting Error Chains in Static Analysis for Precise Evaluation Results and Enhanced Usability
Zhang et al. Programming smart contract with solidity
Wong Dynamic Taint Analysis in JavaScript for JavaScript
Shezan et al. CHKPLUG: Checking GDPR Compliance of WordPress Plugins via Cross-language Code Property Graph

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21890594

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21890594

Country of ref document: EP

Kind code of ref document: A1