CN110430197A - A kind of transaction data synchronization method of block chain network - Google Patents
A kind of transaction data synchronization method of block chain network Download PDFInfo
- Publication number
- CN110430197A CN110430197A CN201910729123.1A CN201910729123A CN110430197A CN 110430197 A CN110430197 A CN 110430197A CN 201910729123 A CN201910729123 A CN 201910729123A CN 110430197 A CN110430197 A CN 110430197A
- Authority
- CN
- China
- Prior art keywords
- server
- operator
- socket
- connection
- transaction data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
- H04L67/025—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
Abstract
The present invention relates to a kind of transaction data synchronization methods of block chain network, including when the Transaction Information of server changes or when needing to be sent out data according to instruction, server determination targeted carrier to be sent from the operator for pre-establishing socket long connection according to the data, the socket long connection real-time transmission transaction data based on the server Yu the targeted carrier;And block chain is written into the transaction data of the real-time transmission.
Description
Technical field
The invention belongs to block chain technical fields, and in particular to a kind of transaction data synchronization method of block chain network.
Background technique
In recent years, information New Communication Technology rapidly develops, and the fusion application of every technology also becomes trend.With cloud meter
The series of new techniques such as calculation, virtualization, software definition it is gradually mature, the boundary between each technology is no longer clear, and synthesis is answered
With being also no longer simply to be superimposed, but learn from other's strong points to offset one's weaknesses, fusion development.In the framework of traditional financial field service, industry
Business and network are service provider oneself independent management, and network is support system, the expense cross charging between business and network.Face
To the main trend of Industrial Convergence, financial industry is moved towards to open from closing, but the data sharp increase of magnanimity may server and each fortune
Seek the communication blocking between quotient.In addition, in application scenes, side very high for the requirement of real-time of data, centralized
Formula is unfavorable for protecting the privacy and real-time Transmission of data.
Block chain technology is also referred to as distributed account book technology, is that one kind is participated in " remembering jointly by several calculating equipment
Account ", the emerging technology of common a complete distributed data base of maintenance.Since block chain technology has decentralization, openly
Transparent, every calculating equipment can participate in data-base recording and respectively calculate that data synchronization can be rapidly performed by between equipment
Characteristic so that block chain technology is widely applied in numerous fields.
In order to comply with the application prospect and the status participated in business of multi-party high frequency of financial services industry scale, solve existing
Delay caused by http connection data is executed in technology by simple timing request, and improves the safety of Transaction Information
Can, it is current urgent problem to be solved.
Summary of the invention
To solve the above-mentioned problems, the present invention provides a kind of transaction data synchronization method of block chain network, is reinforcing industry
While the close cooperation between supplier and other operators of being engaged in, by block chain Technology application in financial field, so that in real time
Transaction data synchronization is into region chain network, so as to improve traceability and transparency, improve transmission of transaction data reliability,
Safety and stability.
The purpose of the present invention is adopt the following technical solutions realization:
A kind of transaction data synchronization method of block chain network, which comprises
When the Transaction Information of server changes or when needing to be sent out transaction data according to instruction, the clothes
Business device determination targeted carrier to be sent from the operator for pre-establishing socket long connection according to the data, is based on institute
State the socket long connection real-time transmission transaction data of server Yu the targeted carrier;And by the transaction of the real-time transmission
Block chain is written in data.
Preferably, the server establishes socket long connection with the operator and includes:
When server socket is waiting connection status, real time monitoring network state;
Server socket receives and the connection request of response operator socket, thread is established, by server socket
Description issue operator, once receive the confirmation description information of operator, then successful connection;
After successful connection, the server socket is listening state, continues to the company of other operator's sockets
Request is connect, and remains that the socket between operator is connect;
If connection is unsuccessful, reconnect;
Wherein, connection request includes the address of server socket and the description information of port numbers.
Preferably, according to transaction data, the determination from the operator for pre-establishing socket long connection will be sent out the server
The targeted carrier sent, and the socket long connection real-time transmission number of deals based on the server Yu the targeted carrier
According to, comprising:
If the transaction data is the private data for establishing the operator of socket long connection with the server, judge
Whether the socket long connection between the server and the operator is normal, is connected if normal by the socket long
It connects to the operator and transmits transaction data in real time;Otherwise data are not sent;
If the transaction data belongs to shared resource, the server sends the transaction data in the form of multicast
To all operators in same local area network.
Further, the socket long connection judged between server and the operator whether normally include:
After server receives the detection packet that operator sends, receipt response bag;
If the time of the receipt response bag is fixed without departing from the time-out that operator starts in the detection packet sending instant
When device, then illustrate that server is normal, delete operator it is described detection packet sending instant starting overtime timer;
If the time of the receipt response bag exceeds overtime timer, server failure or Joint failure are judged, weight
Newly establish connection.
Further, the server receive the detection packet that operator sends include: server with the first heart beat cycle into
The long connecting test of row;When first heart beat cycle is able to maintain that long connection, on the basis of first heart beat cycle with
Presupposition multiple is multiplied to increase duration and carry out long connecting test again, obtains the second heart beat cycle for being able to maintain that long connection;When
When first heart beat cycle cannot maintain long connection, removed again on the basis of first heart beat cycle with setting multiple
Long connecting test is carried out to reduce duration, obtains the second heart beat cycle for being able to maintain that long connection;With second heart beat cycle
Maintain long connection.
A kind of transaction data synchronization method of block chain network, which comprises
Operator by the socket long connection real-time transmission transaction data that is pre-established with server, and will it is described in real time
Block chain is written in the transaction data of transmission;Wherein, the transaction data are as follows: when the Transaction Information of server changes or need
The transaction data to be sent out according to instruction;
Whether the transaction data belongs to shared resource is held transmission ordered multicast to be set as needed by operator.
Preferably, the operator includes: with server socket long establishment of connection
The socket of operator sends connection request to the socket of server;Wherein, connection request includes server set
Connect the address of word and the description information of port numbers;
Operator is issued into the description of server socket, once operator confirms description information, then successful connection;
After successful connection, the socket connection between operator and server is remained;
If connection is unsuccessful, reconnect.
Preferably, the operator and server socket long establishment of connection further include:
Operator be arranged linkage interface, the linkage interface include data drawing list, network connection state icon and beginning/
Stop button;
The data drawing list shows data relevant to real-time transaction data or chart, and constitutes the master of the linkage interface
Body portion;
The network connection state icon is arranged except the data drawing list, the network connection state figure is clicked
Mark, re-establishes the socket long connection between operator and server;
When operator does not connect with server socket, the network connection state icon is shown in red;When
When operator and server socket successful connection, the network connection state icon is shown in green;
The start/stop button is mobile in user's finger stop place, and according to pre-set transparency, is runing
In the state of server reception transaction data, the start/stop button is shown as stopping icon and presses in this case quotient
Under the start/stop button, operator to server send halt instruction, and stop in real time obtain transaction data;
In the state that operator is not in and receives transaction data from server, the start/stop button is shown as out
Beginning icon presses the start/stop button in this case, if the socket long connection between operator and server is just
Often, operator obtains transaction data and updates data drawing list;If the socket long connection between operator and server is abnormal, mention
Start to obtain transaction data after showing the successful connection of user elder generation;Wherein,
The linkage interface further includes at least two server icons, server icon setting data drawing list it
Outside, for selecting or replacing connected server.
Further, the socket transmission connection request from the socket of operator to server includes:
Designated port is monitored according to call back function predetermined by operator, waits and establishes socket long with the server
Connection;
After successful connection, obtain inlet flow from socket, operator according to the format according to real-time transmission transaction data into
Row reading data;
Wherein, the call back function predetermined is for adjusting designated port, to obtain transaction from different servers
Data.
Further, the operator includes: according to the format of real-time transmission transaction data progress reading data
Judge transaction data format of the server to operator's real-time transmission;Wherein, data format include packet header and
Data field;
If including packet header in the data format, the head data amount check that packet header includes is judged;When the head data amount check
When less than or equal to setting value, then it is assumed that from the received transaction data of server be without head information data, directly read one wrap
Returned data;
If in the data format not including packet header, directly the transaction data that operator sends is converted to by character string
Binary array is sent to server using socket.
Compared with the immediate prior art, the present invention have it is following the utility model has the advantages that
A kind of transaction data synchronization method of block chain network, when the Transaction Information of server changes or needs
When being sent out transaction data according to instruction, the server is according to the data from the operation for pre-establishing socket long connection
The determination targeted carrier to be sent in quotient, the socket long connection based on the server and the targeted carrier pass in real time
Send transaction data;And block chain is written into the transaction data of the real-time transmission.Using socket long connection type in operator
Transmission of transaction data is carried out between server, when the data of server change, in real time from server to operator
The data for transmitting data, enabling an operator to passively obtain data, and obtain are real-time transaction data, to reduce
Requirement to mass data operational capability etc..Reinforcing the same of the close cooperation between service supplier and other operators
When, the common recognition mechanism based on block chain can prevent the transaction data of record to be tampered, and guarantee the authenticity of transaction data, effectively
Improve transaction data traceability and transparency and data transmission reliability, safety and stability.
Detailed description of the invention
Fig. 1 is the transaction data synchronization method flow diagram in the specific embodiment of the invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into
It is described in detail to one step, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole implementation
Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts
All other embodiment, shall fall within the protection scope of the present invention.
The term used in embodiments of the present invention is only to be not intended to be limiting merely for for the purpose of describing particular embodiments
The present invention.In the embodiment of the present invention and the "an" of singular used in the attached claims, " described " and "the"
It is also intended to including most forms, unless the context clearly indicates other meaning, " a variety of " generally comprise at least two.
It should be appreciated that term "and/or" used herein is only a kind of incidence relation for describing affiliated partner, indicate
There may be three kinds of relationships, for example, A and/or B, can indicate: individualism A, exist simultaneously A and B, individualism B these three
Situation.In addition, character "/" herein, typicallys represent the relationship that forward-backward correlation object is a kind of "or".
It will be appreciated that though may be described in embodiments of the present invention using term first, second, third, etc..,
But these ... it should not necessarily be limited by these terms.These terms be only used to by ... distinguish.For example, not departing from implementation of the present invention
In the case where example range, first ... can also be referred to as second ..., and similarly, second ... can also be referred to as the
One ....
Depending on context, word as used in this " if ", " if " can be construed to " ... when " or
" when ... " or " in response to determination " or " in response to detection ".Similarly, context is depended on, phrase " if it is determined that " or " such as
Fruit detection (condition or event of statement) " can be construed to " when determining " or " in response to determination " or " when detection (statement
Condition or event) when " or " in response to detection (condition or event of statement) ".
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
Include, so that commodity or device including a series of elements not only include those elements, but also including not clear
The other element listed, or further include for this commodity or the intrinsic element of device.In the feelings not limited more
Under condition, the element that is limited by sentence "including a ...", it is not excluded that in the commodity or device for including the element also
There are other identical elements.
The alternative embodiment that the invention will now be described in detail with reference to the accompanying drawings.
Embodiment 1:
As shown in Figure 1, a kind of transaction data synchronization method of the block chain network provided, specific steps include:
S1 is described when the Transaction Information of server changes or when needing to be sent out transaction data according to instruction
Server determination targeted carrier to be sent from the operator for pre-establishing socket long connection according to the data;
Socket long connection real-time transmission transaction data of the S2 based on the server Yu the targeted carrier, and by institute
State the transaction data write-in block chain of real-time transmission.
In step S1, according to transaction data, the determination from the operator for pre-establishing socket long connection will be sent server
Targeted carrier, and based on server and the socket long of targeted carrier connection real-time transmission transaction data, comprising:
A sentences if the transaction data is the private data for establishing the operator of socket long connection with the server
Whether the socket long connection broken between the server and the operator is normal, passes through the socket long if normal
It connects to the operator and transmits transaction data in real time;Otherwise data are not sent;
B, if the transaction data belongs to shared resource, the server sends out the transaction data in the form of multicast
Give all operators in same local area network.
In step A, judge the socket long connection between server and the operator whether normally include:
After server receives the detection packet that operator sends, receipt response bag;
If the time of the receipt response bag is fixed without departing from the time-out that operator starts in the detection packet sending instant
When device, then illustrate that server is normal, delete operator it is described detection packet sending instant starting overtime timer;
If the time of the receipt response bag exceeds overtime timer, server failure or Joint failure are judged, weight
Newly establish connection.
Wherein, it includes: that server with the first heart beat cycle carries out long connection that server, which receives the detection packet that operator sends,
Test;When first heart beat cycle is able to maintain that long connection, with presupposition multiple on the basis of first heart beat cycle
Multiplied again to increase duration and carry out long connecting test, obtains the second heart beat cycle for being able to maintain that long connection;When described first
When heart beat cycle cannot maintain long connection, when being removed again to reduce on the basis of first heart beat cycle with setting multiple
It is long to carry out long connecting test, obtain the second heart beat cycle for being able to maintain that long connection;It remains long with second heart beat cycle to connect
It connects.
Server establishes socket long connection with the operator and includes: in step S2
When server socket is waiting connection status, real time monitoring network state;
Server socket receives and the connection request of response operator socket, thread is established, by server socket
Description issue operator, once receive the confirmation description information of operator, then successful connection;
After successful connection, the server socket is listening state, continues to the company of other operator's sockets
Request is connect, and remains that the socket between operator is connect;
If connection is unsuccessful, reconnect;
Wherein, connection request includes the address of server socket and the description information of port numbers.
In order to further construct perfect block chain transaction, the present embodiment is executing step S2 for the number of deals of real-time transmission
It further include later the intelligent contract for generating each dimension of multiple transregional piece of chain networks at random according to write-in block chain;It is then based on pre-
The feasibility decision condition first defined determines the feasible intelligence contract under the current mode of doing business of block chain network;Finally determine
The intelligence contract exports current intelligent contract when feasible to the feasibility of the current mode of doing business of all block chain networks,
Intelligent contract, which is formulated, to be completed;Otherwise, punish original-Dual Subgradient optimization algorithm to the intelligent contract and its using distribution
Corresponding block chain network is coordinated and optimized, and is obtained new intelligent contract, is then executed previous step: based on predetermined
Feasibility decision condition determines the feasible intelligence contract under the current mode of doing business of block chain network.
Embodiment 2:
A kind of transaction data synchronization method of block chain network is provided, comprising:
S101 operator passes through the socket long connection real-time transmission transaction data that pre-establishes with server;
Block chain is written in the transaction data of the real-time transmission by S102;
Wherein, the transaction data are as follows: when the Transaction Information of server changes or need according to instruction to outgoing
The transaction data sent;
Whether the transaction data belongs to shared resource is held transmission ordered multicast to be set as needed by operator.
In step S101, operator includes: with server socket long establishment of connection
The socket of operator sends connection request to the socket of server;Wherein, connection request includes server set
Connect the address of word and the description information of port numbers;
Operator is issued into the description of server socket, once operator confirms description information, then successful connection;
After successful connection, the socket connection between operator and server is remained;
If connection is unsuccessful, reconnect.
Be the equal of above in order to improve quality of connection and data transmission quality, establish corresponding dealing with network breakdown or
Connection failure treatment mechanism, to ensure that being successfully transmitted for transaction data.
Specifically, establish between operator and server establish socket long connection when, if connection is unsuccessful, Huo Zhe
Socket long connection is caused to disconnect because of failure after setting up socket long connection, it tries repeatedly to reconnect, wherein every
The corresponding time carries out reconnection, and interval time length exponentially power rises.
Judgment mechanism and dealing with network breakdown or company below with reference to several common scenes, to the network open circuit in the present invention
Failure handling mechanism is connect to be introduced.
Scene one, user do not connect wifi using operator, or the wifi of connection is not what server provided
Wifi connection.In this case operator can not carry out socket connection with server, because not in same network segment.But user can
To switch wifi halfway, it is connected to the wifi of server, our trial reconnection mechanism just plays the role of at this time, waits until
When up to next timing node for attempting reconnection, reconnected, if without there is any network failure during this, that
Successful connection will be prompted, eliminating also needs the step of connecting manually when user misoperation.
Scene two, operator have had been coupled to the wifi of server before use, start to obtain data there are no transmission
Before order, network breaks down.At this point, operator can first judge whether the socket for being connected to server, if not connecting
Success, then operator can prompt user not have successful connection, in this case, first is that operator can click connection icon manually
It is reconnected, but part operator may be unaware that and connect how manually.So reconnection mechanism just plays the role of, it is only necessary to
Until the timing node of next reconnection, operator will Auto-reconnect, while feed back whether successful connection.
Scene three, successful connection, and also had sent and started to obtain data command, obtaining transaction data
In the process, there is network failure.In the case, operator just obtains less than corresponding real-time transaction data, at this time
It equally runs and works in judgment mechanism and reconnection mechanism such as scene 22.
Scene four, when operator receives transaction data, oksocket frame has a corresponding readjustment, informs operation business circles
The current socket connection in face, operator can control the displaying at interface, as socket is disconnected, socket connection is lost
It loses, socket successful connection, socket sends data and successfully ring from the response after server reading transaction data, socket
It answers.Connection failure can be unsuccessful including initially setting up socket long connection, additionally it is possible to including establishing after long connection due to event
Hinder and long connection is caused to disconnect, such as the socket of either server end bug occurs or server end internal fault is led
The connection failure of cause.The case where disconnecting can also include operator currently with server not in same network segment, or current
Operator is just not turned on network at all, and either current operator does not just find and can connect at all in the network segment of server yet
The socket connect, the also either dynamic connection being disconnected with operator of user hand, these are all analyzable ranges and are not events
Barrier.It is not as disconnecting caused by failure that is, these disconnect mode.Thus can generally for these
The network of analysis disconnects, and does not execute automatic reconnect.
In addition, in step S101, operator and server socket long establishment of connection further include:
Operator be arranged linkage interface, the linkage interface include data drawing list, network connection state icon and beginning/
Stop button;
The data drawing list shows data relevant to real-time transaction data or chart, and constitutes the master of the linkage interface
Body portion;
The network connection state icon is arranged except the data drawing list, the network connection state figure is clicked
Mark, re-establishes the socket long connection between operator and server;
When operator does not connect with server socket, the network connection state icon is shown in red;When
When operator and server socket successful connection, the network connection state icon is shown in green;
The start/stop button is mobile in user's finger stop place, and according to pre-set transparency, is runing
In the state of server reception transaction data, the start/stop button is shown as stopping icon and presses in this case quotient
Under the start/stop button, operator to server send halt instruction, and stop in real time obtain transaction data;
In the state that operator is not in and receives transaction data from server, the start/stop button is shown as out
Beginning icon presses the start/stop button in this case, if the socket long connection between operator and server is just
Often, operator obtains transaction data and updates data drawing list;If the socket long connection between operator and server is abnormal, mention
Start to obtain transaction data after showing the successful connection of user elder generation;Wherein,
The linkage interface further includes at least two server icons, server icon setting data drawing list it
Outside, for selecting or replacing connected server.
Wherein, the socket transmission connection request from the socket of operator to server includes:
Designated port is monitored according to call back function predetermined by operator, waits and establishes socket long with the server
Connection;
After successful connection, obtain inlet flow from socket, operator according to the format according to real-time transmission transaction data into
Row reading data;
Wherein, the call back function predetermined is for adjusting designated port, to obtain transaction from different servers
Data.
The operator carries out reading data according to the format of real-time transmission transaction data
Judge transaction data format of the server to operator's real-time transmission;Wherein, data format include packet header and
Data field;
If including packet header in the data format, the head data amount check that packet header includes is judged;When the head data amount check
When less than or equal to setting value, then it is assumed that from the received transaction data of server be without head information data, directly read one wrap
Returned data;
If in the data format not including packet header, directly the transaction data that operator sends is converted to by character string
Binary array is sent to server using socket.
Block chain can be written in the transaction data of the real-time transmission while step S101 is executed, reality has been effectively ensured
When transmission of transaction data validity and safety.
Embodiment 3:
It is described the present invention also provides a kind of transaction data synchronization system of block chain network based on same technical concept
System includes the block chain and server for being installed on service supplier side, and with server there are contract relation and pass through
Cross multiple operators of server authentication;
The operator, for based on the socket long connection transmitting data in real time pre-established with the server;
The server, for when itself transaction data changes or needing according to instruction to be sent out number of deals
According to when, according to the transaction data from the operator for pre-establishing socket long connection the determination targeted carrier to be sent,
And based on the socket long of operator connection real-time transmission transaction data, and by the transaction data write area of real-time transmission
Block chain.The real-time transaction data sent each time is saved in block chain, using the common recognition mechanism of block chain, can prevent from recording
Transaction data be tampered, guarantee the authenticity of transaction data.
Wherein, the operator and server include UART serial ports;And/or the server and operator include nothing
Line communication module;
UART serial ports is plugged by wired mode for realizing operator and server and is connected;
Wireless communication module is wirelessly connected for realizing operator and server.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing the function of specifying in one or more flows of the flowchart
The step of.
Finally it should be noted that: the above embodiments are merely illustrative of the technical scheme of the present invention and are not intended to be limiting thereof, to the greatest extent
Invention is explained in detail referring to above-described embodiment for pipe, it should be understood by those ordinary skilled in the art that: still
It can be with modifications or equivalent substitutions are made to specific embodiments of the invention, and without departing from any of spirit and scope of the invention
Modification or equivalent replacement, should all cover within the scope of the claims of the present invention.
Claims (10)
1. a kind of transaction data synchronization method of block chain network, which is characterized in that the described method includes:
When the Transaction Information of server changes or when needing to be sent out transaction data according to instruction, the server
According to the data from the operator for pre-establishing socket long connection the determination targeted carrier to be sent, be based on the clothes
The socket long connection real-time transmission transaction data of business device and the targeted carrier;And by the transaction data of the real-time transmission
Block chain is written.
2. the method as described in claim 1, which is characterized in that the server and the operator establish socket long connection
Include:
When server socket is waiting connection status, real time monitoring network state;
Server socket receives and the connection request of response operator socket, thread is established, by retouching for server socket
It states and issues operator, once receive the confirmation description information of operator, then successful connection;
After successful connection, the server socket is listening state, and the connection for continuing to other operator's sockets is asked
It asks, and remains that the socket between operator is connect;
If connection is unsuccessful, reconnect;
Wherein, connection request includes the address of server socket and the description information of port numbers.
3. the method as described in claim 1, which is characterized in that the server is according to transaction data from pre-establishing socket
The determination targeted carrier to be sent in the operator of long connection, and based on the server with the targeted carrier's
Socket long connection real-time transmission transaction data, comprising:
If the transaction data is the private data for establishing the operator of socket long connection with the server, described in judgement
Whether the socket long connection between server and the operator normal, if normal by the socket long connection to
The operator transmits transaction data in real time;Otherwise data are not sent;
If the transaction data belongs to shared resource, the transaction data is sent to together by the server in the form of multicast
All operators in one local area network.
4. method as claimed in claim 3, which is characterized in that the socket between the judgement server and the operator
Long connection whether normally include:
After server receives the detection packet that operator sends, receipt response bag;
If the time of the receipt response bag without departing from operator it is described detection packet sending instant start overtime timer,
Then illustrate that server is normal, deletes operator in the overtime timer of the detection packet sending instant starting;
If the time of the receipt response bag exceeds overtime timer, judges server failure or Joint failure, build again
Vertical connection.
5. method as claimed in claim 4, which is characterized in that the server receives the detection packet that operator sends and includes:
Server carries out long connecting test with the first heart beat cycle;When first heart beat cycle is able to maintain that long connection, described
Multiplied again with presupposition multiple to increase duration and carry out long connecting test on the basis of first heart beat cycle, acquisition is able to maintain that length
Second heart beat cycle of connection;When first heart beat cycle, which cannot remain long, to be connected, in the base of first heart beat cycle
It is removed again with setting multiple to reduce duration and carry out long connecting test on plinth, obtains and be able to maintain that long the second heartbeat connected is all
Phase;Long connection is maintained with second heart beat cycle.
6. a kind of transaction data synchronization method of block chain network, which is characterized in that the described method includes:
Operator is by the socket long connection real-time transmission transaction data that pre-establishes with server, and by the real-time transmission
Transaction data be written block chain;Wherein, the transaction data are as follows: when the Transaction Information of server changes or need root
The transaction data being sent out according to instruction;
Whether the transaction data belongs to shared resource is held transmission ordered multicast to be set as needed by operator.
7. method as claimed in claim 6, which is characterized in that the operator and server socket long establishment of connection packet
It includes:
The socket of operator sends connection request to the socket of server;Wherein, connection request includes server socket
Address and port numbers description information;
Operator is issued into the description of server socket, once operator confirms description information, then successful connection;
After successful connection, the socket connection between operator and server is remained;
If connection is unsuccessful, reconnect.
8. method as claimed in claim 6, which is characterized in that the operator and server socket long establishment of connection are also
Include:
Linkage interface is set in operator, the linkage interface includes data drawing list, network connection state icon and beginning/stopping
Button;
The data drawing list shows data relevant to real-time transaction data or chart, and constitutes the main part of the linkage interface
Point;
The network connection state icon is arranged except the data drawing list, the network connection state icon is clicked, weight
Newly establish the socket long connection between operator and server;
When operator does not connect with server socket, the network connection state icon is shown in red;Work as operation
When quotient is with server socket successful connection, the network connection state icon is shown in green;
The start/stop button is mobile in user's finger stop place, and according to pre-set transparency, operator from
In the state that server receives transaction data, the start/stop button is shown as stopping icon and presses institute in this case
Start/stop button is stated, operator sends halt instruction to server, and stops obtaining transaction data in real time;
In the state that operator is not in and receives transaction data from server, the start/stop button is shown as starting figure
Mark, in this case, presses the start/stop button, if the socket long connection between operator and server is normal, fortune
Battalion quotient obtains transaction data and updates data drawing list;If the socket long connection between operator and server is abnormal, prompt to use
Start to obtain transaction data after the successful connection of family elder generation;Wherein,
The linkage interface further includes at least two server icons, and the server icon is arranged except data drawing list, is used
In the connected server of selection or replacement.
9. the method for claim 7, which is characterized in that the socket hair from the socket of operator to server
The connection request is sent to include:
Designated port is monitored according to call back function predetermined by operator, waits and establishes socket long company with the server
It connects;
After successful connection, inlet flow is obtained from socket, operator is counted according to the format according to real-time transmission transaction data
According to reading;
Wherein, the call back function predetermined is for adjusting designated port, to obtain transaction data from different servers.
10. method as claimed in claim 9, which is characterized in that the operator is according to the format of real-time transmission transaction data
Carrying out reading data includes:
Judge transaction data format of the server to operator's real-time transmission;Wherein, data format includes packet header and data
Area;
If including packet header in the data format, the head data amount check that packet header includes is judged;When the head data amount check is less than
When equal to setting value, then it is assumed that from the received transaction data of server be without head information data, directly read one packet return
Data;
If in the data format do not include packet header, directly by operator send transaction data by character string be converted to two into
Array processed is sent to server using socket.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910729123.1A CN110430197A (en) | 2019-08-08 | 2019-08-08 | A kind of transaction data synchronization method of block chain network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910729123.1A CN110430197A (en) | 2019-08-08 | 2019-08-08 | A kind of transaction data synchronization method of block chain network |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110430197A true CN110430197A (en) | 2019-11-08 |
Family
ID=68415025
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910729123.1A Pending CN110430197A (en) | 2019-08-08 | 2019-08-08 | A kind of transaction data synchronization method of block chain network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110430197A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102271123A (en) * | 2010-06-01 | 2011-12-07 | 阿里巴巴集团控股有限公司 | Communication method, system and equipment |
US20140258409A1 (en) * | 2013-01-30 | 2014-09-11 | Tencent Technology (Shenzhen) Company Limited | Method, server and browser for pushing message actively |
CN106209857A (en) * | 2016-07-14 | 2016-12-07 | 腾讯科技(深圳)有限公司 | Data transmission method and device |
CN106372868A (en) * | 2016-09-06 | 2017-02-01 | 联动优势科技有限公司 | Verification method and apparatus for transaction data written into block chain |
CN106506601A (en) * | 2016-10-12 | 2017-03-15 | 北京奇虎科技有限公司 | The method and device of data transfer |
-
2019
- 2019-08-08 CN CN201910729123.1A patent/CN110430197A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102271123A (en) * | 2010-06-01 | 2011-12-07 | 阿里巴巴集团控股有限公司 | Communication method, system and equipment |
US20140258409A1 (en) * | 2013-01-30 | 2014-09-11 | Tencent Technology (Shenzhen) Company Limited | Method, server and browser for pushing message actively |
CN106209857A (en) * | 2016-07-14 | 2016-12-07 | 腾讯科技(深圳)有限公司 | Data transmission method and device |
CN106372868A (en) * | 2016-09-06 | 2017-02-01 | 联动优势科技有限公司 | Verification method and apparatus for transaction data written into block chain |
CN106506601A (en) * | 2016-10-12 | 2017-03-15 | 北京奇虎科技有限公司 | The method and device of data transfer |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105099989B (en) | The methods, devices and systems of service processing result are requested and obtained for processing business | |
CN108322345A (en) | A kind of dissemination method and server of fault restoration data packet | |
EP3214891B1 (en) | Switching-on method, base station and storage medium | |
CN103117876B (en) | The synchronous method and device of user state information | |
CN113741282A (en) | Intelligent management system and method for equipment based on edge computing | |
CN108429629A (en) | Equipment fault restoration methods and device | |
CN105553790B (en) | A kind of data processing method and strategic server | |
WO2022127504A1 (en) | Network element management method and apparatus, and storage medium | |
CN105516292A (en) | Hot standby method of cloud platform of intelligent substation | |
CN107332866A (en) | A kind of power transmission and transformation state monitoring method, equipment and system | |
CN110445697A (en) | Video big data cloud platform equipment access service method | |
CN109151082A (en) | A kind of multi-connection method for building up, device and system | |
CN109981421A (en) | A kind of smart machine distribution method and apparatus | |
CN104754287A (en) | Video monitoring equipment configuration parameter issuing method and system | |
CN114926163A (en) | Resource cross-chain transfer method and device | |
CN106789279A (en) | A kind of control method of gateway, the control method and device of remote control terminal | |
CN110532305A (en) | A kind of business datum method for cutting over and system | |
CN108366000A (en) | Keep Alive Packet exchange method, device, communication equipment and communication system | |
CN108064059A (en) | A kind of method of resource allocation, medium and equipment | |
CN110430197A (en) | A kind of transaction data synchronization method of block chain network | |
CN109274763B (en) | Information synchronization method and dual-computer hot standby equipment | |
CN108882263A (en) | A kind of base station O&M method and apparatus | |
CN107360295A (en) | A kind of test main frame and method | |
CN109271454A (en) | A kind of method and the network equipment that data are synchronous | |
CN109600278A (en) | A kind of data communications method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191108 |