CN111737360A - Block chain-based equipment management method and device and computer equipment - Google Patents

Block chain-based equipment management method and device and computer equipment Download PDF

Info

Publication number
CN111737360A
CN111737360A CN202010702567.9A CN202010702567A CN111737360A CN 111737360 A CN111737360 A CN 111737360A CN 202010702567 A CN202010702567 A CN 202010702567A CN 111737360 A CN111737360 A CN 111737360A
Authority
CN
China
Prior art keywords
target
information
block
equipment
warehousing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010702567.9A
Other languages
Chinese (zh)
Other versions
CN111737360B (en
Inventor
仵甘
申子熹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010702567.9A priority Critical patent/CN111737360B/en
Publication of CN111737360A publication Critical patent/CN111737360A/en
Application granted granted Critical
Publication of CN111737360B publication Critical patent/CN111737360B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a device management method and device based on a block chain, a computer device and a storage medium. The method comprises the following steps: acquiring a device warehousing request; the equipment warehousing request carries target warehousing information of the target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment; acquiring a target block corresponding to the target equipment identifier, and acquiring target ex-warehouse information of the target equipment from the target block; the target block is determined according to the target equipment identifier and the block height; and uploading the target warehousing information to other block chain nodes in the block chain network for consensus, generating a current block corresponding to the target equipment identifier based on the target warehousing-out information and the target warehousing information when the consensus is completed, and storing the current block. By adopting the method, the efficiency, effectiveness and safety of equipment management can be improved.

Description

Block chain-based equipment management method and device and computer equipment
Technical Field
The present application relates to the field of internet technologies, and in particular, to a device management method and apparatus based on a block chain, a computer device, and a storage medium.
Background
With the development of internet technology, more and more devices are widely applied, and convenience is brought to the life of people. During the production and use of the device, it is often necessary to record and manage the relevant data of the device.
In the traditional technology, a manual management method is mainly adopted, a specially-assigned person is equipped for equipment management, and the whole process information from production to use of the equipment is manually recorded.
However, when equipment management is performed manually, firstly, the number of managed equipment is limited, and for equipment with a large number, the manual management operation is difficult, and a large amount of time is consumed, so that the efficiency of equipment management is low. In addition, the failure rate of manual management is high, situations such as missing note, wrong note and data tampering are easily caused, and the effectiveness and safety of equipment management cannot be guaranteed.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a device management method, an apparatus, a computer device, and a storage medium based on a block chain, which can improve efficiency of device management and guarantee effectiveness and security of device management.
A device management method based on a block chain is applied to a device management node in a block chain network, and the method comprises the following steps:
receiving a device warehousing request; the equipment warehousing request carries target warehousing information of the target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment; the target block is determined according to the target equipment identifier and the block height;
acquiring a target block corresponding to the target equipment identifier, and acquiring target ex-warehouse information of the target equipment from the target block;
uploading the target warehousing information to other block chain nodes in the block chain network for consensus processing, and generating a current block corresponding to the target equipment identification based on the target ex-warehousing information and the target warehousing information when consensus is completed;
the current block is stored.
In one embodiment, before receiving the device warehousing request, the method for device management based on the blockchain further includes: and receiving a device allocation request, wherein the device allocation request carries device attribution information corresponding to the target device identifier, uploading the device attribution information to other block link points in the block chain network for consensus processing, and generating a data block corresponding to the target device identifier according to the device attribution information when consensus is completed.
In one embodiment, before uploading the target warehousing information to other block link points in the block chain network for consensus processing, the block chain-based device management method further includes: the method comprises the steps of obtaining a node certificate and an authentication certificate, wherein the node certificate comprises a public key and a private key, the authentication certificate is used for determining the validity period of the node certificate, generating a node identifier based on the public key, establishing communication connection with other block chain nodes, and sending the public key and the authentication certificate to other block chain nodes based on the communication connection so that the other block chain nodes can store the public key and the authentication certificate in an associated mode.
In one embodiment, uploading the target binned information to other blockchain nodes in a blockchain network for consensus processing includes: and encrypting the target warehousing information based on a private key to obtain encrypted information, sending the encrypted information and the target warehousing information to other block chain nodes to enable other block chain nodes to decrypt the encrypted information based on a public key to obtain decrypted information, and performing consensus processing on the target warehousing information when the target warehousing information is consistent with the decrypted information.
An apparatus for blockchain-based device management, the apparatus comprising:
the request receiving module is used for receiving equipment warehousing requests; the equipment warehousing request carries target warehousing information of the target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment;
the information acquisition module is used for acquiring a target block corresponding to the target equipment identifier and acquiring target ex-warehouse information of the target equipment from the target block; the target block is determined according to the target equipment identifier and the block height;
the block generation module is used for uploading the target warehousing information to other block chain nodes in the block chain network for consensus processing, and when the consensus is completed, generating a current block corresponding to the target equipment identifier based on the target ex-warehousing information and the target warehousing information;
and the block storage module is used for storing the current block.
In one embodiment, the request receiving module is further configured to receive an equipment ex-warehouse request, where the equipment ex-warehouse request carries the target equipment type identifier and the equipment borrowing information; the information acquisition module is also used for determining a target device identifier and corresponding device storage information according to the target device type identifier and the device borrowing information; and generating target ex-warehouse information according to the target equipment identification, the corresponding equipment storage information and the equipment borrowing information.
In one embodiment, the block generation module is further configured to upload the target ex-warehouse information to other block chain nodes in the block chain network, so that the other block chain nodes perform consensus processing according to the target equipment identifier and the adjacent in-warehouse information corresponding to the target equipment identifier; and when the consensus is completed, generating a target block corresponding to the target equipment identification based on the target ex-warehouse information.
In one embodiment, the request receiving module is further configured to receive a device allocation request, where the device allocation request carries device attribution information corresponding to the target device identifier; the block generation module is further used for uploading the equipment attribution information to other block link points in the block chain network for consensus processing, and when the consensus is completed, a data block corresponding to the target equipment identifier is generated according to the equipment attribution information.
In one embodiment, the request receiving module is further configured to receive device attribute information sent by a device generating node in the blockchain network, where the device attribute information includes a target device identifier; the block generation module is further used for generating an initial block corresponding to the target device identifier according to the device attribute information.
In one embodiment, the information obtaining module is further configured to obtain a node certificate and an authentication certificate, where the node certificate includes a public key and a private key, and the authentication certificate is used to determine a validity period of the node certificate, generate a node identifier based on the public key, establish a communication connection with other blockchain nodes, and send the public key and the authentication certificate to the other blockchain nodes based on the communication connection, so that the other blockchain nodes store the public key and the authentication certificate in an associated manner.
In one embodiment, the block generation module is further configured to encrypt the target entering information based on a private key to obtain encrypted information, send the encrypted information and the target entering information to other block chain nodes, so that the other block chain nodes decrypt the encrypted information based on the public key to obtain decrypted information, and perform consensus processing on the target entering information when the target entering information is consistent with the decrypted information.
In one embodiment, the block link points include an equipment production node and an equipment supervision node, and the block generation module is further configured to obtain a first processing result returned by the equipment production node; the first processing result is that the equipment production node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification to obtain the target ex-warehousing information; acquiring a second processing result returned by the equipment supervision node; the second processing result is that the equipment supervision node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification to obtain the target ex-warehousing information; and when the first processing result is consistent with the second processing result, determining that the equipment management node, the equipment production node and the equipment supervision node reach consensus.
In one embodiment, the target ex-warehouse information and the target in-warehouse information both include device attribute information and device state information, and the block generation module is further configured to compare the device attribute information in the target ex-warehouse information with the device attribute information in the target in-warehouse information to obtain an attribute information comparison result; comparing the equipment state information in the target ex-warehouse information with the equipment state information in the target in-warehouse information to obtain a state information comparison result; and when the attribute information comparison result is consistent and the state information comparison result meets the preset condition, determining that the target warehousing information passes validity verification.
In one embodiment, the block generating module is further configured to generate block header information according to the target device identifier, and store the block header information in a block header of the target block; and taking the attribute information comparison result, the state information comparison result, the target ex-warehouse information and the target in-warehouse information as the block body of the target block.
In one embodiment, the apparatus for device management based on block chains further includes:
the state determining module is used for acquiring adjacent warehousing information corresponding to the target equipment identifier; the adjacent warehousing information comprises historical equipment resource statistical information; obtaining current equipment resource statistical information based on the historical equipment resource statistical information and the state information comparison result; acquiring an initial block corresponding to the target equipment identifier, and acquiring standard equipment resource statistical information of the target equipment from the initial block; determining the current equipment quality state of the target equipment based on the current equipment resource statistical information and the standard equipment resource statistical information; and when the current equipment quality state is abnormal, generating equipment abnormity prompt information.
In one embodiment, the apparatus for device management based on block chains further includes:
the block checking module is used for receiving a block checking request sent by an equipment supervision node in a block chain network, wherein the block checking request carries the height of a target block corresponding to a block to be checked; the method comprises the steps of obtaining a block to be checked corresponding to the height of a target block locally, sending the block to be checked to an equipment monitoring node, enabling the equipment monitoring node to obtain the target check block corresponding to the height of the target block locally, and determining that the block to be checked passes checking when the block to be checked is consistent with the target check block.
In one embodiment, the block check module is further configured to receive a first block height sent by other blockchain nodes; the first block height is the block height corresponding to the new block which is newly stored locally at the link point of other blocks; acquiring the block height corresponding to the new block newly stored locally as a second block height; and when the first block height is consistent with the second block height, determining that the equipment management node and other block chain link points realize block synchronization.
In one embodiment, the target device is a target firearm, the target shipment information includes at least one of firearm use specification information, firearm shipment time, firearm ammunition shipment information, borrower information, and shipment information verification officer information, and the target warehousing information includes at least one of firearm warehousing time, firearm ammunition warehousing information, return officer information, and warehousing information verification officer information.
A device management system based on a blockchain comprises a blockchain network consisting of a device management node, a device production node and a device supervision node;
the device management node is used for receiving a device warehousing request which carries target warehousing information of a target device, the target warehousing information comprises a target device identification of the target device, a target block corresponding to the target device identification is obtained, target ex-warehouse information of the target device is obtained from the target block, the target block is determined according to the target device identification and the block height, the target ex-warehouse information and the target warehousing information are uploaded to a device production node and a device supervision node in a block chain network for consensus processing, when the consensus is completed, a current block corresponding to the target device identification is generated based on the target ex-warehouse information and the target warehousing information, and the current block is stored.
In one embodiment, the device production node is further configured to obtain device attribute information, and send the device attribute information to the device management node, where the device attribute information includes a target device identifier. The device management node is further configured to generate an initial block corresponding to the target device identifier according to the device attribute information.
In one embodiment, the device supervising node is further configured to send a block verification request to the device management node, where the block verification request carries a target block height corresponding to a block to be verified. The equipment management node is also used for locally acquiring the block to be checked corresponding to the height of the target block according to the block checking request and sending the block to be checked to the equipment supervision node. The equipment supervision node is further used for locally acquiring a target check block corresponding to the height of the target block, and when the block to be checked is consistent with the target check block, determining that the block to be checked passes the check.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving a device warehousing request; the equipment warehousing request carries target warehousing information of the target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment;
acquiring a target block corresponding to the target equipment identifier, and acquiring target ex-warehouse information of the target equipment from the target block; the target block is determined according to the target equipment identifier and the block height;
uploading the target warehousing information to other block chain nodes in the block chain network for consensus processing, and generating a current block corresponding to the target equipment identification based on the target ex-warehousing information and the target warehousing information when consensus is completed;
the current block is stored.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a device warehousing request; the equipment warehousing request carries target warehousing information of the target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment;
acquiring a target block corresponding to the target equipment identifier, and acquiring target ex-warehouse information of the target equipment from the target block; the target block is determined according to the target equipment identifier and the block height;
uploading the target warehousing information to other block chain nodes in the block chain network for consensus processing, and generating a current block corresponding to the target equipment identification based on the target ex-warehousing information and the target warehousing information when consensus is completed;
the current block is stored.
According to the block chain-based equipment management method, the block chain-based equipment management device, the computer equipment and the storage medium, when the equipment enters the warehouse, the equipment management node in the block chain network can upload the warehouse-in information of the equipment to other block chain link points in the block chain network for consensus processing, and when the consensus is completed, the legality of the warehouse-in information can be determined. And locally acquiring a target block corresponding to the equipment, acquiring ex-warehouse information of the equipment from the target block, generating a new block according to the ex-warehouse information and the in-warehouse information of the equipment when the consensus is completed, and storing the new block. Therefore, the related data of equipment warehouse-out and warehouse-in are stored on the block chain based on the attribute that the block chain records cannot be tampered and shared, so that the safety and reliability of the data can be effectively guaranteed, and the effectiveness and safety of equipment management are improved. Unified management of a large amount of equipment data is realized through a block chain technology, and the efficiency of equipment management can be improved. And the related data of equipment warehouse-out and warehouse-in are stored in one block, so that the data backtracking is convenient to follow-up.
Drawings
FIG. 1 is a diagram of an application environment of a blockchain-based device management method in one embodiment;
FIG. 2 is a flowchart illustrating a method for device management based on blockchains in an embodiment;
FIG. 3 is a timing diagram illustrating the establishment of communication links between block link points in one embodiment;
FIG. 4 is a flow diagram illustrating a process for consensus among the block link points in one embodiment;
FIG. 5 is a schematic diagram illustrating an exemplary process for verifying validity of target warehousing information;
FIG. 6 is a flow diagram illustrating the determination of a current device quality state of a target device in one embodiment;
FIG. 7 is a timing diagram illustrating block synchronization between block link points according to one embodiment;
FIG. 8A is a block chain network architecture in accordance with one embodiment;
FIG. 8B is a flow diagram illustrating data UL storage in accordance with an embodiment;
FIG. 8C is a schematic diagram of an interface of a data management client in one embodiment;
FIG. 8D is a flow diagram that illustrates a methodology for blockchain based firearm management in one embodiment;
FIG. 9 is a block diagram of a blockchain-based device management system in one embodiment;
FIG. 10 is a block link point architecture diagram according to an embodiment;
FIG. 11 is a block diagram of an apparatus for device management based on blockchains in one embodiment;
FIG. 12 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The device management method based on the block chain can be applied to the application environment shown in fig. 1. The application environment includes a terminal 102, a device management node 104, a device production node 106, and a device supervisory node 108. Wherein the terminal 102 communicates with the device management node 104, the device production node 106, and the device supervision node 108 via a network. The terminal 102 may be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The device management node 104, the device production node 106, and the device supervisory node 108 are in the same blockchain network. The blockchain network may specifically include one or more device management nodes 104, one or more device production nodes 106, and one or more device supervisory nodes 108. The device management node 104, the device production node 106, and the device supervision node 108 may be implemented by separate servers or a server cluster composed of a plurality of servers.
The terminal 102 sends an equipment warehousing request to the equipment management node 104, where the equipment warehousing request carries target warehousing information of the target equipment, and the target warehousing information includes a target equipment identifier of the target equipment. The device management node 104 locally obtains a target block corresponding to the target device identifier, and obtains target ex-warehouse information of the target device from the target block, where the target block is determined according to the target device identifier and the block height. The device management node 104 uploads the target warehousing information to other block link points in the block chain network for consensus processing, and when the consensus is completed, the device management node 104 generates a current block corresponding to the target device identifier based on the target warehousing information and the target warehousing information, and stores the current block.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.
The platform product service layer provides basic capability and an implementation framework of typical application, and developers can complete block chain implementation of business logic based on the basic capability and the characteristics of the superposed business. The application service layer provides the application service based on the block chain scheme for the business participants to use.
In an embodiment, as shown in fig. 2, a block chain-based device management method is provided, which is described by taking the application of the method to the device management node in fig. 1 as an example, and includes the following steps:
step S202, receiving a device warehousing request; the equipment warehousing request carries target warehousing information of the target equipment, and the target warehousing information comprises a target equipment identifier of the target equipment.
The blockchain network is a carrier and organization mode for running blockchain technology. The block chain technology, bt (block chain technology) for short, also called distributed book technology, is an internet database technology, and is characterized by decentralized and transparent disclosure, so that everyone can participate in data recording. The blockchain technology is a brand new distributed infrastructure and computing mode that uses blockchain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to secure data transmission and access, and uses intelligent contracts composed of automated script codes to program and manipulate data.
The block chain network comprises an equipment management node, an equipment production node and an equipment supervision node. The device management node is used for managing data generated by the device in the use process in the block chain network. The device production node is used for managing data generated by the device in a production link in the block chain network. The device supervision node is used for supervising data generated by each link from production to use of the device in the block chain network.
The equipment warehousing request is used for requesting to return the equipment and recording return information. The equipment refers to equipment which can be produced, borrowed and returned. For example, electronic devices used by businesses (sensors, detectors, transportation vehicles, etc.), military devices used by police officers (firearms, communications equipment, etc.), and the like. The warehousing information refers to related information when the device is returned, and the warehousing information may include at least one of device attribute information, device attribution information, device state information, returned user information, verified user information, and the like of the device. The device attribute information refers to information of the device, such as device production time, device identification, device type, device size, and the like, which is fixed and unchangeable. The device attribution information refers to subordinate information of the device, and includes information of each link from factory shipment, transportation to storage management of the device, for example, when the device is a firearm, the device attribution information may be logistics information, issuing information, storage information, police team information, firearm warehouse information, and the like of the firearm. When the device is a transport vehicle, the device attribution information may be a factory number or the like to which the transport vehicle is attributed. Device status information refers to information of the device that is constantly changing, e.g., device quality, device resources, etc. The returned user information refers to related information of the returned user. Verifying user information refers to verifying relevant information of a user of the relevant device information when the device is borrowed or returned.
The device identifier is an identifier for uniquely identifying the device, and may specifically include a character string of at least one character of letters, numbers, and symbols. Such as a device number, a two-dimensional code, a bar code, etc.
Specifically, when returning the device, the user may trigger a device warehousing request through the terminal, where the device warehousing request may carry target warehousing information of the target device, and the target warehousing information includes a target device identifier of the target device. The terminal may send the device warehousing request to a device management node in the block chain network, that is, the device management node receives the device warehousing request sent by the terminal.
For example, when the target device is a firearm, the police need to return the target firearm after completing use of the target firearm. When the police officer returns the target firearm, the police officer information of the police officer (namely the return police officer information) can be submitted to the firearm management police officer through the terminal. The firearm management police can inspect the target firearm returned by the police to obtain the current information of the target firearm, and uploads the current information of the target firearm, such as firearm attribute information and firearm state information, through the terminal to trigger a firearm warehousing request. The terminal can generate the firearm warehousing information of the target firearm according to the returning police officer information and the current information of the target firearm, and generate the firearm warehousing request according to the firearm warehousing information of the target firearm. The terminal may send a firearm warehousing request to a firearm management node in the blockchain network. The firearm status information may include firearm ammunition warehousing information, among other things. The firearm in-garage information may also include a firearm in-garage time and a garage information verification officer information. The firearm-in-garage time may be a reception time of the firearm-in-garage request, and the warehousing information verification officer information may be officer information of a firearm management officer.
Step S204, a target block corresponding to the target equipment identification is obtained, and target ex-warehouse information of the target equipment is obtained from the target block; the target zone is determined based on the target device identification and the zone height.
The target block is a block locally stored by the blockchain node, and the block header comprises a target device identifier and a block with the latest storage time. The device management node may determine a plurality of blocks of which the block headers include the target device identifiers from the locally stored blocks, and then obtain a block with the highest block height from the plurality of blocks as the target block. The ex-warehouse information refers to relevant information when the device is borrowed, and may include at least one of device attribute information, device attribution information, device state information, borrowing user information, verifying user information, and the like of the device.
Specifically, the device management node locally stores a large number of blocks, and the block header of each block includes a corresponding device identifier. It can be understood that the related information of different devices is stored in different blocks, the related information of different devices can be effectively stored in an isolated manner, and the related information of the corresponding device can be quickly and accurately queried according to the device identifier. When the device is borrowed, the device management node may generate a block according to the ex-warehouse information of the device and store the generated block. When the device is returned, the device management node may generate a block according to the ex-warehouse information and the in-warehouse information of the device, and store the generated block. Therefore, after the device management node receives the device warehousing request, the device management node may obtain the target device identifier of the target device from the target warehousing information, and determine the target block corresponding to the target device identifier in the blocks locally stored by the device management node according to the storage time and the device identifier corresponding to each block. And the equipment management node acquires the target ex-warehouse information of the target equipment from the target block.
Step S206, uploading the target warehousing information to other block chain nodes in the block chain network for consensus processing, and when the consensus is completed, generating a current block corresponding to the target equipment identification based on the target ex-warehousing information and the target warehousing information.
Specifically, after receiving the device warehousing request, the device management node may send the target warehousing information to other block link points in the block link network for consensus processing. The consensus processing of the block link points on the target warehousing information may be validity verification of the target warehousing information, specifically, validity verification of the target warehousing information, whether the target warehousing information is complete, whether the target warehousing information is correct, and the like. The target warehousing information which passes the validity verification is target warehousing information which is completely recorded, correct and not tampered. And the validity verification of the target warehousing information can be carried out according to the target ex-warehousing information corresponding to the target warehousing information. The block link point performs corresponding hash calculation on the target warehousing information which passes the validity verification to obtain a corresponding hash value, or performs corresponding hash calculation on the target ex-warehousing information and the target warehousing information which passes the validity verification to obtain a corresponding hash value. And when the hash values calculated by the same method of the block chain link points exceeding the preset threshold value in the block chain network are consistent, the target warehousing information can be considered to pass the consensus. And then the equipment management node and other block chain nodes can generate a current block according to the target ex-warehouse information and the target in-warehouse information, and the target equipment identification is used as the block head of the current block. The preset threshold value can be self-defined.
It is understood that the hash calculation may specifically be to obtain the root of the merkel tree by using the merkel tree algorithm. The data of the block may also be processed by using MD5 (Message-Digest Algorithm), SHA-1 (Secure Hash Algorithm-1), or SHA-2 (Secure Hash Algorithm-2), and the like, which is not limited herein in this embodiment of the present application.
In an embodiment, the device management node may compare the target ex-warehouse information with the target in-warehouse information to obtain an information comparison result, and then generate the current block according to the information comparison result, the target ex-warehouse information, and the target in-warehouse information. It can be understood that the information comparison result can represent the information that the equipment changes from the warehouse-out to the warehouse-in. Therefore, through the cross validation of the data, a more binding management mechanism is formed, and the use of the equipment becomes more legally compliant. And writing the information comparison result into the block, and quickly inquiring to obtain the information of the equipment which changes from one warehouse-out to one warehouse-in when a subsequent user inquires the information.
In step S208, the current block is stored.
Specifically, the device management node and other tile link points may each store the generated current tile locally.
According to the block chain-based equipment management method, when equipment enters the warehouse, the equipment management node in the block chain network can upload the warehouse entering information of the equipment to other block chain nodes in the block chain network for consensus processing, and when consensus is completed, the legal validity of the warehouse entering information can be determined. The target block corresponding to the device can be locally obtained, the ex-warehouse information of the device is obtained from the target block, when the consensus is completed, a new block is generated according to the ex-warehouse information and the in-warehouse information of the device, and the new block is stored. Therefore, the related data of equipment warehouse-out and warehouse-in are stored on the block chain based on the attribute that the block chain records cannot be tampered and shared, so that the safety and reliability of the data can be effectively guaranteed, and the effectiveness and safety of equipment management are improved. Unified management of a large amount of equipment data is realized through a block chain technology, and the efficiency of equipment management can be improved. And the related data of equipment warehouse-out and warehouse-in are stored in one block, so that the data backtracking is convenient to follow-up.
In one embodiment, before receiving the device warehousing request, the method for device management based on the blockchain further includes: receiving an equipment ex-warehouse request, wherein the equipment ex-warehouse request carries a target equipment type identifier and equipment borrowing information; determining a target device identifier and corresponding device storage information according to the target device type identifier and the device borrowing information; and generating target ex-warehouse information according to the target equipment identification, the corresponding equipment storage information and the equipment borrowing information.
The device warehouse-out request is used for requesting the borrowing device and recording borrowing information. The device type identifier is an identifier for uniquely identifying the type of the device, and may specifically include a character string of at least one character of letters, numbers and symbols. For example, when the device is a firearm, the device types may include a pistol, a rifle, a carbine, a submachine gun, and the like. When the device is a sensor, the device type may include a temperature sensor, a pressure sensor, a photosensor, and the like. When the equipment is a transportation vehicle, the equipment types may include 2 ton trucks, 5 ton trucks, 10 ton trucks, and the like. The device borrowing information may include device usage specification information, borrowing user information, verifying user information, and the like. The device storage information may include device attribute information, device attribution information, and the like.
Specifically, when a user borrows a device, a device ex-warehouse request can be triggered through a terminal, and the device ex-warehouse request carries a target device type identifier and device borrowing information. And the terminal sends the equipment ex-warehouse request to the equipment management node. And after receiving the equipment ex-warehouse request, the equipment management node determines a target equipment identifier and corresponding equipment storage information according to the target equipment type identifier and the equipment borrowing information, and then generates the target ex-warehouse information according to the target equipment identifier, the corresponding equipment storage information and the equipment borrowing information.
For example, when the target device is a firearm, police officers can submit firearm use description information and personal police officer information (i.e., the police officer information for borrowing) to firearm administrators through the terminal when the firearms are borrowed by police officers. The firearm use instruction information includes information on a scene of use of the firearm, a purpose of use of the firearm, and the like. After checking and receiving the information, the firearm management officer can determine the corresponding firearm type and firearm ammunition ex-warehouse information according to the firearm use description information, and uploads the firearm type and firearm ammunition ex-warehouse information through the terminal to trigger a firearm ex-warehouse request. The terminal can generate a firearm warehouse-out request according to the firearm type and the firearm borrowing information and send the firearm warehouse-out request to the firearm management node. The firearm borrowing information includes borrowing police officer information, firearm use instruction information, firearm ammunition warehouse-out information, warehouse-out information verification police officer information (namely firearm management police officer information) and the like. The firearm management node can determine a police team to which the borrowing user belongs according to the borrowing police officer information, and randomly determine a target firearm which is not taken out of the warehouse currently and is corresponding to the firearm type and storage position information corresponding to the target firearm from a firearm database corresponding to the police team. The firearm management node can generate firearm warehouse-out information according to the firearm identification of the target firearm, the corresponding storage position information and the firearm borrowing information. The firearm warehouse-out information can also carry the firearm warehouse-out time, and the firearm warehouse-out time can be the receiving time of the firearm warehouse-out request. After the firearm management node determines the target firearm and the corresponding storage position information, the firearm management node may send the current information of the target firearm to a terminal corresponding to the borrowing police officer and the firearm management police officer, for example, the firearm attribute information, the storage position information, and the like of the target firearm, so that the borrowing police officer and the firearm management police officer can timely obtain the relevant information of the target firearm.
In this embodiment, the target device identifier and the corresponding device storage information are determined according to the target device type identifier and the device lending information in the device lending request, and then the target lending information is generated according to the target device identifier, the corresponding device storage information and the device lending information. Therefore, when the equipment enters the warehouse, the target ex-warehouse information corresponding to the target warehousing information can be quickly determined according to the target equipment identification.
In one embodiment, after generating the target outbound information according to the target device identifier, the corresponding device storage information, and the device borrowing information, the device management method based on the block chain further includes: uploading the target ex-warehouse information to other block chain nodes in the block chain network so that the other block chain nodes perform consensus processing according to the adjacent in-warehouse information and the target ex-warehouse information corresponding to the target equipment identifier; and when the consensus is completed, generating a target block corresponding to the target equipment identification based on the target ex-warehouse information.
And the adjacent warehousing information refers to warehousing information of the target equipment when the target equipment is warehoused for the last time. The device management node may first determine a block corresponding to the target device identifier from the locally stored blocks, and then obtain the neighboring warehousing information from the block corresponding to the target device identifier. For example, the device management node may determine, from the locally stored blocks, a plurality of blocks whose block headers include the target device identifier, then obtain, from the plurality of blocks, a block with the second highest block height, and obtain, from the block with the second highest block height, the neighboring binning information.
Specifically, after the device management node receives the device ex-warehouse request, the device management node may send the target ex-warehouse information to other block link points in the block chain network for consensus processing. The common identification processing of the target ex-warehouse information by the block link points can be consistency verification of the target ex-warehouse information according to adjacent in-warehouse information of the target equipment, and validity verification of the target ex-warehouse information. The consistency verification of the target ex-warehouse information according to the adjacent in-warehouse information may specifically be to verify whether equipment attribution information in the adjacent in-warehouse information is consistent with equipment attribution information in the target ex-warehouse information, and whether equipment attribute information in the adjacent in-warehouse information is consistent with equipment attribute information in the target ex-warehouse information. And when the information is consistent, determining that the target ex-warehouse information passes consistency verification. It is understood that the device is fixedly stored in one location. When the storage positions of the same equipment in the previous warehouse entry and the current warehouse exit are the same, the equipment is not moved randomly between the previous warehouse entry and the current warehouse exit. When the attribute information such as the size of the equipment, the type of the equipment and the like is the same when the same equipment is put in storage for the last time and put out of storage for the current time, the equipment can be further explained to be not moved randomly between the last time of storage and the current time of delivery. The validity verification of the target ex-warehouse information may specifically be verifying the validity of the target ex-warehouse information, whether the target ex-warehouse information is complete, whether the target ex-warehouse information is correct, and the like. The target delivery information which passes the consistency and validity verification is the target delivery information which is complete in record, correct, not tampered and not illegally borrowed. And the block link point performs corresponding hash calculation on the target ex-warehouse information which passes the consistency and validity verification to obtain a corresponding hash value. When the hash values calculated by the block chain nodes exceeding the preset threshold value in the block chain network are consistent, the target ex-warehouse information can be considered to pass the consensus. And then the equipment management node and other block chain nodes can generate a block according to the target ex-warehouse information, the target equipment identification is used as the block head of the block, and the generated block is stored locally. The block stores the target ex-warehouse information of the target device in the current ex-warehouse process, so that the block is the target block corresponding to the target device identifier.
In this embodiment, before generating a target block corresponding to a target device identifier, a consensus process is performed on target ex-warehouse information in a block chain network. When the consensus is completed, the target block corresponding to the target equipment identifier is generated according to the target ex-warehouse information, so that the consistency and the accuracy of data in the target block can be guaranteed.
In one embodiment, before receiving the device warehousing request, the method for device management based on the blockchain further includes: receiving a device allocation request, wherein the device allocation request carries device attribution information corresponding to a target device identifier; and uploading the equipment attribution information to other block chain nodes in the block chain network for consensus, and generating a data block corresponding to the target equipment identifier according to the equipment attribution information when the consensus is completed.
Wherein, the device allocation request is used for requesting allocation of the device and recording the allocation information.
Specifically, when an enterprise or a police team purchases a device, a device allocation request may be triggered by the terminal, and the device allocation request may carry device attribution information corresponding to the target device identifier. The terminal may send a device allocation request to a device management node in the blockchain network. After the device management node receives the device allocation request, the device management node may send the device attribution information to other block link points in the block chain network for consensus processing. The common identification processing performed on the device attribution information by the block link node may be validity verification of the device attribution information, specifically, validity verification of the device attribution information, integrity verification of the device attribution information, correctness verification of the device attribution information, and the like. The device attribution information which passes the validity verification is the device attribution information which is complete in record, correct and has not been tampered. And the block link point performs corresponding hash calculation on the equipment attribution information passing the validity verification to obtain a corresponding hash value. When the hash values calculated by the block chain nodes exceeding the preset threshold value in the block chain network are consistent, the device attribution information can be considered to pass the consensus. And the device management node and other block chain nodes can generate a data block according to the device attribution information, the target device identification is used as a block header of the data block, and the generated data block is stored locally.
In this embodiment, the device affiliation information is first subjected to consensus processing in the block chain network. When the consensus is completed, the data block corresponding to the target equipment identifier is generated according to the equipment attribution information, so that the consistency and the accuracy of the data in the data block can be guaranteed.
In one embodiment, before receiving the device allocation request, the method for device management based on a block chain further includes: receiving equipment attribute information sent by equipment generating nodes in a block chain network, wherein the equipment attribute information comprises a target equipment identifier; and generating an initial block corresponding to the target equipment identifier according to the equipment attribute information.
The initial block is a block locally stored in the blockchain node, and the block header includes the target device identifier and the block with the latest storage time, that is, the first block corresponding to the target device in the blockchain network.
Specifically, when the device manufacturer produces the target device, the device manufacturer may trigger a device production request through the terminal, where the device production request carries the device attribute information of the target device. The terminal may send a device production request to the device production node. The equipment production node can send the equipment attribute information to other block link points for consensus processing. The performing of the consensus processing on the device attribute information by the block link node may be verifying validity of the device attribute information, specifically, verifying validity of the device attribute information, whether the device attribute information is complete, whether the device attribute information is correct, and the like. The device attribute information which passes the validity verification is the device attribute information which is recorded completely, correctly and has not been tampered. And the block link point performs corresponding hash calculation on the equipment attribute information passing the validity verification to obtain a corresponding hash value. When the hash values calculated by the block chain nodes exceeding the preset threshold value in the block chain network are consistent, the device attribute information can be considered to pass the consensus. And then the device management node and other block chain nodes can generate an initial block according to the device attribute information, the target device identifier is used as the block head of the initial block, and the generated initial block is stored locally.
In one embodiment, the blocks corresponding to the devices in the block chain network include an initial block storing device attribute information, a data block storing device attribution information, a data block storing device borrowing information, and a data block storing complete information of the whole process from borrowing to returning of the devices, and the blocks are sequentially generated and stored according to a time sequence. Therefore, the data of the equipment in each stage from production to use in the whole process are stored in the block chain network, the orderliness and the integrity of the data in the block chain network can be guaranteed, the follow-up accurate backtracking of the data is facilitated, and the data of the equipment in any stage can be quickly inquired.
In this embodiment, the device attribute information is first subjected to consensus processing in the block chain network. When the consensus is completed, the initial block corresponding to the target equipment identifier is generated according to the equipment attribute information, so that the consistency and the accuracy of data in the initial block can be guaranteed.
In one embodiment, before uploading the target warehousing information to other block link points in the block chain network for consensus processing, the block chain-based device management method further includes: acquiring a node certificate and an authentication certificate; the node certificate comprises a public key and a private key, and the authentication certificate is used for determining the validity period of the node certificate; generating a node identifier based on the public key; establishing communication connection with other block chain nodes; and based on the communication connection, the public key and the authentication certificate are sent to other block chain nodes, so that the other block chain nodes store the public key and the authentication certificate in an associated manner.
The node certificate is a digital certificate used for verifying the identity of the block chain node. The node certificate may include organization verification information, public and private keys, and the like. The organization verification information may include information such as certificate issuer information, certificate user information, and the like. The private key is used to encrypt data. The public key is used for generating a node identifier and decrypting the data. The authentication certificate is a digital certificate for verifying the validity period of the node certificate, that is, verifying the validity period of the public key and the private key in the node certificate. Both the node certificate and the certificate of authenticity are issued by a specialized, authoritative digital certificate authority. The node identifier is an identifier for uniquely identifying the blockchain node, and may specifically include a character string of at least one character of letters, numbers, and symbols. And addressing the block chain link points through the node identification on the block chain network so as to transmit data, or acquiring a data transmitting party through the node identification.
Specifically, the blockchain node may send a certificate acquisition request to the digital certificate authority, where the certificate acquisition request carries software and hardware information of the blockchain node. And the digital authentication center returns the corresponding node certificate and the authentication certificate to the block link point according to the certificate acquisition request. The blockchain node may obtain a public key in the node certificate as the node identifier. In a blockchain network, TCP (Transmission Control Protocol) communication connection for communication is established and maintained between blockchain link points. According to the TCP connection, the device management node may send the public key in the own node certificate and the corresponding authentication certificate to other blockchain nodes, and of course, the device management node may also receive the public key and the corresponding authentication certificate sent by other blockchain nodes. After the block chain node receives the public key and the corresponding authentication certificate, the public key and the authentication certificate can be stored in an associated mode. Between the block chain nodes, the relevant information of the equipment is transmitted in an encrypted way. The block link points can decrypt the received encrypted data according to the corresponding public keys and verify the identity information of the sending nodes corresponding to the encrypted data, so that the safety of the data is guaranteed.
Referring to fig. 3, fig. 3 is a timing diagram illustrating the establishment of communication links between block link points according to an embodiment. Taking an equipment management node and an equipment supervision node as examples for explanation, the equipment management node acquires a first node certificate and a first authentication certificate corresponding to the equipment management node from a digital authentication center, and the equipment supervision node acquires a second node certificate and a second authentication certificate corresponding to the equipment supervision node from the digital authentication center. The first node certificate includes a first public key and a first private key. The first authentication certificate includes a validity period of the first node certificate. The second node certificate includes a second public key and a second private key. The second authentication certificate includes a validity period of the second node certificate. The equipment management node initiates a TCP connection to the equipment management node, and when the TCP connection is successfully established, the equipment management node returns a connection success notice to the equipment management node. When the system is in fault and the network is abnormal, the equipment management node or the equipment supervision node can actively initiate TCP connection and reestablish communication connection. The device management node obtains the first public key from the first node certificate as a node ID of the device management node, that is, a node identifier corresponding to the device management node. The device supervision node acquires the second public key from the second node certificate as the node ID of the device supervision node, that is, the node identifier corresponding to the device supervision node. The device management node sends the first public key and the first authentication certificate to the device supervision node so that the device supervision node stores the first public key and the first authentication certificate in an associated mode. Subsequently, when the device supervision node receives the encrypted data sent by the device management node and encrypted according to the first private key, the device supervision node can locally acquire the first public key corresponding to the device management node to decrypt the encrypted data. The device supervision node also sends the second public key and the second authentication certificate to the device supervision node so that the device management node stores the second public key and the second authentication certificate in an associated manner. Subsequently, when the device management node receives the encrypted data sent by the device supervision node and encrypted according to the second private key, the device management node can locally acquire a second public key corresponding to the device management node to decrypt the encrypted data.
In one embodiment, uploading the target binned information to other blockchain nodes in a blockchain network for consensus processing includes: encrypting the target warehousing information based on a private key to obtain encrypted information; and sending the encrypted information and the target warehousing information to other block chain nodes to enable other block chain nodes to decrypt the encrypted information based on the public key to obtain decrypted information, and performing consensus processing on the target warehousing information when the target warehousing information is consistent with the decrypted information.
Specifically, the device management node may obtain a private key from the node certificate, and encrypt the target warehousing information according to the private key to obtain encrypted information. And the equipment management node sends the encryption information and the target warehousing information to other block chain nodes together. After receiving the information sent by the device management node, the other block link nodes can locally acquire a public key corresponding to the device management node, and decrypt the encrypted information according to the public key to obtain decrypted information. When the decryption information is consistent with the received target warehousing information, the target warehousing information is determined to be data sent by the equipment management node and the trust node, and then other block chain nodes can perform consensus processing on the target warehousing information. It is understood that the data transmitted between the block nodes can be determined based on the above steps to determine the identity information of the data sender.
In an embodiment, after determining that the public key corresponding to the device management node is invalid according to the authentication certificate corresponding to the device management node, the other blockchain nodes may send a node certificate update request to the device management node to obtain a new public key and an authentication certificate. Of course, the device management node may also actively acquire a new node certificate and a new authentication certificate from the digital authentication center when its own node certificate fails, and actively send the public key in the new node certificate and the new authentication certificate to other blockchain nodes.
In this embodiment, data is encrypted and transmitted between the link points of the block, so that the security of the data can be guaranteed. The block chain node only performs consensus processing on the data sent by the trust node, and the accuracy of the data in the block chain can be further guaranteed.
In one embodiment, as shown in fig. 4, the block link points include an equipment production node and an equipment supervision node, and uploading the target warehousing information to other block link points in the block chain network for consensus processing includes:
step S206A, receiving a first processing result returned by the equipment production node; and the first processing result is that the equipment production node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification to obtain the target ex-warehousing information.
Step S206B, receiving a second processing result returned by the device supervision node; and the second processing result is that the equipment supervision node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification to obtain the target ex-warehousing information.
Step S206C, when the first processing result and the second processing result are consistent, determining that the device management node, the device production node, and the device supervision node agree.
Specifically, the equipment management node sends the target warehousing information to the equipment production node and the equipment supervision node. And after receiving the target warehousing information, the equipment production node acquires corresponding target ex-warehousing information from a target block corresponding to the local target equipment identifier, and compares the target ex-warehousing information with the target warehousing information to verify the effectiveness of the target warehousing information. And when the comparison result of the attribute information of the equipment attribute information in the target ex-warehouse information and the target in-warehouse information is consistent, and the comparison result of the state information of the equipment state information in the target ex-warehouse information and the target in-warehouse information meets the preset condition, determining that the target in-warehouse information passes validity verification. And the equipment production node performs Hash calculation on the locally acquired target ex-warehouse information and the target in-warehouse information which passes validity verification to obtain a first processing result, and returns the first processing result to the equipment management node. The device supervision node obtains a second processing result based on the same operation. And when the first processing result is consistent with the second processing result, determining that the equipment management node, the equipment production node and the equipment supervision node reach consensus. The device management node may send a consensus completion notification to the device production node and the device supervision node to notify the device production node and the device supervision node that consensus on the target warehousing information has been achieved currently. And then the device management node, the device supervision node, and the device production node may trigger generation of the current block according to the target warehousing information and the target ex-warehousing information (i.e., step S206D, when the consensus is completed, the current block corresponding to the target device identifier is generated based on the target ex-warehousing information and the target warehousing information).
In an embodiment, as shown in fig. 5, the target ex-warehouse information and the target in-warehouse information both include device attribute information and device state information, and the validity verification of the received target in-warehouse information according to the target ex-warehouse information in the local target block includes:
step S502, comparing the equipment attribute information in the target ex-warehouse information with the equipment attribute information in the target in-warehouse information to obtain an attribute information comparison result.
Step S504, comparing the equipment state information in the target ex-warehouse information with the equipment state information in the target in-warehouse information to obtain a state information comparison result.
Step S506, when the attribute information comparison result is consistent and the state information comparison result meets the preset condition, determining that the target warehousing information passes validity verification.
Specifically, when the device attribute information in the target ex-warehouse information is consistent with the device attribute information in the target warehousing information, for example, the device identifier, the device type, the device size, and other attribute information are consistent, it is indicated that the target ex-warehouse information and the target warehousing information correspond to the same target device, and the borrowing and returning of the user are the same target device. And when the comparison result of the equipment state information in the target ex-warehouse information and the equipment state information in the target in-warehouse information meets the preset condition, indicating that the use of the target equipment meets the regulation. Therefore, when the attribute information comparison result is consistent and the state information comparison result meets the preset condition, it is determined that the target warehousing information passes the validity verification.
For example, when the target device is a firearm, the device state information in the target warehousing information includes the number of warehousing magazines and the number of warehousing ammunition, and the device state information in the target warehousing information includes the number of warehousing magazines and the number of warehousing ammunition. When the target device is used for shooting training, the preset condition may be that the number of magazines is not changed during warehouse-out and warehouse-in, and the ammunition consumption number during warehouse-out and warehouse-in is within a preset threshold value. When the number of the outgoing magazines is consistent with that of the incoming magazines, the police completely returns the magazines. And when the difference value between the quantity of the outgoing ammunition and the quantity of the warehousing ammunition is within a preset threshold value, the police correctly returns the residual ammunition and does not have private ammunition. Therefore, it is determined that the comparison result of the state information satisfies the preset condition. The preset conditions can be set according to actual needs.
In this embodiment, the validity of the target warehousing information is determined by combining the attribute information comparison result and the state information comparison result, and the validity and the correctness of the target device in the using process can be guaranteed.
In one embodiment, generating a current block corresponding to the target device identifier based on the target ex-warehouse information and the target in-warehouse information includes: generating block head information according to the target equipment identification, and storing the block head information into a block head of the current block; and taking the attribute information comparison result, the state information comparison result, the target ex-warehouse information and the target in-warehouse information as the block body of the current block.
Specifically, the block includes a block head and a block body. After the block link points in the block chain network achieve common identification, the equipment management node can receive the attribute information comparison result and the state information comparison result sent by other block chain nodes, and can also perform information comparison by itself to obtain the attribute information comparison result and the state information comparison result, so that the equipment management node takes the attribute information comparison result, the state information comparison result, the target ex-warehouse information and the target in-warehouse information as the block body of the current block, takes the target equipment identification as the block head of the current block, and finally obtains the current block. Of course, the block header of the current block may further include a hash value obtained by performing hash calculation according to the attribute information comparison result, the state information comparison result, the target ex-warehouse information, and the target in-warehouse information, a receiving time of the target in-warehouse request, a hash value corresponding to a previous block, and a block height corresponding to the current block. The last block refers to a block that is newly stored in the blockchain network, and the device identifier corresponding to the block may be a device identifier of the target device or a device identifier of another device.
In this embodiment, block header information is generated according to the target device identifier, the block header information is stored in the block header of the current block, and the block in which the corresponding device information is stored can be quickly queried through the target device identifier.
In one embodiment, as shown in fig. 6, the method for device management based on a blockchain further includes:
step S602, acquiring adjacent warehousing information corresponding to the target equipment identifier; the neighbor warehousing information includes historical device resource statistics.
Step S604, obtaining the current equipment resource statistical information based on the comparison result of the historical equipment resource statistical information and the state information.
Step S606, obtaining an initial block corresponding to the target device identifier, and obtaining standard device resource statistics information of the target device from the initial block.
Step S608, determining the current device quality status of the target device based on the current device resource statistical information and the standard device resource statistical information.
Step S610, when the current equipment quality state is abnormal, generating equipment abnormity prompting information.
The service life of the equipment is limited, and the quality state of the equipment can be measured according to the equipment resource statistical information of the equipment. For example, when the device is a firearm, the device resource statistics are the total amount of ammunition consumed. When the equipment is a laser sensor, the equipment resource statistical information is the laser emission times. And when the equipment is a transport vehicle, the equipment resource statistical information is the total kilometer traveled. The historical equipment resource statistical information refers to the statistical information of the equipment resources consumed by the equipment before the equipment is taken out of the warehouse. The current equipment resource statistical information refers to the equipment resource statistical information consumed by the equipment after the warehousing. The standard equipment resource statistical information refers to consumable equipment resource statistical information specified in equipment production. The comparison result of the state information obtained based on the warehouse-out information and the warehouse-in information comprises the resource consumption information of the equipment.
Specifically, when the device is put in storage each time, the consumed device resources may be counted to obtain device resource statistical information. When the device enters the warehouse this time, the device management node may obtain the adjacent warehouse entry information corresponding to the target device from the locally stored block, obtain the historical device resource statistical information from the adjacent warehouse entry information, and add the historical device resource statistical information and the comparison result of the state information to obtain the current device resource statistical information. The device management node may obtain standard device resource statistical information of the target device from an initial block corresponding to the target device identifier, determine that the current device quality state of the target device is quality abnormal when a difference between the standard device resource statistical information and the current device resource statistical information is smaller than an early warning value, and determine that the current device quality state of the target device is quality normal when the difference between the standard device resource statistical information and the current device resource statistical information is larger than the early warning value. When the current equipment quality state is abnormal, the equipment management node generates equipment abnormity prompt information according to the target equipment identification, and sends the equipment abnormity prompt information to the preset terminal so as to prompt the user that the target equipment quality is abnormal, and corresponding measures are taken in time so as to avoid unnecessary loss and potential safety hazards. The early warning value can be customized as required, and can be stored in the initial block.
For example, when the target device is a firearm, the historical device resource statistics is the historical total ammunition consumption, that is, the total ammunition consumption of the firearm before the borrowing. And the standard equipment resource statistical information is theoretical ammunition consumption total amount and is used for measuring the quality state of the firearms. The theoretical total ammunition consumption is already determined at the time of firearm production. And adding the historical ammunition consumption total amount and the ammunition consumption amount in the using process to obtain the current ammunition consumption total amount. And when the difference value between the current ammunition consumption total amount and the theoretical ammunition consumption total amount is smaller than the early warning value, determining that the current quality state of the firearm is abnormal in quality. The firearm management node can generate firearm abnormity prompt information according to the firearm identification, and sends the firearm abnormity prompt information to a terminal corresponding to a firearm management police officer so as to prompt the firearm management police officer that the firearm quality corresponding to the firearm identification is seriously reduced and needs to be destroyed or recycled in time, thereby avoiding unnecessary loss and potential safety hazards.
In this embodiment, when the target device enters the warehouse each time, the current device resource statistical information is calculated, and the current device quality state of the target device is determined based on the current device resource statistical information and the standard device resource statistical information. When the current equipment quality state is abnormal, the user can be informed in time, unnecessary loss and potential safety hazards are avoided, and the use safety of the equipment is improved.
In one embodiment, the method for device management based on block chains further includes: receiving a block checking request sent by an equipment supervision node in a block chain network, wherein the block checking request carries the height of a target block corresponding to a block to be checked; the method comprises the steps of obtaining a block to be checked corresponding to the height of a target block locally, sending the block to be checked to an equipment monitoring node, enabling the equipment monitoring node to obtain the target check block corresponding to the height of the target block locally, and determining that the block to be checked passes checking when the block to be checked is consistent with the target check block.
The block check request is used for checking block data.
In particular, a device supervision node in a blockchain network may regularly supervise the block data of other blockchain nodes in the blockchain network. The device supervision node may send a block verification request to other block link nodes in the block chain network, where the block verification request carries a target block height corresponding to a block to be verified. After receiving the block checking request, the device management node may obtain the block to be checked corresponding to the height of the target block from the locally stored blocks, and return the block to be checked to the device monitoring node. The equipment supervision node also acquires a target check block corresponding to the height of the target block from the locally stored blocks. And when the block data of the target check block and the block to be checked are consistent, determining that the block data of the block to be checked is correct, wherein the block to be checked is an effective block and passes the check.
In one embodiment, when the block data of the target parity block and the block to be verified are inconsistent, the device monitoring node may sequentially pull blocks having block heights greater than or equal to the block height corresponding to the block to be verified from the locally stored blocks to form a block set. The device supervision node may return the set of tiles to the device management node. After receiving the block set, the device management node may update the locally stored blocks according to the block set, so as to achieve data consistency. It will be appreciated that the device supervisory node may perform checksum updates on the blocks of the device production node in the same manner as described above.
In this embodiment, the device supervision node checks the block data of other block chain nodes at regular time, so that the consistency of the block data in the block chain network can be ensured.
In one embodiment, the method for device management based on block chains further includes: receiving a first block height sent by other block chain nodes; the first block height is the block height corresponding to the new block which is newly stored locally at the link point of other blocks; acquiring the block height corresponding to the new block newly stored locally as a second block height; and when the first block height is consistent with the second block height, determining that the equipment management node and other block chain link points realize block synchronization.
Specifically, each block link point maintains the block height of the block link point, and broadcasts the current latest block height in the block link network at regular time, so as to realize block synchronization with other block link nodes and ensure the data synchronization in the block link network. And when the local latest block height of the equipment management node is consistent with the local latest block height of the other block link points, determining that the equipment management node and the other block link points realize block synchronization.
Referring to fig. 7, fig. 7 is a timing diagram illustrating block synchronization between block link points according to an embodiment. Taking the device management node and the device supervision node as examples for explanation, the device management node and the device supervision node may broadcast the local latest block heights thereof at regular time. The device supervising node may obtain a block height corresponding to a new block newly stored locally as a first block height, and send the first block height to the device management node, that is, the device supervising node sends the local latest block height to the device management node. After receiving the first block height sent by the equipment supervision node, the equipment management node may obtain a block height corresponding to a new block newly stored locally as a second block height, and determine whether the first block height and the second block height are the same. And when the two are consistent, determining that the equipment management node and the equipment supervision node realize the block synchronization. When the two are not consistent and the latest block height of the equipment management node is smaller than the latest block height of the equipment supervision node, that is, the first block height is larger than the second block height, the equipment management node may send a block acquisition request to the equipment supervision node, where the block acquisition request carries the first block height and the second block height. After receiving the block acquisition request, the device supervision node acquires blocks with the block height between the second block height and the first block height from the locally stored blocks to form a first block set, and sends the first block set to the device management node, so that the device management node locally stores the first block set, namely, the blocks in the first block set are added, and the device management node realizes block synchronization with other block chain nodes. When the two are not consistent and the latest block height of the equipment management node is greater than the latest block height of the equipment supervision node, namely the first block height is smaller than the second block height, the equipment management node acquires blocks with the block heights between the first block height and the second block height from the locally stored blocks to form a second block set, generates a block updating request according to the second block set, and sends the block updating request to the equipment supervision node. After receiving the block update request, the device supervision node locally stores the second block set carried in the block update request, that is, adds blocks in the second block set, so that the device supervision node realizes block synchronization with other block chain nodes.
The application also provides an application scenario applying the device management method based on the block chain. Specifically, the block chain-based device management method is applied to the application scenario as follows:
as shown in fig. 8A, an alliance chain is established according to firearm manufacturers, police teams, and regulatory agencies, which are units of firearm circulation, to form a block chain network, so as to ensure that all related business parties of firearms participate, and each business party can be used as a block chain node, that is, a firearm manufacturer corresponds to a firearm production node, and a police team corresponds to a firearm management node and a regulatory agency corresponds to a firearm regulatory node. The block chain nodes in the whole alliance chain can communicate with each other and share data. Each service party may control a corresponding block link point in the block chain network. The firearm transaction from each link of production, quality inspection, distribution and police force, firearm warehousing-in, warehousing-out, firearm holding use and the like needs to be subjected to consensus processing, and after consensus is completed, block chain link storage is generated to ensure that the firearm from each link of production, quality inspection, distribution and police force, firearm warehousing-in, warehousing-out, firearm holding use and the like all accords with the block chain tracing standard, so that data tracing can be performed in the future. As shown in fig. 8B, when the firearm is shipped from the factory, firearm information such as the identification parameter of the firearm is stored in chain. When the police team buys the firearms, the logistics information, the issuing information, the storage information, the police team information, the firearms library information and other data of the firearms are stored in an uplink mode. When the police officer executes a task or an activity, the use data such as the warehouse-out information and the warehouse-in information of the firearms are linked and stored in real time. As the block chain stores the data of the whole process from production to logistics distribution of firearms and participation of the firearms to the existing police team, the data of any link of the firearms in the whole process can be found through tracing of the block chain. The data is stored in the blockchain in an encrypted manner, for example, using an encryption Algorithm such as SHA-512 (Secure Hash Algorithm-512), SHA-256 (Secure Hash Algorithm-256), and the like.
Through the client provided by the block chain link points corresponding to the unified platform, the gun holding police officer can perform identity registration, police officer information authentication and firearm use process data uploading. The data generated from the entire process of firearm production, deployment and supervision of use by various police teams to use of the firearm with a police officer can be linked up. As shown in fig. 8C, the client includes functional modules such as data overview, node management, smart contract management, private key management, and system management. When the user clicks the "data overview" function module, the client may display an interface corresponding to the data overview function module, as shown in fig. 8C. The data overview function module is used for summarizing and counting the blockchain data, and specifically can display data such as the number of nodes in the blockchain network, the number of deployed intelligent contracts, the number of blocks, the transaction number, key monitoring indexes, node IDs (identities), detailed information of the blocks and transactions and the like, so that a user can quickly know the overall situation of the blockchain network. The node management function module is used for managing node information, and a user can execute operations such as adding, deleting and updating of nodes. The intelligent contract management function module is used for managing the intelligent contracts, and the users can perform operations such as deployment, release and update of the intelligent contracts. The private key management function module is used for managing the private key of the node, and a user can execute operations such as adding, deleting and updating of an encryption algorithm. The system management function module is used for managing interface display of the client, and a user can perform operations such as adding, deleting and updating page elements and the like to adjust page display content.
Referring to fig. 8D, fig. 8D is a flow diagram illustrating a method for shooter management based on blockchain in one embodiment.
1. After the firearms are produced, the firearms production nodes broadcast, identify together and generate block chain chaining storage of the firearms attribute information such as the firearms serial numbers, the production time, the related parameter information and the like of the firearms in the block chain network.
2. After the police team purchases the firearms, the firearms management police match and upload the firearms attribution information such as police team numbers and equipment position numbers corresponding to the firearms management node, and the firearms attribution information is broadcasted, commonly identified and stored in a block chain network to generate blocks and link chains.
3. When the police officer performs tasks or military exercises and other activities related to the use of firearms, the firearms are delivered to the corresponding police officers in an ex-warehouse mode, the firearms management police officers upload ex-warehouse information of the firearms to the firearms management nodes, and the ex-warehouse information is broadcasted, processed in a consensus mode and stored in a block chain network in a generation mode. The firearm management node can also compare the information of the firearms stored in the warehouse last time with the information of the firearms discharged from the warehouse this time, and broadcast, common identification processing and block uplink storage are generated on the comparison result in the block chain network.
4. And after the movement related to using the firearms is finished, the corresponding police officers return the firearms and the firearms are put in storage. And uploading the warehousing information of the firearms to a firearms management node by a firearms management police, broadcasting and identifying the warehousing information in a block chain network through the firearms management node, and generating block uplink storage according to the ex-warehouse information and the warehousing information.
5. The firearm management node can also compare the information of the firearms which are taken out of the warehouse and put in the warehouse at this time, and broadcast, common identification processing and block uplink storage are generated on the comparison result in the block chain network.
6. The data generated by the whole process synchronously share the firearm supervision node, and the use process of the firearm is transparent. The firearm supervision node can supervise the legality and the compliance of the firearms in real time, and ensure the safety and the legality and the compliance of the use of the firearms.
Therefore, in each link of production, quality inspection, distribution and police, warehousing of the firearms, ex-warehouse, holding of the firearms and the like, a management mechanism with higher binding force is formed through cross verification of data, and the use of the firearms becomes more legal and compliant. Based on the attribute that the blockchain records cannot be tampered and shared, the legality and authenticity of the firearms can be effectively ensured. In a blockchain network, if a firearm is lost during transport or is out of order during distribution, the data stored on the distributed book can provide a quick track channel to determine the last activity location of the firearm. In the blockchain network, the output information related to firearms is recorded in detail, and can be embodied into a certain batch, a certain release time and corresponding activity information. When the firearm has a problem or the quality of the firearm is seriously reduced according to data calculation, accurate recall and timely destruction can be realized, and unnecessary loss and hidden danger are avoided.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the above-mentioned flowcharts may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or the stages is not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a part of the steps or the stages in other steps.
In one embodiment, as shown in fig. 9, a blockchain-based device management system is provided that includes a blockchain network consisting of a device management node 902, a device production node 904, and a device supervision node 906;
the device management node 902 is configured to receive a device warehousing request, where the device warehousing request carries target warehousing information of a target device, the target warehousing information includes a target device identifier of the target device, obtain a target block corresponding to the target device identifier, obtain target ex-warehouse information of the target device from the target block, the target block is determined according to the target device identifier and a block height, upload the target ex-warehouse information and the target warehousing information to a device production node 904 and a device supervision node 906 in a block chain network for consensus processing, generate a current block corresponding to the target device identifier based on the target ex-warehouse information and the target warehousing information when the consensus is completed, and store the current block.
In one embodiment, the device production node is further configured to obtain device attribute information, and send the device attribute information to the device management node, where the device attribute information includes a target device identifier; the device management node is further configured to generate an initial block corresponding to the target device identifier according to the device attribute information.
In one embodiment, the device supervision node is further configured to send a block verification request to the device management node, where the block verification request carries a target block height corresponding to a block to be verified; the equipment management node is also used for locally acquiring a block to be checked corresponding to the height of the target block according to the block checking request and sending the block to be checked to the equipment supervision node; the equipment supervision node is further used for locally acquiring a target check block corresponding to the height of the target block, and when the block to be checked is consistent with the target check block, determining that the block to be checked passes the check.
In one embodiment, the device management node is further configured to receive a device ex-warehouse request, where the device ex-warehouse request carries a target device type identifier and device borrowing information, determine the target device identifier and corresponding device storage information according to the target device type identifier and the device borrowing information, and generate the target ex-warehouse information according to the target device identifier, the corresponding device storage information, and the device borrowing information.
In one embodiment, the device management node is further configured to upload the target ex-warehouse information to the device production node and the device supervision node, so that the device production node and the device supervision node perform consensus processing according to the adjacent warehousing information and the target ex-warehouse information corresponding to the target device identifier, and when the consensus is completed, generate a target block corresponding to the target device identifier based on the target ex-warehouse information.
In one embodiment, the device management node is further configured to receive a device allocation request, where the device allocation request carries device attribution information corresponding to the target device identifier, upload the device attribution information to the device production node and the device supervision node to perform consensus processing, and generate a data block corresponding to the target device identifier according to the device attribution information when the consensus is completed.
In one embodiment, the device management node is further configured to obtain a node certificate and an authentication certificate, generate a node identifier based on the public key, establish a communication connection with other blockchain nodes, and send the public key and the authentication certificate to the device production node and the device supervision node based on the communication connection, so that the device production node and the device supervision node store the public key and the authentication certificate in an associated manner; the node certificate comprises a public key and a private key, and the authentication certificate is used for determining the validity period of the node certificate.
In one embodiment, the device management node is further configured to encrypt the target entering information based on a private key to obtain encrypted information, send the encrypted information and the target entering information to other block chain nodes, so that the other block chain nodes decrypt the encrypted information based on the public key to obtain decrypted information, and perform consensus processing on the target entering information when the target entering information is consistent with the decrypted information.
In one embodiment, the device management node is further configured to obtain a first processing result returned by the device production node, obtain a second processing result returned by the device supervision node, and determine that the device management node, the device production node, and the device supervision node agree when the first processing result and the second processing result are consistent; the first processing result is that the equipment production node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, hash calculation is performed on the target ex-warehousing information and the target warehousing information passing the validity verification, and the second processing result is that the equipment supervision node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and hash calculation is performed on the target ex-warehousing information and the target warehousing information passing the validity verification.
In one embodiment, the target ex-warehouse information and the target in-warehouse information both include device attribute information and device state information, the device management node is further configured to compare the device attribute information in the target ex-warehouse information with the device attribute information in the target in-warehouse information to obtain an attribute information comparison result, compare the device state information in the target ex-warehouse information with the device state information in the target in-warehouse information to obtain a state information comparison result, and when the attribute information comparison result is consistent and the state information comparison result meets a preset condition, determine that the target in-warehouse information passes validity verification.
In one embodiment, the device management node is further configured to generate block header information according to the target device identifier, store the block header information in a block header of the current block, and use the attribute information comparison result, the state information comparison result, the target ex-warehouse information, and the target in-warehouse information as the block body of the current block.
In an embodiment, the device management node is further configured to obtain neighboring warehousing information corresponding to the target device identifier, where the neighboring warehousing information includes historical device resource statistical information, obtain current device resource statistical information based on a comparison result of the historical device resource statistical information and the state information, obtain an initial block corresponding to the target device identifier, obtain standard device resource statistical information of the target device from the initial block, determine a current device quality state of the target device based on the current device resource statistical information and the standard device resource statistical information, and generate device abnormality notification information when the current device quality state is abnormal in quality.
In one embodiment, the target device is a target firearm, the target shipment information includes at least one of firearm use specification information, firearm shipment time, firearm ammunition shipment information, borrower information, and shipment information verification officer information, and the target warehousing information includes at least one of firearm warehousing time, firearm ammunition warehousing information, return officer information, and warehousing information verification officer information.
Referring to fig. 10, fig. 10 is a block link point architecture in accordance with an embodiment. The block link nodes include at least one of a device management node, a device supervisory node, and a device production node. The block link node comprises a security application layer, a core protocol layer, a security capability layer and a bottom layer service engine. And the blockchain node performs data interaction and data sharing with the outside (a client or other blockchain nodes) through a security application layer. The core protocol layer is a core function layer of the blockchain node. The distributed identity service in the core protocol layer is used for cross checking data generated in each link in the using process of the equipment, and the data stored in the block chain is guaranteed to be credible data. Multi-source data collection in distributed identity services refers to the collection of data sent by various business parties. The multi-source identity authentication in the distributed identity service means that the identity information of data is confirmed through data cross check. When the data passes the multi-source identity authentication, the data is indicated to be credible data, and the data passing the multi-source identity authentication is identified through the credible identification. The data stored on the final blockchain is trusted data. The big data model in the core protocol layer is used for recording the full-flow data used by the equipment. Authorization in a distributed identity service refers to allowing a third party (e.g., outsourced manufacturer of firearms, etc.) to upload data by authorizing a login to a corresponding client. The intelligent contract in the core protocol layer is used for verifying the validity of data, can carry out uplink storage on the data generated in each link in the using process of the equipment, and automatically carries out uplink verification on each link. For example, when the firearm is equipped and issued, the data generated during use is uploaded to a block chain for storage, the gun using process is transparentized and is mutually contrasted with the records on the block chain to ensure the legality and compliance of the firearm in the using process, and meanwhile, the supervision requirement is met. The unified identity authentication in the core protocol layer is used for confirming the identity information of the nodes and the node operators. The data security cipher security in the core protocol layer is used for encrypting data transmitted between nodes to ensure the security of data transmission. The safety layer provides related safety services such as safety audit, node safety service, identity safety authentication service, behavior logs and the like, provides related safety service guarantee for the block chain network, and ensures the safety and credibility of data stored in the block chain and the safety and reliability of safety application layer business service. The safety audit is that authority audit is carried out on each link in the using process of the equipment, and the audit and the nomination audit are carried out on each link in the whole process. The node security service checks the node authority, and ensures the security and the reliability of the node data source. The node identity authentication service is used for verifying and verifying the authority of the node operation data personnel, so that the safety and the reliability of a client data source are ensured. The behavior log is used for recording the block chain node behavior. The underlying service engine provides the runtime environment and the underlying components needed for the blockchain network to function properly.
In one embodiment, as shown in fig. 11, there is provided a device management apparatus based on a blockchain, where the apparatus may adopt a software module or a hardware module, or a combination of the two modules as a part of a computer device, and the apparatus specifically includes: a request receiving module 1102, an information obtaining module 1104, a block generating module 1106 and a block storing module 1108, wherein:
a request receiving module 1102, configured to receive a device warehousing request; the equipment warehousing request carries target warehousing information of the target equipment, and the target warehousing information comprises a target equipment identifier of the target equipment.
The information acquisition module 1104 is configured to acquire a target block corresponding to the target device identifier, and acquire target ex-warehouse information of the target device from the target block; the target block is determined according to the target equipment identifier and the block height; .
A block generating module 1106, configured to upload the target warehousing information to other block link points in the block link network for consensus processing, and when the consensus is completed, generate a current block corresponding to the target device identifier based on the target warehousing information and the target warehousing information.
A block storage module 1108, configured to store the current block.
In one embodiment, the request receiving module is further configured to receive an equipment ex-warehouse request, where the equipment ex-warehouse request carries the target equipment type identifier and the equipment borrowing information; the information acquisition module is also used for determining a target device identifier and corresponding device storage information according to the target device type identifier and the device borrowing information; and generating target ex-warehouse information according to the target equipment identification, the corresponding equipment storage information and the equipment borrowing information.
In one embodiment, the block generation module is further configured to upload the target ex-warehouse information to other block chain nodes in the block chain network, so that the other block chain nodes perform consensus processing according to the target equipment identifier and the adjacent in-warehouse information corresponding to the target equipment identifier; and when the consensus is completed, generating a target block corresponding to the target equipment identification based on the target ex-warehouse information.
In one embodiment, the request receiving module is further configured to receive a device allocation request, where the device allocation request carries device attribution information corresponding to the target device identifier; the block generation module is further used for uploading the equipment attribution information to other block link points in the block chain network for consensus processing, and when the consensus is completed, a data block corresponding to the target equipment identifier is generated according to the equipment attribution information.
In one embodiment, the request receiving module is further configured to receive device attribute information sent by a device generating node in the blockchain network, where the device attribute information includes a target device identifier; the block generation module is further used for generating an initial block corresponding to the target device identifier according to the device attribute information.
In one embodiment, the information obtaining module is further configured to obtain a node certificate and an authentication certificate, where the node certificate includes a public key and a private key, and the authentication certificate is used to determine a validity period of the node certificate, generate a node identifier based on the public key, establish a communication connection with other blockchain nodes, and send the public key and the authentication certificate to the other blockchain nodes based on the communication connection, so that the other blockchain nodes store the public key and the authentication certificate in an associated manner.
In one embodiment, the block generation module is further configured to encrypt the target entering information based on a private key to obtain encrypted information, send the encrypted information and the target entering information to other block chain nodes, so that the other block chain nodes decrypt the encrypted information based on the public key to obtain decrypted information, and perform consensus processing on the target entering information when the target entering information is consistent with the decrypted information.
In one embodiment, the block link points include an equipment production node and an equipment supervision node, and the block generation module is further configured to obtain a first processing result returned by the equipment production node; the first processing result is that the equipment production node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification to obtain the target ex-warehousing information; acquiring a second processing result returned by the equipment supervision node; the second processing result is that the equipment supervision node performs validity verification on the received target warehousing information according to the target ex-warehousing information in the local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification to obtain the target ex-warehousing information; and when the first processing result is consistent with the second processing result, determining that the equipment management node, the equipment production node and the equipment supervision node reach consensus.
In one embodiment, the target ex-warehouse information and the target in-warehouse information both include device attribute information and device state information, and the block generation module is further configured to compare the device attribute information in the target ex-warehouse information with the device attribute information in the target in-warehouse information to obtain an attribute information comparison result; comparing the equipment state information in the target ex-warehouse information with the equipment state information in the target in-warehouse information to obtain a state information comparison result; and when the attribute information comparison result is consistent and the state information comparison result meets the preset condition, determining that the target warehousing information passes validity verification.
In one embodiment, the block generating module is further configured to generate block header information according to the target device identifier, and store the block header information in a block header of the target block; and taking the attribute information comparison result, the state information comparison result, the target ex-warehouse information and the target in-warehouse information as the block body of the target block.
In one embodiment, the apparatus for device management based on block chains further includes:
the state determining module is used for acquiring adjacent warehousing information corresponding to the target equipment identifier; the adjacent warehousing information comprises historical equipment resource statistical information; obtaining current equipment resource statistical information based on the historical equipment resource statistical information and the state information comparison result; acquiring an initial block corresponding to the target equipment identifier, and acquiring standard equipment resource statistical information of the target equipment from the initial block; determining the current equipment quality state of the target equipment based on the current equipment resource statistical information and the standard equipment resource statistical information; and when the current equipment quality state is abnormal, generating equipment abnormity prompt information.
In one embodiment, the apparatus for device management based on block chains further includes:
the block checking module is used for receiving a block checking request sent by an equipment supervision node in a block chain network, wherein the block checking request carries the height of a target block corresponding to a block to be checked; the method comprises the steps of obtaining a block to be checked corresponding to the height of a target block locally, sending the block to be checked to an equipment monitoring node, enabling the equipment monitoring node to obtain the target check block corresponding to the height of the target block locally, and determining that the block to be checked passes checking when the block to be checked is consistent with the target check block.
In one embodiment, the block check module is further configured to receive a first block height sent by other blockchain nodes; the first block height is the block height corresponding to the new block which is newly stored locally at the link point of other blocks; acquiring the block height corresponding to the new block newly stored locally as a second block height; and when the first block height is consistent with the second block height, determining that the equipment management node and other block chain link points realize block synchronization.
In one embodiment, the target device is a target firearm, the target shipment information includes at least one of firearm use specification information, firearm shipment time, firearm ammunition shipment information, borrower information, and shipment information verification officer information, and the target warehousing information includes at least one of firearm warehousing time, firearm ammunition warehousing information, return officer information, and warehousing information verification officer information.
For specific definition of the device management apparatus based on the block chain, reference may be made to the above definition of the device management method based on the block chain, and details are not described here. The modules in the device management apparatus based on the block chain may be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 12. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data such as warehousing information and ex-warehouse information of the equipment. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a blockchain based device management method.
Those skilled in the art will appreciate that the architecture shown in fig. 12 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (15)

1. A device management method based on a block chain is applied to a device management node in a block chain network, and the method comprises the following steps:
receiving a device warehousing request; the equipment warehousing request carries target warehousing information of target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment;
acquiring a target block corresponding to the target equipment identifier, and acquiring target ex-warehouse information of the target equipment from the target block; the target block is determined according to the target equipment identifier and the block height;
uploading the target warehousing information to other block chain nodes in the block chain network for consensus processing, and generating a current block corresponding to the target equipment identification based on the target ex-warehousing information and the target warehousing information when consensus is completed;
storing the current block.
2. The method of claim 1, wherein prior to receiving the device-in-storage request, the method further comprises:
receiving an equipment ex-warehouse request, wherein the equipment ex-warehouse request carries the type identification of the target equipment and equipment borrowing information;
determining the target equipment identifier and corresponding equipment storage information according to the target equipment type identifier and the equipment borrowing information;
and generating the target ex-warehouse information according to the target equipment identification, the corresponding equipment storage information and the equipment borrowing information.
3. The method of claim 2, wherein after generating the target outbound information based on the target device identification, corresponding device storage information, and device borrowing information, the method further comprises:
uploading the target ex-warehouse information to other block chain nodes in the block chain network so that the other block chain nodes perform consensus processing according to adjacent in-warehouse information corresponding to the target equipment identifier and the target ex-warehouse information;
and when the consensus is completed, generating the target block corresponding to the target equipment identification based on the target ex-warehouse information.
4. The method of claim 2, wherein prior to receiving the device outbound request, the method further comprises:
receiving device attribute information sent by a device generating node in the blockchain network, wherein the device attribute information comprises the target device identifier;
and generating an initial block corresponding to the target equipment identifier according to the equipment attribute information.
5. The method according to claim 1, wherein the blockchain nodes include an equipment production node and an equipment supervision node, and the uploading the target-binned information to other blockchain nodes in the blockchain network for consensus processing includes:
receiving a first processing result returned by the equipment production node; the first processing result is that the equipment production node performs validity verification on the received target warehousing information according to target ex-warehousing information in a local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification;
receiving a second processing result returned by the equipment supervision node; the second processing result is that the equipment supervision node performs validity verification on the received target warehousing information according to target ex-warehousing information in a local target block, and performs hash calculation on the target ex-warehousing information and the target warehousing information passing the validity verification;
when the first processing result is consistent with the second processing result, determining that the equipment management node, the equipment production node and the equipment supervision node achieve consensus.
6. The method according to claim 5, wherein the target ex-warehouse information and the target in-warehouse information both include device attribute information and device status information, and the validity verification of the received target in-warehouse information according to the target ex-warehouse information in the local target block includes:
comparing the equipment attribute information in the target ex-warehouse information with the equipment attribute information in the target in-warehouse information to obtain an attribute information comparison result;
comparing the equipment state information in the target ex-warehouse information with the equipment state information in the target in-warehouse information to obtain a state information comparison result;
and when the attribute information comparison result is consistent and the state information comparison result meets a preset condition, determining that the target warehousing information passes validity verification.
7. The method according to claim 6, wherein the generating a current block corresponding to the target device identifier based on the target ex-warehouse information and the target in-warehouse information comprises:
generating block header information according to the target equipment identification, and storing the block header information into a block header of the current block;
and taking the attribute information comparison result, the state information comparison result, the target ex-warehouse information and the target in-warehouse information as the block body of the current block.
8. The method of claim 6, further comprising:
acquiring adjacent warehousing information corresponding to the target equipment identification; the adjacent warehousing information comprises historical equipment resource statistical information;
obtaining current equipment resource statistical information based on the historical equipment resource statistical information and the state information comparison result;
acquiring an initial block corresponding to the target equipment identifier, and acquiring standard equipment resource statistical information of the target equipment from the initial block;
determining a current device quality state of the target device based on the current device resource statistical information and standard device resource statistical information;
and when the current equipment quality state is abnormal, generating equipment abnormity prompt information.
9. The method of claim 1, further comprising:
receiving a block checking request sent by an equipment supervision node in the block chain network, wherein the block checking request carries a target block height corresponding to a block to be checked;
and locally acquiring a to-be-checked block corresponding to the height of the target block, and sending the to-be-checked block to the equipment monitoring node, so that the equipment monitoring node locally acquires the target check block corresponding to the height of the target block, and when the to-be-checked block is consistent with the target check block, determining that the to-be-checked block passes the check.
10. The method of claim 1, further comprising:
receiving a first block height sent by other block chain nodes; the first block height is the block height corresponding to the new block which is locally and newly stored by the link points of the other blocks;
acquiring the block height corresponding to the new block newly stored locally as a second block height;
when the first block height and the second block height are consistent, determining that the equipment management node and the other block link points realize block synchronization.
11. The method of claim 1, wherein the target device is a target firearm, the target shipment information comprises at least one of firearm use description information, firearm shipment time, firearm ammunition shipment information, borrowing police information, and shipment information verification police information, and the target warehousing information comprises at least one of firearm warehousing time, firearm ammunition warehousing information, return police information, and warehousing information verification police information.
12. An apparatus for device management based on blockchains, the apparatus comprising:
the request receiving module is used for receiving equipment warehousing requests; the equipment warehousing request carries target warehousing information of target equipment, wherein the target warehousing information comprises a target equipment identifier of the target equipment;
the information acquisition module is used for acquiring a target block corresponding to the target equipment identifier and acquiring target ex-warehouse information of the target equipment from the target block; the target block is determined according to the target equipment identifier and the block height;
the block generation module is used for uploading the target warehousing information to other block chain nodes in a block chain network for consensus processing, and when consensus is completed, a current block corresponding to the target equipment identifier is generated based on the target ex-warehousing information and the target warehousing information;
and the block storage module is used for storing the current block.
13. A device management system based on a block chain is characterized by comprising a block chain network consisting of a device management node, a device production node and a device supervision node;
the device management node is used for receiving a device warehousing request, wherein the device warehousing request carries target warehousing information of a target device, the target warehousing information comprises a target device identification of the target device, a target block corresponding to the target device identification is obtained, target ex-warehouse information of the target device is obtained from the target block, the target block is determined according to the target device identification and a block height, the target ex-warehouse information and the target warehousing information are uploaded to a device production node and a device supervision node in the block chain network for consensus processing, when the consensus is completed, a current block corresponding to the target device identification is generated based on the target ex-warehouse information and the target warehousing information, and the current block is stored.
14. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 11 when executing the computer program.
15. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 11.
CN202010702567.9A 2020-07-21 2020-07-21 Block chain-based equipment management method and device and computer equipment Expired - Fee Related CN111737360B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010702567.9A CN111737360B (en) 2020-07-21 2020-07-21 Block chain-based equipment management method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010702567.9A CN111737360B (en) 2020-07-21 2020-07-21 Block chain-based equipment management method and device and computer equipment

Publications (2)

Publication Number Publication Date
CN111737360A true CN111737360A (en) 2020-10-02
CN111737360B CN111737360B (en) 2020-12-15

Family

ID=72655314

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010702567.9A Expired - Fee Related CN111737360B (en) 2020-07-21 2020-07-21 Block chain-based equipment management method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN111737360B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328693A (en) * 2020-11-16 2021-02-05 杭州复杂美科技有限公司 Block synchronization method, device and storage medium
CN112418859A (en) * 2020-12-04 2021-02-26 腾讯科技(深圳)有限公司 Block chain consensus method and device, electronic equipment and readable storage medium
CN112488632A (en) * 2020-12-15 2021-03-12 欧冶云商股份有限公司 High-reliability steel goods hanging identification method and system based on block chain storage verification
CN112487065A (en) * 2020-12-09 2021-03-12 中国联合网络通信集团有限公司 Data retrieval method and device
CN112528323A (en) * 2020-12-09 2021-03-19 联通(浙江)产业互联网有限公司 Data processing method and device
CN113204599A (en) * 2021-07-02 2021-08-03 深圳百里科技有限公司 Equipment monitoring method and device based on Internet of things, monitoring equipment and storage medium
CN113259384A (en) * 2021-06-18 2021-08-13 航天云网数据研究院(广东)有限公司 Mechanism model call information processing method, server and system based on block chain
CN113592339A (en) * 2021-08-09 2021-11-02 四川长虹智能制造技术有限公司 Cargo information calibration system and method and electronic equipment
CN115936732A (en) * 2023-01-06 2023-04-07 北京志行正科技有限公司 Plate management method, device, equipment and medium based on block chain

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160261690A1 (en) * 2015-03-02 2016-09-08 Dell Products L.P. Computing device configuration and management using a secure decentralized transaction ledger
CN107705203A (en) * 2017-08-08 2018-02-16 迅鳐成都科技有限公司 Financial Information sharing method in a kind of steel transaction based on block chain
CN109391510A (en) * 2018-08-13 2019-02-26 杭州复杂美科技有限公司 A kind of malfunctioning node detection method and system, equipment and can storage medium
CN109710823A (en) * 2018-11-02 2019-05-03 远光软件股份有限公司 Archive management method, file administration network and electronic equipment based on block chain
CN110287261A (en) * 2019-06-28 2019-09-27 浪潮卓数大数据产业发展有限公司 A kind of fixed corporate assets management method based on block chain
CN110708170A (en) * 2019-12-13 2020-01-17 腾讯科技(深圳)有限公司 Data processing method and device and computer readable storage medium
CN110851423A (en) * 2019-11-12 2020-02-28 北京芯际科技有限公司 Block chain-based system for building logistics platform of medium and small enterprises and operation method thereof
CN110955691A (en) * 2019-11-19 2020-04-03 华中科技大学 Book drifting method and system based on block chain technology
CN111031036A (en) * 2019-12-12 2020-04-17 深圳大学 Block chain-based vaccine information monitoring method and device and computer equipment
US20200151817A1 (en) * 2018-11-09 2020-05-14 Refinitiv Us Organization Llc Tokenized commodity for multipart transactions validated by a peer-to-peer network of nodes

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160261690A1 (en) * 2015-03-02 2016-09-08 Dell Products L.P. Computing device configuration and management using a secure decentralized transaction ledger
CN107705203A (en) * 2017-08-08 2018-02-16 迅鳐成都科技有限公司 Financial Information sharing method in a kind of steel transaction based on block chain
CN109391510A (en) * 2018-08-13 2019-02-26 杭州复杂美科技有限公司 A kind of malfunctioning node detection method and system, equipment and can storage medium
CN109710823A (en) * 2018-11-02 2019-05-03 远光软件股份有限公司 Archive management method, file administration network and electronic equipment based on block chain
US20200151817A1 (en) * 2018-11-09 2020-05-14 Refinitiv Us Organization Llc Tokenized commodity for multipart transactions validated by a peer-to-peer network of nodes
CN110287261A (en) * 2019-06-28 2019-09-27 浪潮卓数大数据产业发展有限公司 A kind of fixed corporate assets management method based on block chain
CN110851423A (en) * 2019-11-12 2020-02-28 北京芯际科技有限公司 Block chain-based system for building logistics platform of medium and small enterprises and operation method thereof
CN110955691A (en) * 2019-11-19 2020-04-03 华中科技大学 Book drifting method and system based on block chain technology
CN111031036A (en) * 2019-12-12 2020-04-17 深圳大学 Block chain-based vaccine information monitoring method and device and computer equipment
CN110708170A (en) * 2019-12-13 2020-01-17 腾讯科技(深圳)有限公司 Data processing method and device and computer readable storage medium

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328693A (en) * 2020-11-16 2021-02-05 杭州复杂美科技有限公司 Block synchronization method, device and storage medium
CN112418859A (en) * 2020-12-04 2021-02-26 腾讯科技(深圳)有限公司 Block chain consensus method and device, electronic equipment and readable storage medium
CN112487065A (en) * 2020-12-09 2021-03-12 中国联合网络通信集团有限公司 Data retrieval method and device
CN112528323A (en) * 2020-12-09 2021-03-19 联通(浙江)产业互联网有限公司 Data processing method and device
CN112488632A (en) * 2020-12-15 2021-03-12 欧冶云商股份有限公司 High-reliability steel goods hanging identification method and system based on block chain storage verification
CN113259384A (en) * 2021-06-18 2021-08-13 航天云网数据研究院(广东)有限公司 Mechanism model call information processing method, server and system based on block chain
CN113259384B (en) * 2021-06-18 2021-11-26 航天云网数据研究院(广东)有限公司 Mechanism model call information processing method, server and system based on block chain
CN113204599A (en) * 2021-07-02 2021-08-03 深圳百里科技有限公司 Equipment monitoring method and device based on Internet of things, monitoring equipment and storage medium
CN113592339A (en) * 2021-08-09 2021-11-02 四川长虹智能制造技术有限公司 Cargo information calibration system and method and electronic equipment
CN115936732A (en) * 2023-01-06 2023-04-07 北京志行正科技有限公司 Plate management method, device, equipment and medium based on block chain

Also Published As

Publication number Publication date
CN111737360B (en) 2020-12-15

Similar Documents

Publication Publication Date Title
CN111737360B (en) Block chain-based equipment management method and device and computer equipment
CN109639632B (en) User information management method based on block chain, electronic equipment and storage medium
JP7199775B2 (en) Data processing method, data processing device, node device, and computer program based on smart contract
CN111970129B (en) Data processing method and device based on block chain and readable storage medium
CN112311735B (en) Credible authentication method, network equipment, system and storage medium
CN110008720B (en) Dynamic data tracing method and device for Internet of things based on alliance chain
CN110795755B (en) Building project scene type evidence storing and non-tampering method and system based on block chain
CN110602455B (en) Video storage system, video processing method, device, equipment and storage medium
CN110096903B (en) Asset verification method based on block chain and block chain network system
CN108989118B (en) Enterprise-level private block chain deployment tool based on GO language
US11757884B2 (en) Method and system for controlling the release of a resource
CN113256297B (en) Data processing method, device and equipment based on block chain and readable storage medium
US11303446B2 (en) Prevention of majority attacks
CN112527912A (en) Data processing method and device based on block chain network and computer equipment
US20210109776A1 (en) Free-riding node identification for blockchain
CN117040896A (en) Internet of things management method and Internet of things management platform
KR20230005353A (en) Sanctioned Events in a Decentralized Database
CN114003959A (en) Decentralized identity information processing method, device and system
CN108924089A (en) A kind of client device recognition methods, device and client device
CN117407437A (en) Block chain-based data processing method, equipment and readable storage medium
CN109495246B (en) Method for verifying federated link node
CN112102118A (en) Collaborative law enforcement and case handling method based on block chain
CN116596551A (en) Supply chain product tracing method based on block chain, storage medium and electronic equipment
Chinthamu et al. Self-Secure firmware model for Blockchain-Enabled IOT environment to Embedded system
US20230208640A1 (en) Selective audit process for privacy-preserving blockchain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40030748

Country of ref document: HK

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20201215