Specific embodiment
In order to make those skilled in the art better understand the technical solutions in the application, below in conjunction with the application reality
The attached drawing in example is applied, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described implementation
Example is merely a part but not all of the embodiments of the present application.Based on the embodiment in the application, this field is common
The application protection all should belong in technical staff's every other embodiment obtained without creative efforts
Range.
As previously mentioned, finding in block platform chain development process, network environment will cause very the communication between node
Big influence.Transmission data between node once exceed the transmittability of node under the current network environment, then will lead to logical
There is not smooth problem in letter.Especially for the node for executing heartbeat mechanism in block chain, this kind of node once triggers heartbeat
After the connecting detection logic of mechanism, will disconnect with other nodes it is established connection and attempt reconnection.Therefore network environment not
When good, the excessive node that easilys lead to of transmission data between node triggers connecting detection logic, and communication is caused to be forced to interrupt.
For this purpose, the application provides a kind of technical solution to solve the above problems, can guarantee between the node of block chain
Stablize under current network environment, communication is effectively performed.
Fig. 1 is the flow chart of the data transmission method of the embodiment of the present application block chain.Method shown in FIG. 1 can be by hereafter
Corresponding device executes, comprising:
Step S102 prepares the second node into block chain in the first node (can refer to our node) in block chain
When (can refer to Correspondent Node) sends first object data, the first network transmission shape between first node and second node is determined
Condition.
Wherein, the embodiment of the present application does not limit the method for determination of the network transmission situation between node specifically.
As exemplary introduction.
Network test dynamically can be carried out to the interface channel between first node and second node according to logic of propositions,
And the network transmission situation for obtaining network test carries out local cache.Accordingly, this step is ready for sending in first node
When one target data, from the network transmission situation obtained in local cache between first node and second node.Alternatively, can also be with
When first node is ready for sending first object data, network survey is carried out to the interface channel between first node and second node
Examination, determines the network transmission situation between first node and second node.
In addition, block chain can be the arbitrary forms such as alliance's chain, publicly-owned chain, privately owned chain, the embodiment of the present application is not also made to have
Body limits.
Step S104, determining the first data to match with first network status transmission split benchmark, and (data split benchmark
Refer to the fractionation mode split to data).
Wherein, first network status transmission may include: the network transmission efficiency between first node and second node.This
Step determines that the first data are torn open when first object data have exceeded the network transmission efficiency between first node and second node
Divide benchmark.For example, determining that obtained network transmission efficiency is the data of a maximum transmitted 5M, it is assumed that first object data it is big
Small is 16M, it is determined that the first data split benchmark and first object data at least should be split into 4 parts, and every 4 parts of data are little
In 5M.
Step S106, according to the first data split benchmark first object data are split, obtain at least one first
Split data.
Specifically, this step further can also split data configuration first after obtaining the first fractionation data for first
The mark of target data, to be used to indicate the first fractionation data source in first object data.At the same time it can also being further each
A first, which splits data configuration, splits serial number, can split data to each first based on serial number is split for receiving node
It is orderly synthesized, reduction obtains first object data.
At least one above-mentioned first fractionation data are respectively sent to second node, so as to second node base by step S108
In at least one above-mentioned first fractionation Data Synthesis first object data to submit upper layer processing.
Wherein, the sending method that the embodiment of the present application does not split data to first makees specific limit.
As exemplary introduction.
This step can based on the interface channel established between first node and second node by it is above-mentioned at least one
First fractionation data are successively sent to second node, can also be based on the multiple connections established between first node and second node
At least one above-mentioned first fractionation data parallel is sent to second node by channel.
Further, it is also possible to, based on acknowledgement mechanism is determined, send first on above-mentioned basis and split data.It is answered in determination
It answers under mechanism, second node can feed back response message to first node after being successfully received the first fractionation data.If first node
Do not receive the response message from second node after sending some first fractionation data, then it can be according to dependency rule, again
To the transmission of second node the first fractionation data, until transmission times reaches requirement or receives answering for second node after sending
Answer information.
Based on the data transmission method of block chain shown in FIG. 1, the scheme of the embodiment of the present application can be according to first node
Network transmission state between second node carries out the fractionation of adaptability to data to be transmitted, and to obtaining data after fractionation
It is sent respectively, to guarantee transmission energy of the transmission data without departing from node under the current network environment between node
Power, it is ensured that the communication between node is unimpeded.In addition, in block chain execute heartbeat mechanism node, can also avoid because
The problem of transmitting data excessive and wrong initiation reconnection guarantees the stability and validity communicated between node.
Further, on above-mentioned basis, the method for the embodiment of the present application is also based on first node and receives other
Node transmitted data in the manner described above.
That is, the method for the embodiment of the present application further include:
Step S110 receives at least one second fractionation data that the third node in block chain is sent to first node.
It should be understood that third node can be according to transmission side data normal direction first shown in above-mentioned steps S102- step S108
Node sends the second target data.That is, at least one above-mentioned second fractionation data are third nodes according to the second data fractionation base
Standard splits the second target data, and it is to be ready for sending the second target based on third node that the second data, which split benchmark,
What the second network transmission situation determination when data between corresponding first node and third node obtained;
At least one above-mentioned second fractionation Data Synthesis is the second target data by step S112.
Exemplary introduction as step S110 and step S112.
Also include the mark of the second target data in the message for carrying the second fractionation data that third node is sent with
And second split the corresponding fractionation serial number of data.The method of the embodiment of the present application is based on second after reception second splits data
The mark of target data creates the file for the second target data in the spatial cache of first node, is split with caching second
Data and the corresponding fractionation serial number of the second fractionation data.It, can be according to tearing open after the completion of splitting data buffer storage for all second
Divide the sequence of fractionation indicated by serial number, each second fractionation data in file are orderly synthesized, obtain second with reduction
Target data.
It is situated between in detail to the method for determining the network transmission situation between first node and second node further below
It continues.
As previously mentioned, the network transmission situation between first node and second node can be, but not limited to include: first
Network transmission efficiency between node and second node.
Accordingly, the method for the embodiment of the present application can be by sending test data, to detect first node and the second section
Network transmission efficiency between point.That is, establishing interface channel in first node and second node first when executing step S102
Afterwards, the communication of first node and second node is initialized, and after the completion of initialization, is based on the interface channel to second
Node sends test data.Later, the test feedback data that second node is sent is received, test feedback data instruction has second
Node is directed to the receiving time of test data.Finally, the sending time and test of size, test data based on test data
The receiving time of data determines the network transmission efficiency between first segment and second node.
As exemplary introduction.
Assuming that test data size is 600m, the sending time of test data is 3:10, and the receiving time of test data is
3:15.3:15-3:10=5 minutes a length of, corresponding net when can determine the transmission of test data according to these above-mentioned information
Network efficiency of transmission is 600m/ (5*60S)=2m/S.
After obtaining the network transmission efficiency between first node and second node, network transmission efficiency can be based on into one
Step determines that the first data split benchmark.
Certainly, other than network transmission efficiency, the method for the embodiment of the present application can also be based further on and transmit first
Other relevant network informations of target target data determine that the first data split benchmark.For example, being based further on first node
The network load of network load and/or second node determines that the first data split benchmark.Since mode is not unique, herein not
It illustrates and repeats again.
It should be understood that the method for the embodiment of the present application can send and pass dynamically according to the network transmission situation between node
Transmission of data.Therefore, according to the data having determined split benchmark to transmission data split after, if network transmission situation into
One step deteriorates, and is also based on new fractionation benchmark and splits again to acquisition data are split.
That is, in the embodiment of the present application, first object data can be first node and split benchmark to the according to third data
What three target datas were split.Accordingly, it is to be ready for sending third number of targets based on first node that third data, which split benchmark,
According to when corresponding first node and second node between network transmission situation determine and to obtain.
Example introduction is carried out below with reference to method of the concrete implementation mode to the present embodiment.
The method of the present embodiment is applied to the data transmission between alliance's chain interior joint.
Wherein, as shown in Fig. 2, the our node of alliance's chain sends the main flow of target data to Correspondent Node, comprising:
Step S201, our node and Correspondent Node establish connection.
Step S202, our node initiate network detection, the network transmission efficiency between determining and Correspondent Node.
In this step, our node is after establishing interface channel success with Correspondent Node, immediately based on the interface channel
Test data packet is sent to Correspondent Node, with the network transmission efficiency between test and Correspondent Node, so that more new data is split
Benchmark.
Step S203, our node are based on the corresponding data of network transmission efficiency and split benchmark, judge whether to need to mesh
Mark data are split.
In this step, if the size of target data has exceeded network transmission efficiency, it is determined that need to target data into
Row is split;Otherwise, it determines not needing to split target data.
Step S204, our node are corresponding based on network transmission efficiency after determination needs to split target data
Data split benchmark, target data is split into 2 sub- data packets (subdata packet 1,2).
Step S205, our node are based on ACK mechanism, send subdata packet 1 to Correspondent Node.
Step S206, after receiving subdata packet 1, subdata packet 1 is cached Correspondent Node, and to our node
The ACK response message of the subdata packet 1 of transmission.
Step S207, our node after receiving the ACK response message of subdata packet 1, initiate network detection, update with
Network transmission efficiency between Correspondent Node.
Step S208, our node judge whether to need based on the updated network transmission efficiency between Correspondent Node
Subdata packet 2 is wanted to be split.
Step S209, our node do not need ACK mechanism to be based on, to other side after subdata packet 2 split in judgement
Node sends subdata packet 2.
Step S210, after receiving subdata packet 2, subdata packet 2 is cached Correspondent Node, and to our node
The ACK response message of the subdata packet 2 of transmission.
Step S211, subdata packet 1 and subdata packet 2 are synthesized target data by Correspondent Node, and target data is passed
It is crosslinked the upper layer of alliance's chain.
It is the introduction to the method for the embodiment of the present application above.It should be understood that not departing from hereinbefore basis,
Variation appropriate can also be carried out, these variations also should be regarded as the protection scope of the embodiment of the present application.
With the data transmission method of above-mentioned block chain correspondingly, as shown in figure 3, the embodiment of the present application also provides a kind of base
In the data transmission device 300 of block chain, comprising:
Status transmission determining module 310 prepares the second node into the block chain in the first node in block chain
When sending first object data, the network transmission situation between the first node and the second node is determined.
Benchmark determining module 320 is split, based on the network transmission situation between the first node and the second node,
Determine that the first data to match split benchmark.
Data split module 330, split benchmark according to first data and split to the first object data, obtain
To at least one the first fractionation data.
At least one described first fractionation data are respectively sent to the second node by data transmission blocks 340.
Based on the data transmission device of block chain shown in Fig. 3, the scheme of the embodiment of the present application can be according to first node
Network transmission state between second node carries out the fractionation of adaptability to data to be transmitted, and to obtaining data after fractionation
It is sent respectively, to guarantee transmission energy of the transmission data without departing from node under the current network environment between node
Power, it is ensured that the communication between node is unimpeded.In addition, in block chain execute heartbeat mechanism node, can also avoid because
The problem of transmitting data excessive and wrong initiation reconnection guarantees the stability and validity communicated between node.
Optionally, the device of the embodiment of the present application further include:
Data reception module, receive that the third node in the block chain is sent to the first node at least one
Two split data, at least one described second fractionation data, which are the third nodes, splits benchmark to the second mesh according to the second data
Mark data are split, and it is to be ready for sending second mesh based on the third node that second data, which split benchmark,
What the second network transmission situation determination when marking data between the corresponding first node and the third node obtained;
At least one described second fractionation Data Synthesis is second target data by Data Synthesis module.
Optionally, the first network status transmission includes: the network between the first node and the second node
Efficiency of transmission.
Optionally, it is logical specifically to establish connection in the first node and the second node for fractionation benchmark determining module 320
Behind road, test data is sent to the second node based on the interface channel;Later, the survey that the second node is sent is received
Feedback data is tried, the test feedback data indicates that the second node is directed to the receiving time of the test data;And it is based on
The receiving time of the size of the test data, the sending time of the test data and the test data, determine described in
Network transmission efficiency between first segment and the second node.
Optionally, benchmark determining module 320 is split to pass based on the network between the first node and the second node
The network load of defeated situation, the network load of the first node and/or the second node determines the first data to match
Split benchmark.
Optionally, to be the first node split benchmark to third number of targets according to third data to the first object data
It is obtained according to fractionation, it is when being ready for sending the third target data based on the first node that the third data, which split benchmark,
What the network transmission situation determination between the corresponding first node and the second node obtained.
Optionally, the data transmission blocks 340 are specifically based on determining acknowledgement mechanism, will at least one described first fractionation
Data are respectively sent to the second node.
Optionally, the block chain is alliance's chain.
Obviously, the data transmission device of the block chain of the embodiment of the present application can be used as above-mentioned block chain shown in FIG. 1
The executing subject of data transmission method, therefore the data transmission device can be realized data transmission method and be realized in Fig. 1 and Fig. 2
Function.Since principle is identical, repeats no more herein.
Fig. 4 is the structural schematic diagram of one embodiment electronic equipment of the application.Referring to FIG. 4, in hardware view, the electricity
Sub- equipment includes processor, optionally further comprising internal bus, network interface, memory.Wherein, memory may be comprising interior
It deposits, such as high-speed random access memory (Random-Access Memory, RAM), it is also possible to further include non-volatile memories
Device (non-volatile memory), for example, at least 1 magnetic disk storage etc..Certainly, which is also possible that other
Hardware required for business.
Processor, network interface and memory can be connected with each other by internal bus, which can be ISA
(Industry Standard Architecture, industry standard architecture) bus, PCI (Peripheral
Component Interconnect, Peripheral Component Interconnect standard) bus or EISA (Extended Industry Standard
Architecture, expanding the industrial standard structure) bus etc..The bus can be divided into address bus, data/address bus, control always
Line etc..Only to be indicated with a four-headed arrow in Fig. 4, it is not intended that an only bus or a type of convenient for indicating
Bus.
Memory, for storing program.Specifically, program may include program code, and said program code includes calculating
Machine operational order.Memory may include memory and nonvolatile memory, and provide instruction and data to processor.
Processor is from the then operation into memory of corresponding computer program is read in nonvolatile memory, in logical layer
Data transmission device is formed on face.Processor executes the program that memory is stored, and is specifically used for executing following operation:
When the first node in block chain prepares the transmission first object data of the second node into the block chain, really
First network status transmission between the fixed first node and the second node;
Determining the first data to match with the first network status transmission split benchmark;
Benchmark is split according to first data to split the first object data, is obtained at least one and first is torn open
Divided data;
At least one described first fractionation data are respectively sent to the second node, so that the second node is based on
First object data described at least one described first fractionation Data Synthesis are to submit upper layer processing.
The data transmission method of block chain disclosed in the above-mentioned embodiment illustrated in fig. 1 such as the application can be applied to processor
In, or realized by processor.Processor may be a kind of IC chip, the processing capacity with signal.It was realizing
Each step of Cheng Zhong, the above method can be complete by the integrated logic circuit of the hardware in processor or the instruction of software form
At.Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU),
Network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processor, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device are divided
Vertical door or transistor logic, discrete hardware components.It may be implemented or execute and is in the embodiment of the present application disclosed each
Method, step and logic diagram.General processor can be microprocessor or the processor is also possible to any conventional place
Manage device etc..The step of method in conjunction with disclosed in the embodiment of the present application, can be embodied directly in hardware decoding processor and execute
At, or in decoding processor hardware and software module combination execute completion.Software module can be located at random access memory,
This fields such as flash memory, read-only memory, programmable read only memory or electrically erasable programmable memory, register maturation
In storage medium.The storage medium is located at memory, and processor reads the information in memory, completes above-mentioned side in conjunction with its hardware
The step of method.
It should be understood that the electronic equipment of the embodiment of the present application may be implemented the data transmission device of above-mentioned block chain in Fig. 1 and
The function of embodiment shown in Fig. 2, repeats no more herein.
Certainly, other than software realization mode, other implementations are not precluded in the electronic equipment of the application, for example patrol
Collect device or the mode of software and hardware combining etc., that is to say, that the executing subject of following process flow is not limited to each patrol
Unit is collected, hardware or logical device are also possible to.
In addition, the embodiment of the present application also proposed a kind of computer readable storage medium, the computer readable storage medium
One or more programs are stored, which includes instruction, and it is included the portable of multiple application programs which, which works as,
When formula electronic equipment executes, the method that the portable electronic device can be made to execute embodiment illustrated in fig. 1, and be specifically used for executing
Following methods:
When the first node in block chain prepares the transmission first object data of the second node into the block chain, really
First network status transmission between the fixed first node and the second node;
Determining the first data to match with the first network status transmission split benchmark;
Benchmark is split according to first data to split the first object data, is obtained at least one and first is torn open
Divided data;
At least one described first fractionation data are respectively sent to the second node, so that the second node is based on
First object data described at least one described first fractionation Data Synthesis are to submit upper layer processing.
It should be understood that above-metioned instruction can make above when the portable electronic device for being included multiple application programs executes
The data transmission device of the block chain realizes the function of Fig. 1 and embodiment illustrated in fig. 2, and repeats no more herein.
It will be understood by those skilled in the art that the embodiment of this specification can provide as the production of method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or implementation combining software and hardware aspects can be used in this specification
The form of example.Moreover, it wherein includes the computer of computer usable program code that this specification, 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.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
The above is only the embodiments of this specification, are not limited to this specification.For those skilled in the art
For, this specification can have various modifications and variations.All any modifications made within the spirit and principle of this specification,
Equivalent replacement, improvement etc., should be included within the scope of the claims of this specification.