CN115860757A - Energy data tracing method and device based on block chain technology - Google Patents

Energy data tracing method and device based on block chain technology Download PDF

Info

Publication number
CN115860757A
CN115860757A CN202211149063.4A CN202211149063A CN115860757A CN 115860757 A CN115860757 A CN 115860757A CN 202211149063 A CN202211149063 A CN 202211149063A CN 115860757 A CN115860757 A CN 115860757A
Authority
CN
China
Prior art keywords
data
uplink data
energy
tracing
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211149063.4A
Other languages
Chinese (zh)
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.)
State Grid Corp of China SGCC
State Grid Jibei Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
State Grid Jibei Electric Power 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 State Grid Corp of China SGCC, State Grid Jibei Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN202211149063.4A priority Critical patent/CN115860757A/en
Publication of CN115860757A publication Critical patent/CN115860757A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides an energy data tracing method and device based on a block chain technology, wherein the method comprises the following steps: according to the acquired service uplink data and the service attribute information, energy uplink data are constructed; encrypting the energy uplink data and uploading the encrypted data to a block chain; receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label; according to the tracing transaction label, tracing data are inquired from the block chain, and the energy uplink data are stored in the block chain in an encrypted manner, so that the credibility and the integrity of the data can be ensured, the problems of single-point failure and asymmetric information are solved, and the data tracing can be efficiently carried out.

Description

Energy data tracing method and device based on block chain technology
Technical Field
The invention relates to the technical field of electric power, in particular to an energy data tracing method and device based on a block chain technology.
Background
A Vehicle to Grid (V2G for short) electric Vehicle power transaction system comprises a charging pile user and an electric Vehicle user, and electric Vehicle energy data can be stored in the V2G power transaction. The electric vehicle charging and discharging transaction system in the related art adopts a centralized storage and management mode, the mode has the weakness of being limited by a credit-based mode, and a central server has the problem of benefit trend to modify storage, so that the credibility and integrity of data are poor. In addition, there is a single point of failure problem, and when the central server fails, the system goes down. The existing system data is stored in a database log, an information isolated island is easy to form, data tracing is difficult to perform, and the problem of information asymmetry exists.
Disclosure of Invention
The invention aims to provide an energy data tracing method based on a block chain technology, which is used for encrypting and storing energy uplink data in a block chain, so that the credibility and the integrity of the data can be ensured, the problems of single-point failure and asymmetric information are solved, and the data tracing can be efficiently carried out. Another object of the present invention is to provide an energy data tracing apparatus based on the block chain technology. It is yet another object of the present invention to provide a computer readable medium. It is a further object of the present invention to provide a computer apparatus.
In order to achieve the above object, the present invention discloses an energy data tracing method based on a block chain technology, including:
according to the acquired service uplink data and the service attribute information, energy uplink data are constructed;
encrypting the energy uplink data and uploading the encrypted data to a block chain;
receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label;
and querying the tracing data from the blockchain according to the tracing transaction label.
Preferably, the constructing the energy uplink data according to the acquired service uplink data and the service attribute information includes:
acquiring service uplink data and service attribute information;
according to the business uplink data and the business attribute information, structured traceability data are constructed;
and generating the energy uplink data according to the acquired last block address and the structured source tracing data.
Preferably, the acquiring the uplink service data includes:
acquiring service information;
performing hash calculation on the service information to obtain a service hash value;
and generating service uplink data according to the service information and the service hash value.
Preferably, the constructing the structured tracing data according to the service uplink data and the service attribute information includes:
and constructing structured traceability data according to the business uplink data and the business attribute information through a data traceability description model.
Preferably, before encrypting and uploading the energy uplink data to the blockchain, the method further includes:
checking the energy uplink data through an intelligent contract;
and if the verification is passed, continuing to perform the steps of encrypting the energy uplink data and uploading the encrypted data to the block chain.
Preferably, the encrypting and uploading the energy uplink data to the blockchain includes:
encrypting the energy uplink data through an encryption algorithm to obtain encrypted energy uplink data and a secret key encryption value;
and uploading the key encryption value and the encrypted energy uplink data to a block chain.
Preferably, the energy uplink data comprises a current transaction label;
after the energy uplink data is encrypted and uploaded to the block chain, the method further comprises the following steps:
receiving a block address returned by the block chain;
and binding and storing the block address and the current transaction label.
Preferably, the querying the traceability data from the blockchain according to the traceability transaction label comprises:
inquiring a corresponding block address according to the source tracing transaction label;
acquiring encrypted uplink data and a corresponding key encryption value according to the block address;
and decrypting the encrypted uplink data according to the key encryption value through a decryption algorithm to obtain the tracing data.
The invention also discloses an energy data tracing device based on the block chain technology, which comprises the following components:
the building unit is used for building the energy uplink data according to the obtained service uplink data and the service attribute information;
the uploading unit is used for encrypting the energy uplink data and uploading the encrypted energy uplink data to the block chain;
the system comprises a receiving unit, a transaction processing unit and a transaction processing unit, wherein the receiving unit is used for receiving a tracing request sent by a user, and the tracing request comprises a tracing transaction label;
and the query unit is used for querying the traceability data from the block chain according to the traceability transaction label.
Preferably, the building unit is specifically configured to obtain service uplink data and service attribute information; according to the business uplink data and the business attribute information, structured traceability data are constructed; and generating the energy uplink data according to the acquired last block address and the structured source tracing data.
Preferably, the construction unit is specifically configured to obtain the service information; performing hash calculation on the service information to obtain a service hash value; and generating service uplink data according to the service information and the service hash value.
Preferably, the building unit is specifically configured to build the structured traceability data according to the service uplink data and the service attribute information through the data traceability description model.
Preferably, the apparatus further comprises:
the checking unit is used for checking the energy uplink data through the intelligent contract; if the verification is passed, the uploading unit is triggered to continue to execute the steps of encrypting the energy uplink data and uploading the encrypted energy uplink data to the block chain.
Preferably, the uploading unit is specifically configured to encrypt the energy uplink data through an encryption algorithm to obtain a key encryption value and encrypted energy uplink data; and uploading the encrypted key encryption value and the encrypted energy uplink data to the block chain.
Preferably, the energy uplink data includes a current transaction label; the device still includes:
the receiving unit is also used for receiving the block address returned by the block chain;
and the binding storage unit is used for binding and storing the block address and the current transaction label.
Preferably, the query unit is specifically configured to query a corresponding block address according to the source tracing transaction label; acquiring encrypted uplink data and a corresponding key encryption value according to the block address; and decrypting the encrypted uplink data according to the key encryption value through a decryption algorithm to obtain the tracing data.
The invention also discloses a computer-readable medium, on which a computer program is stored which, when executed by a processor, implements a method as described above.
The invention also discloses a computer device comprising a memory for storing information comprising program instructions and a processor for controlling the execution of the program instructions, the processor implementing the method as described above when executing the program.
The invention also discloses a computer program product comprising computer programs/instructions which, when executed by a processor, implement the method as described above.
According to the acquired business uplink data and the business attribute information, energy uplink data are constructed; encrypting the energy uplink data and uploading the encrypted data to a block chain; receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label; according to the tracing transaction label, tracing data are inquired from the block chain, and the energy uplink data are stored in the block chain in an encrypted manner, so that the credibility and the integrity of the data can be ensured, the problems of single-point failure and asymmetric information are solved, and the data tracing can be efficiently carried out.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of an architecture of an energy data tracing system based on a block chain technology according to an embodiment of the present invention;
fig. 2 is a schematic diagram of technical type selection in a system architecture according to an embodiment of the present invention;
fig. 3 is a flowchart of an energy data tracing method based on a block chain technique according to an embodiment of the present invention;
fig. 4 is a flowchart of another energy data tracing method based on the block chain technique according to an embodiment of the present invention;
fig. 5 is a logic diagram of an encryption algorithm based on SM4 and SM2 according to an embodiment of the present invention;
fig. 6 is a schematic view illustrating a full flow of uplink transmission of service data according to an embodiment of the present invention;
fig. 7 is a logic diagram of a decryption algorithm based on SM4 and SM2 according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an energy data tracing apparatus based on a block chain technique according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to facilitate understanding of the technical solutions provided in the present application, the following first describes relevant contents of the technical solutions in the present application. The V2G electric automobile electric power transaction system comprises a charging pile user and an electric automobile user. The charging pile users comprise individual charging pile users and operated public charging users, and the electric vehicle users comprise new energy vehicle users and V2G vehicle users. In the V2G power trading, electric vehicles are not simple energy consumers but production investment consumers. When the power consumption of the power grid is in a low ebb, the electric automobile purchases electricity from a charging pile user; when the power consumption of the power grid is in a peak, the electric automobile sells the electric power purchased in the valley to the charging pile user, and the income is obtained from the electric power.
The invention provides an energy data tracing method based on a block chain technology, which aims to meet the requirement of tracing data in the transaction process of an electric vehicle, and mainly aims at data tracing of business information generated in the transaction process of the electric vehicle. The following is a brief description of the business data that may be generated during the transaction:
in the transaction preparation process, a charging pile user serves as a transaction initiator, logs in a transaction system and sends information to be transacted, wherein the information to be transacted comprises but is not limited to transaction cost and service cost of an electric vehicle; after the successful release, the current node broadcasts to all the block link nodes, and finally generated service information of the information to be transacted includes but is not limited to a transaction initiator, the transaction cost of the electric vehicle, the service cost and the release time.
The electric automobile user serves as a transaction response party and submits an electric power transaction request to the charging pile user through the transaction system according to self transaction requirements. The transaction request includes transaction electricity amount and transaction electricity price information. And performing feasibility verification on the transaction request, if the verification is passed, broadcasting the transaction request to all the block link points by the current node, and finally generating service information of the transaction request, wherein the service information comprises but is not limited to a transaction initiator, a transaction responder, transaction electric quantity, electric vehicle transaction cost, service cost and declaration time. As an alternative, the feasibility verification: when the transaction is an electric vehicle charging transaction, when the transaction electric quantity of a user is smaller than the residual electric quantity of the charging pile, the request is successful; otherwise, the request fails, and the user re-declares the transaction electric quantity; when the transaction is an electric vehicle discharge transaction, judging whether the transaction electric quantity of a user is smaller than the maximum chargeable quantity of the charging pile (the charging pile stores the maximum electric quantity-the charging pile residual electric quantity), if so, successfully requesting; if not, the request fails, and the user re-declares the transaction electric quantity.
The charging pile user serves as a transaction initiator, initiates a confirmed transaction message, generates business information of transaction uplink information including but not limited to the transaction initiator, a transaction responder, transaction electric quantity, electric vehicle transaction cost, service cost and transaction time, and broadcasts to all block link points by the current node.
In the transaction process, the transaction system forms an electronic contract according to the uplink transaction information. The electric automobile user sends a connection request to the charging pile user, and the charging pile user returns a connection success state; the current node broadcasts to all the block link points, and finally generated service information of the connection success state comprises but is not limited to electric vehicle users, charging piles and connection success time.
After the connection is successful, the charging pile user confirms the charging request or the discharging request according to the electronic contract, after the success is confirmed, the current node broadcasts to all the block link points, and finally generated charging or discharging confirmed service information comprises but is not limited to electric vehicle users, the charging pile, charging or discharging and confirming time.
And after the charging or discharging is finished, broadcasting the information to all the block link points, and generating service information of the charging or discharging finish, wherein the service information comprises but is not limited to electric vehicle users, charging piles, charging or discharging, transaction electric quantity and finishing time. And the transaction system respectively sends the service information of the charging or discharging completion to the electric vehicle user and the charging pile user so as to confirm the electric vehicle user and the charging pile user.
After the electric vehicle user and the charging pile user confirm, charging or discharging is completed, broadcasting is carried out on all the block link points, and business information of the user for confirming charging or discharging completion is generated and includes but is not limited to the electric vehicle user, the charging pile, charging or discharging, transaction electric quantity and confirmation time.
The system sends a settlement list to the transaction payer, and the transaction payer broadcasts to all the block chain nodes after the transaction payer pays the transaction fee according to the settlement list, and the generated service information paid by the user comprises but is not limited to the transaction payer, the transaction confirmer, the transaction fee and the payment time. Specifically, when the transaction is an electric vehicle charging transaction, the transaction payer is an electric vehicle user, the transaction payee is a charging pile user, and the transaction payment fee is the product of the transaction electric quantity and the electric vehicle transaction fee plus the service fee; when the transaction is an electric vehicle discharge transaction, the transaction paying party is a charging pile user, the transaction collecting party is an electric vehicle user, and the transaction payment fee is obtained by subtracting the service fee from the product of the transaction electric quantity and the transaction fee of the electric vehicle. After settlement is completed, the transaction system sends payment completion information to the transaction payee.
It should be noted that the above transaction process relates to a transaction link, an execution link and a settlement link, and the embodiment of the present invention only exemplifies business data that may be generated in the transaction process, and may generate more business data in the actual transaction process, which is not limited in the embodiment of the present invention.
Fig. 1 is a schematic structural diagram of an energy data tracing system based on a blockchain technology according to an embodiment of the present invention, as shown in fig. 1, the system includes a blockchain layer 100, a tracing data model layer 200, a generic tracing service layer 300, and an application layer 400, where the blockchain layer 100, the tracing data model layer 200, the generic tracing service layer 300, and the application layer 400 are sequentially arranged from bottom to top.
Related services of blockchains are encapsulated in the blockchain layer 100, including but not limited to a cryptographic algorithm module 110 for encryption and decryption algorithm and Hash (Hash) algorithm, a consensus mechanism module 120 for keeping ledger consistency of each node in the network, a peer-to-peer (P2P) network module 130 for communication between nodes in the blockchain network, and blockchain related modules such as a data persistence module 140 and an intelligent contract module 150 for persisting ledgers to local storage (blockchain file system or database system).
In the traceability data model layer 200, a provenance vocalbusty (procoC) model is merged into the block chain traceability, and the data traceability records are described by means of various components in the procoC model. The traceability data model layer 200 includes, but is not limited to, a data building block module 210, an execution entity building block module 220, an activity building block module 230, and a traceability data encapsulation module 240.
The universal tracing service layer 300 provides a universal service for the blockchain tracing system, such as an identity management module 310 for performing authority authentication on an executing entity and an inquiring user, a tracing data submission module 320 for submitting tracing data into a blockchain, a tracing data inquiry module 330 for inquiring the blockchain, and a verification module 340 for verifying authenticity and reliability of the tracing data. These modules are encapsulated at the generic traceback services layer 300 and are opened to the traceback application calls in the form of API interfaces.
The application layer 400 interfaces with a specific tracing area and compiles an application program according to specific requirements and service scenarios of the tracing area. The API interface provided by the generic tracing service layer 300 is called in an application to implement operations of tracing data uplink, query, verification, etc., and the application layer 400 includes, but is not limited to, a mobile side Application (APP) 410, a PC side web 420, and a client 430.
The technology type of each layer in the system architecture can be set according to actual requirements, which is not limited in the embodiment of the invention. As an alternative, fig. 2 is a schematic diagram of a technical type selection in a system architecture provided by an embodiment of the present invention, and as shown in fig. 2, a view layer in an application layer selects Vue framework, javaScript programming language, and HTML5; the main frame of the universal tracing service layer selects a Spring Boot 2.2.1 frame, a Spring Framework 5.2 open-source frame and an Apache Shift 1.7.0 safety frame; a persistent layer in the tracing data model layer is selected from Apache MyBatis 3.5.5, hibernate Validation 6.0.0, ahcache 2.6.1, mySQL 5.8 and Alibaba Druid 1.2.2; and selecting Java EE 8.0, servlet 3.0 and Apache major 3 from the system environment in the block chain layer.
It should be noted that the energy data tracing system based on the blockchain technique shown in fig. 1 is also applicable to the energy data tracing method based on the blockchain technique shown in fig. 3 or fig. 4, and is not described herein again.
The following describes an implementation process of the energy data tracing method based on the blockchain technology, which is provided by the embodiment of the present invention, by taking the energy data tracing apparatus based on the blockchain technology as an example. It can be understood that the implementation subject of the energy data tracing method based on the blockchain technology provided by the embodiment of the invention includes, but is not limited to, an energy data tracing device based on the blockchain technology.
Fig. 3 is a flowchart of an energy data tracing method based on a block chain technique according to an embodiment of the present invention, and as shown in fig. 3, the method includes:
step 101, according to the acquired service uplink data and the service attribute information, constructing energy uplink data.
Step 102, encrypting the energy uplink data and uploading the encrypted data to a block chain.
And 103, receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label.
And 104, querying the tracing data from the blockchain according to the tracing transaction label.
It should be noted that the technical solutions in the present application, such as obtaining, storing, using, and processing data, all conform to relevant regulations of national laws and regulations. The user information in the embodiment of the application is obtained through legal compliance, and the user information is obtained, stored, used, processed and the like through authorization approval of a client.
In the technical scheme provided by the embodiment of the invention, the energy uplink data is constructed according to the acquired service uplink data and the service attribute information; encrypting the energy uplink data and uploading the encrypted data to a block chain; receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label; according to the tracing transaction label, tracing data are inquired from the block chain, and the energy uplink data are stored in the block chain in an encrypted manner, so that the credibility and the integrity of the data can be ensured, the problems of single-point failure and asymmetric information are solved, and the data tracing can be efficiently carried out.
Fig. 4 is a flowchart of another energy data tracing method based on a block chain technique according to an embodiment of the present invention, and as shown in fig. 4, the method includes:
step 201, acquiring service uplink data and service attribute information.
In the embodiment of the invention, each step is executed by the energy data tracing device based on the block chain technology.
Specifically, acquiring service information; performing hash calculation on the service information to obtain a service hash value; and generating service uplink data according to the service information and the service hash value.
In the embodiment of the invention, the service information can be obtained from the transaction process. Specifically, if the current transaction process is a process of issuing information, the service information of the information to be transacted includes, but is not limited to, a transaction initiator, the transaction cost of the electric vehicle, the service cost and the issuing time; and performing hash calculation on the transaction initiator, the electric vehicle transaction cost, the service cost and the release time to obtain corresponding service hash values, wherein the generated service uplink data comprises but is not limited to the transaction initiator, the electric vehicle transaction cost, the service cost, the release time and the corresponding service hash values.
If the current transaction process is a transaction request process, the business information of the transaction request comprises but is not limited to a transaction initiator, a transaction responder, transaction electric quantity, electric vehicle transaction cost, service cost and declaration time; and performing hash calculation on the transaction initiator, the transaction responder, the transaction electric quantity, the electric vehicle transaction fee, the service fee and the declaration time to obtain corresponding service hash values, wherein the generated service uplink data comprises but is not limited to the transaction initiator, the transaction responder, the transaction electric quantity, the electric vehicle transaction fee, the service fee, the declaration time and the corresponding service hash values.
If the current transaction process is a transaction uplink process, the business information of the transaction uplink information comprises but is not limited to a transaction initiator, a transaction responder, transaction electric quantity, electric vehicle transaction cost, service cost and transaction time; and performing hash calculation on the transaction initiator, the transaction responder, the transaction electric quantity, the electric vehicle transaction fee, the service fee and the transaction time to obtain corresponding service hash values, wherein the generated service uplink data comprises but is not limited to the transaction initiator, the transaction responder, the transaction electric quantity, the electric vehicle transaction fee, the service fee, the transaction time and the corresponding service hash values.
If the current transaction process is in a connection success state, the service information of the connection success state comprises but is not limited to electric vehicle users, charging piles and connection success time; and performing hash calculation on the electric vehicle user, the charging pile and the connection success time to obtain a corresponding service hash value, wherein the generated service cochain data comprises but is not limited to the electric vehicle user, the charging pile, the connection success time and the corresponding service hash value.
If the current transaction process is charging or discharging confirmation, the service information of the charging or discharging confirmation comprises but is not limited to electric vehicle users, charging piles, charging or discharging and confirmation time; and performing hash calculation on the electric vehicle user, the charging pile, the charging or discharging and the confirmation time to obtain a corresponding service hash value, wherein the generated service chaining data comprises but is not limited to the electric vehicle user, the charging pile, the charging or discharging, the confirmation time and the corresponding service hash value.
If the current transaction process is charging or discharging ending, the service information of the charging or discharging ending comprises but is not limited to electric vehicle users, charging piles, charging or discharging, transaction electric quantity and completion time; and performing hash calculation on the electric vehicle user, the charging pile, the charging or discharging, the transaction electric quantity and the completion time to obtain a corresponding service hash value, wherein the generated service chaining data comprises but is not limited to the electric vehicle user, the charging pile, the charging or discharging, the transaction electric quantity, the completion time and the corresponding service hash value.
If the current transaction process is that the user confirms that charging or discharging is completed, the business information that the user confirms that charging or discharging is completed comprises but is not limited to electric vehicle users, charging piles, charging or discharging, transaction electric quantity and confirmation time; and performing hash calculation on the electric vehicle user, the charging pile, the charging or discharging, the transaction electric quantity and the confirmation time to obtain a corresponding service hash value, wherein the generated service chaining data comprises but is not limited to the electric vehicle user, the charging pile, the charging or discharging, the transaction electric quantity, the confirmation time and the corresponding service hash value.
If the current transaction process is user payment, the service information paid by the user comprises but is not limited to a transaction payer, a transaction confirming party, transaction fee and payment time; and performing hash calculation on the transaction payer, the transaction confirming party, the transaction fee and the payment time to obtain corresponding service hash values, wherein the generated uplink service data comprises but is not limited to the transaction payer, the transaction confirming party, the transaction fee, the payment time and the corresponding service hash values.
In the embodiment of the invention, the service hash value is mainly used for verifying whether the service information is tampered or not and ensuring the integrity and reliability of data.
In the embodiment of the invention, the service attribute information comprises but is not limited to a transaction label, an executor and an execution time, wherein the transaction label can uniquely identify one service operation, and the executor and the execution time can be obtained according to the service information. For example: the service information comprises a transaction initiator, the transaction cost of the electric vehicle, the service cost and the release time, the service attribute information comprises a generated unique transaction label, the executor is a charging pile user, and the execution time is the same as the release time.
Step 202, structured traceability data is constructed according to the business uplink data and the business attribute information.
Specifically, structured traceability data is constructed according to business uplink data and business attribute information through a data traceability description (ProVOC) model.
The ProVOC model consists of 3 primary class components of data, activity and execution entities. The data component is a description of things needing tracing and comprises 2 secondary class components of parameters and a data set, wherein the data set is designed according to a process link where the electric automobile is located. An activity component is one or more sequential actions initiated or controlled by an executing entity, primarily to describe how data transitions from a previous state to a next state. The execution entity refers to the initiator of the activity, and includes human execution entities and non-human execution entities.
According to the ProVOC model, the data tracing information is defined as a quintuple, and the quintuple is defined as { transaction label, executor, execution time, business uplink data, last block address }. The transaction label is a unique code for uniquely identifying a service operation and is generated when a transaction initiator issues a transaction; business uplink data is an event that affects data that occurs during an electric vehicle transaction; the executor is an initiator of the event, and the transaction flow executor comprises a new energy user, a V2G user, a charging pile user and a transaction system; the execution time is a time representing the occurrence of an event; the last block address is the block chain address where the last tracing information is stored, so as to facilitate the query when tracing the data. The block address may refer to a block hash address or a block number, so that the uplink data of the memory block can be found through the block address.
Step 203, generating the energy uplink data according to the obtained last block address and the structured source tracing data.
In the embodiment of the invention, the system database stores the block address of the previous block, and final energy uplink data is generated according to the block address of the previous block and the structured source tracing data.
Step 204, checking the energy uplink data through the intelligent contract, and if the checking is passed, continuing to execute step 205; if the verification fails, the process ends.
In the embodiment of the invention, a uplink request is initiated to a database system, wherein the uplink request comprises energy uplink data; an intelligent contract in the database system performs data check on the uplink data of the energy source, wherein the data check includes but is not limited to whether fields need to be filled, field data types, field formats and the like. If the verification is passed, it indicates that the energy uplink data is legal, continue to execute step 205; if the verification fails, the uplink data of the energy source is not legal, and the process is ended
In step 205, the energy uplink data is encrypted and uploaded to the blockchain.
In the embodiment of the present invention, step 205 specifically includes:
and step 2051, encrypting the energy uplink data through an encryption algorithm to obtain a key encryption value and the encrypted energy uplink data.
In the embodiment of the invention, the encryption algorithm is based on SM4 and SM2, and SM2 is an elliptic curve public key cryptographic algorithm which is an asymmetric encryption algorithm; the SM4 cryptographic algorithm conforms to the packet data algorithm of the wireless local area network standard and is symmetric encryption.
Fig. 5 is a logic diagram of an SM4 and SM 2-based encryption algorithm according to an embodiment of the present invention, as shown in fig. 5, a user submits energy uplink data planText { transaction label, executor, execution time, service uplink data, last block address }.
The SM4Key is generated by SM4Key = getSm4Key ().
The message digest dataDigest of the energy uplink data is calculated by SHA-256. Specifically, the source uplink data drawtext is calculated by dataDigest = SHA256 computhas (drawtext), and a message digest dataDigest is obtained.
And encrypting the energy uplink data and the message digest through an SM4 cryptographic algorithm to obtain encrypted energy uplink data encrypt data. Specifically, the Key sm4Key, the energy uplink data planText and the message digest dataDigest are calculated through encryptData = sm4Encrypt (planText + dataDigest, sm4 Key), so as to obtain the encrypted energy uplink data encryptData.
And encrypting the SM4 secret Key SM4Key by using the SM2public Key of the user to obtain a secret Key encryption value Sm4encrypt Key. Specifically, by Sm4 encryptokey = Sm2Encrypt (Sm 4Key, sm2 PublicKey), the Key Sm4Key is encrypted according to the user Sm2public Key Sm2PublicKey, and the Key encryption value Sm4 encryptokey is obtained.
And step 2052, uploading the key encryption value and the encrypted energy uplink data to the block chain.
As shown in fig. 5, in the embodiment of the present invention, the key encryption value Sm4EncryptKey is uploaded to the blockchain together with the encrypted energy uplink data encryptData.
Fig. 6 is a schematic view of a full flow of uplink transmission of service data according to an embodiment of the present invention, as shown in fig. 6, after a user and/or a system performs a service operation, energy uplink data is generated, and structured source-tracing data is stored in a service database; generating structured traceability data according to the energy uplink data through a ProVOC model; inquiring the last block address, and generating final energy uplink data according to the structured source tracing data; uploading the energy uplink data to a database through intelligent contract verification of the block chain; meanwhile, the block data in the block chain is synchronous with the service database in timing, so that the data symmetry is ensured.
And step 206, receiving the block address returned by the block chain.
In the embodiment of the invention, after successful chaining, the block chain returns the block address of the block for storing the key encryption value Sm4encrypt Key and the encrypted energy chaining data encrypt data.
And step 207, binding and storing the block address and the current transaction label.
In the embodiment of the invention, the transaction label and the block address of the energy uplink data are bound and stored in the system database, so that the block where the energy data is located can be quickly traced when a subsequent user traces data.
And step 208, receiving a tracing request sent by the user, wherein the tracing request comprises a tracing transaction label.
In the embodiment of the present invention, the source tracing transaction label of the source tracing request corresponds to the transaction label of the energy uplink data.
And step 209, querying the traceability data from the blockchain according to the traceability transaction label.
In the embodiment of the present invention, step 209 specifically includes:
at step 2091, the corresponding block address is queried according to the traceable transaction label.
Specifically, the system database is matched with the current transaction label of the energy uplink data according to the source-tracing transaction label, and a corresponding block address is inquired.
And 2092, acquiring the encrypted uplink data and the corresponding key encryption value according to the block address.
Specifically, from the block chain, according to the block address, the corresponding encrypted uplink data and the corresponding key encryption value are obtained.
And 2093, decrypting the encrypted uplink data according to the key encryption value through a decryption algorithm to obtain the tracing data.
In the embodiment of the invention, the decryption algorithm is based on SM4 and SM 2.
Fig. 7 is a logic diagram of a decryption algorithm based on SM4 and SM2 according to an embodiment of the present invention, as shown in fig. 7, a user queries a key encryption value and encrypted uplink data from a block chain; and decrypting the Key encryption value Sm4EncryptKey according to the private Key of the user SM2 by using the SM2 algorithm to obtain the Key SM4Key. Specifically, the Key encryption value Sm4EncryptKey is decrypted according to the Sm2private Key Sm2PrivateKey of the user Sm4Key = Sm2Decrypt (Sm 4EncryptKey, sm2 PrivateKey), so as to obtain the Key Sm4Key.
And decrypting the encrypted uplink data encryptData by using an SM4 cryptographic algorithm to obtain a message digest dataDiget and a traceabletText. Specifically, the encrypted uplink data encryptedata is decrypted according to the Key sm4Key by (placetext, dataDigest) = sm4Decrypt (encryptData, sm4 Key), so as to obtain the message digest dataDigest and the traceable data placetext.
The message digest dataDigest' of the traceable data planText is calculated by SHA-256. Specifically, the traceable data planText is calculated by dataDigest '= SHA256 computer has (planText), and a calculated message digest dataDigest' is obtained.
And judging whether the calculated message digest' is consistent with the decrypted message digest dataDigest. If the integrity of the tracing data is consistent with the integrity of the tracing data, the tracing data obtained after decryption is obtained, and the tracing data is sent to the user; otherwise, the integrity of the tracing data is damaged, and a tracing failure message is sent to the user.
In the technical scheme of the energy data tracing method based on the block chain technology, the energy uplink data is constructed according to the acquired service uplink data and the service attribute information; encrypting the energy uplink data and uploading the encrypted data to a block chain; receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label; according to the tracing transaction label, tracing data are inquired from the block chain, and the energy uplink data are stored in the block chain in an encrypted manner, so that the credibility and the integrity of the data can be ensured, the problems of single-point failure and asymmetric information are solved, and the data tracing can be efficiently carried out.
Fig. 8 is a schematic structural diagram of an energy data tracing apparatus based on a blockchain technique according to an embodiment of the present invention, the apparatus is configured to execute the energy data tracing method based on the blockchain technique, and as shown in fig. 8, the apparatus includes: the system comprises a construction unit 11, an uploading unit 12, a receiving unit 13 and an inquiring unit 14.
The construction unit 11 is configured to construct the energy uplink data according to the acquired service uplink data and the service attribute information.
The uploading unit 12 is used for encrypting the energy uplink data and uploading the data to the blockchain.
The receiving unit 13 is configured to receive a tracing request sent by a user, where the tracing request includes a tracing transaction label.
The query unit 14 is configured to query the traceable data from the blockchain according to the traceable transaction label.
In the embodiment of the present invention, the construction unit 11 is specifically configured to obtain service uplink data and service attribute information; according to the business uplink data and the business attribute information, structured traceability data are constructed; and generating the energy uplink data according to the acquired last block address and the structured source tracing data.
In the embodiment of the present invention, the construction unit 11 is specifically configured to obtain service information; performing hash calculation on the service information to obtain a service hash value; and generating service uplink data according to the service information and the service hash value.
In this embodiment of the present invention, the constructing unit 11 is specifically configured to construct the structured traceability data according to the service uplink data and the service attribute information through the data traceability description model.
In the embodiment of the present invention, the apparatus further includes: a verification unit 15.
The checking unit 15 is configured to check the energy uplink data through the intelligent contract; if the verification is passed, the uploading unit 12 is triggered to continue to perform the steps of encrypting the energy uplink data and uploading the encrypted energy uplink data to the block chain.
In the embodiment of the present invention, the uploading unit 12 is specifically configured to encrypt the energy uplink data through an encryption algorithm to obtain a key encryption value and encrypted energy uplink data; and uploading the encrypted key encryption value and the encrypted energy uplink data to the block chain.
In the embodiment of the invention, the energy uplink data comprises a current transaction label; the device still includes: the storage unit 16 is bound.
The receiving unit 13 is also used for receiving block addresses returned by the block chain.
The binding storage unit 16 is used for binding and storing the block address and the current transaction label.
In the embodiment of the present invention, the query unit 14 is specifically configured to query a corresponding block address according to the source tracing transaction label; acquiring encrypted uplink data and a corresponding key encryption value according to the block address; and decrypting the encrypted uplink data according to the key encryption value through a decryption algorithm to obtain the tracing data.
In the scheme of the embodiment of the invention, the energy uplink data is constructed according to the acquired service uplink data and the service attribute information; encrypting the energy uplink data and uploading the encrypted data to a block chain; receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label; according to the tracing transaction label, tracing data are inquired from the block chain, and the energy uplink data are stored in the block chain in an encrypted manner, so that the credibility and the integrity of the data can be ensured, the problems of single-point failure and asymmetric information are solved, and the data tracing can be efficiently carried out.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer device, which may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
The embodiment of the present invention provides a computer device, which includes a memory and a processor, where the memory is used to store information including program instructions, and the processor is used to control execution of the program instructions, and the program instructions are loaded and executed by the processor to implement the steps of the above embodiment of the energy data tracing method based on the block chain technology.
Referring now to FIG. 9, shown is a schematic diagram of a computer device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 9, the computer apparatus 600 includes a Central Processing Unit (CPU) 601 that can execute various appropriate jobs and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the computer apparatus 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a Cathode Ray Tube (CRT), a liquid crystal feedback (LCD), and the like, and a speaker and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. A driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary on the storage section 608.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (19)

1. An energy data tracing method based on a block chain technology is characterized by comprising the following steps:
according to the acquired business uplink data and the business attribute information, energy uplink data are constructed;
encrypting the energy uplink data and uploading the encrypted energy uplink data to a block chain;
receiving a tracing request sent by a user, wherein the tracing request comprises a tracing transaction label;
and querying the tracing data from the blockchain according to the tracing transaction label.
2. The method of claim 1, wherein the constructing the energy uplink data according to the obtained service uplink data and the service attribute information comprises:
acquiring service uplink data and service attribute information;
according to the business uplink data and the business attribute information, structured traceability data are constructed;
and generating energy uplink data according to the acquired last block address and the structured source tracing data.
3. The method of claim 2, wherein the obtaining uplink data for services comprises:
acquiring service information;
performing hash calculation on the service information to obtain a service hash value;
and generating service uplink data according to the service information and the service hash value.
4. The method of claim 2, wherein the constructing the structured traceability data according to the service uplink data and the service attribute information comprises:
and constructing structured traceability data according to the business uplink data and the business attribute information through a data traceability description model.
5. The method of claim 1, wherein before encrypting and uploading the energy uplink data to a blockchain, the method further comprises:
checking the energy uplink data through an intelligent contract;
and if the verification is passed, continuing to execute the step of encrypting the energy uplink data and uploading the encrypted energy uplink data to the block chain.
6. The method of claim 1, wherein the encrypting and uploading the energy uplink data to a blockchain comprises:
encrypting the energy uplink data through an encryption algorithm to obtain encrypted energy uplink data and a secret key encryption value;
and uploading the key encryption value and the encrypted energy uplink data to a block chain.
7. The method of claim 1, wherein the energy uplink data includes a current transaction number;
after encrypting and uploading the energy uplink data to a blockchain, the method further comprises:
receiving a block address returned by the block chain;
and binding and storing the block address and the current transaction label.
8. The method for tracing energy data based on blockchain technology according to claim 1, wherein querying the traceable data from the blockchain according to the traceable transaction label comprises:
inquiring a corresponding block address according to the source tracing transaction label;
acquiring encrypted uplink data and a corresponding key encryption value according to the block address;
and decrypting the encrypted uplink data according to the key encryption value through a decryption algorithm to obtain the tracing data.
9. An energy data tracing device based on a block chain technology is characterized in that the device comprises:
the building unit is used for building the energy uplink data according to the obtained service uplink data and the service attribute information;
the uploading unit is used for encrypting the energy uplink data and uploading the encrypted energy uplink data to the block chain;
the system comprises a receiving unit, a source tracing unit and a processing unit, wherein the receiving unit is used for receiving a source tracing request sent by a user, and the source tracing request comprises a source tracing transaction label;
and the query unit is used for querying the tracing data from the block chain according to the tracing transaction label.
10. The apparatus according to claim 9, wherein the building unit is specifically configured to obtain service uplink data and service attribute information; according to the business uplink data and the business attribute information, structured traceability data are constructed; and generating energy uplink data according to the acquired last block address and the structured source tracing data.
11. The device for tracing energy data based on block chain technology as claimed in claim 10,
the construction unit is specifically used for acquiring service information; performing hash calculation on the service information to obtain a service hash value; and generating service uplink data according to the service information and the service hash value.
12. The apparatus for tracing energy data based on block chain technology as claimed in claim 10,
the building unit is specifically configured to build structured traceability data according to the service uplink data and the service attribute information through a data traceability description model.
13. The block chain technology-based energy data tracing apparatus of claim 9, wherein said apparatus further comprises:
the checking unit is used for checking the energy uplink data through the intelligent contract; and if the verification is passed, triggering an uploading unit to continuously execute the steps of encrypting the energy uplink data and uploading the encrypted energy uplink data to the block chain.
14. The apparatus for tracing energy data based on block chain technology as claimed in claim 9,
the uploading unit is specifically configured to encrypt the energy uplink data through an encryption algorithm to obtain a key encryption value and encrypted energy uplink data; and uploading the key encryption value and the encrypted energy uplink data to a block chain.
15. The apparatus according to claim 9, wherein the energy uplink data includes a current transaction number; the device further comprises:
the receiving unit is also used for receiving the block address returned by the block chain;
and the binding storage unit is used for binding and storing the block address and the current transaction label.
16. The device for tracing energy data based on block chain technology as claimed in claim 9,
the query unit is specifically configured to query a corresponding block address according to the source tracing transaction label; acquiring encrypted uplink data and a corresponding key encryption value according to the block address; and decrypting the encrypted uplink data according to the key encryption value through a decryption algorithm to obtain the tracing data.
17. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, implements the method for tracing energy data based on a block chain technique according to any one of claims 1 to 8.
18. A computer device comprising a memory for storing information including program instructions and a processor for controlling the execution of the program instructions, wherein the program instructions when loaded and executed by the processor implement the method for energy data tracing based on block chain techniques of any one of claims 1 to 8.
19. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the method for energy data tracing based on block chain techniques of any one of claims 1 to 8.
CN202211149063.4A 2022-09-21 2022-09-21 Energy data tracing method and device based on block chain technology Pending CN115860757A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211149063.4A CN115860757A (en) 2022-09-21 2022-09-21 Energy data tracing method and device based on block chain technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211149063.4A CN115860757A (en) 2022-09-21 2022-09-21 Energy data tracing method and device based on block chain technology

Publications (1)

Publication Number Publication Date
CN115860757A true CN115860757A (en) 2023-03-28

Family

ID=85661001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211149063.4A Pending CN115860757A (en) 2022-09-21 2022-09-21 Energy data tracing method and device based on block chain technology

Country Status (1)

Country Link
CN (1) CN115860757A (en)

Similar Documents

Publication Publication Date Title
CN108985757B (en) Information processing method, device and system, storage medium and electronic equipment
CN110609869B (en) Block chain-based data storage method, related equipment and storage medium
CN109635585B (en) Method, proxy node and medium for querying transaction information in blockchain network
US11531981B2 (en) Digital contracts in blockchain environments
CN110473094B (en) Data authorization method and device based on block chain
CN108596619B (en) Transaction method, device, central node and system for blockchain system
CN110457875B (en) Data authorization method and device based on block chain
CN107730225B (en) Big data transaction method, system, equipment and computer storage medium
CN109948371B (en) Method for issuing identity certificate for block chain node and related device
KR102170008B1 (en) Controlled application distribution
WO2021196966A1 (en) Transaction method, gateway device, payment platform, merchant device and transaction system
CN110070357B (en) Data processing method, device and system
CN109636610B (en) Decentralized data transaction system and method
CN111418184A (en) Credible insurance letter based on block chain
CN111429134A (en) Data transaction method and device based on block chain
CN113706312A (en) Photovoltaic electricity transaction method and device based on block chain
CN111461799B (en) Data processing method, data processing device, computer equipment and medium
CN111433799A (en) Credible insurance letter based on block chain
CN114358766A (en) Method, equipment and blockchain system for trading green electric certificates
CN115796871A (en) Resource data processing method and device based on block chain and server
CN111311259A (en) Bill processing method, device, terminal and computer readable storage medium
CN111325586B (en) Bill generation method, device, server and medium based on block chain network
Zhang et al. FutureText: A blockchain-based contract signing prototype with security and convenience
CN115860757A (en) Energy data tracing method and device based on block chain technology
CN116975901A (en) Identity verification method, device, equipment, medium and product based on block chain

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