Specific embodiment
The principle and features of the present invention will be described below with reference to the accompanying drawings, and the given examples are served only to explain the present invention, and
It is non-to be used to limit the scope of the invention.
The present invention proposes a kind of block catenary system.
As shown in FIG. 1, FIG. 1 is the system architecture schematic diagrams of 1 preferred embodiment of block catenary system of the present invention.
The block catenary system 1 of the present embodiment includes that a load-balancing device 100 and the load-balancing device 100 are logical
The multiple contract chain node devices 200 for believing connection are set with multiple data-link nodes of contract chain node device communication connection
Standby 300.The multiple configuration of contract chain node device 200 in figure on contract chain group (not marking), the data-link node
Equipment 300 configures on data-link group (not marking in figure), and the load-balancing device 100 communicates to connect multiple client
400。
Contract chain group includes a plurality of contract chain (Contract Chain), and the data-link group includes a plurality of number
According to chain (Data Chain).It in the present embodiment, include at least one described contract chain node device 200 on every contract chain,
It include at least one described data-link node device 300 on every data chain.
The load-balancing device 100, for receiving the intelligent contract call request of the transmission of client 400, based on default
Load balancing rule the response of a certain contract chain in contract chain group is distributed into the intelligent contract call request.
Client 400 can be any suitable electronic equipment such as mobile phone, tablet computer, personal computer.
The contract chain, the intelligent contract call request distributed for receiving the load-balancing device 100, based on default
The corresponding data-link of the type algorithm analysis intelligence contract call request, and call with intelligent contract with the data-link
Corresponding data interaction is requested to operate.
The corresponding contract chain number of every contract chain, the different corresponding conjunctions of contract chain in contract chain group
About chain number is different.Wherein, contract chain refers to disposing the block chain of intelligent contract code, is responsible for executing intelligent contract code.
At least one intelligent contract code is disposed on every contract chain, that is, every contract chain can handle different types of intelligence and close
About call request.The intelligent contract code disposed on different contract chains can be identical, be also possible to different but same
Intelligent contract code can be deployed on a plurality of contract chain, concurrently responded to reach different contract chains and executed a plurality of intelligent contract tune
With the purpose of request.
The data interaction operation includes reading and/or preservation of contract data etc..
The preset kind algorithm can be consistency hash algorithm etc..
The data-link is based on the first contract data hair in the intelligent contract call request for receiving the contract chain
The data read request sent reads first contract data and is sent to the contract chain, receives and saves the contract chain and return
The second contract data returned.
The corresponding data-link number of each data-link, the corresponding data-link number of different data-links are different.Wherein,
Data-link refers to the block chain stored for data, is responsible for storing intelligent contract data, provides data access for intelligence contract
Interface.Data-link can provide remote data access interface and read and save contract data for contract chain, wherein remote data access
The implementation of interface includes but is not limited to the side HTTP (HyperText Transfer Protocol, hypertext transfer protocol)
Formula, RPC (Remote Procedure Call, remote procedure call) mode etc..
The present invention also proposes a kind of data processing method.The data processing method method is applied to above-mentioned block catenary system
Contract chain node device 200 in 1, the configuration of contract chain node device 200 is on contract chain, and the block catenary system 1 is also
It is described including the load-balancing device 100 and data-link node device 300 communicated to connect with the contract chain node device 200
Data-link node device 300 configures on the data-link that the block linkwork 1 is united.
As shown in Fig. 2, Fig. 2 is the flow diagram of data processing method preferred embodiment of the present invention.In the present embodiment,
The method includes the steps S1-S2.
Step S1, the intelligent contract call request that balancing received load equipment 100 is distributed.
User sends intelligent contract call request by client 400, and load-balancing device 100 receives client 400
The intelligent contract call request of one or more sent (the intelligent contract called in a plurality of call request may be identical, it is also possible to
It is different) after, it need to be carried out based on the preset load balancing rule load data current to each contract chain in default contract chain group
Analysis, and one or more intelligent contract call request is sequentially allocated to a certain item in contract chain group based on the analysis results
The response of contract chain.
The load data of each contract chain may is that in the corresponding task queue of each contract chain pending in contract chain group
Business quantity, and/or, the average task of the unit time of each contract chain within a preset time handles quantity.
Every contract chain in contract chain group respectively corresponds a task queue, and contract chain often receives an intelligence and closes
About call request, by intelligent contract call request storage into its corresponding task queue.When in task queue include a plurality of intelligence
When energy contract call request, contract chain follows the principle of first in first out, and the intelligence successively handled in its corresponding task queue is closed
About call request.
Step S2 responds the intelligent contract call request, according to the preset kind in the intelligent contract call request
Data determine the corresponding data-link of the intelligent contract call request, and execute the intelligent contract calling with the data-link and ask
Corresponding data interaction is asked to operate.
Preset kind data in the present embodiment are the key (key) of contract data.The data-link stores intelligent contract number
According to.The contract data is saved in the form of key-value, and the key of contract data is uniquely that the content for forming key includes
Intelligent contract address, variable number and/or fragment number etc., for example, the array of large buffer memory can be saved with fragment, with
Reduce the data granularity of transimission and storage, the corresponding fragment number of each fragment data.
Data interaction operation may include reading and/or preservation of contract data etc..
In other embodiments, the preset kind data according in the intelligent contract call request determine the intelligence
Can include: the step of contract call request corresponding data-link
Obtain the preset kind data in the intelligent contract call request;
Call preset kind algorithm, be calculated cryptographic Hash according to the preset kind data, and to the cryptographic Hash into
Row modulus obtains modulus result;And
Number data-link corresponding with the modulus result is filtered out from preset data-link group, as the intelligence
The corresponding data-link of contract call request.
The preset kind algorithm can be consistency hash algorithm etc..
For example, the intelligent contract address for the intelligent contract disposed on contract chain is determined according to the number of itself contract chain, and
The key (key) that the first contract data to be called is obtained from intelligent contract call request, to the first contract data to be called
Key and the corresponding intelligent contract address of contract chain carry out consistency Hash operation and obtain cryptographic Hash, for example, to intelligent contract
Key carry out hash operation, HASH=sha256 (key) is then based on the quantity of data-link in data-link group to hash value
Modulus has 10 data chains then to 10 modulus, for example, modulus result is n;According to the volume of each data-link of preset data chain group
Number, select identical with the modulus result data-link of number as the corresponding data-link of the intelligence contract request, for example, and modulus
As a result the data-link that the corresponding number of n is dn.
In intelligent contract, the key of variable generally comprises character string and index subscript, and intelligent contract address is then usually one
Cryptographic Hash, it is believed that be a very big number, therefore, in the hash algorithm of the present embodiment it is received be variable key and
The two input parameters of intelligent contract address, output is the result for returning to consistency Hash operation.
In other embodiments, the data interaction corresponding with the data-link execution intelligence contract call request
The step of operation includes:
Data read request is sent to the data-link;And
It receives the data-link and responds corresponding with the data read request returned after the data read request
One contract data executes intelligent contract the second contract data of code building, and second contract data is sent to the number
It is saved according to chain.
Wherein, data read request is used for data-link request and the intelligent contract call request corresponding first
Contract data.
After contract chain determines the corresponding data-link dn of intelligent contract call request, call getContractData interface to
Data-link dn requests corresponding first contract data of intelligent contract call request.
It include verify data in the data read request, for example, signature, block height, the number of contract chain etc., for
Data-link dn carries out legitimate verification to the data read request: signature in verify data read requests simultaneously checks that data are read
Take block height, the contract chain number etc. in request.When signature verification pass through and block height, contract chain number with intelligence close
About call request to it is corresponding when judge otherwise the data read request judges that the data read request is not led to by legitimate verification
Cross legitimate verification.
When the data read request passes through legitimate verification, data-link dn reads the first contract data and is sent to contract
Chain, the first contract data that contract chain returns after being verified from data-link dn acquisition execute intelligent contract code revision first
Contract data generates the second contract data, calls setContractData interface that the second contract data of generation is sent to number
It is saved according to chain dn.When the data read request does not pass through legitimate verification, contract chain receives testing for data-link feedback
Card is as a result, and feed back to client 400 based on verification result generation warning information.
In other embodiments, load data includes pending number of tasks in the corresponding task queue of each contract chain
Amount, the preset load balancing rule include:
The pending task quantity in the corresponding task queue of each contract chain in contract chain group is counted respectively, is found out
The pending the smallest one or more contract chain of task quantity;
If the pending the smallest contract chain of task quantity only has one, it is determined that the contract chain found out is to respond the intelligence
The contract chain of contract call request;Or
If the pending the smallest contract chain of things quantity has a plurality of, the random selection one from a plurality of contract chain found out
The contract chain of the contract chain intelligent contract call request in response.
For example, including n contract chain in contract chain group: c1, c2 ..., cn, load-balancing device 100 receive one
Pending task when intelligent contract call request A, in timing or the corresponding task queue of n contract chain of real-time statistics
Quantity: T1, T2 ..., Tn.If T1, T2 ..., one and only one minimum value in Tn is minimized corresponding contract chain as sound
Answer the contract chain of intelligent contract call request A;If multiple minimum values are existed simultaneously T1, T2 ..., in Tn, from multiple minimum values pair
The contract chain of a contract chain intelligent contract call request A in response is randomly choosed in a plurality of contract chain answered.
Pending task quantity in the corresponding task queue of every contract chain can reflect the real time load situation of contract chain,
The present embodiment improves the treatment effeciency of intelligent contract call request by the selection the smallest contract chain of real time load.
In other embodiments, load data includes that the average of the unit time of each contract chain within a preset time is appointed
Business processing quantity, for example, the average task of each second handles quantity in nearest 1 hour.The preset load balancing rule
Include:
Calculate separately the average task processing of the unit time of each contract chain within a preset time in contract chain group
Quantity finds out the average task processing maximum one or more contract chain of quantity;
If the average task processing maximum contract chain of quantity only has one, it is determined that the contract chain found out is to respond the intelligence
The contract chain of energy contract call request;Or
If averagely the task processing maximum contract chain of quantity has a plurality of, one is randomly choosed from a plurality of contract chain found out
The contract chain of a contract chain intelligent contract call request in response.
For example, including n contract chain in contract chain group: c1, c2 ..., cn, load-balancing device 100 receive one
When intelligent contract call request A, each second within nearest 1 hour is averaged respectively for timing or n contract chain of real-time statistics
Task handles quantity: K1, K2 ..., Kn.If K1, K2 ..., one and only one minimum value in Kn is minimized corresponding contract
The contract chain of chain intelligent contract call request A in response;If multiple minimum values are existed simultaneously K1, K2 ..., in Kn, from multiple
The contract chain of a contract chain intelligent contract call request A in response is randomly choosed in the corresponding a plurality of contract chain of minimum value.
The average task processing quantity of the unit time of every contract chain within a preset time can reflect the reality of contract chain
Performance, the present embodiment contract chain optimal by selection actual performance, improves the treatment effeciency of intelligent contract call request.
In other embodiments, load data includes pending task quantity in the corresponding task queue of each contract chain
And the average task of the unit time of each contract chain within a preset time handles quantity, the preset load balancing rule packet
It includes:
The pending task quantity in the corresponding task queue of each contract chain in contract chain group is counted respectively, is found out
The pending the smallest one or more contract chain of task quantity;
If the pending the smallest contract chain of task quantity only has one, it is determined that the contract chain found out is to respond the intelligence
The contract chain of contract call request;Or
If the pending the smallest contract chain of things quantity has a plurality of, the smallest a plurality of conjunction of pending things quantity is calculated separately
The average task of the unit time of each contract chain within a preset time handles quantity about in chain, finds out average task processing quantity
Maximum one or more contract chain;
If the average task processing maximum contract chain of quantity only has one, it is determined that the contract chain found out is to respond the intelligence
The contract chain of energy contract call request;Or
If averagely the task processing maximum contract chain of quantity has a plurality of, one is randomly choosed from a plurality of contract chain found out
The contract chain of the contract chain intelligent contract call request in response.
For example, including 10 contract chains in contract chain group: c1, c2 ..., c10, load-balancing device 100 receive one
It is pending in timing or the corresponding task queue of 10 contract chains of real-time statistics when item intelligence contract call request A
Task quantity: T1, T2 ..., T10.If T1, T2 ..., one and only one minimum value T5 in T10 is minimized the corresponding conjunction of T5
The contract chain of about chain c5 intelligent contract call request A in response;If T1, T2 ..., 3 minimum value T2 are existed simultaneously in T10,
T5, T10, the average task of each second handles quantity: K2 within nearest 1 hour respectively by real-time statistics contract chain c2, c5, c10,
K5,K10.If one and only one minimum value K2 in K2, K5, K10, it is minimized the corresponding contract chain c2 of K2 intelligence in response
The contract chain of contract call request A;It is random from contract chain c2, c5 if existing simultaneously 2 minimum values K2, K5 in K2, K5, K10
Select the contract chain of a contract chain intelligent contract call request A in response.
The present embodiment passes through the real time load situation for considering each contract chain first, selects the smallest contract chain of real time load,
Then from the contract chain for selecting best performance in the smallest contract chain is loaded, the treatment effeciency of intelligent contract call request is improved.
In other embodiments, load data includes pending task quantity in the corresponding task queue of each contract chain
And the average task of the unit time of each contract chain within a preset time handles quantity, the preset load balancing rule packet
It includes:
Calculate separately the average task processing of the unit time of each contract chain within a preset time in contract chain group
Quantity finds out the average task processing maximum one or more contract chain of quantity;
If the average task processing maximum contract chain of quantity only has one, it is determined that the contract chain found out is to respond the intelligence
The contract chain of energy contract call request;Or
If averagely the task processing maximum contract chain of quantity has a plurality of, statistical average task processing quantity is maximum respectively
It is minimum to find out pending task quantity for pending task quantity in a plurality of contract chain in the corresponding task queue of each contract chain
One or more contract chain;
If the pending the smallest contract chain of task quantity only has one, it is determined that the contract chain found out is to respond the intelligence
The contract chain of contract call request;Or
If the pending the smallest contract chain of things quantity has a plurality of, the random selection one from a plurality of contract chain found out
The contract chain of the contract chain intelligent contract call request in response.
For example, including 10 contract chains in contract chain group: c1, c2 ..., c10, load-balancing device 100 receive one
When item intelligence contract call request A, timing or 10 contract chains of real-time statistics respectively within nearest 1 hour each second it is flat
Equal task handles quantity: K1, K2 ..., K10.If K1, K2 ..., one and only one minimum value K7, is minimized K7 pairs in K10
The contract chain of the contract chain c7 answered intelligent contract call request A in response;If K1, K2 ..., 3 minimums are existed simultaneously in K10
Value K2, K7, K10, pending task quantity T2, T5 in the corresponding task queue of real-time statistics contract chain c2, c7, c10,
T10.If one and only one minimum value T2 in T2, T7, T10, it is minimized the corresponding contract chain c2 of T2 and intelligently closes in response
The contract chain of about call request A;If existing simultaneously 2 minimum values T2, T7 in T2, T7, T10, selected at random from contract chain c2, c7
Select the contract chain of a contract chain intelligent contract call request A in response.
The present embodiment passes through the real-time performance for considering each contract chain first, best performance contract chain is selected, then from performance
The smallest contract chain of real time load is selected in optimal contract chain, improves the treatment effeciency of intelligent contract call request.
In other embodiments, load data includes pending task quantity in the corresponding task queue of each contract chain
And the average task of the unit time of each contract chain within a preset time handles quantity, the preset load balancing rule packet
It includes:
The pending task quantity in the corresponding task queue of each contract chain in contract chain group is counted respectively, according to
The sequence of pending task quantity from small to large is ranked up, and determines the corresponding first row of each contract chain in contract chain group
Serial number;
Calculate separately the average task processing of the unit time of each contract chain within a preset time in contract chain group
Quantity is ranked up according to the sequence of average task processing quantity from big to small, determines each contract chain in contract chain group
Corresponding second row serial number;
First row serial number, second row serial number and default weight calculation rule based on each contract chain, calculate described each
The corresponding weighted value of contract chain finds out the smallest one or more contract chain of weighted value;
If the smallest contract chain of weighted value only has one, it is determined that the contract chain found out is to respond the intelligent contract to call
The contract chain of request;Or
If the smallest contract chain of weighted value has a plurality of, one contract chain work of random selection from a plurality of contract chain found out
For the contract chain for responding the intelligent contract call request.
In the present embodiment, the calculation formula of the corresponding weighted value of each contract chain can illustrate are as follows:
Qi=(α/Pi1)+(β/Pi2)
Wherein, Qi represents the corresponding weighted value of i-th contract chain, and Pi1 represents the first row serial number of the i-th contract chain, Pi2 generation
The second row serial number of i-th contract chain of table, i are positive integer, and α, β are predetermined weight coefficient, α, β and be 1, and α,
β can be adjusted according to actual needs.
For example, including 10 contract chains: c1, c2 ... in contract chain group, c10 is determined each according to pending task quantity
The first row serial number of contract chain: Pr1, Pr2 ..., Pr10 handle quantity according to the average task of each second in nearest 1 hour
Determine the second row serial number of each contract chain: Ps1, Ps2 ..., PS1.10 contracts are calculated separately using the calculation formula of weighted value
The corresponding weighted value of chain: Q1, Q2 ..., Q10.If Q1, Q2 ..., one and only one minimum value Q7, is minimized Q7 pairs in Q10
The contract chain of the contract chain c7 answered intelligent contract call request A in response;If Q1, Q2 ..., 3 minimums are existed simultaneously in Q10
Value Q2, Q7, Q10 randomly choose a contract chain intelligent contract call request A in response from contract chain c2, c7, c10
Contract chain.
The present embodiment calculates the synthetic weights of each contract chain by comprehensively considering the real time load and real-time performance of each contract chain
Weight values select the smallest contract chain of synthetic weights weight values, improve the treatment effeciency of intelligent contract call request.
The data processing method that above-described embodiment proposes, introduces the logical concept of contract chain and data-link, and contract chain is negative
The execution of contract code is blamed, data-link is responsible for the storage of data, so that the execution of contract and the storage of data be made to be no longer limited by
The performance of individual machine;Using multichain framework, the same contract can be deployed on multiple contract chains, the conjunction on multiple contract chains
About code may be performed simultaneously, and realize the scalability of calculated performance, and the data of the same contract can be stored in it is more
On a data-link, data-link quantity can be increased on demand;To sum up, realize intelligent contract performance and memory space it is expansible
Property, improve the treatment effeciency of intelligent contract data.
The present invention also proposes a kind of contract chain node device, and the data-link node device is suitable for contract chain group
Each contract chain.
As shown in figure 3, Fig. 3 is the schematic diagram of 200 preferred embodiment of contract chain node device of the present invention.
Contract chain node device 200 can be the calculating such as desktop PC, notebook, palm PC and server and set
It is standby.The contract chain node device 200 may include, but be not limited only to, first memory 21, first processor 22 and first network
Interface 23.Fig. 3 illustrates only the contract chain node device 200 with component 21-23, it should be understood that being not required for reality
Apply all components shown, the implementation that can be substituted is more or less component.
First memory 21 can be the internal storage unit of contract chain node device 200 in some embodiments, such as
The hard disk or memory of the contract chain node device 200.First memory 21 is also possible to contract chain in further embodiments
The plug-in type hard disk being equipped on the External memory equipment of node device 200, such as contract chain node device 200, intelligent memory card
(Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Into
One step, first memory 21 can also both internal storage units including contract chain node device 200 or including external storage
Equipment.First memory 21 is for storing the application software and Various types of data for being installed on contract chain node device 200, such as first
The program code etc. of data processor 10.First memory 21, which can be also used for temporarily storing, have been exported or will be defeated
Data out.
First processor 22 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), microprocessor or other data processing chips, for running the program code stored in second memory 32 or processing number
According to, such as execute the first data processor 10 etc..
First network interface 23 may include standard wireline interface and wireless interface (such as WI-FI interface).For example, contract
Chain node device 200 carries out data biography by first network interface 23 and load-balancing device 100 and data-link node device 300
It is defeated.
In some embodiments, contract chain node device 200 can also include the first display (not marking in figure), optional
Ground, the first display can be light-emitting diode display, liquid crystal display, touch-control liquid crystal display and OLED (Organic
Light-Emitting Diode, Organic Light Emitting Diode) touch device etc..First display is set for being shown in contract chain node
The information that is handled in standby 200 and for showing visual user interface.
As shown in figure 4, Fig. 4 is the program module schematic diagram of 10 preferred embodiment of the first data processor in Fig. 3.At this
In embodiment, the first data processor 10 can be divided into one or more modules, one or more module is stored
In memory 21, and it is performed by one or more processors (the present embodiment is processor 22), to complete the present invention.Example
Such as, in Fig. 4, the first data processor 10 can be divided into the first receiving module 101 and interactive module 102.The present invention
So-called module is the series of computation machine program instruction section for referring to complete specific function, than program more suitable for description first
Implementation procedure of the data processor 10 in contract chain node device 200, in which:
First receiving module 101, the intelligent contract call request distributed for balancing received load equipment 100.
User sends intelligent contract call request by client 400, and load-balancing device 100 receives client 400
The intelligent contract call request of one or more sent (the intelligent contract called in a plurality of call request may be identical, it is also possible to
It is different) after, it need to be carried out based on the preset load balancing rule load data current to each contract chain in default contract chain group
Analysis, and one or more intelligent contract call request is sequentially allocated to a certain item in contract chain group based on the analysis results
The response of contract chain.
The load data of each contract chain may is that in the corresponding task queue of each contract chain pending in contract chain group
Business quantity, and/or, the average task of the unit time of each contract chain within a preset time handles quantity.
Every contract chain in contract chain group respectively corresponds a task queue, and the first receiving module 101 often receives
One intelligent contract call request, by intelligent contract call request storage into the task queue of contract chain.When in task queue
When comprising a plurality of intelligent contract call request, the first receiving module 101 follows the principle of first in first out, successively handles contract chain
Intelligent contract call request in task queue.
Interactive module 102, for the intelligent contract call request, according to default in the intelligent contract call request
Categorical data determines the corresponding data-link of the intelligent contract call request, and executes the intelligent contract tune with the data-link
With the corresponding data interaction operation of request.
Preset kind data in the present embodiment are the key (key) of contract data.The data-link stores intelligent contract number
According to.The contract data is saved in the form of key-value, and the key of contract data is uniquely that the content for forming key includes
Intelligent contract address, variable number and/or fragment number etc., for example, the array of large buffer memory can be saved with fragment, with
Reduce the data granularity of transimission and storage, the corresponding fragment number of each fragment data.
Data interaction operation may include reading and/or preservation of contract data etc..
As shown in figure 5, Fig. 5 is the submodule schematic diagram of interactive module in Fig. 4.
The interactive module 102 in the present embodiment includes: module 121-123.Wherein:
Data read module 121, for obtaining the preset kind data in the intelligent contract call request;
Cryptographic Hash is calculated according to the preset kind data for calling preset kind algorithm in computing module 122,
And modulus is carried out to the cryptographic Hash, obtain modulus result;And
Screening module 123, for filtering out number number corresponding with the modulus result from preset data-link group
According to chain, as the corresponding data-link of the intelligence contract call request.
The preset kind algorithm can be consistency hash algorithm etc..
For example, data read module 121 determines the intelligent contract disposed on contract chain according to the number of itself contract chain
Intelligent contract address, and obtain from intelligent contract call request the key (key) of the first contract data to be called, computing module
The corresponding intelligent contract address of the key and contract chain of 122 pairs of first contract datas to be called carries out consistency Hash operation and obtains
Cryptographic Hash is obtained, for example, the key to intelligent contract carries out hash operation, HASH=sha256 (key) is then based on data chain group
The quantity of data-link has 10 data chains then to 10 modulus, for example, modulus result is n hash value modulus in group;Screening module
123, according to the number of each data-link of preset data chain group, select number data-link identical with modulus result as described in
Intelligent contract requests corresponding data-link, for example, the data-link that number corresponding with modulus result n is dn.
In intelligent contract, the key of variable generally comprises character string and index subscript, and intelligent contract address is then usually one
Cryptographic Hash, it is believed that be a very big number, therefore, in the hash algorithm of the present embodiment it is received be variable key and
The two input parameters of intelligent contract address, output is the result for returning to consistency Hash operation.
In other embodiments, the interactive module 102 further include: module 124-125.Wherein:
Data demand module 124, for sending data read request to the data-link;And
Execution module 125, for receive the data-link respond it is returning with the data after the data read request
Corresponding first contract data of read requests, executes intelligent contract the second contract data of code building, and by second contract
Data are sent to the data-link and are saved.
Wherein, data read request is used for data-link request and the intelligent contract call request corresponding first
Contract data.
After screening module 123 determines the corresponding data-link dn of intelligent contract call request, data demand module 124 is called
GetContractData interface requests corresponding first contract data of intelligent contract call request to data-link dn.
It include verify data in the data read request, for example, signature, block height, the number of contract chain etc., for
Data-link dn carries out legitimate verification to the data read request: signature in verify data read requests simultaneously checks that data are read
Take block height, the contract chain number etc. in request.When signature verification pass through and block height, contract chain number with intelligence close
About call request to it is corresponding when judge otherwise the data read request judges that the data read request is not led to by legitimate verification
Cross legitimate verification.
When the data read request passes through legitimate verification, data-link dn reads the first contract data and is sent to contract
Chain, the first contract data that execution module 125 returns after being verified from data-link dn acquisition, and execute intelligent contract code and repair
Change the first contract data and generate the second contract data, setContractData interface is called to send out the second contract data of generation
Data-link dn is given to be saved.When the data read request does not pass through legitimate verification, execution module 125 receives data
The verification result of chain feedback, and warning information is generated based on verification result and feeds back to client 400.
The present invention also proposes a kind of computer readable storage medium, and the computer-readable recording medium storage has the first number
According to processing routine, first data processor can be executed by least one processor, so that at least one described processor
Execute the data processing method in any of the above-described embodiment.
The present invention also provides a kind of data processing method, the method is applied to the data-link in above-mentioned block catenary system 1
Node device 300, the block catenary system 1 further include the contract chain node device with data-link accommodation communication connection
200 and the contract chain node device 200 communication connection load-balancing device 100, the contract chain node device 200 configures
On the contract chain of the block catenary system 1.
As shown in fig. 6, Fig. 6 is the flow diagram of data processing method preferred embodiment of the present invention.In the present embodiment,
The data processing method includes step S1-S5.
Step S1 receives the data read request that contract chain is sent based on intelligent contract call request.
Wherein, data read request is used for data-link request and the intelligent contract call request corresponding first
Contract data.
Contract chain is distributed in the intelligent contract call request that load-balancing device 100 sends client 400, and contract chain obtains
The preset kind data (for example, key (key) of contract data) in intelligent contract call request are taken, and call preset kind algorithm
After (for example, consistency hash algorithm) determines the corresponding data-link of the intelligent contract call request, call
GetContractData interface requests corresponding first contract data of intelligent contract call request to data-link.
It further include verify data in the data read request, including signature, block height, contract chain number etc..Wherein,
Contract chain number is that the number of the contract chain of data read request is sent to data-link, for example, contract chain cn.
Step S2 obtains the verify data in the data read request, carries out legitimate verification to the verify data.
Data-link reads the signature in data read request and checks the block height in data read request, contract chain
The verify datas such as number, and legitimate verification is carried out to verify data: when signature verification passes through and block height, contract chain are compiled
Number with intelligent contract call request to it is corresponding when judge that the data read request by legitimate verification, otherwise, judges data reading
Take request legitimate verification failure.
Step S3 reads the first contract corresponding with the data read request when the verify data passes through verifying
Data are sent to the contract chain.
When data-link judges that the data read request passes through legitimate verification, reads the first contract data and be sent to conjunction
About chain cn generates the second contract data so that contract chain cn executes intelligent contract the first contract data of code revision.
Step S4 receives the second contract data corresponding with first contract data that the contract chain is sent, to institute
It states the second contract data and carries out consistency checking.
After data link receives the second contract data of contract chain cn return, the calculating of all nodes is received by verifying
As a result whether identical, if so, judging otherwise the second contract data judges that the second contract data does not pass through by consistency checking
Consistency checking.
Second contract data is entered chain and saved by step S5 when second contract data passes through verifying, and will place
Reason result feeds back to the contract chain.
When data-link judges that the second contract data passes through consistency checking, data-link calls setContractData to connect
Mouth saves the second contract data into data chain.In the second contract data after entering chain preservation and coming into force, data-link readjustment
Second contract data is entered the successful result of chain preservation and feeds back to contract chain cn, will entered chain and save successfully knot by contract chain cn
Fruit is built consensus on contract chain cn.
When data-link judges that the second contract data does not pass through consistency checking, data-link is based on verification result and generates early warning
Information feeds back to contract chain cn.
The present invention also proposes that a kind of data-link node device 300, the data-link node device 300 are suitable for data chain group
On the data-link of group.
As shown in fig. 7, Fig. 7 is the schematic diagram of 300 preferred embodiment of data-link node device of the present invention.
Data-link node device 300 can be the calculating such as desktop PC, notebook, palm PC and server and set
It is standby.The data-link node device 300 may include, but be not limited only to, second memory 31, second processor 32 and the second network
Interface 33.Fig. 7 illustrates only the data-link node device 300 with component 31-33, it should be understood that being not required for reality
Apply all components shown, the implementation that can be substituted is more or less component.
Second memory 31 can be the internal storage unit of data-link node device 300 in some embodiments, such as
The hard disk or memory of the data-link node device 300.Second memory 31 is also possible to data-link in further embodiments
The plug-in type hard disk being equipped on the External memory equipment of node device 300, such as data-link node device 300, intelligent memory card
(Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Into
One step, second memory 31 can also both internal storage units including data-link node device 300 or including external storage
Equipment.Second memory 31 is for storing the application software and Various types of data for being installed on data-link node device 300, such as second
The program code etc. of data processor 20.Second memory 31, which can be also used for temporarily storing, have been exported or will be defeated
Data out.
Second processor 32 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), microprocessor or other data processing chips, for running the program code stored in second memory 32 or processing number
According to, such as execute the second data processor 20 etc..
Second network interface 33 may include standard wireline interface and wireless interface (such as WI-FI interface).For example, data
Chain node device 300 carries out data biography with load-balancing device 100 and contract chain node device 200 by the second network interface 33
It is defeated.
In some embodiments, data-link node device 300 can also include second display (not marking in figure), optional
Ground, second display can be light-emitting diode display, liquid crystal display, touch-control liquid crystal display and OLED (Organic
Light-Emitting Diode, Organic Light Emitting Diode) touch device etc..Second display is set for being shown in data-link node
The information that is handled in standby 300 and for showing visual user interface.
As shown in figure 8, Fig. 8 is the Program modual graph of 20 preferred embodiment of the second data processor in Fig. 7.In this implementation
In example, the second data processor 20 can be divided into one or more modules, one or more module, which is stored in, deposits
In reservoir 31, and it is performed by one or more processors (the present embodiment is processor 32), to complete the present invention.For example,
In Fig. 8, the second data processor 20 can be divided into the second receiving module 201, the first authentication module 202, feedback module
203, the second authentication module 204 and update module 205.The so-called module of the present invention is to refer to complete a series of of specific function
Computer program instructions section, than program more suitable for describing the second data processor 20 in data-link node device 300
Implementation procedure, in which:
Second receiving module 201, the data read request sent for receiving contract chain based on intelligent contract call request.
Wherein, data read request is used for data-link request and the intelligent contract call request corresponding first
Contract data.
Contract chain is distributed in the intelligent contract call request that load-balancing device 100 sends client, and contract chain obtains
Preset kind data (for example, key (key) of contract data) in the number of contract chain and intelligent contract call request, and call
After preset kind algorithm (for example, consistency hash algorithm) determines the corresponding data-link of the intelligent contract call request, call
GetContractData interface requests corresponding first contract data of intelligent contract call request to data-link.
It further include verify data in the data read request, the verify data, including signature, block height, contract
Chain number etc..Wherein, contract chain number is that the number of the contract chain of data read request is sent to data-link, for example, contract chain
cn。
First authentication module 202, for obtaining the verify data in the data read request, to the verify data into
Row legitimate verification.
First authentication module 202 reads the signature in data read request and checks the height of the block in data read request
Degree, contract chain number etc. verify datas, and to verify data carry out legitimate verification: when signature verification pass through and block height,
Contract chain number and intelligent contract call request to it is corresponding when judge that the data read request passes through legitimate verification, otherwise, judge
Data read request legitimate verification failure.
Feedback module 203, for reading corresponding with the data read request when the verify data passes through verifying
First contract data is sent to the contract chain.
When the first authentication module 202 judges that the data read request passes through legitimate verification, feedback module 203 is read
First contract data is sent to contract chain cn, generates the so that contract chain cn executes intelligent contract the first contract data of code revision
Two contract datas.
Second authentication module 204 is sending with first contract data corresponding second for receiving the contract chain
Contract data carries out consistency checking to second contract data.
After the second authentication module 204 receives the second contract data of contract chain cn return, received by verifying all
Whether the calculated result of node is identical, if so, judging that the second contract data consistency checking passes through, otherwise, judges the second contract
Data consistency checking failure.
Update module 205, for when second contract data passes through consistency checking, by second contract data
Enter chain preservation.
When the second authentication module 204 judges that the second contract data passes through consistency checking, update module 205 is called
SetContractData interface saves the second contract data into data chain.Entering chain preservation in the second contract data
After coming into force, update module 205 adjusts back contract chain cn, and the second contract data is entered the successful result of chain preservation and feeds back to contract chain
Cn will enter the successful result of chain preservation and build consensus on contract chain cn.
When the second authentication module 204 judges that the second contract data does not pass through consistency checking, feedback module 203 is based on testing
Card result generates warning information and feeds back to contract chain cn.
Further, the present invention also proposes that a kind of computer readable storage medium, the computer readable storage medium are deposited
Contain the second data processor, second data processor can be executed by least one processor so that it is described at least
One processor executes the data processing method in any of the above-described embodiment.
The above description is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all at this
Under the inventive concept of invention, using equivalent structure transformation made by description of the invention and accompanying drawing content, or directly/use indirectly
It is included in other related technical areas in scope of patent protection of the invention.