Disclosure of Invention
In view of this, the present invention provides a block chain-based data uplink method, apparatus, device and medium, which are intended to solve the technical problem that the prior art cannot uplink data collected by a cell camera and protect the uplink data.
The technical scheme of the invention is realized as follows:
in one aspect, the present invention provides a block chain-based data uplink method, including the following steps:
s1, acquiring data collected by the camera and corresponding running state information of the camera, and taking the data and the running state information as data to be linked;
s2, performing security verification on the data to be uplink, and transmitting the verified data to be uplink into the block chain after the data to be uplink passes the security verification;
s3, establishing a consensus algorithm, calculating the data to be uplink in the block chain according to the consensus algorithm, and transferring the data to be uplink in the block chain into the block chain data storage according to the calculation result.
On the basis of the above technical solution, preferably, in step S1, the data collected by the camera and the corresponding operating state information of the camera are acquired, and the data and the operating state information are used as data to be uplink, and the method further includes the following steps of acquiring the data collected by the camera and the corresponding operating state information of the camera, where the operating state includes: and during work and fault, the data and the running state information collected by the camera are used as data to be linked and stored in a local equipment log.
Based on the above technical solution, preferably, in step S2, the method further includes the steps of setting a security data standard, performing security verification on the uplink data according to the security data standard, and transmitting the to-be-uplink data to the block chain when the uplink data meets the security data standard; and when the uplink data does not meet the safety data standard, deleting the data to be uplink, and detecting a camera corresponding to the data.
On the basis of the above technical scheme, preferably, when the uplink data meets the safety data standard, the to-be-uplink data is transmitted to the block chain, the method further includes the following steps of obtaining the equipment number of each camera in the cell, establishing an identity verification library according to the equipment number, performing identity verification on the to-be-uplink data through the identity verification library, and when the to-be-uplink data passes the verification, transmitting the to-be-uplink data to the block chain; and deleting the data to be uplink when the data to be uplink is not verified.
Based on the above technical solution, preferably, in step S3, a consensus algorithm is established, the data to be uplink in the block chain is calculated according to the consensus algorithm, and the data to be uplink in the block chain is transferred to the block chain data repository according to the calculation result, which further includes the following steps:
h is a consensus value of the consensus algorithm, m is the number of the cameras for transmitting information, and N is the total number of the cameras.
On the basis of the above technical solution, preferably, the to-be-uplink data in the block chain is transferred to and stored in the block chain data repository according to the calculation result, and the method further includes the steps of setting a consensus threshold, comparing the consensus threshold with the consensus threshold, and when the consensus is greater than the consensus threshold, transferring the to-be-uplink data in the block chain to and stored in the block chain data repository; and deleting the data to be uplink in the block chain when the consensus value is smaller than the consensus value threshold.
On the basis of the above technical solution, preferably, when the consensus value is greater than the consensus value threshold, the to-be-uplink data in the block chain is transferred to the block chain data repository, and the method further includes the steps of establishing a private key library, encrypting the to-be-uplink data transferred to the block chain data repository through the private key library, acquiring the device information of the camera corresponding to the to-be-uplink data, and distributing corresponding decoding according to the device information.
Still further preferably, the block chain-based data uplink apparatus includes:
the acquisition module is used for acquiring data acquired by the camera and corresponding running state information of the camera, and taking the data and the running state information as data to be linked;
the uplink module is used for carrying out security verification on the data to be uplink, and transmitting the verified data to be uplink into the block chain after the data to be uplink passes the security verification;
and the computing module is used for establishing a consensus algorithm, computing the data in the block chain according to the consensus algorithm and storing the computed data into the block chain data storage bank.
In a second aspect, the block chain based data uplink method further includes an apparatus, the apparatus comprising: a memory, a processor, and a block chain based data uplink method program stored on the memory and executable on the processor, the block chain based data uplink method program configured to implement the steps of the block chain based data uplink method as described above.
In a third aspect, the block chain based data uplink method further includes a medium, which is a computer medium having a block chain based data uplink method program stored thereon, and when the block chain based data uplink method program is executed by a processor, the block chain based data uplink method program implements the steps of the block chain based data uplink method as described above.
Compared with the prior art, the block chain-based data uplink method has the following beneficial effects:
(1) the data collected by the cell camera and the state of the camera corresponding to the data are combined into complete data to be subjected to chain linking, then the data subjected to chain linking are encrypted through a private key, only security personnel can decrypt the data through decoding of corresponding camera equipment, and the data of the camera is subjected to chain linking encryption in such a way, so that the data can be prevented from being lost, and meanwhile, the data can be protected, and the data is prevented from being maliciously tampered;
(2) by establishing the consensus algorithm, the data in the block chain is calculated by using the consensus algorithm, the consensus value of each calculated to-be-linked data is obtained, the data can be analyzed according to the consensus value, the data with problems can be accurately judged, the corresponding camera is found at the same time, and security personnel can be reminded to maintain the data in time.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, the apparatus may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the device, and that in actual implementations the device may include more or less components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1005 as a medium may include an operating system, a network communication module, a user interface module, and a block chain based data uplink method program.
In the apparatus shown in fig. 1, the network interface 1004 is mainly used for establishing a communication connection between the apparatus and a server storing all data required in the system of block chain based data uplink method; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 of the block chain-based data uplink method apparatus of the present invention may be disposed in the block chain-based data uplink method apparatus, and the block chain-based data uplink method apparatus calls the block chain-based data uplink method program stored in the memory 1005 through the processor 1001 and executes the block chain-based data uplink method provided in the present invention.
Referring to fig. 2, fig. 2 is a flowchart illustrating a block chain-based data uplink method according to a first embodiment of the present invention.
In this embodiment, the block chain based data uplink method includes the following steps:
s10: and acquiring data acquired by the camera and corresponding running state information of the camera, and taking the data and the running state information as data to be linked.
It should be understood that the data acquired by the camera in this embodiment is a security situation that the camera shoots the whole cell, and is a video file, and the running state of the camera at this time is recorded in the acquisition process, and if the camera is running normally, the running state is a working state; if the camera does not shoot the picture or cannot normally transmit data, the corresponding state is a fault, and the central processing unit sends a warning to security personnel after finding the situation to remind the camera to be maintained in time.
It should be understood that when acquiring data collected by a camera, the device information of the camera corresponding to the data is also synchronously acquired, and the device information of the camera is corresponding to the data and the state collected by the camera and is combined together for recording, and the recording form is as follows: video data recorded by a camera in the working state is stored in a local equipment log as an equipment record which can be checked, and the recorded data is linked up to prevent the data from being lost or tampered.
S20: and carrying out security verification on the data to be uplink, and transmitting the verified data to be uplink to the block chain after the data to be uplink passes the security verification.
It should be understood that before the obtained data is uplink, security verification is performed on the data to be uplink, where the security verification is performed by setting a standard format of security data by a user, and the format of the data to be uplink is verified according to the standard format, and the format may be an attribute format of a video or a format of status information of a device, and through the formats, some error data can be screened out so as to prevent excessive data from occupying resources.
It should be understood that the central processing unit may also establish an identity verification library according to the device numbers of different cameras in the cell, and then perform identity verification on the data to be uplink according to the identity verification library, and if the device corresponding to the data to be uplink can be found in the identity verification library, it indicates that there is no problem in the data; if the equipment corresponding to the uplink data cannot be found in the identity verification library, it indicates that the equipment may have a problem or the data is tampered.
It should be appreciated that blockchains are a new model for the application of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, etc. The block chain is an important concept of bitcoin, which is essentially a decentralized database, and as the underlying technology of bitcoin, is a string of data blocks generated by using a cryptographic method for correlation.
It should be understood that, in general, a blockchain system is composed of a data layer, a network layer, a consensus layer, a stimulus layer, a contract layer, and an application layer. The data layer encapsulates a bottom layer data block, basic data such as related data encryption and time stamp and a basic algorithm; the network layer comprises a distributed networking mechanism, a data transmission mechanism, a data verification mechanism and the like; the consensus layer mainly encapsulates various consensus algorithms of the network nodes; the incentive layer integrates economic factors into a block chain technology system, and mainly comprises an issuing mechanism, a distributing mechanism and the like of economic incentive; the contract layer mainly encapsulates various scripts, algorithms and intelligent contracts and is the basis of the programmable characteristic of the block chain; the application layer encapsulates various application scenarios and cases of the blockchain.
S30: and establishing a consensus algorithm, calculating the data to be uplink in the block chain according to the consensus algorithm, and transferring the data to be uplink in the block chain into a block chain data storage library according to a calculation result.
It should be understood that the consensus algorithm mentioned in this embodiment is:
h is a consensus value of the consensus algorithm, m is the number of the cameras for transmitting information, and N is the total number of the cameras.
It should be understood that consensus generally refers to a consensus among different people regarding a certain problem or view, a common understanding, value, idea, etc. sought by different groups, and in a consensus agreed upon in some respect, the mechanism of consensus is to determine the way in which a certain consensus is achieved and maintained. In this embodiment, the consensus algorithm is used to detect the correctness of the data, m is the number of the cameras transmitting information, and if 3m +1 cameras transmit information, at least 2m +1 cameras are required to achieve consensus, where the consensus is achieved according to the correctness of the data.
It should be understood that the common identification in this embodiment means that if a certain data is to be uplink, the cpu compares the format of the certain data with other data to be uplink, and if the format is the same, it indicates that a common identification is achieved between the cell cameras, and the data can be uplink.
It should be understood that, in this embodiment, a common identity threshold is set, and the data to be uplink is determined through the common identity threshold, where when the common identity is greater than the common identity threshold, it indicates that the cell camera has achieved common identity for the correctness of the data, and the data to be uplink is correct; when the consensus value is smaller than the consensus value threshold, the cell camera does not achieve the consensus on the correctness of the data, the data needing to be linked is wrong, the data is deleted, the corresponding camera is tracked, and the corresponding camera number is sent to security personnel.
It should be understood that the private key is a private algorithm used for encrypting data, and is more private than the existing encryption technology, limited decoding is only allocated for data to be encrypted, and the decoding is not public, and by encrypting the data to be linked stored in the blockchain data storage by the private key, the security of the data can be effectively protected, and the data can be greatly prevented from being tampered.
The above description is only for illustrative purposes and does not limit the technical solutions of the present application in any way.
As can be easily found from the above description, in the present embodiment, data acquired by a camera and corresponding running state information of the camera are acquired, and the data and the running state information are used as data to be linked; performing security verification on the data to be uplink, and transmitting the verified data to be uplink to the block chain after the data to be uplink passes the security verification; and establishing a consensus algorithm, calculating the data to be uplink in the block chain according to the consensus algorithm, and transferring the data to be uplink in the block chain into a block chain data storage library according to a calculation result. This embodiment combines together through the data with district camera collection and the status information of district camera, links up these data, has avoided the district camera when damaging, may lead to district security protection information to lose, simultaneously according to consensus algorithm, can carry out the analysis to the state of district camera, judges whether there is the trouble the district camera.
In addition, the embodiment of the invention also provides a data uplink device based on the block chain. As shown in fig. 3, the block chain based data uplink apparatus includes: an acquisition module 10, an uplink module 20, and a calculation module 30.
An obtaining module 10, configured to obtain data acquired by a camera and corresponding running state information of the camera, and use the data and the running state information as to-be-linked data;
the uplink module 20 is configured to perform security verification on the to-be-uplink data, and transmit the verified to-be-uplink data to the block chain after the to-be-uplink data passes the security verification;
and the calculating module 30 is configured to establish a consensus algorithm, calculate data in the blockchain according to the consensus algorithm, and store the calculated data in the blockchain data storage library.
In addition, it should be noted that the above-described embodiments of the apparatus are merely illustrative, and do not limit the scope of the present invention, and in practical applications, a person skilled in the art may select some or all of the modules to implement the purpose of the embodiments according to actual needs, and the present invention is not limited herein.
In addition, the technical details that are not elaborated in this embodiment may refer to the block chain based data uplink method provided in any embodiment of the present invention, and are not described herein again.
Furthermore, an embodiment of the present invention further provides a medium, which is a computer medium, and the computer medium stores a block chain based data uplink method program, and when executed by a processor, the block chain based data uplink method program implements the following operations:
s1, acquiring data collected by the camera and corresponding running state information of the camera, and taking the data and the running state information as data to be linked;
s2, performing security verification on the data to be uplink, and transmitting the verified data to be uplink into the block chain after the data to be uplink passes the security verification;
s3, establishing a consensus algorithm, calculating the data to be uplink in the block chain according to the consensus algorithm, and transferring the data to be uplink in the block chain into the block chain data storage according to the calculation result.
Further, when executed by a processor, the block chain based data uplink method further performs the following operations:
the data of acquireing the camera and the running state information of the corresponding camera, running state includes: and during work and fault, the data and the running state information collected by the camera are used as data to be linked and stored in a local equipment log.
Further, when executed by a processor, the block chain based data uplink method further performs the following operations:
setting a safety data standard, carrying out safety verification on the uplink data according to the safety data standard, and transmitting the data to be uplink into a block chain when the uplink data meets the safety data standard; and when the uplink data does not meet the safety data standard, deleting the data to be uplink, and detecting a camera corresponding to the data.
Further, when executed by a processor, the block chain based data uplink method further performs the following operations:
acquiring equipment numbers of all cameras in a cell, establishing an identity verification library according to the equipment numbers, performing identity verification on data to be uplink through the identity verification library, and transmitting the data to be uplink into a block chain when the data to be uplink passes the verification; and deleting the data to be uplink when the data to be uplink is not verified.
Further, when executed by a processor, the block chain based data uplink method further performs the following operations:
the consensus algorithm is as follows:
h is a consensus value of the consensus algorithm, m is the number of the cameras for transmitting information, and N is the total number of the cameras.
Further, when executed by a processor, the block chain based data uplink method further performs the following operations:
setting a consensus threshold, comparing the consensus with the consensus threshold, and when the consensus is greater than the consensus threshold, transferring the data to be uplink in the block chain into the block chain data storage library; and deleting the data to be uplink in the block chain when the consensus value is smaller than the consensus value threshold.
Further, when executed by a processor, the block chain based data uplink method further performs the following operations:
and establishing a private key library, encrypting the data to be uplink stored in the block chain data repository through the private key library, acquiring the equipment information of the camera corresponding to the data to be uplink, and distributing corresponding decoding according to the equipment information.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.