CN108073513A - The apparatus and method tested the intelligent contract based on block chain - Google Patents

The apparatus and method tested the intelligent contract based on block chain Download PDF

Info

Publication number
CN108073513A
CN108073513A CN201710265237.6A CN201710265237A CN108073513A CN 108073513 A CN108073513 A CN 108073513A CN 201710265237 A CN201710265237 A CN 201710265237A CN 108073513 A CN108073513 A CN 108073513A
Authority
CN
China
Prior art keywords
function
intelligent contract
block chain
feature
contract
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710265237.6A
Other languages
Chinese (zh)
Inventor
皮冰锋
华松
孙俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to CN201710265237.6A priority Critical patent/CN108073513A/en
Priority to JP2018079746A priority patent/JP2018185808A/en
Publication of CN108073513A publication Critical patent/CN108073513A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application discloses the apparatus and method for being tested the intelligent contract based on block chain, which includes:Sequencing unit, the feature for being configured as the function in intelligent contract are ranked up function;Selecting unit is configured as the function according to sequencing selection predetermined quantity;And test setting unit, each function for selecting unit selection is configured as, the parameter for being respectively arranged to the event monitor of test and being monitored.

Description

The apparatus and method tested the intelligent contract based on block chain
Technical field
Embodiments herein is related to field of information processing, more particularly to block chain technical field, relates more specifically to The apparatus and method tested the intelligent contract based on block chain.
Background technology
In recent years, block chain (blockchain) technology becomes to become more and more popular.By block chain technology, before by by The medium of trust can be operated in a manner of decentralization without central administrative authority come the application run.For example, bit Coin (bitcoin), ether mill (Ethereum) be block chain technology some apply example.Block chain technology causes mutual mistrust Both sides can be with free transaction.This is ensured by three kinds of technologies:A large amount of encrypted uses of data storage, end-to-end (P2P) net Network and intelligent contract.
Intelligent contract is resident in the self-operating script on block chain.Once being disposed, public function can be by other Contract calls.But intelligent contract is difficult to update, this is because they are stored in the block of decentralization, it is difficult to change.Cause This before announcement, it is necessary to ensure the quality of intelligent contract.
The content of the invention
The brief overview on the present invention is given below, in order to provide on the basic of certain aspects of the invention Understand.It should be appreciated that this general introduction is not the exhaustive general introduction on the present invention.It is not intended to determine the pass of the present invention Key or pith, nor is it intended to limit the scope of the present invention.Its purpose only provides some concepts in simplified form, In this, as the preamble in greater detail discussed later.
According to an aspect of the invention, there is provided a kind of dress for being tested the intelligent contract based on block chain It puts, including:Sequencing unit, the feature for being configured as the function in intelligent contract are ranked up function;Selecting unit, quilt It is configured to the function according to sequencing selection predetermined quantity;And test setting unit, it is configured as selecting unit selection Each function, the parameter for being respectively arranged to the event monitor of test and being monitored.
According to another aspect of the present invention, provide a kind of for being tested the intelligent contract based on block chain Method, including:The feature of function in intelligent contract is ranked up function;According to the letter of sequencing selection predetermined quantity Number;And for each selected function, the parameter for being respectively arranged to the event monitor of test and being monitored.
Other aspects according to the invention additionally provide corresponding computer program code, computer readable storage medium And computer program product.
Apparatus and method according to the application for being tested the intelligent contract based on block chain can obtain intelligence The information and substantial amounts of hierarchical information and parameter value of important function in energy contract, so that the survey to intelligent contract Examination is more effective.
By the way that below in conjunction with attached drawing the following detailed description of the embodiment of the present invention, these and other of the invention is excellent Point will be apparent from.
Description of the drawings
In order to which the above and other advantages and features of the application are expanded on further, below in conjunction with the accompanying drawings to the specific of the application Embodiment is described in further detail.The attached drawing together with following detailed description include in the present specification and Form the part of this specification.Element with identical function and structure is denoted with the same reference numerals.It should be appreciated that These attached drawings only describe the typical case of the application, and are not to be taken as the restriction to scope of the present application.In the accompanying drawings:
Fig. 1 is shown according to one embodiment of the application for testing the intelligent contract based on block chain Device functional block diagram;
Fig. 2 is to show intelligent contract and its an exemplary figure of the operation on EVM;
Fig. 3 shows an example of the structure of event log;
Fig. 4 shows an exemplary figure of the Json object that intelligent contract is parsed into;
Fig. 5 is the digraph for showing the call relation between function;
Fig. 6 is the schematic diagram for the scene for showing the technology using the application;
Fig. 7 is shown according to one embodiment of the application for testing the intelligent contract based on block chain Method flow chart;And
Fig. 8 is the general purpose personal computer that can wherein realize method according to an embodiment of the invention and/or device The block diagram of example arrangement.
Specific embodiment
The exemplary embodiment of the present invention is described hereinafter in connection with attached drawing.For clarity and conciseness, All features of actual implementation mode are not described in the description.It should be understood, however, that developing any this actual implementation It must be made during example much specific to the decision of embodiment, to realize the objectives of developer, for example, symbol Conjunction and system and those relevant restrictive conditions of business, and these restrictive conditions may have with the difference of embodiment Changed.In addition, it will also be appreciated that although development is likely to be extremely complex and time-consuming, to having benefited from the disclosure For those skilled in the art of content, this development is only routine task.
Herein, it is also necessary to which explanation is a bit, in order to avoid because having obscured the present invention during unnecessary details, in the accompanying drawings The device structure closely related with scheme according to the present invention and/or processing step are illustrate only, and is omitted and the present invention The little other details of relation.
It is discussed below to carry out in the following order:
1. for the device tested the intelligent contract based on block chain
2. for the method tested the intelligent contract based on block chain
3. to implement the computing device of the apparatus and method of the application
[1. device for being tested the intelligent contract based on block chain]
As previously described, because the specific properties of intelligent contract before issue, it is necessary to ensure its quality.For ensuring intelligent conjunction The mode of quality about adjustment method such as including mathematically carrying out formal verification, record log.However, for example for note The method for recording daily record, it tends to be difficult to obtain contract daily record, specifically, daily record is called by event and obtained, and event needs in advance It is defined and inserted into intelligent contract.In addition, the structure of event log is extremely complex, it is difficult to therefrom obtain for defect diagonsis Enough information.
In consideration of it, embodiments herein proposes a kind of dress for being tested the intelligent contract based on block chain 100 are put, functional block diagram is as shown in Figure 1, device 100 includes:Sequencing unit 101 is configured as according in intelligent contract The feature of function function is ranked up;Selecting unit 102 is configured as the function according to the sequencing selection predetermined quantity; And test setting unit 103, each function selected for selecting unit 102 is configured as, is respectively arranged to test Event monitor and the parameter to be monitored.
Wherein, sequencing unit 101, selecting unit 102 and test setting unit 103 can for example be handled by one or more Circuit realizes that the process circuit for example can be implemented as chip.
Wherein, intelligent contract is the self-operating script for autonomous nodes, and multiple hold can be defined in intelligent contract Line function.For the debugging of intelligent contract, some functions are important, some functions are unessential.In other words, counterweight The function wanted, which carries out debugging, can obtain the defects of more diagnostic message.Therefore, sequencing unit 101 is set to arrange function Sequence finds this important function.The sequence is carried out according to the feature of function, wherein, the feature of function can reflect this Significance level of the function for debugging.
It should be understood that the debugging efficiency of intelligent contract will be improved by being tested for the high function of significance level.Therefore, select Unit 102 is selected such as the function according to sequencing selection predetermined quantity according to commissioning requirements, acceptable time cost.In general, It can select most important N (N>=1) a function is tested.
It, will in different position insertion events (hereinafter also referred to as event monitor) for each selected function Different results and procedural information are obtained, correspondingly, the parameter to be monitored is also by difference.It, can be in order to improve the efficiency of test The position insertion event of more Debugging message can be being obtained, and can suitably monitor the ginseng that more Debugging message are provided Number.Therefore, test setting unit 103 will be directed to each function, be respectively arranged to the event monitor of test and supervise The parameter listened.
Then, event monitor will be inserted in the corresponding position of selected each function and there is provided will monitor The intelligent contract of parameter be deployed on test block chain, in the operational process of intelligent contract, the event of insertion be triggered from And event log is grabbed, for defect diagonsis.
In one example, sequencing unit 101 is configured as at least one feature pair in the following feature according to function Function is ranked up:With the relevant feature of block chain;The structure complexity of function;And the call relation between function.For example, row Sequence unit 101 can be configured as the weighted sum of feature based to be ranked up to function.
Illustratively, sequencing unit 101 can also foreclose the function with particular community when being ranked up.This A little importances for the test of intelligent contract of the function with particular community are usually relatively low.
For convenience, it is described below with reference to the intelligent contract in ether mill as example, wherein it is assumed that intelligence is closed About there is the form of solidity, and run on ether mill virtual machine (EVM).However, it is to be understood that the application and unlimited In this, but other ways of realization of other kinds of application and intelligent contract can be suitably applied to.
Fig. 2 shows an example of intelligent contract and its operation on EVM.Each intelligence contract can include state Statement, function, function modifier, event, structure type and enumeration type of variable etc..As shown in Fig. 2, the intelligence contract includes Be named as the contract of MetaCoin, except constructed fuction getBalance, also define two function MetaCoin and SendCoin, and define state variable " balances ".
In addition, in order to check the correctness for sending ether mill coin, also define event and insert it into function In sendCoin.It is disposed in EVM after intelligent contract, you can recall (JScallback) to trigger JS to capture event day Will, as is shown on the right of figure 2.Fig. 3 shows an example of the structure of event log.As can be seen that in this example, upper half Part is block and merchandise relevant the information such as quantity of the block comprising the daily record, block Hash Round Robin data partition, transmission ether mill Trading account of coin etc., the latter half are limited monitoring parameter values.As previously mentioned, the information included in acquiescence daily record is difficult to use In diagnosis defect, for example, they do not triggered such as with the heap stack trace of contract contract which and run in function The related information of calling level.
Wherein, intelligent contract can be resolved to Json object by contract resolver, as shown in Figure 4.Contract resolver provides The component interface that such as variable, function etc. interact with contract, and also show with the relevant features of solidity such as Visibility and accessibility.For example, the visibility of function can be appointed as " external (external) ", " public (public) ", " interior Portion (internal) " or " privately owned (private) ", such as be defaulted as public.For variable, accessibility can be appointed as " public Common (public) " or " internal (internal) ", such as it is defaulted as inside.Illustratively, sequencing unit 101 can be based on Json Output merge obtaining the collection of function in contract and be ranked up according to the feature of function.
For the intelligent contract of the form of solidity, sequencing unit 101 can check the attribute of function and will have example Such as " constructor (constructor) ", " from function (selfdestruct) is destroyed ", " getter (getter) ", " setter Etc. (setter) " function of attributes forecloses, i.e., the function with these attributes is not involved in sorting.In Fig. 2 and shown in Fig. 4 In example, function " MetaCoin " is constructor, and function " getBalance " is getter, is not involved in sorting.
Next, sequencing unit 101 is for example ranked up its cofunction.As previously mentioned, the feature of sequence institute foundation can To include:With the relevant feature of block chain;The structure complexity of function;And the call relation between function.
In one example, it is at least one in including as follows with the relevant feature of block chain:With the relevant category of block chain Property;The attribute related with the transactional operation of intelligent contract;And sender and the reception for the transactional operation being related to intelligent contract The attribute of Fang Youguan.
For example, with the main body of the relevant attribute of block chain including function whether include block or with the relevant attribute of block, Such as block.blockhash (uint blockNumber), block.gaslimit, block.coinbase etc. (the intelligent contract of solidity forms).
The attribute related with the transactional operation of intelligent contract is such as including msg.sender, msg.value.Using Fig. 2 as Example, function " sendCoin " use " balances [msg.sender]<Amount " is used as Conditions Evaluation.
The attribute related with the sender of transactional operation that intelligent contract is related to and recipient is for example including related with account Attribute such as<address>.send(uint256 amount),<address>.balance (uint256) etc..
If three of the above attribute, F are represented with three boolean logic values respectivelybWhether have for representative function and block The value of relevant attribute, FtWhether there is the value of the attribute related with transactional operation, F for representative functionaWhether have for representative function There is the value of the attribute related with account, then it can be calculated as below with the relevant feature of block chain:
Wb=Fb+Ft+Fa (1)
Wherein, "+" expression or computing.It should be understood that formula (1) is only a kind of meter given with the relevant feature of block chain Calculation method, but the application is not limited to this, and the attribute considered is also not necessarily limited to above-mentioned three kinds.
On the other hand, the structure complexity of function may be employed the number of the input of function, function output number with And at least one in the number of the control structure included in function states.For example, it can be included in function in solidity Control structure include " if/else ", " while ", " do ", " for ", " break ", " continue ", ":" etc..
In one example, sequencing unit 101 can be configured as the structure complexity based on each function with owning The ratio of the sum of the structure complexity of function is ranked up, i.e. can calculate the structure complexity of function based on the ratio.
For example, the following formula (2) may be employed to calculate the structure complexity W of functions
Wherein, NiRepresent above-mentioned input, output, control structure number in the number of some, Nj,iRepresent intelligence conjunction The total number of the corresponding aspect included in all functions in about.WsFor the accumulation of the structure complexity of three of the above number reflection As a result.It is of course also possible to use only one or two in three kinds of numbers calculate structure complexity Ws, this is not restricted 's.
In addition, call relation between function can based on function in intelligent contract by the frequency of other function calls and The function is obtained by the frequency that other intelligent contracts call.
As previously mentioned, the visibility of function can be appointed as " outside ", " public ", " inside " or " privately owned ".Wherein, have The function of " outside " or " public " can be visible by other contracts and be called, and " inside " and " privately owned " function can only be adjusted by inside With.Fig. 5 shows the digraph of the call relation between function.
For example, intrinsic call relation and external call relation can be weighed using following two indices respectively.IIF is (inverse Call frequency) frequency called for function by intrinsic function it is inverse, as shown in following formula (3).
Wherein, niFor the number that i-th of function is called, ∑ njFor the number of all call relations in the intelligence contract.With Exemplified by Fig. 5, f3By f2And f4It calls, the number that is called is 2, and co-exists in 4 call relations in intelligence and about 1, therefore f3IIF values beIt is appreciated that when the number that a function is called is more, it is basic letter to illustrate it Several probability is higher, therefore its significance level will be lower, so as to be presented as the feature of relatively low weight.
CIF (cross-call frequency) is the frequency that function is called by other intelligent contracts, as shown in following formula (4).
Wherein, | D | total contract number is represented, | j:fi∈dj| it represents and calls function fiContract number, using Fig. 5 as Example, altogether there are three intelligent contract, for function f4, quilt and about 2 function f9It calls.Therefore, f4CIF value be
Finally, the feature of the call relation of function can be expressed as the product of above-mentioned two index, as shown in following formula (5).
Wr=IIF*CIF (5)
With function f3And f4Exemplified by, it calculates as follows:
Each feature and its example of calculating is presented above, however, it is to be understood that the application is without being limited thereto, but can Suitably to use in a manner of other features or other feature calculations.Then, sequencing unit 101 can to the feature that is calculated into Row weighted sum, to obtain the final weight order of each function, as shown in following formula (8).
W=α * Wb+β*Ws+(1-α-β)*Wr (8)
Wherein, α and β can be set based on experience value.When α or β is 0, corresponding feature will not be received in sequence Enter to consider.
It after the W values of each function are calculated, is sorted according to the value, and selects N number of letter of such as W values maximum Number, so that test setting unit 103 sets event monitor and the parameter to be monitored in these functions.Wherein, N's is big It is small to change with the variation of the number in intelligent contract, and depending on desired adjustment accuracy and acceptable time Cost.
Which row should be by event monitor in event monitor indicator function, which the instruction of the parameter to be monitored should monitor The parameter of species is for defect diagonsis.
In one example, test setting unit 103 is configured as at least one the following place of function event being set to supervise Visual organ:Before the execution of transactional operation involved by intelligent contract;Before acquisition return value;In control structure.
If for example, function have account association attributes or the relevant attribute of ether mill coin, especially with it is following transmission with Too mill coin when calling when:<address>.send(uint256 amount)returns(bool);<address> .call.value (uint256amount) () returns (bool), it should the insertion event monitor before these calling.
If function has return, can also call return before insertion event monitor.It, can if function does not return With the insertion event monitor at last column of function.
If function has control structure, should event monitor be set in the main body of control structure.For example, can be Event monitor is set in each branch of " if/else " or in the loop body of " for " or " while ".
As previously mentioned, the event log of acquiescence does not include sufficiently for the information of debugging.Therefore, it is enough in order to obtain Evaluation information is adjusted, test setting unit 103 is additionally operable to point out that the parameter of which species should be monitored.
At least one in following parameter is monitored for example, test setting unit 103 can be configured as:Calling layer Grade information;Block chain relevant information;And the parameter for debugging offline.
Illustratively, call hierarchical information that can include at least one of the following:The position ratio of event monitor is set Such as line number;The title of intelligent contract can be marked for log searching;The such as time time that event monitor is performed Stamp, can be used for being ranked up daily record.
Block chain relevant information can include at least one of the following:The ginseng of transactional operation involved by intelligent contract Number, such as the quantity of to be sent and reception ether mill coin;The sender of transactional operation involved by intelligent contract and reception Side, for example send account and receive account;Perform the remaining amount of computational resources before the transactional operation involved by intelligent contract.Example Such as, certain gas is first obtained before the intelligent contract of operation, that is, amount of computational resources, it is ensured that run in the gas Complete intelligence contract, the remaining amount of computational resources before performing the transactional operation involved by intelligent contract be, for example, send performing or Receive the remaining gas amounts before the coin of ether mill.
Parameter for debugging offline can include at least one of the following:The input parameter value of function;Function it is defeated Go out parameter value;The relevant public variable of and function.For example, in the example of hgure 5, var1It may be by function f6It influences, so should In f6Event in monitor public variable var1
Fig. 6 shows the schematic diagram of the scene of the technology using the application.Wherein, first to the intelligence of no definition event Contract is parsed to obtain the function to be ranked up, and is passed through sequencing unit 101 and for example carried out by the descending of weight order Sequence then selects top n function by selecting unit 102, and by test setting unit 103 for each in N number of function Function insertion event monitor and the definite parameter to be monitored.Then, the intelligent contract with event is deployed in block chain On run and crawl log.User such as developer can check the daily record of crawl to be used for defect diagonsis.
In conclusion it can be selected according to the device 100 of the present embodiment by the characteristic value of the function in intelligent contract It selects important function and obtains substantial amounts of hierarchical information by setting event monitor and the parameter to be monitored in these functions And parameter value, so as to fulfill the Validity Test of intelligent contract.
[2. method for being tested the intelligent contract based on block chain]
For the process for the device tested the intelligent contract based on block chain described in embodiment above In, it is clear that also disclose some processing or method.Hereinafter, in the case where not repeating some details above by discussion The summary of these methods is provided, although it should be noted that these methods are being described for for the intelligence based on block chain It is open during the device that contract is tested, but these methods are not necessarily using those described components or not necessarily It is performed by those components.For example, the embodiment of the device for being tested the intelligent contract based on block chain can portion Divide ground or fully realized using hardware and/or firmware, and what methodology discussed below can perform by computer completely Program is realized, although these methods can also use the hard of the device tested the intelligent contract based on block chain Part and/or firmware.
Fig. 7 is shown according to one embodiment of the application for being tested the intelligent contract based on block chain The flow chart of method, this method include:The feature of function in intelligent contract is ranked up function (S11);According to row Sequence selects the function (S12) of predetermined quantity;And for each selected function, the event for being respectively arranged to test is supervised Visual organ and the parameter (S13) to be monitored.
It, can arranging function according at least one feature in the following feature of function for example, in step s 11 Sequence:With the relevant feature of block chain;The structure complexity of function;And the call relation between function, wherein, feature based adds It weighs and to be ranked up to function.
Wherein, it is at least one in can including as follows with the relevant feature of block chain:With the relevant category of block chain Property;The attribute related with the transactional operation of intelligent contract;And sender and the reception for the transactional operation being related to intelligent contract The attribute of Fang Youguan.The structure complexity of function may be employed the number of the input of function, function output number and letter At least one in the number of the control structure included in number states, and the structure complexity based on each function and institute There is the ratio of the sum of the structure complexity of function to be ranked up.Call relation between function can be based on function in intelligent contract It is interior to be obtained by the frequency of other function calls and function by the frequency that other intelligent contracts call.
In step s 13, can event monitor be set at least one the following place of function:Involved by intelligent contract Before the execution of transactional operation;Before acquisition return value;In control structure.Furthermore, it is possible to in following parameter it is at least one into Row is monitored:Call hierarchical information;Block chain relevant information;And the parameter for debugging offline.Call hierarchical information that can wrap Include at least one of the following:The position of event monitor is set;The title of intelligent contract;Event monitor be performed when Between.Block chain relevant information can include at least one of the following:The parameter of transactional operation involved by intelligent contract;Intelligence The sender and recipient of transactional operation involved by contract;Remaining meter before performing the transactional operation involved by intelligent contract Calculate stock number.Parameter for debugging offline can include at least one of the following:The input parameter value of function;Function it is defeated Go out parameter value;The relevant public variable of and function.
Correlative detail in above example is in the dress to being used to test the intelligent contract based on block chain It is shown in detail in the description put, details are not described herein.
[3. to implement the computing device of the apparatus and method of the application]
All modules, unit can be matched somebody with somebody by way of software, firmware, hardware or its combination in above device It puts.Specific means workable for configuration or mode are well known to those skilled in the art, and details are not described herein.By software or It is (such as shown in Fig. 8 general to the computer with specialized hardware structure from storage medium or network in the case that firmware is realized Computer 800) program for forming the software is installed, which is able to carry out various functions etc. when being equipped with various programs.
In fig. 8, central processing unit (CPU) 801 is according to the program stored in read-only memory (ROM) 802 or from depositing The program that storage part 808 is loaded into random access memory (RAM) 803 performs various processing.In RAM 803, also according to need Store the required data when CPU 801 performs various processing etc..CPU 801, ROM 802 and RAM 803 are via bus 804 are connected to each other.Input/output interface 805 is also connected to bus 804.
Components described below is connected to input/output interface 805:Importation 806 (including keyboard, mouse etc.), output section Divide 807 (including displays, such as cathode-ray tube (CRT), liquid crystal display (LCD) etc. and loud speaker etc.), storage part 808 (including hard disks etc.), communications portion 809 (including network interface card such as LAN card, modem etc.).Communications portion 809 Communication process is performed via network such as internet.As needed, driver 810 can be connected to input/output interface 805. Removable media 811 such as disk, CD, magneto-optic disk, semiconductor memory etc. are installed in driver 810 as needed On so that the computer program read out is mounted to as needed in storage part 808.
It is such as removable from network such as internet or storage medium in the case where realizing above-mentioned series of processes by software Except medium 811 installs the program of composition software.
It will be understood by those of skill in the art that this storage medium be not limited to it is shown in Fig. 8 wherein have program stored therein, Separately distribute the removable media 811 for providing a user program with equipment.The example of removable media 811 includes disk (including floppy disk (registered trademark)), CD (comprising compact disc read-only memory (CD-ROM) and digital versatile disc (DVD)), magneto-optic disk (including mini-disk (MD) (registered trademark)) and semiconductor memory.Alternatively, storage medium can be ROM 802, storage part Hard disk included in 808 etc., wherein computer program stored, and user is distributed to together with the equipment comprising them.
The present invention also proposes a kind of program product for the instruction code for being stored with machine-readable.Described instruction code is by machine When device reads and performs, can perform it is above-mentioned according to the method for the embodiment of the present invention.
Correspondingly, it is configured as carrying the storage medium of the program product of the above-mentioned instruction code for being stored with machine-readable It is also included in disclosure of the invention.The storage medium includes but not limited to floppy disk, CD, magneto-optic disk, storage card, memory stick Etc..
Finally, it is to be noted that, term " comprising ", "comprising" or its any other variant be intended to it is non-exclusive Property include so that process, method, article or equipment including a series of elements not only include those elements, but also Further include other elements that are not explicitly listed or further include for this process, method, article or equipment it is intrinsic Element.In addition, in the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that wrapping Include in process, method, article or the equipment of the element that also there are other identical elements.
Although the embodiment of the present invention is described in detail with reference to attached drawing above, it is to be understood that reality described above It applies mode to be only configured as illustrating the present invention, and is not construed as limiting the invention.Come for those skilled in the art It says, the above embodiment can be made various changes and modifications without departing from the spirit and scope of the invention.Therefore, this hair Bright scope is only limited by appended claim and its equivalents.
By the description above, the embodiment provides following technical solution, but not limited to this.
A kind of 1. devices for being tested the intelligent contract based on block chain are attached, including:
Sequencing unit, the feature for being configured as the function in intelligent contract are ranked up the function;
Selecting unit is configured as the function according to the sequencing selection predetermined quantity;And
Test setting unit is configured as each function for selecting unit selection, is respectively arranged to survey The event monitor of examination and the parameter to be monitored.
Device of the note 2. according to note 1, wherein, the sequencing unit is configured as the following feature according to function In at least one feature the function is ranked up:With the relevant feature of block chain;The function it is complicated Degree;And the call relation between function,
Wherein, the sequencing unit is configured as being ranked up the function based on the weighted sum of the feature.
Device of the note 3. according to note 2, wherein, in including as follows with the relevant feature of block chain at least One:With the relevant attribute of block chain;The attribute related with the transactional operation of the intelligent contract;And with the intelligence The sender for the transactional operation that contract the is related to attribute related with recipient.
Device of the note 4. according to note 2, wherein, the structure complexity of the function uses the input of the function Number, the function output number and the function in the number of control structure that includes it is at least one come table State, and the sequencing unit be configured as structure complexity based on each function and all functions structure complexity it The ratio of sum is ranked up.
Device of the note 5. according to note 2, wherein, the call relation between the function is based on the function described It is obtained in intelligent contract by the frequency of other function calls and the function by the frequency that other intelligent contracts call.
Note 6. according to note 1 described in device, wherein, the test setting unit be configured as the function as At least one lower place sets the event monitor:Before the execution of transactional operation involved by the intelligence contract;It obtains and returns Before value;In control structure.
Device of the note 7. according to note 1, wherein, the test setting unit is configured as in following parameter It is at least one to be monitored:Call hierarchical information;Block chain relevant information;And the parameter for debugging offline.
Device of the note 8. according to note 7, wherein, the calling level information includes at least one of the following: The position of the event monitor is set;The title of the intelligence contract;The time that the event monitor is performed.
Note 9. according to note 7 described in device, wherein, the block chain relevant information include it is following at least one It is a:The parameter of transactional operation involved by the intelligence contract;It is described intelligence contract involved by transactional operation sender with Recipient;Perform the remaining amount of computational resources before the transactional operation involved by the intelligent contract.
Device of the note 10. according to note 7, wherein, it is described for the parameter debugged offline including in following extremely It is one few:The input parameter value of the function;The output parameter value of the function;With the public variable of the functional dependence.
A kind of 11. methods for being tested the intelligent contract based on block chain are attached, including:
The feature of function in intelligent contract is ranked up the function;
According to the function of the sequencing selection predetermined quantity;And
For each selected function, the parameter for being respectively arranged to the event monitor of test and being monitored.
Method of the note 12. according to note 11, wherein, according at least one feature pair in the following feature of function The function is ranked up:With the relevant feature of block chain;The structure complexity of the function;And the calling between function Relation,
Wherein, the function is ranked up based on the weighted sum of the feature.
Device of the note 13. according to note 12, wherein, in including as follows with the relevant feature of block chain extremely It is one few:With the relevant attribute of block chain;The attribute related with the transactional operation of the intelligent contract;And with the intelligence It can the sender of transactional operation that is related to of the contract attribute related with recipient.
Device of the note 14. according to note 12, wherein, the structure complexity of the function is using the defeated of the function It is at least one next in the number of the control structure included in the number, the number of the output of the function and the function that enter Statement, and arranged based on the ratio of the structure complexity of each function and the sum of the structure complexity of all functions Sequence.
Device of the note 15. according to note 12, wherein, the call relation between the function is based on the function in institute It states in intelligent contract and is obtained by the frequency of other function calls and the function by the frequency that other intelligent contracts call.
Device of the note 16. according to note 11, wherein, at least one the following place of the function, the thing is set Part monitor:Before the execution of transactional operation involved by the intelligence contract;Before acquisition return value;In control structure.
Device of the note 17. according to note 11, wherein, at least one in following parameter is monitored:It calls Hierarchical information;Block chain relevant information;And the parameter for debugging offline.
Device of the note 18. according to note 17, wherein, it is described call level information include it is following at least one It is a:The position of the event monitor is set;The title of the intelligence contract;The time that the event monitor is performed.
Note 19. according to note 17 described in device, wherein, the block chain relevant information include it is following at least one It is a:The parameter of transactional operation involved by the intelligence contract;It is described intelligence contract involved by transactional operation sender with Recipient;Perform the remaining amount of computational resources before the transactional operation involved by the intelligent contract.
Device of the note 20. according to note 17, wherein, it is described for the parameter debugged offline including in following extremely It is one few:The input parameter value of the function;The output parameter value of the function;With the public variable of the functional dependence.

Claims (10)

1. a kind of device for being tested the intelligent contract based on block chain, including:
Sequencing unit, the feature for being configured as the function in intelligent contract are ranked up the function;
Selecting unit is configured as the function according to the sequencing selection predetermined quantity;And
Test setting unit is configured as each function for selecting unit selection, is respectively arranged to test Event monitor and the parameter to be monitored.
2. the apparatus according to claim 1, wherein, the sequencing unit is configured as in the following feature according to function At least one feature is ranked up the function:With the relevant feature of block chain;The structure complexity of the function;With And the call relation between function,
Wherein, the sequencing unit is configured as being ranked up the function according to the weighted sum of the feature.
3. the apparatus of claim 2, wherein, at least one in including as follows with the relevant feature of block chain It is a:With the relevant attribute of block chain;The attribute related with the transactional operation of the intelligent contract;And it is closed with the intelligence The sender for the transactional operation being about the related to attribute related with recipient.
4. the apparatus of claim 2, wherein, the structure complexity of the function uses the number of the input of the function Mesh, the function output number and the function at least one in the number of control structure that includes state, And the sequencing unit is configured as the sum of structure complexity of structure complexity and all functions based on each function Ratio be ranked up.
5. the apparatus of claim 2, wherein, the call relation between the function is based on the function in the intelligence It is obtained in contract by the frequency of other function calls and the function by the frequency that other intelligent contracts call.
6. the apparatus according to claim 1, wherein, the test setting unit be configured as the function such as down toward One of few place sets the event monitor:Before the execution of transactional operation involved by the intelligence contract;Obtain return value it Before;In control structure.
7. the apparatus according to claim 1, wherein, the test setting unit be configured as in following parameter at least One is monitored:Call hierarchical information;Block chain relevant information;And the parameter for debugging offline.
8. device according to claim 7, wherein, the calling level information includes at least one of the following:It sets The position of the event monitor;The title of the intelligence contract;The time that the event monitor is performed.
9. device according to claim 7, wherein, the block chain relevant information includes at least one of the following:Institute State the parameter of the transactional operation involved by intelligent contract;The sender of transactional operation involved by the intelligence contract and reception Side;Perform the remaining amount of computational resources before the transactional operation involved by the intelligent contract.
10. a kind of method for being tested the intelligent contract based on block chain, including:
The feature of function in intelligent contract is ranked up the function;
According to the function of the sequencing selection predetermined quantity;And
For each selected function, the parameter for being respectively arranged to the event monitor of test and being monitored.
CN201710265237.6A 2017-04-21 2017-04-21 The apparatus and method tested the intelligent contract based on block chain Pending CN108073513A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710265237.6A CN108073513A (en) 2017-04-21 2017-04-21 The apparatus and method tested the intelligent contract based on block chain
JP2018079746A JP2018185808A (en) 2017-04-21 2018-04-18 Apparatus for and method of testing smart agreement based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710265237.6A CN108073513A (en) 2017-04-21 2017-04-21 The apparatus and method tested the intelligent contract based on block chain

Publications (1)

Publication Number Publication Date
CN108073513A true CN108073513A (en) 2018-05-25

Family

ID=62159081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710265237.6A Pending CN108073513A (en) 2017-04-21 2017-04-21 The apparatus and method tested the intelligent contract based on block chain

Country Status (2)

Country Link
JP (1) JP2018185808A (en)
CN (1) CN108073513A (en)

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446096A (en) * 2018-11-06 2019-03-08 北京知道创宇信息技术有限公司 A kind of intelligence contract adjustment method, device and its storage medium
CN109460657A (en) * 2018-10-15 2019-03-12 杭州安恒信息技术股份有限公司 A kind of safety detection method overflowed based on intelligent contract code value
CN109583857A (en) * 2018-12-11 2019-04-05 腾讯科技(深圳)有限公司 It is open to invite task processing method, system, equipment and storage medium
CN109951546A (en) * 2019-03-15 2019-06-28 百度在线网络技术(北京)有限公司 Transactions requests processing method, device, equipment and medium based on intelligent contract
CN110046091A (en) * 2019-03-12 2019-07-23 阿里巴巴集团控股有限公司 A kind of automatic test approach and device
CN110069295A (en) * 2019-05-06 2019-07-30 百度在线网络技术(北京)有限公司 Block chain processing method, device, equipment and medium
CN110175454A (en) * 2019-04-19 2019-08-27 肖银皓 A kind of intelligent contract safety loophole mining method and system based on artificial intelligence
WO2019072288A3 (en) * 2018-11-30 2019-09-19 Alibaba Group Holding Limited Testing platform for blockchain networks
CN110633200A (en) * 2018-06-25 2019-12-31 富士通株式会社 Method and device for testing intelligent contracts
CN110633199A (en) * 2018-06-22 2019-12-31 富士通株式会社 Testing apparatus, method, and medium for block chain supporting intelligent contract
CN110889574A (en) * 2018-09-11 2020-03-17 富士通株式会社 Uncertainty factor detection device, method and medium for intelligent contract
WO2020062673A1 (en) * 2018-09-26 2020-04-02 深圳壹账通智能科技有限公司 Smart contract test method, storage medium, test terminal and test device
WO2020103545A1 (en) * 2018-11-19 2020-05-28 苏宁云计算有限公司 Blockchain-based smart contract debugging and releasing method and system
CN111290958A (en) * 2020-02-20 2020-06-16 联动优势(北京)数字科技有限公司 Method and device for debugging intelligent contract
CN111782338A (en) * 2018-12-12 2020-10-16 阿里巴巴集团控股有限公司 Data processing method and system based on intelligent contract of block chain
CN111813635A (en) * 2020-08-28 2020-10-23 支付宝(杭州)信息技术有限公司 Monitoring method, system and device for intelligent contracts of block chains
CN112131115A (en) * 2020-09-23 2020-12-25 腾讯科技(深圳)有限公司 Intelligent contract fuzzy test method, device and storage medium
CN112215618A (en) * 2020-12-11 2021-01-12 支付宝(杭州)信息技术有限公司 Verification method and device of intelligent contract
CN112837155A (en) * 2021-02-10 2021-05-25 中国人民银行数字货币研究所 Method and device for registering and executing intelligent contracts in block chain
CN113051507A (en) * 2021-03-29 2021-06-29 北京智慧星光信息技术有限公司 Method and system for constructing bidirectional binding web page front end display based on json data
TWI741373B (en) * 2018-12-12 2021-10-01 開曼群島商創新先進技術有限公司 Data processing method and system based on blockchain smart contract

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110543407B (en) * 2019-08-21 2021-11-05 杭州趣链科技有限公司 Static analysis method for performance of identity intelligent contract
KR102160379B1 (en) * 2020-04-20 2020-09-25 이화여자대학교 산학협력단 Testing method for decentralized application based on blockchain and testing apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130205287A1 (en) * 2012-02-03 2013-08-08 International Business Machines Corporation Reducing Application Startup Time by Optimizing Spatial Locality of Instructions in Executables
CN104794059A (en) * 2015-05-08 2015-07-22 北京理工大学 Defect positioning method and device based on function calling records
CN105550104A (en) * 2015-12-08 2016-05-04 北京奇虎科技有限公司 Application program performance test method and device
CN105893042A (en) * 2016-03-31 2016-08-24 北京航空航天大学 Intelligent contract implementation method based on block chain
CN106155897A (en) * 2015-04-16 2016-11-23 腾讯科技(深圳)有限公司 A kind of method for processing business and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130205287A1 (en) * 2012-02-03 2013-08-08 International Business Machines Corporation Reducing Application Startup Time by Optimizing Spatial Locality of Instructions in Executables
CN106155897A (en) * 2015-04-16 2016-11-23 腾讯科技(深圳)有限公司 A kind of method for processing business and device
CN104794059A (en) * 2015-05-08 2015-07-22 北京理工大学 Defect positioning method and device based on function calling records
CN105550104A (en) * 2015-12-08 2016-05-04 北京奇虎科技有限公司 Application program performance test method and device
CN105893042A (en) * 2016-03-31 2016-08-24 北京航空航天大学 Intelligent contract implementation method based on block chain

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110633199A (en) * 2018-06-22 2019-12-31 富士通株式会社 Testing apparatus, method, and medium for block chain supporting intelligent contract
CN110633200A (en) * 2018-06-25 2019-12-31 富士通株式会社 Method and device for testing intelligent contracts
CN110889574A (en) * 2018-09-11 2020-03-17 富士通株式会社 Uncertainty factor detection device, method and medium for intelligent contract
WO2020062673A1 (en) * 2018-09-26 2020-04-02 深圳壹账通智能科技有限公司 Smart contract test method, storage medium, test terminal and test device
CN109460657A (en) * 2018-10-15 2019-03-12 杭州安恒信息技术股份有限公司 A kind of safety detection method overflowed based on intelligent contract code value
CN109446096A (en) * 2018-11-06 2019-03-08 北京知道创宇信息技术有限公司 A kind of intelligence contract adjustment method, device and its storage medium
WO2020103545A1 (en) * 2018-11-19 2020-05-28 苏宁云计算有限公司 Blockchain-based smart contract debugging and releasing method and system
US11210203B2 (en) 2018-11-30 2021-12-28 Advanced New Technologies Co., Ltd. Testing platform for blockchain networks
WO2019072288A3 (en) * 2018-11-30 2019-09-19 Alibaba Group Holding Limited Testing platform for blockchain networks
CN109583857A (en) * 2018-12-11 2019-04-05 腾讯科技(深圳)有限公司 It is open to invite task processing method, system, equipment and storage medium
CN109583857B (en) * 2018-12-11 2021-05-14 腾讯科技(深圳)有限公司 Method, system, device and storage medium for processing public offer task
CN111782338A (en) * 2018-12-12 2020-10-16 阿里巴巴集团控股有限公司 Data processing method and system based on intelligent contract of block chain
CN111782338B (en) * 2018-12-12 2024-05-03 创新先进技术有限公司 Data processing method and system based on blockchain intelligent contract
US11321710B2 (en) 2018-12-12 2022-05-03 Advanced New Technologies Co., Ltd. Blockchain smart contract-based data processing
TWI741373B (en) * 2018-12-12 2021-10-01 開曼群島商創新先進技術有限公司 Data processing method and system based on blockchain smart contract
CN110046091A (en) * 2019-03-12 2019-07-23 阿里巴巴集团控股有限公司 A kind of automatic test approach and device
CN109951546A (en) * 2019-03-15 2019-06-28 百度在线网络技术(北京)有限公司 Transactions requests processing method, device, equipment and medium based on intelligent contract
CN110175454A (en) * 2019-04-19 2019-08-27 肖银皓 A kind of intelligent contract safety loophole mining method and system based on artificial intelligence
CN110069295A (en) * 2019-05-06 2019-07-30 百度在线网络技术(北京)有限公司 Block chain processing method, device, equipment and medium
CN110069295B (en) * 2019-05-06 2022-06-17 百度在线网络技术(北京)有限公司 Block chain processing method, device, equipment and medium
CN111290958A (en) * 2020-02-20 2020-06-16 联动优势(北京)数字科技有限公司 Method and device for debugging intelligent contract
CN111290958B (en) * 2020-02-20 2023-05-30 联动优势科技有限公司 Method and device for debugging intelligent contract
CN111813635A (en) * 2020-08-28 2020-10-23 支付宝(杭州)信息技术有限公司 Monitoring method, system and device for intelligent contracts of block chains
CN112131115A (en) * 2020-09-23 2020-12-25 腾讯科技(深圳)有限公司 Intelligent contract fuzzy test method, device and storage medium
CN112215618B (en) * 2020-12-11 2021-02-26 支付宝(杭州)信息技术有限公司 Verification method and device of intelligent contract
CN112215618A (en) * 2020-12-11 2021-01-12 支付宝(杭州)信息技术有限公司 Verification method and device of intelligent contract
CN112837155A (en) * 2021-02-10 2021-05-25 中国人民银行数字货币研究所 Method and device for registering and executing intelligent contracts in block chain
CN112837155B (en) * 2021-02-10 2024-05-31 中国人民银行数字货币研究所 Method and device for registering and executing intelligent contracts in blockchain
CN113051507A (en) * 2021-03-29 2021-06-29 北京智慧星光信息技术有限公司 Method and system for constructing bidirectional binding web page front end display based on json data
CN113051507B (en) * 2021-03-29 2023-11-21 北京智慧星光信息技术有限公司 Method and system for constructing bidirectional binding web page front-end display based on json data

Also Published As

Publication number Publication date
JP2018185808A (en) 2018-11-22

Similar Documents

Publication Publication Date Title
CN108073513A (en) The apparatus and method tested the intelligent contract based on block chain
De Alfaro et al. Reputation systems for open collaboration
CN111309594B (en) System testing method, device, equipment and storage medium
US8359580B2 (en) System and method for tracking testing of software modification projects
CN105868039A (en) Method, system and device for managing software problem reports
US20020049573A1 (en) Automated system and method for designing model based architectures of information systems
CN101369320B (en) Information processing device, method, recording medium and computer program
CN109582550B (en) Method, device and server for acquiring full-service scene fault set
CN110309022A (en) Method, simulator, equipment and the storage medium of mock trading test
CN110377522A (en) The test method for scene of trading, calculates equipment and medium at device
CN110659206A (en) Simulation architecture establishing method, device, medium and electronic equipment based on microservice
CN112035350B (en) Test method and device for block chain system and computer equipment
CN110764999A (en) Automatic testing method and device, computer device and storage medium
CN111737609A (en) WEB system menu bar display method, terminal and storage medium
CN111580855A (en) Strategy issuing method and system based on full-flow gray level issuing and electronic equipment
CN110865941A (en) Interface test case generation method, device and system
US20090169008A1 (en) System and method for tracking testing of software modification projects from a wireless mobile device
US11837003B2 (en) Dynamic generation of client-specific feature maps
Zhou et al. Antfuzzer: A grey-box fuzzing framework for eosio smart contracts
CN109753742A (en) A kind of Fault Diagnosis of Aeroengines method, system based on unbalanced sample
CN110209883A (en) A kind of method and device of user&#39;s history data validity judgement
CN117707960A (en) Method, device, equipment and storage medium for testing accounting function
CN116185637A (en) Resource scheduling processing method, device, computer equipment and storage medium
CN113626445A (en) Report processing method and device
CN108235324A (en) The test method and server of a kind of message template

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20180525