CN116308802A - Intelligent contract-based power transaction method, device, equipment and storage medium - Google Patents

Intelligent contract-based power transaction method, device, equipment and storage medium Download PDF

Info

Publication number
CN116308802A
CN116308802A CN202310539199.4A CN202310539199A CN116308802A CN 116308802 A CN116308802 A CN 116308802A CN 202310539199 A CN202310539199 A CN 202310539199A CN 116308802 A CN116308802 A CN 116308802A
Authority
CN
China
Prior art keywords
power
electricity
node
power transaction
transaction
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
CN202310539199.4A
Other languages
Chinese (zh)
Other versions
CN116308802B (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.)
Dongguan Power Supply Bureau of Guangdong Power Grid Co Ltd
Original Assignee
Dongguan Power Supply Bureau of Guangdong Power Grid 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 Dongguan Power Supply Bureau of Guangdong Power Grid Co Ltd filed Critical Dongguan Power Supply Bureau of Guangdong Power Grid Co Ltd
Priority to CN202310539199.4A priority Critical patent/CN116308802B/en
Publication of CN116308802A publication Critical patent/CN116308802A/en
Application granted granted Critical
Publication of CN116308802B publication Critical patent/CN116308802B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/06Electricity, gas or water supply
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y04INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
    • Y04SSYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
    • Y04S10/00Systems supporting electrical power generation, transmission or distribution
    • Y04S10/50Systems or methods supporting the power network operation or management, involving a certain degree of interaction with the load-side end user applications

Abstract

The invention relates to the technical field of power engineering, and discloses a power transaction method, device, equipment and storage medium based on intelligent contracts, wherein the method comprises the following steps: when receiving an electricity utilization request sent by an electricity purchasing party, acquiring an electricity unit price list; after receiving a confirmation electricity utilization instruction of an electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and a power unit price list by calling an intelligent contract; encrypting the power transmission and distribution power transaction data through a random number generation algorithm; after receiving confirmation information of the power transmission and distribution power transaction data encrypted by the power purchasing party and the power selling party, controlling the current power transaction according to the risk of the power transaction being attacked; by means of the method, the generated power transmission and distribution power transaction data are encrypted by means of the random number generation algorithm, whether current power transaction is conducted or not is determined according to the risk that power transaction is attacked, point-to-point data interaction between two parties is achieved, and therefore safety of the power transaction can be effectively improved.

Description

Intelligent contract-based power transaction method, device, equipment and storage medium
Technical Field
The present invention relates to the field of power engineering technologies, and in particular, to a power transaction method, device, equipment and storage medium based on intelligent contracts.
Background
With the rapid development of economy, people pay more and more attention to electric power, market subjects participating in electric power transaction become diversified, at present, electric power transaction is basically completed through a third party institution, specifically, after a transaction request of both electric power transaction parties is processed and decided through the third party management institution, the third party management institution sends the request to a transaction platform, meanwhile, trust problems of both electric power transaction parties are restrained in a manner of paying default or listing an abnormal list and the like, but all data from the beginning to the end of the electric power transaction in the manner are managed by the third party institution, so that the safety of the interacted data cannot be ensured, and in addition, the third party institution stores all data from the beginning to the end of the electric power transaction in a conventional data set, and the risk of losing exists, namely, the overall safety is lower when the electric power transaction is performed according to the manner.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide an intelligent contract-based power transaction method, device, equipment and storage medium, and aims to solve the technical problem of low safety of power transaction in the prior art.
To achieve the above object, the present invention provides a smart contract-based power transaction method, including the steps of:
when receiving an electricity utilization request sent by an electricity purchasing party, acquiring an electricity unit price list sent to a blockchain by an electricity selling party;
after receiving a confirmation electricity utilization instruction of the electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and the power unit price list by calling an intelligent contract;
encrypting the power transmission and distribution power transaction data through a random number generation algorithm;
after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked;
and controlling the current power transaction according to the risk of the power transaction being attacked.
Optionally, when receiving the electricity request sent by the electricity purchasing party, the method obtains a unit price list of the electricity sent to the blockchain by the electricity selling party, including:
when receiving an electricity consumption request sent by an electricity purchasing party, acquiring account information of the electricity purchasing party;
determining whether the electricity purchasing party is an abnormal user according to the account information;
intercepting the electricity utilization request when the electricity purchasing party is determined to be an abnormal user;
when the electricity purchasing party is not an abnormal user, determining a login attribution area of an account to which the account information belongs;
generating a power unit price list request when the login home zone is a common home zone;
and setting the electricity selling party obtained according to the request of the electricity unit price list by the blockchain in the electricity unit price list of the login attribution area.
Optionally, after receiving the confirmation electricity consumption instruction of the electricity purchasing party, generating electricity transmission and distribution power transaction data according to the confirmation electricity consumption instruction and the electricity unit price list by calling an intelligent contract, including:
after receiving a confirmation electricity utilization instruction of the electricity purchasing party, analyzing the confirmation electricity utilization instruction to obtain electricity purchasing quantity of the electricity purchasing party;
determining the unit price of the electric power corresponding to the electricity purchasing quantity according to the unit price list of the electric power;
generating exclusive power data of the electricity purchasing party according to the electricity purchasing quantity, the power unit price and the power transmission and distribution data;
and packaging the exclusive power data through a target node to generate power transmission and distribution power transaction data.
Optionally, after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked includes:
after receiving confirmation information of the power transmission and distribution power transaction data encrypted by the power purchasing party and the power selling party, detecting whether an attack node has a behavior of tampering with the power transmission and distribution power transaction data or not;
when the behavior of tampering the power transmission and distribution power transaction data of the attack node is detected, determining a block gap between the attack node and an honest chain;
acquiring the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block;
calculating the probability of eliminating the block gap of the attack node according to the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node;
and determining the risk of the power transaction being attacked according to the probability of eliminating the block gap by the attack node, the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node.
Optionally, the determining the risk of the power transaction being attacked according to the probability that the attack node eliminates the block gap, the probability that the attack node manufactures the next block, and the probability that the honest node manufactures the next block includes:
calculating an expected growth value of an attack chain corresponding to the attack node according to the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block;
counting the number of blocks of the block gap;
generating a probability expression for replacing the honest block according to the expected growth value, the number of blocks, the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block;
and calculating the risk of the power transaction being attacked according to the block number and the probability expression of the substitution of the honest blocks.
Optionally, the controlling the current power transaction according to the risk of the power transaction being attacked includes:
acquiring node access data of a power distribution network of an electricity seller;
determining user nodes and other node sets according to the node access data;
determining injection power of the user node accessing to the other node set;
when the injection power is a preset power threshold, acquiring a phase angle of the user node and impedance between the user node and each node in the other node set;
calculating the power load born by the power distribution network according to the injection power, the phase angle and the impedance;
and when the power load is smaller than a preset power load threshold, controlling the current power transaction according to the risk of the power transaction being attacked.
Optionally, when the power load is smaller than a preset power load threshold, the controlling the current power transaction according to the risk of the power transaction being attacked includes:
when the power load is smaller than a preset power load threshold, judging whether a value corresponding to the risk of the power transaction being attacked is smaller than a preset risk threshold;
when the corresponding value of the risk of the power transaction being attacked is smaller than a preset risk threshold, the current power transaction is sent to a power purchasing party;
updating node access data of a power distribution network of an electricity seller when receiving successful payment information of the current electric power transaction by the electricity buyer;
and stopping the current power transaction when the power load is greater than or equal to a preset power load threshold value and/or the corresponding value of the risk of the power transaction being attacked is greater than or equal to a preset risk threshold value.
In addition, in order to achieve the above object, the present invention also provides an intelligent contract-based power transaction apparatus, comprising:
the acquisition module is used for acquiring an electric power unit price list sent to the blockchain by the electricity seller when receiving an electricity utilization request sent by the electricity buyer;
the generation module is used for generating power transmission and distribution power transaction data according to the confirmation power utilization instruction and the power unit price list by calling an intelligent contract after receiving the confirmation power utilization instruction of the power purchasing party;
the encryption module is used for encrypting the power transmission and distribution power transaction data through a random number generation algorithm;
the determining module is used for determining the risk of the power transaction being attacked after receiving the confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data;
and the control module is used for controlling the current power transaction according to the risk of the power transaction being attacked.
In addition, to achieve the above object, the present invention also proposes an intelligent contract-based power trading device including: a memory, a processor, and a smart contract-based power transaction program stored on the memory and executable on the processor, the smart contract-based power transaction program configured to implement a smart contract-based power transaction method as described above.
In addition, in order to achieve the above object, the present invention also proposes a storage medium having stored thereon a smart contract-based power transaction program that, when executed by a processor, implements a smart contract-based power transaction method as described above.
According to the intelligent contract-based power transaction method, when a power utilization request sent by a power purchasing party is received, a power unit price list sent to a blockchain by the power selling party is obtained; after receiving a confirmation electricity utilization instruction of the electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and the power unit price list by calling an intelligent contract; encrypting the power transmission and distribution power transaction data through a random number generation algorithm; after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked; controlling the current power transaction according to the risk of the power transaction being attacked; by means of the method, the generated power transmission and distribution power transaction data are encrypted by means of the random number generation algorithm, whether current power transaction is conducted or not is determined according to the risk that power transaction is attacked, point-to-point data interaction between two parties is achieved, and therefore safety of the power transaction can be effectively improved.
Drawings
FIG. 1 is a schematic diagram of a smart contract-based power transaction facility of a hardware operating environment in accordance with an embodiment of the present invention;
FIG. 2 is a flow chart of a first embodiment of a smart contract-based power transaction method according to the present invention;
FIG. 3 is a flow chart of a second embodiment of the smart contract-based power transaction method of the present invention;
fig. 4 is a schematic functional block diagram of a first embodiment of the smart contract-based power transaction apparatus of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a power transaction device structure based on an intelligent contract in a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the smart contract-based power trading device may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) Memory or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the structure shown in fig. 1 does not constitute a limitation of smart contract-based power transaction devices, and may include more or fewer components than illustrated, or may combine certain components, or a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a smart contract-based power transaction program may be included in a memory 1005 as one type of storage medium.
In the smart contract-based power transaction facility shown in fig. 1, the network interface 1004 is mainly used for data communication with a network integration platform workstation; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the smart contract-based power transaction apparatus of the present invention may be provided in the smart contract-based power transaction apparatus, which invokes the smart contract-based power transaction program stored in the memory 1005 through the processor 1001 and performs the smart contract-based power transaction method provided by the embodiment of the present invention.
Based on the hardware structure, the embodiment of the power transaction method based on the intelligent contract is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of a smart contract-based power transaction method according to the present invention.
In a first embodiment, the smart contract-based power transaction method includes the steps of:
step S10, when receiving the electricity utilization request sent by the electricity purchasing party, acquiring an electricity unit price list sent to the blockchain by the electricity selling party.
It should be noted that, the execution body of the embodiment is an intelligent contract-based power transaction device, and may be other devices that can implement the same or similar functions, such as a power transaction controller, which is not limited in this embodiment, and the power transaction controller is taken as an example in this embodiment.
It should be understood that the electricity unit price list refers to a unit price list of each electricity purchase amount interval of the region to which the electricity seller is disposed, and the electricity unit price corresponding to each region is different.
Further, step S10 includes: when receiving an electricity consumption request sent by an electricity purchasing party, acquiring account information of the electricity purchasing party; determining whether the electricity purchasing party is an abnormal user according to the account information; intercepting the electricity utilization request when the electricity purchasing party is determined to be an abnormal user; when the electricity purchasing party is not an abnormal user, determining a login attribution area of an account to which the account information belongs; generating a power unit price list request when the login home zone is a common home zone; and setting the electricity selling party obtained according to the request of the electricity unit price list by the blockchain in the electricity unit price list of the login attribution area.
It can be understood that the account information refers to account information of an electricity purchasing party for sending an electricity consumption request, the account information can be at least one of a mobile phone number, an identity card number and other unique identification information, then whether the electricity purchasing party is an abnormal user or not is determined according to the account information, specifically, whether the account information is located in an abnormal list or not is judged, if yes, the electricity purchasing party is indicated to be the abnormal user, at the moment, the electricity consumption request sent by the electricity purchasing party is intercepted, otherwise, the electricity purchasing party is indicated to not be the abnormal user, then whether a login home area of an account to which the account information belongs is a common home area is continuously determined, if yes, the existence of login risk is indicated, at the moment, an electricity unit price list request is generated according to the electricity consumption request sent by the electricity purchasing party, and if the login home area is not the common home area, the identity information is required to be sent to the electricity purchasing party so as to ensure the safety of the account is indicated.
And step S20, after receiving the confirmation electricity utilization instruction of the electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and the power unit price list by calling an intelligent contract.
It is understood that the power consumption confirmation instruction refers to an instruction for confirming power consumption and power consumption, the power consumption confirmation instruction carries at least one of power consumption amount and power unit price confirmation information, and the power transmission and distribution power transaction data refers to data for carrying out power transaction by a power purchasing party and a power selling party, and the power transmission and distribution power transaction data includes the power consumption amount, the power unit price and the power transmission and distribution data.
Further, step S20 includes: after receiving a confirmation electricity utilization instruction of the electricity purchasing party, analyzing the confirmation electricity utilization instruction to obtain electricity purchasing quantity of the electricity purchasing party; determining the unit price of the electric power corresponding to the electricity purchasing quantity according to the unit price list of the electric power; generating exclusive power data of the electricity purchasing party according to the electricity purchasing quantity, the power unit price and the power transmission and distribution data; and packaging the exclusive power data through a target node to generate power transmission and distribution power transaction data.
It should be understood that after receiving the confirmation power consumption instruction, the power consumption amount of the power purchasing party is obtained by analyzing the confirmation power consumption instruction, then the power unit price corresponding to the power consumption amount is queried according to the power unit price list, for example, when the power consumption amount is between [ A1, A2], the power unit price is a, when the power consumption amount is between (A2, A3], the power unit price is b, and because the power data of different power consumption amounts are different, after obtaining the power unit price, the exclusive power data of the power purchasing party is generated by combining the power consumption amount and the power transmission and distribution data, and then the exclusive power data is packaged through the target node, so that the power transmission and distribution power transaction block is obtained and is used as the power transmission and distribution power transaction data.
And step S30, encrypting the power transmission and distribution power transaction data through a random number generation algorithm.
It should be understood that the random number generation algorithm refers to an algorithm that encrypts by means of random number generation, for example, the power transmission and distribution power transaction data is
Figure SMS_1
The random number generated by using the random number generation algorithm is +.>
Figure SMS_2
The encrypted power transmission and distribution power transaction data is expressed as +.>
Figure SMS_3
Compared with other encryption algorithms, the random number generation algorithm has randomness, so that the safety of the encrypted power transmission and distribution power transaction data is higher.
And S40, after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked.
It can be understood that after the power transmission and distribution power transaction data are encrypted, the encrypted power transmission and distribution power transaction data are respectively sent to the power purchasing party and the power selling party for confirmation, meanwhile, keys are also sent to the power purchasing party and the power selling party, after confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data is received, the power purchasing party and the power selling party are indicated to complete confirmation on the encrypted power transmission and distribution power transaction data, and at the moment, the risk of the power transaction being attacked needs to be determined.
And step S50, controlling the current power transaction according to the risk of the power transaction being attacked.
It should be appreciated that after obtaining the risk of the power transaction being attacked, whether to perform the current power transaction is controlled according to the comparison result of the value of the risk of the power transaction being attacked and the preset risk threshold value.
Further, step S50 includes: acquiring node access data of a power distribution network of an electricity seller; determining user nodes and other node sets according to the node access data; determining injection power of the user node accessing to the other node set; when the injection power is a preset power threshold, acquiring a phase angle of the user node and impedance between the user node and each node in the other node set; calculating the power load born by the power distribution network according to the injection power, the phase angle and the impedance; and when the power load is smaller than a preset power load threshold, controlling the current power transaction according to the risk of the power transaction being attacked.
It may be understood that the node access data refers to node data of a power distribution network accessed to an electricity seller, and when determining injection power of a user node accessed to other node sets, whether the injection power is a preset power threshold is determined, if yes, a power load born by the power distribution network is calculated according to the injection power, the phase angle and the impedance, specifically:
Figure SMS_4
wherein ,
Figure SMS_7
representing the power load that the distribution network can withstand, +.>
Figure SMS_8
Indicating the injection power +.>
Figure SMS_11
Representing phase angle of user node,/>
Figure SMS_6
Representing the phase angle of the other nodes +.>
Figure SMS_9
Representing impedance->
Figure SMS_10
Representing the conversion coefficient between power and load, +.>
Figure SMS_13
Represents the number of iterations, +.>
Figure SMS_5
Reference numeral indicating user node->
Figure SMS_12
Reference numerals representing other nodes.
Further, when the power load is smaller than a preset power load threshold, the controlling the current power transaction according to the risk of the power transaction being attacked includes: when the power load is smaller than a preset power load threshold, judging whether a value corresponding to the risk of the power transaction being attacked is smaller than a preset risk threshold; when the corresponding value of the risk of the power transaction being attacked is smaller than a preset risk threshold, the current power transaction is sent to a power purchasing party; updating node access data of a power distribution network of an electricity seller when receiving successful payment information of the current electric power transaction by the electricity buyer; and stopping the current power transaction when the power load is greater than or equal to a preset power load threshold value and/or the corresponding value of the risk of the power transaction being attacked is greater than or equal to a preset risk threshold value.
It should be understood that when it is determined that the power load is smaller than the preset power load threshold, the power distribution network of the electricity seller may be further connected to the power connector of the electricity purchasing party, at this time, whether the value corresponding to the risk of the power transaction being attacked is smaller than the preset risk threshold is continuously determined, if yes, the risk is indicated to be smaller, the current power transaction is sent to the electricity purchasing party, the electricity purchasing party performs payment of the current power transaction, after the payment is successful, payment success information of the current power transaction is fed back, at this time, node connection data of the power distribution network of the electricity seller is updated, and if any condition is not satisfied, the current power transaction needs to be stopped.
In the embodiment, when receiving an electricity utilization request sent by an electricity purchasing party, an electricity unit price list sent to a blockchain by an electricity selling party is obtained; after receiving a confirmation electricity utilization instruction of the electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and the power unit price list by calling an intelligent contract; encrypting the power transmission and distribution power transaction data through a random number generation algorithm; after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked; controlling the current power transaction according to the risk of the power transaction being attacked; by means of the method, the generated power transmission and distribution power transaction data are encrypted by means of the random number generation algorithm, whether current power transaction is conducted or not is determined according to the risk that power transaction is attacked, point-to-point data interaction between two parties is achieved, and therefore safety of the power transaction can be effectively improved.
In an embodiment, as shown in fig. 3, a second embodiment of the smart contract-based power transaction method according to the present invention is proposed based on the first embodiment, and the step S40 includes:
step S401, after receiving confirmation information of the power transmission and distribution power transaction data encrypted by the power purchasing party and the power selling party, detecting whether an attack node has a behavior of tampering with the power transmission and distribution power transaction data.
Step S402, when detecting that the attack node has a behavior of tampering with the power transmission and distribution power transaction data, determining a block gap between the attack node and the honest chain.
It can be understood that when the behavior of tampering with the power transmission and distribution power transaction data of the attack node is detected, the power transmission and distribution power transaction data is tampered by the attack node, and at the moment, the block gap between the attack node and the honest chain is determined.
Step S403, obtaining the probability that the attack node manufactures the next block and the probability that the honest node manufactures the next block.
Step S404, calculating the probability of eliminating the block gap of the attack node according to the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node.
It can be understood that after obtaining the probability that the attack node makes the next block and the probability that the honest node makes the next block, the probability that the attack node eliminates the block gap is calculated, specifically as follows:
Figure SMS_14
wherein ,
Figure SMS_15
representing the probability of attack node to eliminate block gap, < ->
Figure SMS_16
Block number representing block gap, +.>
Figure SMS_17
Representing the probability of honest node making the next block,/-, for example>
Figure SMS_18
Representing the probability that the attacking node manufactured the next block.
Step S405, determining a risk of the power transaction being attacked according to the probability that the attack node eliminates the block gap, the probability that the attack node manufactures the next block, and the probability that the honest node manufactures the next block.
It should be appreciated that after the probability of the attack node eliminating the block gap is obtained, the risk of the power transaction being attacked is determined in combination with the probability of the attack node producing the next block and the probability of the honest node producing the next block.
Further, step S405 includes: calculating an expected growth value of an attack chain corresponding to the attack node according to the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block; counting the number of blocks of the block gap; generating a probability expression for replacing the honest block according to the expected growth value, the number of blocks, the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block; and calculating the risk of the power transaction being attacked according to the block number and the probability expression of the substitution of the honest blocks.
It can be understood that the expected value of increase refers to an expected value of increase of the attack chain, and after obtaining the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block, the expected value of increase of the attack chain is calculated by combining the number of blocks with block gaps, which is specifically as follows:
Figure SMS_19
wherein ,
Figure SMS_20
representing the expected value of the growth of the attack chain, +.>
Figure SMS_21
Block number representing block gap, +.>
Figure SMS_22
Representing the probability of honest node making the next block,/-, for example>
Figure SMS_23
Representing the probability that the attacking node manufactured the next block.
It should be understood that, after obtaining the expected value of the increase of the attack chain, the probability of manufacturing the next block by combining the number of blocks, the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node are combined to generate a probability expression that the honest block is replaced, specifically:
Figure SMS_24
wherein ,
Figure SMS_25
probability expression indicating that honest block is replaced, < ->
Figure SMS_26
Indicating the number of blocks of the manufacturing block of the attack chain,
Figure SMS_27
representing the expected value of the growth of the attack chain, +.>
Figure SMS_28
Representing a constant->
Figure SMS_29
Block number representing block gap, +.>
Figure SMS_30
Representing the probability of honest node making the next block,/-, for example>
Figure SMS_31
Representing the probability that the attacking node manufactured the next block.
It should be noted that, in generating the probability expression of replacing the honest blocks, the risk of the power transaction being attacked is calculated according to the number of blocks and the probability expression of replacing the honest blocks.
In the embodiment, after receiving confirmation information of the power transmission and distribution power transaction data encrypted by the power purchasing party and the power selling party, whether an attack node has a behavior of tampering with the power transmission and distribution power transaction data is detected; when the behavior of tampering the power transmission and distribution power transaction data of the attack node is detected, determining a block gap between the attack node and an honest chain; acquiring the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block; calculating the probability of eliminating the block gap of the attack node according to the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node; determining the risk of the power transaction being attacked according to the probability that the attack node eliminates the block gap, the probability that the attack node manufactures the next block and the probability that the honest node manufactures the next block; by the method, after the block gap between the attack node and the honest chain is determined, the risk of the power transaction being attacked is determined by combining the probability that the block gap is eliminated by the attack node, so that the accuracy of determining the risk of the power transaction being attacked can be effectively improved.
In addition, the embodiment of the invention also provides a storage medium, wherein the storage medium stores a power transaction program based on the intelligent contract, and the power transaction program based on the intelligent contract realizes the steps of the power transaction method based on the intelligent contract when being executed by a processor.
Because the storage medium adopts all the technical schemes of all the embodiments, the storage medium has at least all the beneficial effects brought by the technical schemes of the embodiments, and the description is omitted here.
In addition, referring to fig. 4, an embodiment of the present invention further provides an intelligent contract-based power transaction apparatus, including:
and the acquisition module 10 is used for acquiring the unit price list of the electric power sent to the blockchain by the electricity seller when receiving the electricity utilization request sent by the electricity buyer.
And the generating module 20 is configured to generate power transmission and distribution power transaction data according to the confirmation power consumption instruction and the power unit price list by calling an intelligent contract after receiving the confirmation power consumption instruction of the power purchasing party.
And the encryption module 30 is used for encrypting the power transmission and distribution power transaction data through a random number generation algorithm.
The determining module 40 is configured to determine a risk of the power transaction being attacked after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data.
The control module 50 is configured to control a current power transaction according to the risk of the power transaction being attacked.
In the embodiment, when receiving an electricity utilization request sent by an electricity purchasing party, an electricity unit price list sent to a blockchain by an electricity selling party is obtained; after receiving a confirmation electricity utilization instruction of the electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and the power unit price list by calling an intelligent contract; encrypting the power transmission and distribution power transaction data through a random number generation algorithm; after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked; controlling the current power transaction according to the risk of the power transaction being attacked; by means of the method, the generated power transmission and distribution power transaction data are encrypted by means of the random number generation algorithm, whether current power transaction is conducted or not is determined according to the risk that power transaction is attacked, point-to-point data interaction between two parties is achieved, and therefore safety of the power transaction can be effectively improved.
It should be noted that the above-described working procedure is merely illustrative, and does not limit the scope of the present invention, and in practical application, a person skilled in the art may select part or all of them according to actual needs to achieve the purpose of the embodiment, which is not limited herein.
In addition, technical details not described in detail in the present embodiment may refer to the smart contract-based power transaction method provided in any embodiment of the present invention, which is not described herein.
Other embodiments of the smart contract-based power transaction apparatus or the implementation method thereof according to the present invention may refer to the above-mentioned method embodiments, and are not repeated here.
Furthermore, it should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. Read Only Memory)/RAM, magnetic disk, optical disk) and including several instructions for causing a terminal device (which may be a mobile phone, a computer, an integrated platform workstation, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. A smart contract-based power transaction method, characterized in that the smart contract-based power transaction method includes the steps of:
when receiving an electricity utilization request sent by an electricity purchasing party, acquiring an electricity unit price list sent to a blockchain by an electricity selling party;
after receiving a confirmation electricity utilization instruction of the electricity purchasing party, generating power transmission and distribution power transaction data according to the confirmation electricity utilization instruction and the power unit price list by calling an intelligent contract;
encrypting the power transmission and distribution power transaction data through a random number generation algorithm;
after receiving confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data, determining the risk of the power transaction being attacked;
and controlling the current power transaction according to the risk of the power transaction being attacked.
2. The smart contract-based power trading method of claim 1, wherein upon receiving a power request sent by a power buyer, obtaining a monovalent list of power sent by the power seller to the blockchain, comprising:
when receiving an electricity consumption request sent by an electricity purchasing party, acquiring account information of the electricity purchasing party;
determining whether the electricity purchasing party is an abnormal user according to the account information;
intercepting the electricity utilization request when the electricity purchasing party is determined to be an abnormal user;
when the electricity purchasing party is not an abnormal user, determining a login attribution area of an account to which the account information belongs;
generating a power unit price list request when the login home zone is a common home zone;
and setting the electricity selling party obtained according to the request of the electricity unit price list by the blockchain in the electricity unit price list of the login attribution area.
3. The smart contract-based power trading method of claim 1, wherein generating power transmission and distribution power trading data from the confirmation power consumption command and the power unit price list by calling a smart contract after receiving the confirmation power consumption command of the power purchasing party includes:
after receiving a confirmation electricity utilization instruction of the electricity purchasing party, analyzing the confirmation electricity utilization instruction to obtain electricity purchasing quantity of the electricity purchasing party;
determining the unit price of the electric power corresponding to the electricity purchasing quantity according to the unit price list of the electric power;
generating exclusive power data of the electricity purchasing party according to the electricity purchasing quantity, the power unit price and the power transmission and distribution data;
and packaging the exclusive power data through a target node to generate power transmission and distribution power transaction data.
4. The smart contract-based power transaction method according to claim 1, wherein the determining the risk of the power transaction being attacked after receiving confirmation information of the power transmission and distribution power transaction data encrypted by the power purchasing party and the power selling party includes:
after receiving confirmation information of the power transmission and distribution power transaction data encrypted by the power purchasing party and the power selling party, detecting whether an attack node has a behavior of tampering with the power transmission and distribution power transaction data or not;
when the behavior of tampering the power transmission and distribution power transaction data of the attack node is detected, determining a block gap between the attack node and an honest chain;
acquiring the probability of the attack node for manufacturing the next block and the probability of the honest node for manufacturing the next block;
calculating the probability of eliminating the block gap of the attack node according to the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node;
and determining the risk of the power transaction being attacked according to the probability of eliminating the block gap by the attack node, the probability of manufacturing the next block by the attack node and the probability of manufacturing the next block by the honest node.
5. The smart contract-based power transaction method of claim 4, wherein the determining a risk of a power transaction being attacked based on the probability of the attacking node eliminating the block gap, the probability of the attacking node manufacturing a next block, and the probability of the honest node manufacturing a next block, includes:
calculating an expected growth value of an attack chain corresponding to the attack node according to the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block;
counting the number of blocks of the block gap;
generating a probability expression for replacing the honest block according to the expected growth value, the number of blocks, the probability of the attack node manufacturing the next block and the probability of the honest node manufacturing the next block;
and calculating the risk of the power transaction being attacked according to the block number and the probability expression of the substitution of the honest blocks.
6. The smart contract-based power transaction method according to claim 1, wherein the controlling of the current power transaction according to the risk of the power transaction being attacked includes:
acquiring node access data of a power distribution network of an electricity seller;
determining user nodes and other node sets according to the node access data;
determining injection power of the user node accessing to the other node set;
when the injection power is a preset power threshold, acquiring a phase angle of the user node and impedance between the user node and each node in the other node set;
calculating the power load born by the power distribution network according to the injection power, the phase angle and the impedance;
and when the power load is smaller than a preset power load threshold, controlling the current power transaction according to the risk of the power transaction being attacked.
7. The smart contract-based power trading method of claim 6, wherein controlling the current power trade according to the risk of the power trade being attacked when the power load is less than a preset power load threshold includes:
when the power load is smaller than a preset power load threshold, judging whether a value corresponding to the risk of the power transaction being attacked is smaller than a preset risk threshold;
when the corresponding value of the risk of the power transaction being attacked is smaller than a preset risk threshold, the current power transaction is sent to a power purchasing party;
updating node access data of a power distribution network of an electricity seller when receiving successful payment information of the current electric power transaction by the electricity buyer;
and stopping the current power transaction when the power load is greater than or equal to a preset power load threshold value and/or the corresponding value of the risk of the power transaction being attacked is greater than or equal to a preset risk threshold value.
8. A smart contract-based power trading device for implementing the smart contract-based power trading method of any one of claims 1 to 7, characterized in that the smart contract-based power trading device includes:
the acquisition module is used for acquiring an electric power unit price list sent to the blockchain by the electricity seller when receiving an electricity utilization request sent by the electricity buyer;
the generation module is used for generating power transmission and distribution power transaction data according to the confirmation power utilization instruction and the power unit price list by calling an intelligent contract after receiving the confirmation power utilization instruction of the power purchasing party;
the encryption module is used for encrypting the power transmission and distribution power transaction data through a random number generation algorithm;
the determining module is used for determining the risk of the power transaction being attacked after receiving the confirmation information of the power purchasing party and the power selling party on the encrypted power transmission and distribution power transaction data;
and the control module is used for controlling the current power transaction according to the risk of the power transaction being attacked.
9. An intelligent contract-based power trading device, the intelligent contract-based power trading device comprising: a memory, a processor, and a smart contract-based power transaction program stored on the memory and executable on the processor, the smart contract-based power transaction program configured to implement the smart contract-based power transaction method of any one of claims 1 to 7.
10. A storage medium having stored thereon a smart contract-based power transaction program that when executed by a processor implements the smart contract-based power transaction method of any one of claims 1 to 7.
CN202310539199.4A 2023-05-15 2023-05-15 Intelligent contract-based power transaction method, device, equipment and storage medium Active CN116308802B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310539199.4A CN116308802B (en) 2023-05-15 2023-05-15 Intelligent contract-based power transaction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310539199.4A CN116308802B (en) 2023-05-15 2023-05-15 Intelligent contract-based power transaction method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116308802A true CN116308802A (en) 2023-06-23
CN116308802B CN116308802B (en) 2023-10-31

Family

ID=86789048

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310539199.4A Active CN116308802B (en) 2023-05-15 2023-05-15 Intelligent contract-based power transaction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116308802B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108711077A (en) * 2018-05-25 2018-10-26 电子科技大学 A kind of photovoltaic type micro-capacitance sensor method of commerce based on block chain technology
CN111161043A (en) * 2019-12-09 2020-05-15 杭州爱易货科技有限公司 Block chain-based acceptance draft application method
CN111260450A (en) * 2020-02-18 2020-06-09 暨南大学 Electric power bilateral transaction system based on block chain technology
US20210049281A1 (en) * 2019-08-13 2021-02-18 International Business Machines Corporation Reducing risk of smart contracts in a blockchain
CN114154984A (en) * 2021-10-20 2022-03-08 西安电子科技大学广州研究院 Power grid node reliability information determination and evaluation method, system, equipment and terminal
CN115311084A (en) * 2022-05-18 2022-11-08 东南大学 Method, device, equipment and storage medium for electric energy point-to-point transaction
CN115601175A (en) * 2022-10-28 2023-01-13 南京理工大学(Cn) Carbon emission right trading method based on block chain and Bayesian game

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108711077A (en) * 2018-05-25 2018-10-26 电子科技大学 A kind of photovoltaic type micro-capacitance sensor method of commerce based on block chain technology
US20210049281A1 (en) * 2019-08-13 2021-02-18 International Business Machines Corporation Reducing risk of smart contracts in a blockchain
CN111161043A (en) * 2019-12-09 2020-05-15 杭州爱易货科技有限公司 Block chain-based acceptance draft application method
CN111260450A (en) * 2020-02-18 2020-06-09 暨南大学 Electric power bilateral transaction system based on block chain technology
CN114154984A (en) * 2021-10-20 2022-03-08 西安电子科技大学广州研究院 Power grid node reliability information determination and evaluation method, system, equipment and terminal
CN115311084A (en) * 2022-05-18 2022-11-08 东南大学 Method, device, equipment and storage medium for electric energy point-to-point transaction
CN115601175A (en) * 2022-10-28 2023-01-13 南京理工大学(Cn) Carbon emission right trading method based on block chain and Bayesian game

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
方绍凤 等: "计及风险规避的电力零售商平衡市场交易模型", 《电力系统及其自动化学报》, vol. 32, no. 2, pages 23 - 27 *

Also Published As

Publication number Publication date
CN116308802B (en) 2023-10-31

Similar Documents

Publication Publication Date Title
US11362814B1 (en) Autonomous devices
CN110609869B (en) Block chain-based data storage method, related equipment and storage medium
US9530126B2 (en) Secure mobile payment processing
Paverd et al. Security and privacy in smart grid demand response systems
CN114401268A (en) Cross-link data sharing method, system, equipment and readable storage medium
CN115114658B (en) Verifiable data transaction method, device, equipment and medium based on blockchain
CN114358766A (en) Method, equipment and blockchain system for trading green electric certificates
CN111429134A (en) Data transaction method and device based on block chain
CN104881781B (en) A kind of method, system and client based on Secure Transaction
JP2013250752A (en) Sequence data protection method and sequence data protection program
CN116308802B (en) Intelligent contract-based power transaction method, device, equipment and storage medium
CN110266686B (en) Data sharing method, device, equipment and computer readable storage medium
CN107622396A (en) Self-service dealing method, system and terminal device
CN116823257A (en) Information processing method, device, equipment and storage medium
CN109741050A (en) Extend method of financial IC card service life and associated method and device
US20230012276A1 (en) System, Method, and Apparatus for Decentralized E-Commerce
CN115082050A (en) Transaction method, system, device, equipment and medium for third party payment
CN113205378A (en) Electric energy transaction system based on block chain
CN104205142A (en) Link of mobile devices to facilitate mobile commerce transactions
CN113222603A (en) International trade credit settlement authentication method and system
CN113783690A (en) Tender inviting method and device based on authentication
CN110544125A (en) Block chain based cut price data evidence storing method and device
CN115065505B (en) Privacy protection method and related device
KR20190119294A (en) Cryptocurrency hardware wallet for authenticating interlocked transaction and method thereof
CN113095856B (en) Electric power market transaction method and platform

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