CN107918666A - Method of data synchronization and system on a kind of block chain - Google Patents

Method of data synchronization and system on a kind of block chain Download PDF

Info

Publication number
CN107918666A
CN107918666A CN201711193947.9A CN201711193947A CN107918666A CN 107918666 A CN107918666 A CN 107918666A CN 201711193947 A CN201711193947 A CN 201711193947A CN 107918666 A CN107918666 A CN 107918666A
Authority
CN
China
Prior art keywords
data
synchronized
block chain
address
structure definition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711193947.9A
Other languages
Chinese (zh)
Other versions
CN107918666B (en
Inventor
王加楠
张锋
张一锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongchao Credit Card Industry Development Co Ltd Hangzhou Blockchain Technology Research Institute
Original Assignee
Zhongchao Credit Card Industry Development Co Ltd Hangzhou Blockchain Technology Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongchao Credit Card Industry Development Co Ltd Hangzhou Blockchain Technology Research Institute filed Critical Zhongchao Credit Card Industry Development Co Ltd Hangzhou Blockchain Technology Research Institute
Priority to CN201711193947.9A priority Critical patent/CN107918666B/en
Publication of CN107918666A publication Critical patent/CN107918666A/en
Application granted granted Critical
Publication of CN107918666B publication Critical patent/CN107918666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

This application discloses the method for data synchronization on a kind of block chain, the described method includes:Middleware obtains the corresponding data structure definition of intelligent contract;Addressing rules in the data structure definition calculate address of the data to be synchronized in block chain database;Using described address, call block chain storage area data to obtain interface and obtain the data to be synchronized;By the data write-in service database to be synchronized.By the corresponding data structure definition of intelligent contract, calculate the address of data to be synchronized and the interface acquisition data of block chain offer are be provided and are stored and arrive service database.This method avoid writing and calling a large amount of intelligent contract-defined interfaces for being only used for data synchronization, block chain performance is improved.The application also provides the data synchronous system on a kind of block chain, has above-mentioned beneficial effect.

Description

Method of data synchronization and system on a kind of block chain
Technical field
The present invention relates to block chain field, method of data synchronization and system on more particularly to a kind of block chain.
Background technology
Data on block chain are bound with intelligent contract, and each intelligence contract is one section and operates in program on block chain, has There is independent storage region.Intelligent contract can read and write the data in one's own storage region, but can not operate other intelligence Data in energy contract storage region.
Application based on block chain is frequently necessary to carry out data substantial amounts of, complicated inquiry operation, this generic operation is difficult to Realized by intelligent contract.In order to solve the problems, such as this, middleware can be introduced between service application layer and block chain.In Between part maintain traditional relationship type (or non-relational) database, for upper strata service application carry out inquiry operation. Meanwhile the data on block chain are constantly synchronized in database by middleware, ensure on data and the block chain in database Unanimously.
The general thought of existing data synchronization scenario is as follows:
First, a set of interface for being used to obtain data is designed in intelligent contract.The data of simple structure can be by connecing Mouth batch obtains.For complicated data type, it is necessary to which multiple interface kits use.
Then, synchronized process obtains data according to the interface in certain rule invocation intelligence contract.For labyrinth Data, it is necessary to by repeatedly call.For example, it is necessary to first obtain its length when obtaining the data of Array for structural body type, then by Bar obtains the content of array.
Finally, the data got are written in service database.
Such scheme has the disadvantages that:
Need to include mass data sync cap in intelligent contract.The effect of these interfaces is synchronous just for the sake of data, With actual service logic and irrelevant.The presence of these interfaces causes the size of code of intelligent contract to increase, so as to increase block The storage overhead of chain.
The excessively complicated data of structure cannot be included in intelligent contract.The increase of data structure complexity, can make corresponding The design of Data synchronization interface becomes complicated;Intelligent contract has limited the quantity and type of the return value of interface, this leads Cause to need that calling interface is repeated several times during data synchronization;The calling of interface, block chain can all be started once each time Virtual machine, for performing the logic in interface.This brings certain performance cost.
The content of the invention
The purpose of the application is to provide method of data synchronization and system on a kind of block chain, solves in the prior art by number According to by block chain database synchronization to during service database for the high dependency of interface in intelligent contract, and these interfaces The storage overhead and performance cost problem brought.
In order to solve the above technical problems, the application provides the method for data synchronization on a kind of block chain, technical solution is as follows:
Middleware obtains the corresponding data structure definition of intelligent contract;
Addressing rules in the data structure definition calculate ground of the data to be synchronized in block chain database Location;
Using described address, call block chain storage area data to obtain interface and obtain the data to be synchronized;
By the data write-in service database to be synchronized.
Optionally, the generating mode of the data structure definition includes:
Essential information and addressing logic rule in the intelligent contract generate the data structure definition;Wherein, The data structure definition includes the essential information and addressing rules of data.
Optionally, it is described to utilize described address, call block chain storage area data to obtain interface and obtain the number to be synchronized According to including:
Using described address, judge address of the data to be synchronized in block chain database whether by specifying skip to close The field of key word is calculated;
If it is not, then calling block chain storage area data to obtain interface obtains the data to be synchronized;
If so, the corresponding number to be synchronized in address being calculated by the field of the specified skip keywords is not obtained then According to.
Optionally, this method further includes:
The data structure definition is stored on block chain.
Optionally, the data write-in service database to be synchronized is included:
The essential information in the data structure definition resolves to the data to be synchronized of acquisition correctly Data type;
The data to be synchronized for resolving to correct data type are write into the service database.
The application also provides the data synchronous system on a kind of block chain, the system comprises:
Definition module is obtained, the corresponding data structure definition of intelligent contract is obtained for middleware;
Address calculation module, data to be synchronized are calculated in area for the addressing rules in the data structure definition Address in block chain database;
Data acquisition module, for using described address, calling block chain storage area data to obtain and being treated described in interface acquisition Synchrodata;
Data simultaneous module, for the data to be synchronized to be write service database.
Optionally, which further includes:
Data structure definition generation module, it is raw for the essential information in the intelligent contract and addressing logic rule Into the data structure definition;Wherein, the data structure definition includes the essential information and addressing rules of data.
Optionally, the data acquisition module includes:
Judging submodule, for using described address, judging address of the data to be synchronized in block chain database Whether by specifying the field of skip keywords to be calculated;
Data acquisition submodule, is not by specifying for the address when the data to be synchronized in block chain database When the field of skip keywords is calculated, calls block chain storage area data to obtain interface and obtain the data to be synchronized;
Data mask submodule, is by specifying skip for the address when the data to be synchronized in block chain database When the field of keyword is calculated, do not obtain that the address being calculated by the field of the specified skip keywords is corresponding to treat Synchrodata.
Optionally, which further includes:
Memory module, for the data structure definition to be stored in block chain.
Optionally, the data simultaneous module includes:
Data processing submodule, for the essential information in the data structure definition by the described to be synchronized of acquisition Data resolve to correct data type;
Data write submodule, for the data to be synchronized for resolving to correct data type to be write business datum Storehouse.
This application provides the method for data synchronization on a kind of block chain, and the corresponding number of intelligent contract is obtained by middleware Defined according to structure, the addressing rules in the data structure definition calculate data to be synchronized in block chain database Address;Call the data acquisition interface that block chain provides to obtain data to be synchronized, and the data to be synchronized got are converted to Service database is stored in after correct form.
Obviously, the application avoids calling and a large amount of intelligent contracts for being only used for data synchronization is write in intelligent contract and connects Mouthful, and the synchronization for complex types of data is more convenient, improves block chain performance.The application further includes a kind of block chain On data synchronous system, there is above-mentioned beneficial effect.
Brief description of the drawings
In order to illustrate more clearly of the embodiment of the present application, attached drawing needed in the embodiment will be done simply below Introduce, it should be apparent that, drawings in the following description are only some embodiments of the present application, for ordinary skill people For member, without creative efforts, other attached drawings can also be obtained according to these attached drawings.
The method of data synchronization flow chart on a kind of block chain that Fig. 1 is provided by the embodiment of the present invention;
The method of data synchronization flow chart on another block chain that Fig. 2 is provided by the embodiment of the present invention;
Fig. 3 is the work relationship schematic diagram of the corresponding block chain of the embodiment of the present invention and middleware;
The data synchronous system schematic diagram on a kind of block chain that Fig. 4 is provided by the embodiment of the present invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application In attached drawing, the technical solution in the embodiment of the present application is clearly and completely described, it is clear that described embodiment is Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art All other embodiments obtained without making creative work, shall fall in the protection scope of this application.
Please refer to Fig.1, the method for data synchronization flow chart on a kind of block chain that Fig. 1 is provided by the embodiment of the present invention, Technical solution is as follows:
S101:Middleware obtains the corresponding data structure definition of intelligent contract;
Each intelligent contract for needing to carry out data synchronization is respectively provided with corresponding data structure definition.The present embodiment is herein not The generating mode and process of data structure definition are construed as limiting, it can have a variety of generation methods or generating process.Can basis Essential information and addressing logic rule in the intelligence contract generate the data structure definition.For example, in intelligent contract, A series of state variable can be defined.Value in state variable can be written into area after intelligent contract calls terminate each time Block chain database.Partial status variable has complicated customization type, such as structure.It can also be wrapped in data structure definition Structural information containing these customization types.Specifically, corresponding generating mode can be as follows:
According to the adduction relationship between intelligent contract, the source code of the intelligent contract of parsing;Institute in the intelligent contract source code of extraction Some customization types and state variable;Information obtained in the previous step is associated and organized, output data structure definition.
Data structure definition includes addressing information, can also include essential information such as title, type, the number of each data item According to size etc..The effect of essential information is needed in subsequent operation according to the content of essential information to the number to be synchronized that gets According to progress type conversion.Therefore, included in essential information and type changes relevant content, naturally it is also possible to contained The substance unrelated with type conversion.For the convenience of data synchronization process, the essential information of data item can be placed on number In being defined according to structure, naturally it is also possible to store other positions or directly obtained again once after data to be synchronized are tentatively obtained it is right The essential information for the data answered is to make data type conversion use.The application does not limit the existence form of essential information and deposits herein Put position.
Addressing rules are related with the language of intelligent contract.Every kind of intelligence contract language is all abided by when being written and read to storage Follow certain addressing logic specification.The different corresponding addressing rules of intelligent contract language are not exactly the same.For example, In Solidity language, the data of type of foundation (such as uint, bool, address) compact arrangement in the database, its address Offset it is incremented by successively.And for labyrinths such as mapping, its address has carried out Hash calculation according to key, hashes in number According in storehouse.
Data structure definition can be generated when intelligent contract is compiled by compiler, can also manually to data structure definition into Edlin, such as the operation such as mask field can be carried out, or addition additional information.Included in the data structure definition tentatively obtained All data in intelligent contract, wherein the unconcerned non-critical data of service application may also be contained.Can be by fixed The content of data structure definition processed, shields non-critical data, makes it will not be by synchronization.
Data structure definition can be when intelligent contract be compiled by compiler or the data knot on other instruments generation basis Structure defines, then by manually to the data structure definition on basis into edlin, such as deleting garbage, or increase additional information Deng.This generating mode requires to provide the compileable source code of intelligent contract.When the compileable source that can not provide intelligent contract During code, data structure definition can also be directly by manually being write.
, can its be right in later stage manual maintenance if employing dynamic or expansible data structure in intelligent contract The data structure definition answered.For example, when the data structure in intelligent contract changes or needs extension, corresponding data knot Structure defines needs and regenerates.Typically edited on the basis of legacy version, then preserve the renewal for completing data structure definition. There can certainly be other modes to realize the renewal to data structure definition, the application is not construed as limiting update mode at this.
Preferably, obtained for the ease of middleware, data structure definition can be preserved as the ancillary data of intelligent contract On block chain;Can certainly but unlimited order be solely stored in other centralizations server it is first-class.
S102:Addressing rules in the data structure definition calculate data to be synchronized in block chain database Address;
Middleware can calculate address of the data to be synchronized in block chain database according to addressing rules, that is, treat same Deposit position of the step data in block chain database.
S103:Using described address, call block chain storage area data to obtain interface and obtain the data to be synchronized;
Here it is the interface that block chain itself provides that block chain storage area data, which obtains interface, can allow block chain need not Starting virtual machine can directly invoke.
Middleware can be according to the content in data structure definition, and field is analyzed one by one.May in data to be synchronized There are the data useless to service-user.Can be by setting the keyword in data structure definition to shield hash.For example, such as The fruit field does not specify skip keywords, then normally performs the calling block chain storage area data and obtain described in interface acquisition The step of data to be synchronized;If specifying skip keywords in the field, middleware can still calculate the address of the field, but Follow-up simultaneously operating will not be carried out, i.e., it is corresponding not obtain the address being calculated by the field of the specified skip keywords Data to be synchronized.Why need to calculate address, be because the address of follow-up field needs the address based on the field to be counted Calculate.Certainly other modes realize that the shielding to hash or the screening to useful data, the application do not limit herein Its implementation.
S104:By the data write-in service database to be synchronized.
Because it is binary, identical one piece of data that block chain, which provides data, gone according to different data types Conversion, can obtain different results.Middleware needs correct result submitting to service database.So in write-in business number According to before storehouse, it is necessary to by middleware according to the essential informations of data by the data conversion to be synchronized got into correct data. After converting, data to be synchronized are write service database by middleware, that is, are mapped in service database in each field.
If the data of labyrinth need repeatedly to obtain, repeat the above steps S102 to S104, until all data Synchronously complete.
Based on above-mentioned technical proposal, this application provides the method for data synchronization on a kind of block chain, avoid write and A large amount of intelligent contract-defined interfaces for being only used for data synchronization are called, the synchronization for complex types of data is more convenient, improves area Block chain performance.
Embodiment two
It is second embodiment of the application below, with reference to figure 2, another area that Fig. 2 is provided by the embodiment of the present invention Method of data synchronization flow chart on block chain, technical solution are as follows:
S201:The corresponding data structure definition of the intelligent contract of generation.
Editing machine first generates the data structure definition on basis in accordance with the following methods;
According to the adduction relationship between contract, the source code of contract is parsed;By customization type all in contract source code And state variable extracts;Information obtained in the previous step is associated and organized, the data structure based on output is determined Justice.
At this moment the data structure definition obtained includes the essential information of data item, such as title, type, data length etc. Deng, and the addressing rules of data.At this moment also need to manually be compiled the data structure definition on basis, complete code is such as Shown in lower:
In the basic data structure definition of compiler generation, including name, but there is no skip.Therefore, human-edited removes Name, adds skip, that is, rejects garbage and increase additional information.In program ' " keys ":"field_2_name"’ And the additional information by manually adding, keys can also be by compilers according to specific rule generation.
S202:Middleware obtains the data structure definition, and the addressing rules meter in the data structure definition Calculate address of the data to be synchronized in block chain database.
S203:The middleware content in field analysis data structure definition one by one, obtains not shielded according to address Data to be synchronized.
Middleware can be according to the content in data structure definition, and field is analyzed one by one.If the field is not specified Skip keywords, then data to be synchronized in the normal synchronized field corresponding address;It is if specifying skip keywords, i.e., above-mentioned " ' skip ' in code:True ", then calculate after the field corresponding address without follow-up data simultaneously operating again.
Middleware can call the interface that block chain provides, and no shielded data to be synchronized are obtained according to address.
S204:Essential information of the data to be synchronized got in data structure definition is resolved into correct data Type.
The data to be synchronized tentatively got are binary types, it is necessary to carry out data type to be synchronized according to required type Conversion.
S205:It is synchronous that the data to be synchronized write-in service database of right type after parsing is completed into data.
Data to be synchronized after parsing are mapped in each field of service database by middleware.
If the data of labyrinth, repeat the above steps S203 to S205, until all data synchronously complete.
With reference to figure 3, Fig. 3 is the information and number between block chain and middleware in the corresponding data synchronization process of the present embodiment According to interactive schematic diagram.
Middleware is responsible for obtaining data structure definition, the block chain database address of data is calculated, from block chain database Middle reading data, parsing data and preservation data to service database.
Wherein, data are read from block chain database to be realized by middleware and the information of block chain and data interaction 's.Middleware to block chain send obtain specify address date request, block chain return after receiving the request it is described specifiedly Location data, so complete the operation that data are read from block chain database.
Based on above-mentioned technical proposal, the embodiment of the present application obtains data to be synchronized by using data structure definition, avoids A large amount of interfaces for being only used for data synchronization are write in intelligent contract, reduce the size of code of intelligent contract;Also achieve pair The shielding of service-user hash;It is capable of the data of easily synchronous labyrinth;Without calling a large amount of intelligent contract-defined interfaces, Improve block chain performance.
Embodiment three
Such as Fig. 4, Fig. 4 is the data synchronous system schematic diagram on a kind of block chain provided by the embodiments of the present application, the system Including:
Definition module 100 is obtained, the corresponding data structure definition of intelligent contract is obtained for middleware;
Address calculation module 200, data to be synchronized are calculated for the addressing rules in the data structure definition Address in block chain database;
Data acquisition module 300, for using described address, calling block chain storage area data to obtain described in interface acquisition Data to be synchronized;
Data simultaneous module 400, for the data to be synchronized to be write service database.
Wherein, the system also includes:
Data structure definition generation module, for according to the adduction relationship between intelligent contract, parsing the intelligent contract pair The source code answered;Extract all customization types and the state variable in the source code;Associate and organize and is described self-defined Type and the state variable, obtain the data structure definition.
Based on above-described embodiment, the application also provides a kind of embodiment of the data synchronous system on block chain, real herein Apply in example, the data acquisition module further includes:
Judging submodule, for judging address of the data to be synchronized in block chain database whether by specifying skip The field of keyword is calculated;
Data acquisition submodule, is not by specifying for the address when the data to be synchronized in block chain database When the field of skip keywords is calculated, calls block chain storage area data to obtain interface and obtain the data to be synchronized;
Data mask submodule, is by specifying skip for the address when the data to be synchronized in block chain database When the field of keyword is calculated, do not obtain that the address being calculated by the field of the specified skip keywords is corresponding to treat Synchrodata.
The system also includes:
Memory module, for the data structure definition to be stored in block chain;
The data simultaneous module includes:
Data processing submodule, for the data essential information in the data structure definition by acquisition described in treat Synchrodata resolves to correct data type;
Data write submodule, for the data to be synchronized for resolving to correct data type to be write business datum Storehouse.
Then corresponding workflow is:
S301:Obtain the data structure definition that definition module 100 obtains data structure definition generation submodule generation;
The process of data structure definition generation submodule generation data structure definition can be according in the intelligent contract Essential information and addressing logic rule generate the data structure definition, specifically, generating mode can be as follows:
According to the adduction relationship between contract, the source code of contract is parsed;By customization type all in contract source code And state variable extracts;Information obtained in the previous step is associated and organized, the data structure based on output is determined Justice.
Data structure definition includes essential information such as title, type etc. of each data item, and the addressing rule of each data item Then.Wherein, addressing rules are related with the language of intelligent contract.Every kind of intelligence contract language is all abided by when being written and read to storage Follow certain addressing logic specification.The different corresponding addressing rules of intelligent contract language are not exactly the same.For example, In Solidity language, the data of type of foundation (such as uint, bool, address) compact arrangement in the database, its address Offset it is incremented by successively.And for labyrinths such as mapping, its address has carried out Hash calculation according to key, hashes in number According in storehouse.
Data structure definition generation submodule generally comprises a compiler, can be given birth to when intelligent contract is compiled by compiler Into, manually basic data structure can not also be defined into edlin by compiler, such as the operation such as mask field can be carried out, Or addition additional information.Data all in intelligent contract are contained in the data structure definition tentatively obtained, wherein may Contain the unconcerned non-critical data of service application.Can by customizing the content of data structure definition, shielding is some treats it is same Step data, makes it will not be by synchronization.If for example, the field does not specify skip keywords, synchronously should according to normal flow Field.If specifying skip keywords in the field, middleware can still calculate the address of the field, but not carry out follow-up Simultaneously operating.Why need to calculate address, be because the address of follow-up field needs the address based on the field to be counted Calculate.There can also be the method for other customization data structure definition contents, the application is not limited thereto.
If dynamic or expansible data structure are employed in intelligent contract, it is necessary to which its is right in later stage manual maintenance The data structure definition answered.For example, when the data structure in intelligent contract changes or needs extension, corresponding data knot Structure defines needs and regenerates.Typically edited on the basis of legacy version, then preserve the replacement for completing data structure definition. This process can be completed by memory module.There can certainly be other modes to realize the renewal to data structure definition, this Application is not construed as limiting update mode at this.
After data structure definition generation terminates, memory module can preserve the data structure definition.In order to just Obtained in middleware, data structure definition can be stored directly in block as the ancillary data of intelligent contract by memory module On chain;Can certainly but unlimited order be solely stored in other centralizations server it is first-class.
S302:Address calculation module 200 calculates data to be synchronized according to the addressing rules of the data structure definition and exists Address in block chain database;
S303:Data acquisition module 300 utilizes described address, calls block chain storage area data to obtain described in interface acquisition Data to be synchronized;
Here the data to be synchronized got are binary initial data.In addition, wrapped in data acquisition acquisition module A judging submodule is included, for judging address of the data to be synchronized in block chain database whether by specifying skip to close The field of key word is calculated;If it is not, then calling data acquisition submodule, perform the calling block chain storage area data and obtain The step of taking interface to obtain the data to be synchronized;If so, then calling data mask submodule, do not obtain by the specified skip The corresponding data to be synchronized in address that the field of keyword is calculated.
S304:Data simultaneous module 400, for the data to be synchronized to be write service database.
Data simultaneous module 400 includes a data processing submodule, for the base in the data structure definition The data to be synchronized of acquisition are resolved to correct data type by this information;
Data write submodule, for the data to be synchronized for resolving to correct data type to be write business datum Storehouse.
Because the data to be synchronized just obtained are binary data, it is necessary to by data processing submodule according to data structure Essential information in definition is converted into correct data type, recycles data write-in submodule to treat right type together Step data writes service database.
If the data of labyrinth, repeat the above steps S302 to S304, is arrived until all data are fully synchronized Service database.
The method of data synchronization on a kind of block chain provided herein and system are described in detail above.Say Each embodiment is described by the way of progressive in bright book, and what each embodiment stressed is the difference with other embodiment Part, between each embodiment identical similar portion mutually referring to.For system disclosed in embodiment, due to its with Method is corresponding disclosed in embodiment, so description is fairly simple, reference may be made to the description of the method.It should refer to Go out, for those skilled in the art, can also be to the application on the premise of the application principle is not departed from Some improvement and modification are carried out, these are improved and modification is also fallen into the application scope of the claims.
It should also be noted that, in the present specification, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or order.Moreover, term " comprising ", "comprising" or its any other variant meaning Covering non-exclusive inclusion, so that process, method, article or equipment including a series of elements not only include that A little key elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or The intrinsic key element of equipment.Under the situation not limited more, the key element that is limited by sentence "including a ..." is not arranged Except also there are other identical element in the process, method, article or apparatus that includes the element.

Claims (10)

  1. A kind of 1. method of data synchronization on block chain, it is characterised in that the described method includes:
    Middleware obtains the corresponding data structure definition of intelligent contract;
    Addressing rules in the data structure definition calculate address of the data to be synchronized in block chain database;
    Using described address, call block chain storage area data to obtain interface and obtain the data to be synchronized;
    By the data write-in service database to be synchronized.
  2. 2. according to the method described in claim 1, it is characterized in that, the generating mode of the data structure definition includes:
    Essential information and addressing logic rule in the intelligent contract generate the data structure definition;Wherein, it is described Data structure definition includes the essential information and addressing rules of data.
  3. 3. method according to claim 1 or 2, it is characterised in that it is described to utilize described address, call block chain memory block Data acquisition interface, which obtains the data to be synchronized, to be included:
    Using described address, judge address of the data to be synchronized in block chain database whether by specifying skip keywords Field be calculated;
    If it is not, then calling block chain storage area data to obtain interface obtains the data to be synchronized;
    If so, the corresponding data to be synchronized in address being calculated by the field of the specified skip keywords are not obtained then.
  4. 4. according to the method described in claim 3, it is characterized in that, further include:
    The data structure definition is stored on block chain.
  5. 5. according to the method described in claim 4, it is characterized in that, the data write-in service database to be synchronized is included:
    The data to be synchronized of acquisition are resolved to correct number by the essential information in the data structure definition According to type;
    The data to be synchronized for resolving to correct data type are write into the service database.
  6. A kind of 6. data synchronous system on block chain, it is characterised in that the system comprises:
    Definition module is obtained, the corresponding data structure definition of intelligent contract is obtained for middleware;
    Address calculation module, data to be synchronized are calculated in block chain for the addressing rules in the data structure definition Address in database;
    Data acquisition module, for using described address, calling block chain storage area data to obtain interface acquisition described to be synchronized Data;
    Data simultaneous module, for the data to be synchronized to be write service database.
  7. 7. system according to claim 6, it is characterised in that further include:
    Data structure definition generation module, for the essential information in the intelligent contract and addressing logic rule generation institute State data structure definition;Wherein, the data structure definition includes the essential information and addressing rules of data.
  8. 8. the system according to claim 6 or 7, it is characterised in that the data acquisition module includes:
    Judging submodule, for using described address, whether judging address of the data to be synchronized in block chain database Field by specifying skip keywords is calculated;
    Data acquisition submodule, is not by specifying skip to close for the address when the data to be synchronized in block chain database When the field of key word is calculated, calls block chain storage area data to obtain interface and obtain the data to be synchronized;
    Data mask submodule, is by specifying skip crucial for the address when the data to be synchronized in block chain database When the field of word is calculated, it is corresponding to be synchronized that the address being calculated by the field of the specified skip keywords is not obtained Data.
  9. 9. system according to claim 8, it is characterised in that further include:
    Memory module, for the data structure definition to be stored in block chain.
  10. 10. system according to claim 9, it is characterised in that the data simultaneous module includes:
    Data processing submodule, for the essential information in the data structure definition by the data to be synchronized of acquisition Resolve to correct data type;
    Data write submodule, for the data to be synchronized for resolving to correct data type to be write service database.
CN201711193947.9A 2017-11-24 2017-11-24 Data synchronization method and system on block chain Active CN107918666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711193947.9A CN107918666B (en) 2017-11-24 2017-11-24 Data synchronization method and system on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711193947.9A CN107918666B (en) 2017-11-24 2017-11-24 Data synchronization method and system on block chain

Publications (2)

Publication Number Publication Date
CN107918666A true CN107918666A (en) 2018-04-17
CN107918666B CN107918666B (en) 2020-05-12

Family

ID=61897741

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711193947.9A Active CN107918666B (en) 2017-11-24 2017-11-24 Data synchronization method and system on block chain

Country Status (1)

Country Link
CN (1) CN107918666B (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086325A (en) * 2018-06-29 2018-12-25 阿里巴巴集团控股有限公司 Data processing method and device based on block chain
CN109446273A (en) * 2018-12-04 2019-03-08 深圳前海环融联易信息科技服务有限公司 Method of data synchronization, device, computer equipment and the storage medium of block chain
CN109508334A (en) * 2018-11-23 2019-03-22 中科驭数(北京)科技有限公司 For the data compression method of block chain database, access method and system
CN109754251A (en) * 2018-12-27 2019-05-14 石更箭数据科技(上海)有限公司 A kind of data processing method and its device, medium, terminal
CN109766722A (en) * 2019-01-22 2019-05-17 苏州同济区块链研究院有限公司 The method and its system of intelligent contract are constructed in a kind of block chain
CN109857807A (en) * 2019-01-10 2019-06-07 中钞信用卡产业发展有限公司杭州区块链技术研究院 Transaction data synchronization method, apparatus, equipment and medium based on block chain
CN109885612A (en) * 2018-12-26 2019-06-14 联动优势科技有限公司 The synchronization take-effective method and device of block chain intelligence contract
CN110223069A (en) * 2019-06-17 2019-09-10 北京艾摩瑞策科技有限公司 Packaging method and device based on block chain meshed network
CN110245950A (en) * 2019-06-17 2019-09-17 北京艾摩瑞策科技有限公司 Be related to block chain goes out block method and device
WO2019072284A3 (en) * 2018-11-30 2019-09-26 Alibaba Group Holding Limited Blockchain data relationship structuring scheme based on binary log replication
CN110784517A (en) * 2019-09-20 2020-02-11 北京海益同展信息科技有限公司 Service application integration method, system, terminal and storage medium based on block chain
CN111143476A (en) * 2019-12-31 2020-05-12 杭州趣链科技有限公司 Intelligent contract data rapid query method based on database
CN111164586A (en) * 2019-06-28 2020-05-15 阿里巴巴集团控股有限公司 System and method for updating data in a blockchain
CN111581181A (en) * 2020-04-07 2020-08-25 浙商银行股份有限公司 Method for automatically generating intelligent contract of block chain based on database data table
WO2020259417A1 (en) * 2019-06-24 2020-12-30 深圳前海微众银行股份有限公司 Data analysis method and device for block chain
US11108547B2 (en) 2018-11-07 2021-08-31 Advanced New Technologies Co., Ltd. Methods and apparatuses for reading blockchain data
CN114239039A (en) * 2021-09-30 2022-03-25 西南电子技术研究所(中国电子科技集团公司第十研究所) Method for dynamically adapting data structure on user-defined block chain

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2540977A (en) * 2015-07-31 2017-02-08 British Telecomm Expendable access control
CN106651346A (en) * 2016-11-28 2017-05-10 上海凯岸信息科技有限公司 Block chain-based credit investigation data sharing and trading system
CN106681739A (en) * 2017-01-11 2017-05-17 杭州云象网络技术有限公司 Method for automatically generating intelligent contract
WO2017098519A1 (en) * 2015-12-08 2017-06-15 Tallysticks Limited A system and method for automated financial transaction validation, processing and settlement using blockchain smart contracts
CN106874393A (en) * 2017-01-13 2017-06-20 北京众享比特科技有限公司 Synchronizing traffic data method and system, Database Systems based on block chain
WO2017109140A1 (en) * 2015-12-22 2017-06-29 Bigchaindb Gmbh Decentralized, tamper-resistant, asset-oriented database system and method of recording a transaction
US20170228371A1 (en) * 2016-02-05 2017-08-10 Manifold Technology, Inc. Blockchain-enhanced database
CN107147704A (en) * 2017-04-21 2017-09-08 杭州趣链科技有限公司 A kind of generic service middleware system towards block chain
CN107171794A (en) * 2017-06-27 2017-09-15 葛峰 A kind of electronic document based on block chain and intelligent contract signs method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2540977A (en) * 2015-07-31 2017-02-08 British Telecomm Expendable access control
WO2017098519A1 (en) * 2015-12-08 2017-06-15 Tallysticks Limited A system and method for automated financial transaction validation, processing and settlement using blockchain smart contracts
WO2017109140A1 (en) * 2015-12-22 2017-06-29 Bigchaindb Gmbh Decentralized, tamper-resistant, asset-oriented database system and method of recording a transaction
US20170228371A1 (en) * 2016-02-05 2017-08-10 Manifold Technology, Inc. Blockchain-enhanced database
CN106651346A (en) * 2016-11-28 2017-05-10 上海凯岸信息科技有限公司 Block chain-based credit investigation data sharing and trading system
CN106681739A (en) * 2017-01-11 2017-05-17 杭州云象网络技术有限公司 Method for automatically generating intelligent contract
CN106874393A (en) * 2017-01-13 2017-06-20 北京众享比特科技有限公司 Synchronizing traffic data method and system, Database Systems based on block chain
CN107147704A (en) * 2017-04-21 2017-09-08 杭州趣链科技有限公司 A kind of generic service middleware system towards block chain
CN107171794A (en) * 2017-06-27 2017-09-15 葛峰 A kind of electronic document based on block chain and intelligent contract signs method

Non-Patent Citations (9)

* Cited by examiner, † Cited by third party
Title
ASHIQ ANJUM ET AL.: ""Blockchain Standards for Compliance and Trust"", 《 IEEE CLOUD COMPUTING》 *
LI, Y ET AL.: ""EtherQL: A Query Layer for Blockchain System"", 《 22ND INTERNATIONAL CONFERENCE ON DATABASE SYSTEMS FOR ADVANCED APPLICATIONS》 *
XIWEI XU ET AL.: ""The Blockchain as a Software Connector"", 《2016 13TH WORKING IEEE/IFIP CONFERENCE ON SOFTWARE ARCHITECTURE》 *
何蒲 等: ""区块链技术与应用前瞻综述"", 《计算机科学》 *
刘德林: ""区块链智能合约技术在金融领域的研发应用现状、问题及建议"", 《海南金融》 *
孙涵洁: ""融合区块链技术和智能合约的能源互联网需求侧响应分析"", 《机电信息》 *
王加楠 等: ""基于模式的远监督关系抽取算法"", 《中文信息学报》 *
王春宇 等: ""智能合约与金融合约"", 《商》 *
顾彦: ""区块链_金融_未来更多向智能合约领域发展"", 《中国战略新兴产业》 *

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086325A (en) * 2018-06-29 2018-12-25 阿里巴巴集团控股有限公司 Data processing method and device based on block chain
US10949447B2 (en) 2018-06-29 2021-03-16 Advanced New Technologies Co., Ltd. Blockchain-based data synchronizing and data block parsing method and device
US11108547B2 (en) 2018-11-07 2021-08-31 Advanced New Technologies Co., Ltd. Methods and apparatuses for reading blockchain data
CN109508334A (en) * 2018-11-23 2019-03-22 中科驭数(北京)科技有限公司 For the data compression method of block chain database, access method and system
WO2019072284A3 (en) * 2018-11-30 2019-09-26 Alibaba Group Holding Limited Blockchain data relationship structuring scheme based on binary log replication
CN110622149A (en) * 2018-11-30 2019-12-27 阿里巴巴集团控股有限公司 Block chain data relation structure scheme based on binary log replication
CN109446273A (en) * 2018-12-04 2019-03-08 深圳前海环融联易信息科技服务有限公司 Method of data synchronization, device, computer equipment and the storage medium of block chain
CN109885612A (en) * 2018-12-26 2019-06-14 联动优势科技有限公司 The synchronization take-effective method and device of block chain intelligence contract
CN109754251A (en) * 2018-12-27 2019-05-14 石更箭数据科技(上海)有限公司 A kind of data processing method and its device, medium, terminal
CN109857807A (en) * 2019-01-10 2019-06-07 中钞信用卡产业发展有限公司杭州区块链技术研究院 Transaction data synchronization method, apparatus, equipment and medium based on block chain
CN109766722A (en) * 2019-01-22 2019-05-17 苏州同济区块链研究院有限公司 The method and its system of intelligent contract are constructed in a kind of block chain
CN110245950B (en) * 2019-06-17 2020-08-04 北京瑞策科技有限公司 Block discharging method and device related to block chain
CN110223069A (en) * 2019-06-17 2019-09-10 北京艾摩瑞策科技有限公司 Packaging method and device based on block chain meshed network
CN110245950A (en) * 2019-06-17 2019-09-17 北京艾摩瑞策科技有限公司 Be related to block chain goes out block method and device
WO2020259417A1 (en) * 2019-06-24 2020-12-30 深圳前海微众银行股份有限公司 Data analysis method and device for block chain
CN111164586A (en) * 2019-06-28 2020-05-15 阿里巴巴集团控股有限公司 System and method for updating data in a blockchain
CN111164586B (en) * 2019-06-28 2023-07-04 创新先进技术有限公司 System and method for updating data in a blockchain
CN110784517A (en) * 2019-09-20 2020-02-11 北京海益同展信息科技有限公司 Service application integration method, system, terminal and storage medium based on block chain
CN111143476A (en) * 2019-12-31 2020-05-12 杭州趣链科技有限公司 Intelligent contract data rapid query method based on database
CN111143476B (en) * 2019-12-31 2023-06-27 杭州趣链科技有限公司 Intelligent contract data rapid query method based on database
CN111581181A (en) * 2020-04-07 2020-08-25 浙商银行股份有限公司 Method for automatically generating intelligent contract of block chain based on database data table
CN111581181B (en) * 2020-04-07 2021-06-29 浙商银行股份有限公司 Method for automatically generating intelligent contract of block chain based on database data table
CN114239039A (en) * 2021-09-30 2022-03-25 西南电子技术研究所(中国电子科技集团公司第十研究所) Method for dynamically adapting data structure on user-defined block chain

Also Published As

Publication number Publication date
CN107918666B (en) 2020-05-12

Similar Documents

Publication Publication Date Title
CN107918666A (en) Method of data synchronization and system on a kind of block chain
CN105550293B (en) A kind of backstage method for refreshing based on Spark SQL big data processing platforms
CN104461484B (en) The implementation method and device of front-end template
CN104182484B (en) A kind of method and apparatus for realizing HBase data and the mapping of Java field object
CN106371829A (en) Modularization thinking-based template framework design method and system
CN110020307A (en) A kind of method for drafting and device of client's end-view
CN102236544B (en) Method and device for designing skins
CN104407863A (en) Abstract control model programming device and method
CN103995854A (en) Equipment cross-version upgrading method and device
CN106648587A (en) Annotation-based Web application code generation method
CN105677302A (en) Application program modularization developing method and device
CN107924326A (en) The moving method of updated type is covered
CN102364437A (en) Multi-language site development system and implementation method thereof
CN103176778B (en) Web development methods and device
CN104182228B (en) A kind of method and system for creating network application
CN105528418A (en) Design document generation method and apparatus
CN102707948B (en) Source code generation method
CN105446725A (en) Method and system for model driven development
CN106648569A (en) Target serialization achieving method and device
CN108170435A (en) A kind of source code conversion method, device and equipment
CN106372130A (en) Static resource management method
CN110264361A (en) A kind of data analysis method and device of block chain
CN107015841A (en) The preprocess method and program compiling equipment of a kind of program compiling
CN107071007A (en) A kind of method, device and client for obtaining configuration resource
CN112181432A (en) System for realizing bundle modular packaging processing in ReactNative framework

Legal Events

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