Smart contract implementation method and device, blockchain system and storage medium
By setting weight parameters for different nodes and parameters in the blockchain system for weighting processing, the problem that the processing results of smart contracts are inconsistent with the actual information is solved, the accuracy and efficiency of smart contracts are improved, and the importance of multiple nodes and parameters is applicable to multiple nodes and parameters. Difference scenarios.
Patent Information
- Application Number
- CN201910767341.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-20
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2039-08-20
AI Technical Summary
In the existing blockchain system, smart contracts do not consider the differences in the importance of nodes when processing information from each node, resulting in the processing results that are inconsistent with the actual information.
During the formulation and execution of smart contracts, different weight parameters are set for different nodes and parameters, and the weighted processing results are made more in line with actual needs. The specific method includes determining the weight coefficient based on the node importance and parameter variation coefficient, and obtaining the weight coefficient by inputting information multiple times for weighting.
It improves the processing accuracy and efficiency of smart contracts, is suitable for scenarios of differences in importance between different nodes and parameters, and enhances the accuracy and efficiency of blockchain systems.
Smart Images

Figure CN112417030B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of blockchain, and in particular to a smart contract implementation method and device, a blockchain system and a storage medium. Background Art
[0002] As blockchain is increasingly used in various fields, the implementation of smart contracts has also received more attention. As a protocol that can execute specific functions on its own, smart contracts need to be implemented in blockchain systems in several steps: formulating contracts, storing and executing contracts, and verifying contracts.
[0003] 1. Formulate a contract, that is, use a programming language to convert the agreement content formulated by the parties to the smart contract into code that can run on a specific blockchain system.
[0004] 2. Execute the contract, that is, deploy and run the smart contract on a specific blockchain system and enforce the terms of the contract through a programming language.
[0005] 3. Verify the contract, that is, verify the results of the contract execution based on the blockchain system.
[0006] Among them, contract execution and contract verification are based on contract formulation, and the formulation of smart contracts is the key to the implementation of smart contracts. From a business perspective, smart contracts only need to implement two conditions, namely, defining data structure and reading and writing methods, performing data processing, and providing service interfaces.
[0007] Therefore, the core of a smart contract implementation method based on the blockchain system lies in defining data structure and reading and writing methods, as well as data processing and providing service interfaces, and the latter is the most critical. Summary of the invention
[0008] Through research, the inventors found that in the blockchain system of the related technology, when the smart contract processes the information (or data, the same below) of each node, it does not take into account the differences in the importance of each node, resulting in the information processing results of the smart contract may be inconsistent with the actual information represented when considering the differences in the importance of each node.
[0009] In view of at least one of the above technical problems, the present disclosure provides a smart contract implementation method and device, a blockchain system and a storage medium, which set different weight parameters for different nodes so that the processing results of the smart contract can better meet actual needs.
[0010] According to one aspect of the present disclosure, a smart contract implementation method is provided, comprising:
[0011] During the formulation and execution of smart contracts, different node weight coefficients are set for the information uploaded by different nodes;
[0012] The information uploaded by different nodes is weighted according to the corresponding node weight coefficient to obtain the information processing results of the information uploaded by different nodes;
[0013] Compare the information processing results with the predetermined standard values to obtain conclusion information.
[0014] In some embodiments of the present disclosure, setting different node weight coefficients for information uploaded by different nodes includes:
[0015] According to the importance of different nodes, different node weight coefficients are set.
[0016] In some embodiments of the present disclosure, the smart contract implementation method further includes:
[0017] When the number of information uploaded by a node is less than a predetermined value, the node weight coefficient set for the information uploaded by the node is used as the corresponding node weight coefficient;
[0018] When the number of information uploaded by a node is not less than a predetermined value, the corresponding node weight coefficient is obtained through the information input multiple times.
[0019] In some embodiments of the present disclosure, obtaining corresponding node weight coefficients through multiple input information includes:
[0020] For each parameter of the information uploaded by the node, determine the standard deviation and the average value of the parameter based on the information input multiple times;
[0021] Determine the coefficient of variation of the parameter based on the standard deviation of the parameter and the mean value of the parameter;
[0022] The node weight coefficient of the parameter is determined according to the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
[0023] In some embodiments of the present disclosure, the smart contract implementation method further includes:
[0024] Set different parameter weight coefficients for different parameters of the same node;
[0025] For the information uploaded by the same node, weighted processing is performed according to the corresponding parameter weight coefficient to obtain the information processing result of the information uploaded by the same node.
[0026] In some embodiments of the present disclosure, the smart contract implementation method further includes:
[0027] When the number of information uploaded by a node is less than a predetermined value, the parameter weight coefficient set for the information uploaded by the node is used as the corresponding parameter weight coefficient;
[0028] When the number of information uploaded by a node is not less than a predetermined value, the corresponding parameter weight coefficient is obtained through the information input multiple times.
[0029] In some embodiments of the present disclosure, obtaining corresponding parameter weight coefficients through multiple input information includes:
[0030] For each parameter of the information uploaded by the node, determine the standard deviation and the average value of the parameter based on the information input multiple times;
[0031] Determine the coefficient of variation of the parameter based on the standard deviation of the parameter and the mean value of the parameter;
[0032] The parameter weight coefficient of the parameter is determined according to the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
[0033] According to another aspect of the present disclosure, a smart contract implementation method is provided, comprising:
[0034] In the process of smart contract formulation and execution, different parameter weight coefficients are set for different parameters of the same node;
[0035] For the information uploaded by the same node, weighted processing is performed according to the corresponding parameter weight coefficient to obtain the information processing result of the information uploaded by the same node.
[0036] Compare the information processing results with the predetermined standard values to obtain conclusion information.
[0037] According to another aspect of the present disclosure, there is provided a smart contract implementation device, comprising:
[0038] The weight coefficient setting module is used to set different parameter weight coefficients for different parameters of the same node during the formulation and execution of smart contracts;
[0039] The weighted processing module is used to perform weighted processing on the information uploaded by the same node according to the corresponding parameter weight coefficients to obtain the information processing result of the information uploaded by the same node.
[0040] The conclusion acquisition module is used to compare the information processing result with the predetermined standard value to obtain conclusion information.
[0041] In some embodiments of the present disclosure, the smart contract implementation device is used to execute operations to implement the smart contract implementation method as described in any of the above embodiments.
[0042] According to another aspect of the present disclosure, there is provided a smart contract implementation device, comprising:
[0043] A memory for storing instructions;
[0044] The processor is used to execute the instructions so that the smart contract implementation device performs operations to implement the smart contract implementation method as described in any of the above embodiments.
[0045] According to another aspect of the present disclosure, a blockchain system is provided, comprising a smart contract implementation device as described in any of the above embodiments.
[0046] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, the smart contract implementation method as described in any of the above embodiments is implemented.
[0047] The present disclosure sets different weight parameters for different nodes, so that the processing results of smart contracts can better meet actual needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1 Schematic diagram of some embodiments of the smart contract implementation method disclosed in the present invention.
[0050] Figure 2 Schematic diagrams of other embodiments of the smart contract implementation method disclosed in the present invention.
[0051] Figure 3 A schematic diagram of obtaining corresponding node weight coefficients through multiple input information in some embodiments of the present disclosure.
[0052] Figure 4 Schematic diagrams of some further embodiments of the smart contract implementation method disclosed herein.
[0053] Figure 5 Schematic diagram of some embodiments of the smart contract implementation method disclosed in the present invention.
[0054] Figure 6 Schematic diagrams of other embodiments of the smart contract implementation method disclosed in the present invention. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present disclosure and its application or use. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0056] Unless specifically stated otherwise, the relative arrangement of components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure.
[0057] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0058] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.
[0059] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0060] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0061] Through research, the inventors found that in the blockchain system of the related technology, when the smart contract processes the information (or data, the same below) of each node, it does not take into account the differences in the importance of each node, resulting in the information processing results of the smart contract may be inconsistent with the actual information represented when considering the differences in the importance of each node.
[0062] For example, for a blockchain system, the smart contract does not take into account the differences in the importance of each node, and its implementation method may be:
[0063] Multiple nodes j, whose uploaded information a j (x1,x2,……,x n ), the corresponding comparison standard is A(X1,X2,……,X n );
[0064] A possible smart contract implementation is: if a jIf all parameters satisfy the corresponding standard parameters in standard A, then node j obtains the information a. j evaluation results.
[0065] But the actual situation is that in the alliance chain, the permissions or importance of different nodes are different, and the information a uploaded by node j needs to be j Introducing weight coefficient k j (k1,k2,……,k n ) is weighted and then compared with standard A to obtain the conclusion. Therefore, the smart contract implementation method of the relevant technology cannot be applied to situations where the importance of different nodes in the alliance chain is different.
[0066] In addition, in the blockchain system of the related technology, for a single node, different parameters in the information uploaded by it may have different importance. When it is necessary to consider the difference in importance between different parameters, weighted processing can also be introduced in the smart contract to make the result of information processing more consistent with the content represented by the important parameters.
[0067] Related technologies Smart contracts based on this information processing method have a serious impact on the formulation and execution of smart contracts, and further affect the accuracy and efficiency of the blockchain system.
[0068] In view of at least one of the above technical problems, the present disclosure provides a smart contract implementation method and device, a blockchain system and a storage medium. The present disclosure is described below through specific embodiments.
[0069] Figure 1 Schematic diagram of some embodiments of the smart contract implementation method disclosed in the present invention. Preferably, this embodiment can be executed by the smart contract implementation device disclosed in the present invention. The method includes the following steps:
[0070] Step 11: During the formulation and execution of the smart contract, different node weight coefficients are set for the information uploaded by different nodes.
[0071] In some embodiments of the present disclosure, in step 11, the step of setting different node weight coefficients for information uploaded by different nodes may include: setting different node weight coefficients according to the different importance of different nodes.
[0072] Step 12, performing weighted processing on the information uploaded by different nodes according to the corresponding node weight coefficients to obtain information processing results of the information uploaded by different nodes.
[0073] In some embodiments of the present disclosure, step 12 may include:
[0074] Step 121: When the number of pieces of information uploaded by a node is less than a predetermined value, the node weight coefficient set for the information uploaded by the node is used as the corresponding node weight coefficient.
[0075] Step 122, when the number of information uploaded by a node is not less than a predetermined value, the corresponding node weight coefficient is obtained through the information input multiple times.
[0076] In some embodiments of the present disclosure, in step 122, the step of obtaining the corresponding node weight coefficient through multiple input information may include: for each parameter of the node uploaded information, determining the standard deviation of the parameter and the average value of the parameter based on the multiple input information; determining the coefficient of variation of the parameter based on the standard deviation of the parameter and the average value of the parameter; determining the node weight coefficient of the parameter based on the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
[0077] Step 13, compare the information processing result with the predetermined standard value to obtain conclusion information.
[0078] Based on the smart contract implementation method provided by the above-mentioned embodiments of the present disclosure, in view of the fact that the technical solutions adopted by smart contracts in related technologies for data processing cannot take into account the different importance of different nodes, when the processed information contains nodes with different importance, weighted processing is introduced. This can not only handle the situation where there are differences in the importance of multiple nodes and make the processing results more in line with the actual situation, but also improve the implementation efficiency of smart contracts in the blockchain.
[0079] Figure 2 Schematic diagram of other embodiments of the smart contract implementation method disclosed in the present invention. Preferably, this embodiment can be executed by the smart contract implementation device disclosed in the present invention. The method includes the following steps:
[0080] Step 21: Create a contract
[0081] In some embodiments of the present disclosure, step 21 may include steps a, b and c, wherein:
[0082] a. Define data structure and reading and writing methods. Only information that meets the data structure requirements can be entered into the blockchain system according to specific reading and writing methods.
[0083] b. Information processing.
[0084] First, for the information uploaded by different nodes:
[0085] First, for the information a uploaded by different nodes j j (x1,x2,……,x n ), assign the corresponding node weight coefficient K j (k1,k2,……,kn ), and provide the standard value A(X1, X2, ..., X n ), where j is the node number, j = 1, 2, …, m.
[0086] Secondly, after the information is uploaded, the a of node j j Information is calculated according to the node weight coefficient K0 (k1, k2, ..., k n ) is weighted to obtain a weighted result of the information.
[0087] Figure 3 Schematic diagram of obtaining corresponding node weight coefficients through multiple input information in some embodiments of the present disclosure. Figure 3 As shown in the figure, if there is a lot of information to be uploaded, the coefficient of variation method can be used to obtain the node weight coefficient to be adopted through multiple input information, and then the formula (1) is used to process each input information according to the node weight coefficient to obtain the weighted result of each information.
[0088]
[0089] Among them, k i is the node weight coefficient of each parameter, x i For each contestant.
[0090] The principle of obtaining the node weight coefficient using the coefficient of variation method is as follows:
[0091] The coefficient of variation formula is shown in formula (2):
[0092]
[0093] Where V i represents the coefficient of variation of the i-th parameter, σ i represents the standard deviation of the i-th parameter, Represents the average value of the i-th parameter.
[0094] The node weight coefficient of each parameter is shown in formula (3):
[0095]
[0096] Again, the information processing results (weighted results) Compared with the preset standard value A(X1,X2,……,X n ) comparison to obtain certain conclusion information.
[0097] like Figure 3 As shown, the coefficient of variation method of the above embodiment of the present disclosure may also include: comparing and preset standard values, obtain conclusion information and node weight coefficients, and adjust the processing process according to the conclusion information and the node weight coefficients.
[0098] Second, for the same node:
[0099] For the same node, when considering the difference in importance of each parameter, the above-mentioned weighted processing method for the information uploaded by the node can be specifically referred to. That is, each parameter is assigned a parameter weight coefficient, or each parameter is obtained through data processing, and then the information is weighted, and then the weighted processing result is added to the smart contract to participate in the formulation and execution of the smart contract.
[0100] c. Encoding. Encode the above contract content into a specific contract host platform, that is, a digital computer code that can be recognized, deployed and correctly run by a specific blockchain system.
[0101] Step 22, deploy the contract
[0102] The smart contract is deployed on a specific contract host platform, and the participating parties install the contract on the contract host platform and wait for the operation of the smart contract.
[0103] Step 23: Execute the contract
[0104] After the smart contract runs on a specific blockchain system, each participant inputs information into the blockchain system according to the information format requirements and information input method requirements. The smart contract will be enforced by the programming language to enforce the contract terms. The blockchain system also outputs conclusion information through a specific service interface and broadcasts it to other nodes.
[0105] Step 24: Verify the contract
[0106] After each node obtains the conclusion information, it can verify the conclusion information through the blockchain system when necessary.
[0107] Based on the smart contract implementation method provided by the above embodiment of the present disclosure, the purpose is to provide an implementation method that can realize the accurate and efficient processing of information containing nodes of different importance by smart contracts on the blockchain system. In the smart contracts deployed and run on the blockchain system, different weight parameters are set for different nodes and even different parameters, so that the processing results of the smart contracts can better meet the actual needs, and then the smart contracts can be effectively run and the contract results can be verified, so as to maximize the advantages of blockchain and smart contracts.
[0108] The above-mentioned embodiments of the present disclosure relate to a method for implementing a smart contract based on a blockchain system. For different parameters and different nodes, the determination of the weight coefficient is the key. If there is only one piece of information or insufficient information, the weight coefficient can be set based on experience; when the weight coefficient cannot be obtained based on experience and there are multiple pieces of information, the coefficient of variation method can be used to obtain the weight coefficient and process each piece of information. Similarly, the weight coefficient of the node can also be processed according to the above ideas.
[0109] Figure 4 Schematic diagram of some other embodiments of the smart contract implementation method disclosed in the present invention. Preferably, this embodiment can be executed by the smart contract implementation device disclosed in the present invention. The method includes the following steps:
[0110] Step 41, during the formulation and execution of the smart contract, different parameter weight coefficients are set for different parameters of the same node.
[0111] Step 42, weighted processing is performed on the information uploaded by the same node according to the corresponding parameter weight coefficient to obtain the information processing result of the information uploaded by the same node.
[0112] In some embodiments of the present disclosure, step 42 may further include:
[0113] Step 421: When the number of pieces of information uploaded by a node is less than a predetermined value, the parameter weight coefficient set for the information uploaded by the node is used as the corresponding parameter weight coefficient.
[0114] Step 422, when the number of information uploaded by a node is not less than a predetermined value, the corresponding parameter weight coefficient is obtained through the information input multiple times.
[0115] In some embodiments of the present disclosure, in step 422, the step of obtaining the corresponding parameter weight coefficient through the information input multiple times may include: for each parameter of the information uploaded by the node, determining the standard deviation of the parameter and the average value of the parameter based on the information input multiple times; determining the coefficient of variation of the parameter based on the standard deviation of the parameter and the average value of the parameter; determining the parameter weight coefficient of the parameter based on the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
[0116] Step 43, comparing the information processing result with a predetermined standard value to obtain conclusion information.
[0117] Based on the smart contract implementation method provided by the above-mentioned embodiments of the present disclosure, in view of the fact that the technical solution adopted by the related technical smart contract for data processing cannot be applied to the scenario where there are differences in the importance of various parameters in the nodes, when the processed information contains parameters with different importance, weighted processing is introduced, which can not only handle the situation where there are differences in the importance of multiple parameters and make the processing results more in line with the actual situation, but also improve the implementation efficiency of smart contracts in the blockchain.
[0118] The smart contract implementation method provided in the above embodiments of the present disclosure can be used in blockchain application fields such as breeding, smart transportation, and smart medical care.
[0119] The following is an explanation of the smart contract implementation method disclosed in the present invention through a specific embodiment.
[0120] (I) Breeding field
[0121] Researchers have cultivated a batch of crop seeds and are interested in the information of the harvested batch of seeds. i (x1, x2, ..., x8) are processed to select seeds that meet the conditions. Among them:
[0122] x1 represents output (1-10 points, the higher the output, the higher the score);
[0123] x2 indicates appearance rating (level 1: 3 points, level 2: 2 points, level 3: 1 point);
[0124] x3 represents the germination rate (calculated as a percentage, e.g. 90% is scored as 9 points);
[0125] x4 indicates the purity of the variety (1-10 points, the higher the purity, the higher the score);
[0126] x5 represents clarity (1-10 points, the higher the clarity, the higher the score);
[0127] x6 indicates germination rate (1-10 points, the higher the germination rate, the higher the score);
[0128] x7 indicates moisture (1-10 points, the higher the moisture, the lower the score);
[0129] x8 indicates drought resistance (1-10 points, the stronger the drought resistance, the higher the score).
[0130] For this batch of seeds, a blockchain system, also a consortium chain system, may include multiple breeding institutions such as A, B, C, D, etc. Although the seed standards are determined, there are objective differences in the scientific research level and even the testing level of each breeding institution. In order to obtain a more objective evaluation of the seeds bred by breeding institutions with relatively high scientific research levels, the consortium chain system assigns different weight coefficients to different breeding institutions (or nodes in the consortium chain) when evaluating the seeds.
[0131] For example, a higher weight coefficient is assigned to breeding institution A, which has a high scientific research level, strong monitoring ability and high reliability, and a lower weight coefficient is assigned to breeding institution B, which has an average scientific research level, average monitoring ability and average reliability. In this way, although the seed data uploaded by breeding institutions A and B are the same, after assigning the weight coefficients, the seeds uploaded by breeding institution A have better seed quality than the seeds uploaded by breeding institution B after being evaluated by the smart contract.
[0132] The working process of the above blockchain system can be described as:
[0133] First, for a breeding institution A, the weight coefficients K0(k1, k2, ..., k8) of each parameter of its target crop information a1(x1, x2, ..., x8) and the standard values A(X1, X2, ..., X8) to be compared with the results are predetermined. n ).
[0134] Secondly, one or more pieces of information about the target crop are input into the blockchain system and processed by the smart contract. If only one piece of information is processed, the weight coefficient K0 (k1, k2, ..., k8) can be directly assigned; if multiple pieces of information are input, a new weight coefficient is formed according to the coefficient of variation method.
[0135] Third, the smart contract processes the above information, obtains the corresponding processing results, compares them with the standard values, and draws and issues conclusion information.
[0136] Fourth, obtain seed quality evaluation from various breeding institutions.
[0137] According to the method of the above-mentioned embodiment of the present disclosure, crop varieties with objectively more accurate conclusions can be screened out.
[0138] 2. Smart Transportation
[0139] Traffic control departments can use this technical solution to effectively guide traffic based on the information collected at each intersection.
[0140] If the traffic diversion problem is solved by using a consortium chain system and smart contracts, the collection points at each intersection can be regarded as a node. After the information collected by different collection points (nodes) is uploaded to the blockchain system, a certain weight coefficient is assigned according to the actual situation of different collection points, so that the overall traffic efficiency under the intelligence of the entire consortium chain system is higher.
[0141] For example, a lower weight coefficient is assigned to collection points with low population density and relatively concentrated congestion periods, making the traffic diversion at the intersection less efficient than when no weight is assigned, so as to ease the traffic at other collection points that are related to traffic diversion, thereby reducing the traffic diversion efficiency of a certain collection point, but improving the overall traffic diversion efficiency.
[0142] The implementation process of the above blockchain system can be as follows:
[0143] First, collect data. Each signal collection point collects the road information X (x1, x2, ..., x5) of the target road section, where: x1 represents the number of road lanes (for example, the number of roads in a certain direction, one positive direction is scored 1 point, and one negative direction is scored -1 point); x2 represents the number of vehicles (for example, if the number of vehicles on the positive road is more than the number of vehicles on the reverse road, 1 point is scored, if it is less, -1 point is scored, and if it is equal, 0 point is scored); x3 represents the length of time vehicles wait for red lights (for example, if the time vehicles on the positive road wait for red lights is longer than the time vehicles on the reverse road wait for red lights, 1 point is scored, if it is the reverse direction, -1 point is scored, and if it is equal, 0 point is scored); x4 represents the vehicle speed; x5 represents the length of the waiting convoy;
[0144] Second, formulate smart contracts. The traffic control department presets the weight coefficients K0 (k1, k2, ..., k5) of each parameter of the road information X (x1, x2, ..., x5) and the standard values for comparison with the results, and assigns certain weight coefficients to different collection points according to their importance.
[0145] Third, execute the smart contract. The specific collection point inputs the target road information into the blockchain system. If only one piece of information is processed, the weight coefficient K0 (k1, k2, ..., k5) can be specified; if there is historical data, the weight coefficient can be obtained through the coefficient of variation based on the historical data. When processing the information, the smart contract first weights it, then compares it with the standard value, draws the conclusion information on the traffic diversion that needs to be taken, and sends the information to other nodes.
[0146] According to the method of the above-mentioned embodiment of the present disclosure, the blockchain system for realizing traffic diversion can take corresponding diversion measures according to the uploaded information of different nodes, effectively alleviate the overall traffic congestion and improve the traffic efficiency.
[0147] 3. Smart Healthcare
[0148] Before evaluating whether a medical plan can be implemented for a specific patient, the hospital often needs to evaluate the patient's overall health status. This technical solution can be applied in this regard.
[0149] Within the medical system, different medical institutions, even different departments, and different doctors in the same department can be used as different blockchain nodes. When a patient sees a doctor, the patient's health information is weighted according to the medical level of different departments, the performance of medical equipment, etc., to obtain a more objective medical and health evaluation.
[0150] The possible implementation process of the above smart medical blockchain system is:
[0151] First, upload the health information of a patient diagnosed and uploaded at different nodes. Among them, the health information of a patient uploaded by a certain node is X(x1,x2,……,x 11 ), where: x1 represents age (1-10 points, the more suitable the age, the higher the score); x2 represents mental state (1-10 points, the better the mental state, the higher the score); x3 represents blood pressure (1-10 points, the closer the blood pressure is to normal blood pressure, the higher the score); x4 represents heart rate (1-10 points, the closer the heart rate is to normal heart rate, the higher the score); x5 represents physical fitness assessment (1-10 points, the better the physical fitness, the higher the score); x6 represents blood routine (1-10 points, the closer to normal value, the higher the score); x7 represents four coagulation items (1-10 points, the closer to normal value, the higher the score); x8 represents a full set of biochemistry (1-10 points, the closer to normal value, the higher the score); x9 represents associated diseases (1-10 points, the more associated diseases, the lower the score); x 10 Indicates breathing (1-10 points, the better the breathing ability, the higher the score); x 11 Indicates specific markers (1-10 points, the better the condition, the higher the score).
[0152] Second, formulate smart contracts. Experienced medical experts formulate the health standards A(X1, X2, ..., X 11 ), then, according to the performance of the medical equipment and the medical ability of the medical staff, the weight coefficient K0 (k1, k2, ..., k 11 ) and determine a standard value to compare the results with.
[0153] Third, run the smart contract. 11 ) for weighted processing K0(k1,k2,……,k 11 ), and then compare it with the standard value to obtain the patient's health diagnosis information, and upload the health diagnosis information to other nodes of the blockchain system.
[0154] According to the method of the above embodiment of the present disclosure, a more objective assessment of the patient's health status can be made, the accuracy and efficiency of the prediction can be improved, and the patient can query the corresponding health diagnosis information in different medical institutions to obtain the most appropriate medical plan.
[0155] Figure 5 Schematic diagram of some embodiments of the smart contract implementation method disclosed in the present invention. Figure 5 As shown, the smart contract implementation device of the present disclosure may include a weight coefficient setting module 51, a weighted processing module 52 and a conclusion acquisition module 53, wherein:
[0156] The weight coefficient setting module 51 is used to set different parameter weight coefficients for different parameters of the same node during the formulation and execution of the smart contract.
[0157] In some embodiments of the present disclosure, the weight coefficient setting module 51 may be used to set different node weight coefficients according to the importance of different nodes.
[0158] In some embodiments of the present disclosure, the weight coefficient setting module 51 can also be used to set different parameter weight coefficients for different parameters of the same node during the formulation and execution of the smart contract.
[0159] The weighted processing module 52 is used to perform weighted processing on the information uploaded by the same node according to the corresponding parameter weight coefficients to obtain the information processing result of the information uploaded by the same node.
[0160] In some embodiments of the present disclosure, the weighted processing module 52 can be used to, when the number of information uploaded by a node is less than a predetermined value, use the node weight coefficient set for the information uploaded by the node as the corresponding node weight coefficient; when the number of information uploaded by a node is not less than a predetermined value, obtain the corresponding node weight coefficient through multiple input information.
[0161] In some embodiments of the present disclosure, the weighted processing module 52 can be used to determine, for each parameter of the information uploaded by the node, the standard deviation of the parameter and the average value of the parameter based on multiple input information; determine the coefficient of variation of the parameter based on the standard deviation of the parameter and the average value of the parameter; and determine the node weight coefficient of the parameter based on the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
[0162] In some embodiments of the present disclosure, the weighted processing module 52 may also be used to perform weighted processing on information uploaded by the same node according to corresponding parameter weight coefficients to obtain information processing results of the information uploaded by the same node.
[0163] In some embodiments of the present disclosure, the weighted processing module 52 can also be used to, when the number of information uploaded by a node is less than a predetermined value, use the parameter weight coefficient set for the information uploaded by the node as the corresponding parameter weight coefficient; when the number of information uploaded by a node is not less than a predetermined value, obtain the corresponding parameter weight coefficient through multiple input information.
[0164] In some embodiments of the present disclosure, the weighted processing module 52 can be used to determine, for each parameter of the information uploaded by the node, the standard deviation of the parameter and the average value of the parameter based on information input multiple times; determine the coefficient of variation of the parameter based on the standard deviation of the parameter and the average value of the parameter; and determine the parameter weight coefficient of the parameter based on the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
[0165] The conclusion acquisition module 53 is used to compare the information processing result with a predetermined standard value to obtain conclusion information.
[0166] In some embodiments of the present disclosure, the smart contract implementation device is used to implement any of the above embodiments (for example Figure 1-Figure 4 The operation of the smart contract implementation method described in any embodiment).
[0167] In view of the fact that the technical solutions adopted by related technical smart contracts for data processing cannot take into account the reality that different nodes have different importances and cannot be applied to scenarios where there are differences in the importance of various parameters in the nodes, the smart contract implementation method provided in the above embodiments of the present disclosure introduces weighted processing when the processed information contains parameters or nodes with different importances. This can not only handle the situation where there are differences in the importance of multiple nodes, making the processing results more in line with the actual situation, but also improve the implementation efficiency of smart contracts in the blockchain.
[0168] Figure 6 Schematic diagram of some other embodiments of the smart contract implementation method disclosed in the present invention. Figure 6 As shown, the smart contract implementation device of the present disclosure may include a memory 61 and a processor 62, wherein:
[0169] A memory 61, used for storing instructions;
[0170] The processor 62 is used to execute the instruction so that the smart contract implementation device executes any of the above embodiments (for example Figure 1-Figure 4 The operation of the smart contract implementation method described in any embodiment).
[0171] The purpose of the present invention is to provide a device for realizing accurate and efficient processing of information containing nodes of different importance by smart contracts on a blockchain system. In smart contracts deployed and run on a blockchain system, different weight parameters are set for different nodes and even different parameters, so that the processing results of smart contracts can better meet actual needs, and then the smart contracts can be effectively run and the contract results can be verified, so as to maximize the advantages of blockchain and smart contracts.
[0172] According to another aspect of the present disclosure, a blockchain system is provided, including any of the above embodiments (e.g. Figure 5 or Figure 6 Embodiment) The smart contract implementation device described in the embodiment).
[0173] Based on the blockchain system provided by the above-mentioned embodiments of the present disclosure, in the smart contracts deployed and run on the blockchain system, different weight parameters are set for different nodes and even different parameters, so that the processing results of the smart contracts can better meet the actual needs, and then the smart contracts can be effectively run and the contract results can be verified, thereby maximizing the advantages of blockchain and smart contracts.
[0174] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, any of the above embodiments (for example Figure 1-Figure 4 The smart contract implementation method described in any embodiment).
[0175] Based on the computer-readable storage medium provided by the above embodiments of the present disclosure, in the smart contracts deployed and run on the blockchain system, different weight parameters are set for different nodes and even different parameters, so that the processing results of the smart contracts can better meet the actual needs, and then the smart contracts can be effectively run and the contract results can be verified, thereby maximizing the advantages of blockchain and smart contracts.
[0176] The smart contract implementation device described above can be implemented as a general-purpose processor, a programmable logic controller (PLC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components or any appropriate combination thereof for performing the functions described in this application.
[0177] So far, the present disclosure has been described in detail. In order to avoid obscuring the concept of the present disclosure, some details known in the art are not described. Based on the above description, those skilled in the art can fully understand how to implement the technical solution disclosed here.
[0178] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by instructing the relevant hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0179] The description of the present disclosure is given for the purpose of illustration and description, and is not intended to be exhaustive or to limit the present disclosure to the disclosed form. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments are selected and described in order to better illustrate the principles and practical applications of the present disclosure, and to enable those of ordinary skill in the art to understand the present disclosure and thereby design various embodiments with various modifications suitable for specific uses.
Claims
1. A smart contract implementation method, characterized in that: include: During the formulation and execution of smart contracts, different node weight coefficients are set for the information uploaded by different nodes; The information uploaded by different nodes is weighted according to the corresponding node weight coefficient to obtain the information processing results of the information uploaded by different nodes; Compare the information processing results with the predetermined standard value to obtain conclusion information; The smart contract implementation method further includes: When the number of information uploaded by a node is less than a predetermined value, the node weight coefficient set for the information uploaded by the node is used as the corresponding node weight coefficient; When the number of information uploaded by a node is not less than a predetermined value, the corresponding node weight coefficient is obtained through the information input multiple times; Wherein, the obtaining of corresponding node weight coefficients through multiple input information includes: For each parameter of the information uploaded by the node, determine the standard deviation and the average value of the parameter based on the information input multiple times; The coefficient of variation of the parameter is determined based on the ratio of the standard deviation of the parameter to the mean value of the parameter; According to the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters, the node weight coefficient of the parameter is determined; The smart contract implementation method further includes: In the process of smart contract formulation and execution, different parameter weight coefficients are set for different parameters of the same node; For the information uploaded by the same node, weighted processing is performed according to the corresponding parameter weight coefficient to obtain the information processing result of the information uploaded by the same node; When the number of information uploaded by a node is less than a predetermined value, the parameter weight coefficient set for the information uploaded by the node is used as the corresponding parameter weight coefficient; When the number of information uploaded by a node is not less than a predetermined value, the corresponding parameter weight coefficient is obtained through the information input multiple times; Wherein, the obtaining of corresponding parameter weight coefficients through multiple input information includes: For each parameter of the information uploaded by the node, determine the standard deviation and the average value of the parameter based on the information input multiple times; The coefficient of variation of the parameter is determined based on the ratio of the standard deviation of the parameter to the mean value of the parameter; The parameter weight coefficient of the parameter is determined according to the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
2. The smart contract implementation method according to claim 1, characterized in that: The setting of different node weight coefficients for information uploaded by different nodes includes: According to the importance of different nodes, different node weight coefficients are set.
3. A smart contract implementation device, characterized in that: include: The weight coefficient setting module is used to set different node weight coefficients for the information uploaded by different nodes during the formulation and execution of smart contracts; A weighted processing module is used to perform weighted processing on the information uploaded by different nodes according to the corresponding node weight coefficients to obtain the information processing results of the information uploaded by different nodes; A conclusion acquisition module is used to compare the information processing result with a predetermined standard value to obtain conclusion information; The weighted processing module is further used to, when the number of information uploaded by a node is less than a predetermined value, use the node weight coefficient set for the information uploaded by the node as the corresponding node weight coefficient; when the number of information uploaded by a node is not less than a predetermined value, obtain the corresponding node weight coefficient through the information input multiple times; The weighted processing module is used to determine the standard deviation and the average value of each parameter of the information uploaded by the node according to the information input multiple times, when the corresponding node weight coefficient is obtained through the information input multiple times; determine the coefficient of variation of the parameter according to the ratio of the standard deviation of the parameter to the average value of the parameter; and determine the node weight coefficient of the parameter according to the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters; Among them, the weight coefficient setting module is also used to set different parameter weight coefficients for different parameters of the same node during the formulation and execution of smart contracts; The weighted processing module is also used to perform weighted processing on the information uploaded by the same node according to the corresponding parameter weight coefficient to obtain the information processing result of the information uploaded by the same node; when the number of information uploaded by a node is less than a predetermined value, the parameter weight coefficient set for the information uploaded by the node is used as the corresponding parameter weight coefficient; when the number of information uploaded by a node is not less than a predetermined value, the corresponding parameter weight coefficient is obtained through the information input multiple times; Among them, the weighted processing module is used to determine the standard deviation of the parameter and the average value of the parameter for each parameter of the information uploaded by the node according to the information input multiple times, when the corresponding parameter weight coefficient is obtained through multiple input information; determine the coefficient of variation of the parameter according to the ratio of the standard deviation of the parameter to the average value of the parameter; determine the parameter weight coefficient of the parameter according to the ratio of the coefficient of variation of the parameter to the coefficient of variation of all parameters.
4. A smart contract implementation device, characterized in that: include: A memory for storing instructions; A processor is used to execute the instructions so that the smart contract implementation device performs operations to implement the smart contract implementation method as described in claim 1 or 2.
5. A blockchain system, characterized in that: Comprising a smart contract implementation device as described in claim 3 or 4.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed by a processor, implement the smart contract implementation method as described in claim 1 or 2.
