CN114663091B - Power trading method based on multi-chain blockchain architecture - Google Patents

Power trading method based on multi-chain blockchain architecture Download PDF

Info

Publication number
CN114663091B
CN114663091B CN202210305350.3A CN202210305350A CN114663091B CN 114663091 B CN114663091 B CN 114663091B CN 202210305350 A CN202210305350 A CN 202210305350A CN 114663091 B CN114663091 B CN 114663091B
Authority
CN
China
Prior art keywords
chain
transaction
node
nodes
information
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.)
Active
Application number
CN202210305350.3A
Other languages
Chinese (zh)
Other versions
CN114663091A (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.)
Shanghai University of Electric Power
Original Assignee
Shanghai University of Electric Power
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 Shanghai University of Electric Power filed Critical Shanghai University of Electric Power
Priority to CN202210305350.3A priority Critical patent/CN114663091B/en
Publication of CN114663091A publication Critical patent/CN114663091A/en
Application granted granted Critical
Publication of CN114663091B publication Critical patent/CN114663091B/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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • G06Q20/4014Identity check for transactions
    • 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/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Public Health (AREA)
  • Water Supply & Treatment (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Tourism & Hospitality (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a power transaction method based on a multi-chain block chain architecture, which comprises the following steps: a multi-chain block chain structure is constructed in advance, a plurality of block chains are coupled through a plurality of common nodes, and a transaction objective function and constraint conditions are set; when a transaction demand is generated, each node conducts transaction in a mode of signing an intelligent contract according to a preset transaction target function and a constraint condition, the node competes for the bookkeeping right according to a bookkeeping right consensus algorithm based on an honest value, and the shared node conducts cross-link processing on information between different block chains in the transaction process. According to the invention, by adopting the multi-chain block chain and coupling through the common nodes, various information related to transaction can be selectively shared and verified in the multi-chain architecture, so that the safety is improved; the node user can be guided to obey the intelligent contract by competing the bookkeeping right through the bookkeeping right consensus algorithm based on the integrity value, the priority of the integrity node is improved, the occurrence of malicious behaviors is avoided, and the transaction efficiency and quality are improved.

Description

基于多链式区块链架构的电力交易方法Power trading method based on multi-chain blockchain architecture

技术领域technical field

本发明涉及数据安全领域,特别涉及基于多链式区块链架构的电力交易方法。The invention relates to the field of data security, in particular to a power trading method based on a multi-chain block chain architecture.

背景技术Background technique

随着分布式能源技术的发展以及政策层面的有力支持,分布式能源设备(DER)将会得到越来越广泛的应用。传统的电能消费者转变成具有电能生产和消费双重属性的产消用户。微电网作为相对独立的电网结构,可以直接满足产消用户的交易需求,实现清洁能源的高效利用,是分布式电能参与电力交易的主要实践场景。传统微电网电力交易策略存在交易双方信任缺失和信息不透明的现象,导致微电网系统内交易数据易被篡改、交易效率无法得到有效保障。因此,现阶段电力体制改革的关键点在于建立一个安全、高效、透明的交易方案。With the development of distributed energy technology and strong support at the policy level, distributed energy equipment (DER) will be more and more widely used. Traditional electricity consumers are transformed into prosumers with dual attributes of electricity production and consumption. As a relatively independent power grid structure, the microgrid can directly meet the transaction needs of production and consumption users and realize the efficient use of clean energy. It is the main practical scenario for distributed electric energy to participate in power transactions. The traditional microgrid power trading strategy has the phenomenon of lack of trust between the two parties and opaque information, which makes the transaction data in the microgrid system easy to be tampered with, and the transaction efficiency cannot be effectively guaranteed. Therefore, the key point of power system reform at this stage is to establish a safe, efficient and transparent transaction plan.

区块链是一种将密码学算法、分布式数据存储、点对点传输、共识机制和智能合约等新型计算机技术进行深度应用的分布式数据库。数据库中的信息由所有的网络节点共享,而数据的管理方全权负责数据更新,同时数据更新过程也面向所有网络节点公开。因此,区块链具有去中心化、不可篡改以及公开透明的特性,这与微电网分布式电能交易的需求完美契合。因此,区块链技术为解决微电网电力交易领域的问题提供了研究方向和参考依据。Blockchain is a distributed database that deeply applies new computer technologies such as cryptographic algorithms, distributed data storage, point-to-point transmission, consensus mechanisms, and smart contracts. The information in the database is shared by all network nodes, and the data manager is fully responsible for data update, and the data update process is also open to all network nodes. Therefore, the blockchain has the characteristics of decentralization, non-tampering, and openness and transparency, which perfectly fits the needs of distributed energy transactions in microgrids. Therefore, blockchain technology provides a research direction and reference basis for solving problems in the field of microgrid power trading.

目前,国内外学者研究从多个方面将区块链技术引入到微电网电力交易领域中。现有技术中,有文献提出一种基于区块链技术的信誉值激励方法,有效改善了产消用户间交易效率低下的问题。有文献针对分布式能源交易的安全性问题,设计了配售电交易平台,使得节点间分布式能源的交易过程更加安全高效。有文献考虑到“时前市场”这一因素,构建多番主体间的随机匹配市场交易机制,有效解决交易市场多经营主体间的交易问题。有文献提出一种可以实现智能设备的分散自治的高性能区块链管理平台,实现一种去中心化的自治管理系统。有文献提出一种可以保障交易双方权益的电力交易机制,利用区块链技术和多重签名方法实现交易双方的数据安全性。有文献设计了基于区块链的配电系统分布式能源市场架构,达到区块链优势与分布式能源交易特性深度融合的目的。上述文献对实现微电网内电力交易的安全高效性具有积极的作用,也为进一步优化电力系统中的分布式能源交易机制提供了参考和借鉴。但是还存在如下两个方面的问题:①研究主要考虑到交易的公开透明性问题,没有涉及分布式能源交易所需遵守的网络安全约束方面的研究,使得交易方案脱离电力系统安全运行实际需求;②在电力交易过程中仍然存在节点的诚信度问题,而目前的研究中缺少规范节点交易行为的监督机制,这可能导致节点受到利益驱使,从而出现违反合约以及恶意共识等行为。At present, scholars at home and abroad are researching the introduction of blockchain technology into the field of microgrid power trading from various aspects. In the existing technology, some literatures propose a credit value incentive method based on blockchain technology, which effectively improves the problem of low transaction efficiency between prosumer users. Aiming at the security issues of distributed energy transactions, some literatures have designed a distribution and sales trading platform to make the transaction process of distributed energy between nodes safer and more efficient. Some literature considers the factor of "temporary market" and constructs a random matching market transaction mechanism among multiple subjects to effectively solve the transaction problem among multiple business subjects in the trading market. Some literature proposes a high-performance blockchain management platform that can realize the decentralized autonomy of smart devices, and implement a decentralized autonomous management system. Some literature proposes a power transaction mechanism that can protect the rights and interests of both parties to the transaction, using blockchain technology and multi-signature methods to achieve data security for both parties to the transaction. Some literatures have designed a blockchain-based distribution system distributed energy market architecture to achieve the purpose of deep integration of blockchain advantages and distributed energy transaction characteristics. The above literature plays a positive role in realizing the safety and efficiency of power transactions in microgrids, and also provides references for further optimizing the distributed energy transaction mechanism in the power system. However, there are still two problems in the following aspects: ① The research mainly considers the openness and transparency of the transaction, and does not involve the research on the network security constraints that the distributed energy transaction must abide by, which makes the transaction plan divorced from the actual needs of the safe operation of the power system; ② There is still a problem of node integrity in the process of power trading, and the current research lacks a supervision mechanism to regulate node transaction behavior, which may lead to nodes being driven by interests, resulting in violation of contracts and malicious consensus behaviors.

发明内容Contents of the invention

针对现有技术中交易系统安全性较差的问题,本发明提供了基于多链式区块链架构的电力交易方法,为了兼顾系统安全约束与节点诚信保障的双重特性,构建了多链式区块链架构用于提供不同的功能,有效保障产消用户节点间交易的安全高效性。In view of the poor security of the transaction system in the prior art, the present invention provides a power transaction method based on a multi-chain block chain architecture. In order to take into account the dual characteristics of system security constraints and node integrity protection, a multi-chain block chain is constructed. The block chain architecture is used to provide different functions and effectively guarantee the safety and efficiency of transactions between production and consumption user nodes.

以下是本发明的技术方案。The following is the technical scheme of the present invention.

基于多链式区块链架构的电力交易方法,包括以下步骤:A power trading method based on a multi-chain blockchain architecture, including the following steps:

预先构建多链式区块链架构,多个区块链之间通过若干共有节点耦合,并设置交易目标函数和约束条件;Pre-build a multi-chain blockchain architecture, multiple blockchains are coupled through several common nodes, and set transaction objective functions and constraints;

产生交易需求时,各节点根据预设的交易目标函数和约束条件以签订智能合约的方式进行交易,并根据基于诚信值的记账权共识算法竞争记账权,交易过程中由共有节点对不同区块链之间的信息进行跨链处理。When a transaction demand is generated, each node conducts the transaction by signing a smart contract according to the preset transaction objective function and constraints, and competes for the bookkeeping right according to the bookkeeping right consensus algorithm based on the integrity value. Information between blockchains is processed across chains.

本发明采用多链式区块链,不同的区块链可以配置不同的处理模式,实现不同的功能,通过共有节点耦合,使得与交易相关的各类信息可以选择性地在多链式架构中分享和验证,提高安全性;通过基于诚信值的记账权共识算法竞争记账权,可以引导节点用户遵守智能合约,提高诚信节点的优先级,避免恶意行为的出现,提高交易效率和质量。The present invention adopts a multi-chain block chain, and different block chains can be configured with different processing modes to achieve different functions. Through the coupling of shared nodes, various types of information related to transactions can be selectively stored in the multi-chain architecture Share and verify to improve security; Compete for bookkeeping rights through the consensus algorithm of bookkeeping rights based on integrity value, which can guide node users to abide by smart contracts, improve the priority of honest nodes, avoid malicious behavior, and improve transaction efficiency and quality.

作为优选,所述预先构建多链式区块链架构,包括:构建交易链、监督链、信息链和电能链,其中设置调度中心节点作为交易链、监督链和电能链的共有节点,设置交易中心节点作为交易链、信息链和监督链的共有节点,其余节点为产消用户。Preferably, the pre-built multi-chain block chain architecture includes: constructing a transaction chain, a supervision chain, an information chain, and an electric energy chain, wherein the dispatching center node is set as a common node of the transaction chain, the supervision chain, and the electric energy chain, and the transaction The central node is the common node of the transaction chain, information chain and supervision chain, and the rest of the nodes are production and consumption users.

作为优选,所述交易目标函数,包括:Preferably, the transaction objective function includes:

Figure BDA0003564828220000021
Figure BDA0003564828220000021

式中St表示售电用户在t时刻总体收益函数;ΩA表示售电方的集合;

Figure BDA0003564828220000022
表示售电用户m在t时刻的出售电量单价;
Figure BDA0003564828220000023
表示售电用户m在t时刻的出售电量;
Figure BDA0003564828220000024
表示相对于出售电量的成本函数,表示为:In the formula, S t represents the overall revenue function of electricity sellers at time t; Ω A represents the set of electricity sellers;
Figure BDA0003564828220000022
Indicates the unit price of electricity sold by user m at time t;
Figure BDA0003564828220000023
Indicates the electricity sold by electricity seller m at time t;
Figure BDA0003564828220000024
Represents the cost function relative to the electricity sold, expressed as:

Figure BDA0003564828220000025
Figure BDA0003564828220000025

式中a、b、c分别表示对应电量

Figure BDA0003564828220000026
的成本系数;In the formula, a, b, and c respectively represent the corresponding power
Figure BDA0003564828220000026
cost factor;

在售电方和购电方存在电量平衡,表示为:There is an electricity balance between the electricity seller and the electricity buyer, expressed as:

Figure BDA0003564828220000027
Figure BDA0003564828220000027

式中ΩB表示购电方的集合;

Figure BDA0003564828220000031
表示第n个购电方在t时段的需求电量;In the formula, Ω B represents the set of power buyers;
Figure BDA0003564828220000031
Indicates the electricity demand of the nth electricity purchaser in the period t;

售电方可以选择的售电量范围为:The range of electricity sales that the electricity seller can choose is:

Figure BDA0003564828220000032
Figure BDA0003564828220000032

式中

Figure BDA0003564828220000033
分别表示第m个售电方在t时段可出售电量的上下限。In the formula
Figure BDA0003564828220000033
Respectively represent the upper and lower limits of the electricity that the mth electricity seller can sell in the t period.

作为优选,所述约束条件,包括:Preferably, the constraints include:

微电网中点对点交易的平衡约束为:The balance constraints of point-to-point transactions in the microgrid are:

Figure BDA0003564828220000034
Figure BDA0003564828220000034

式中:ΔPi为售电节点i的调整量;ΔLj为购电节点j的调整量;{GP}为所有点对点交易的售电集合;{LP}为所有点对点交易的购电集合;In the formula: ΔP i is the adjustment amount of power selling node i; ΔL j is the adjustment amount of power purchasing node j; {G P } is the set of electricity sales of all point-to-point transactions; {L P } is the set of power purchases of all point-to-point transactions ;

考虑热稳定和动稳定的线路潮流约束:Consider thermally and dynamically stable line power flow constraints:

Figure BDA0003564828220000035
Figure BDA0003564828220000035

式中:Pl,max为支路l的潮流限制,取热稳定和动稳定约束中值小者;Pl,0为支路l的初始潮流;ΔPl为支路l的潮流变化量;{L}为所有线路集合;In the formula: P l,max is the power flow limitation of branch l, whichever is smaller in the middle value of thermal stability and dynamic stability constraints; P l,0 is the initial power flow of branch l; ΔP l is the power flow variation of branch l; {L} is the set of all lines;

考虑动稳定的联络线割集潮流约束:Consider the dynamic and stable tie line cut set power flow constraints:

Figure BDA0003564828220000036
Figure BDA0003564828220000036

式中:PC,max为割集C的潮流限制,取为动稳定约束;

Figure BDA0003564828220000037
为割集C的初始潮流和;
Figure BDA0003564828220000038
为割集C的潮流变化量;{Ccut}为所有联络线割集集合。In the formula: P C,max is the power flow limit of the cut set C, which is taken as the dynamic stability constraint;
Figure BDA0003564828220000037
is the initial power flow sum of the cut set C;
Figure BDA0003564828220000038
is the power flow variation of cut set C; {C cut } is the set of cut sets of all contact lines.

作为优选,所述诚信值以智能合约的完成情况作为计算依据,计算过程包括:Preferably, the integrity value is calculated based on the completion of the smart contract, and the calculation process includes:

Figure BDA0003564828220000039
表示产消用户j在t时段内为售电用户,
Figure BDA00035648282200000310
表示产消用户j在t时段内为购电用户,由于产消用户j不能同时处于售电和购电两种状态,所以产消用户的状态约束可以表示为:
Figure BDA00035648282200000311
set up
Figure BDA0003564828220000039
Indicates that the production and consumption user j is a power selling user in the period t,
Figure BDA00035648282200000310
Indicates that prosumer user j is an electricity purchaser during the period t. Since prosumer user j cannot be in the states of selling electricity and purchasing electricity at the same time, the state constraints of prosumer users can be expressed as:
Figure BDA00035648282200000311

产消用户节点诚信值的计算标准为:The calculation standard for the integrity value of production and consumption user nodes is:

Figure BDA0003564828220000041
Figure BDA0003564828220000041

式中:

Figure BDA0003564828220000042
表示产消用户j的t时段前的诚信值;Qij表示产消用户j和产消用户i在智能合约中成交的电量;
Figure BDA0003564828220000043
表示产消用户j处于售电状态时所产生的实际电量;
Figure BDA0003564828220000044
表示产消用户j处于购电状态时所消耗的实际电量。In the formula:
Figure BDA0003564828220000042
Indicates the integrity value of prosumer user j before period t; Q ij represents the amount of electricity traded between prosumer user j and prosumer user i in the smart contract;
Figure BDA0003564828220000043
Indicates the actual electricity generated by prosumer user j in the state of selling electricity;
Figure BDA0003564828220000044
Indicates the actual power consumed by prosumer user j in the power purchasing state.

作为优选,所述多链式区块链架构中,各节点之间通过基于多中心化联盟链的共识机制进行信用积分计算和权限分级,包括:As a preference, in the multi-chain block chain architecture, credit score calculation and permission classification are performed between nodes through a consensus mechanism based on multi-centered alliance chains, including:

节点的信用积分变更方式:How to change the node's credit points:

Figure BDA0003564828220000045
Figure BDA0003564828220000045

式中:Rj为节点的累计信用积分;α为共识诚信所占的权重;β为交易诚信所占的权重;sj为节点共识贡献值,当节点在t时段完成有效共识,那么sj的值为1,否则为0;

Figure BDA0003564828220000046
为节点交易诚信值进行效益型标准化后的数值,具体计算方法为:In the formula: R j is the cumulative credit score of the node; α is the weight of consensus integrity; β is the weight of transaction integrity; s j is the node consensus contribution value, when the node completes the effective consensus in t period, then s j The value of is 1, otherwise it is 0;
Figure BDA0003564828220000046
It is the value after benefit-based standardization of the node transaction integrity value. The specific calculation method is:

Figure BDA0003564828220000047
Figure BDA0003564828220000047

式中:

Figure BDA0003564828220000048
分别代表在t时段的所有节点中交易诚信值的最大和最小值;In the formula:
Figure BDA0003564828220000048
Respectively represent the maximum and minimum values of the transaction integrity value in all nodes in the t period;

基于上述节点信用积分变更方式将节点划分为三个等级:一级节点为联盟链上的权威节点;二级节点为验证节点;三级节点为普通节点;在系统构建的初始阶段,取排名前30%的机构为一级节点,轮流负责用自己的私钥签名来创建并广播区块;剩余节点为二级节点,轮流检查已签名的区块是否合法;进入运行阶段后,新加入的节点默认为三级节点,不具备创建区块和验证区块的权利;所有节点都有共享数据的权利;各节点的运行结果根据预设条件进行加分或减分,当信用积分跨越预设的权限分级界线时自动调整分级。Nodes are divided into three levels based on the above-mentioned node credit point change method: the first-level nodes are authoritative nodes on the alliance chain; the second-level nodes are verification nodes; the third-level nodes are ordinary nodes; 30% of the institutions are first-level nodes, which take turns to create and broadcast blocks with their own private key signatures; the remaining nodes are second-level nodes, which take turns to check whether the signed blocks are legal; The default is a third-level node, which does not have the right to create blocks and verify blocks; all nodes have the right to share data; the operating results of each node will be added or subtracted according to preset conditions, when the credit score exceeds the preset Automatically adjust the grading when the permission grading boundary is reached.

作为优选,所述基于诚信值的记账权共识算法,包括:As a preference, the credit value-based bookkeeping right consensus algorithm includes:

Figure BDA0003564828220000049
Figure BDA0003564828220000049

式中:H为哈希函数;Dj为产消用户j的根哈希值;Kj表示产消用户j计算的随机数;Cj表示产消用户j的诚信值;Ndiffer表示计算难度系数;节点的诚信值与节点获取记账权的概率成正相关,诚信值越大的节点越容易获取记账权利;In the formula: H is a hash function; D j is the root hash value of prosumer user j; K j represents the random number calculated by prosumer user j; C j represents the integrity value of prosumer user j; N differ represents the difficulty of calculation Coefficient; the integrity value of the node is positively correlated with the probability of the node obtaining the bookkeeping right, and the node with the larger the integrity value is easier to obtain the bookkeeping right;

竞争记账权时,产消用户j打包这段时隙内所有的交易数据,并将其递归哈希得到根哈希值Dj,产消用户j进行大量穷举,基于上式找到Kj,将Kj打包进区块中,同时向网络中其他产消用户广播,其他产消用户收到相应的区块后根据上式中对应的Cj对区块进行验证,如验证通过则将对应区块添加到微电网信息链上,产消用户j得到记账奖励,否则删除该区块。When competing for bookkeeping rights, prosumer user j packs all transaction data in this time slot, and recursively hashes it to obtain the root hash value D j , prosumer user j performs a large number of exhaustive enumerations, and finds K j based on the above formula, Pack K j into the block and broadcast to other prosumer users in the network at the same time. After receiving the corresponding block, other prosumer users will verify the block according to the corresponding C j in the above formula. If the verification is passed, the corresponding The block is added to the microgrid information chain, and the prosumer user j gets the bookkeeping reward, otherwise the block is deleted.

作为优选,所述信息链采用去中心化的公有链,用于为想要参与微电网电力零售交易的产消用户节点进行注册登记;所述电能链采用中心化的私有链,调度中心节点作为中心节点负责生成新区块,其他节点不具有更改新区块中信息的权利,电能链上各个区块用于存储系统的物理信息;所述交易链作为主链,采用多中心化的联盟链,只存储节点的交易信息,依靠交易中心节点和调度中心节点与其它三个侧链的信息耦合;所述监督链采用多中心化的联盟链,用于评定产消用户交易行为的诚信值,各个区块用于存储交易节点的诚信值信息。Preferably, the information chain adopts a decentralized public chain, which is used to register the production and consumption user nodes who want to participate in the retail transaction of microgrid electricity; The central node is responsible for generating new blocks, and other nodes do not have the right to change the information in the new block. Each block on the electric energy chain is used to store the physical information of the system; The transaction information of the storage nodes depends on the information coupling between the transaction center node and the dispatch center node and the other three side chains; the supervision chain adopts a multi-centralized alliance chain to evaluate the integrity value of the transaction behavior of the production and consumption users. Blocks are used to store the integrity value information of transaction nodes.

作为优选,所述注册登记的过程包括:信息链根据用户的身份信息,产生一对密钥Pa和Pb,当用户是产消用户时,用户需提供分布式发电装置的信息,在此基础上,信息链会生成分布式发电装置的公钥和私钥,区块链系统会根据产消用户对应的公钥,完成节点身份的可靠验证,系统会根据节点的公钥与用户信息生成数字证书,网络内活跃节点将网络内信息收集打包并形成新区块,新区块经其他节点验证通过后被写入到区块链中。Preferably, the registration process includes: the information link generates a pair of keys P a and P b according to the identity information of the user. When the user is a prosumer user, the user needs to provide the information of the distributed power generation device. Here Basically, the information chain will generate the public key and private key of the distributed power generation device, and the blockchain system will complete the reliable verification of the node identity according to the public key corresponding to the production and consumption user, and the system will generate With digital certificates, active nodes in the network collect and package information in the network to form new blocks, which are written into the blockchain after being verified by other nodes.

作为优选,所述跨链处理,包括:Preferably, the cross-chain processing includes:

交易链与电能链的跨链处理:调度中心节点在交易链的记账权节点产生交易新区块后,获取待校核的实时市场交易记录,并在安全校核通过后发布到电能链上;电能链上其它节点进行验证,验证通过后,由调度中心节点将所形成的交易调整量信息ΔM发布至交易链,由初始记账权节点验证调整方案的有效性,验证通过后,将初始交易方案更新再进行全网发布;Cross-chain processing of the transaction chain and the energy chain: the dispatching center node obtains the real-time market transaction records to be verified after the transaction chain's bookkeeping right node generates a new transaction block, and releases it to the energy chain after passing the security verification; Other nodes on the electric energy chain conduct verification. After the verification is passed, the dispatching center node will publish the formed transaction adjustment information ΔM to the transaction chain, and the initial bookkeeping right node will verify the validity of the adjustment plan. After the verification is passed, the initial transaction The plan is updated and released on the whole network;

交易链与信息链的跨链处理:交易中心节点将信息链上的区块信息发布至交易链上,为下一时段节点间交易电量的预测提供参考;Cross-chain processing of the transaction chain and the information chain: the transaction center node publishes the block information on the information chain to the transaction chain, providing a reference for the prediction of the transaction power between nodes in the next period;

交易链与监督链的跨链处理:交易中心节点将安全校核调整后的交易结算信息发布至监督链上,监督链上节点选择性计算交易节点的诚信值,之后借助共识机制达成全网共识并形成新区块写入到监督链系统中,交易节点获取区块信息发布至交易链上,该诚信值信息作为下次交易优先推选的评定指标。Cross-chain processing of the transaction chain and the supervision chain: the transaction center node publishes the transaction settlement information after the security check and adjustment to the supervision chain, and the nodes on the supervision chain selectively calculate the integrity value of the transaction node, and then use the consensus mechanism to reach a consensus on the entire network And form a new block and write it into the supervision chain system, the transaction node obtains the block information and publishes it to the transaction chain, and the integrity value information is used as the evaluation index for the next transaction priority selection.

本发明的多链式区块链结构具有如下特点:The multi-chain block chain structure of the present invention has the following characteristics:

点对点交易的多中心化交易链的设计。利用微电网内部产消用户收益最大为目标函数,建立交易优化模型,实现在满足产消节点电能需求的同时,尽量减少产消用户与大电网交易的几率。交易链采用多中心化的联盟链,节点的准入机制取决于节点在信息链上的基本信息以及历史诚信值,这使得产消用户间的交易更加安全且高效的运行。交易链上所有节点通过改进的权益证明共识算法(proof of authority,PoA)达成共识。The design of a multi-centralized transaction chain for point-to-point transactions. Using the maximum profit of production and consumption users inside the microgrid as the objective function, a transaction optimization model is established to realize the reduction of the probability of transactions between production and consumption users and the large power grid while meeting the power demand of production and consumption nodes. The transaction chain adopts a multi-centralized alliance chain, and the node access mechanism depends on the basic information of the node on the information chain and the historical integrity value, which makes the transaction between production and consumption users more secure and efficient. All nodes on the transaction chain reach a consensus through the improved proof of authority (PoA) consensus algorithm.

网络安全校核的中心化电能链设计。电能链的中心节点为调度节点,调度节点作为交易的第三方,不涉及经济利益问题。同时,调度中心的校核信息会发布到私有链上由其它节点进行验证,保障校核信息的可靠性。因此,设立该节点作为私有链的中心节点,不仅可以保证电能安全校核的高效性,而且避免了单节点校核所产生的不透明性和不公开性。Centralized power chain design for network security verification. The central node of the electric energy chain is the scheduling node, and the scheduling node is the third party of the transaction, which does not involve economic interests. At the same time, the verification information of the dispatch center will be released to the private chain for verification by other nodes to ensure the reliability of the verification information. Therefore, setting up this node as the central node of the private chain can not only ensure the efficiency of power security verification, but also avoid the opacity and non-disclosure caused by single-node verification.

约束产消用户行为的多中心化监督链的设计。在监督链系统中,交易中心节点作为耦合交易链和监督链的节点,将交易链的最终结算信息发布到监督链网络中,网络中活跃的节点可以申请计算本交易周期内节点的诚信值。在此基础上,依据改进PoA共识算法在全网达成共识。最终被验证通过的节点诚信值将被写入到区块链上,作为下次交易的优先参考依据。The design of a multi-center supervision chain that constrains production and consumption user behavior. In the supervision chain system, the transaction center node, as the node coupling the transaction chain and the supervision chain, publishes the final settlement information of the transaction chain to the supervision chain network, and the active nodes in the network can apply to calculate the integrity value of the node in the current transaction cycle. On this basis, according to the improved PoA consensus algorithm, a consensus is reached in the whole network. The integrity value of the node that is finally verified will be written into the blockchain as a priority reference for the next transaction.

基于去中心化的信息链的设计。信息链上每个节点都带有一条完整的区块信息,存储产消者地址、自身发用电情况以及日负荷曲线等信息。由于信息链上节点数量庞大,种类繁多,因此,采用公有链可以保障用户节点信息的公开透明性。所有信息链上的节点通过基于诚信值的共识机制相互竞争产生记账权节点,该诚信值依靠交易中心节点实现监督链与信息链间的耦合。同时,信息链所有节点的用户信息都可以进行追溯,且不可人为篡改,可实现交易电量的自行决策与自我管理。Based on the design of decentralized information chain. Each node on the information chain has a complete block information, which stores information such as the address of the prosumer, its own power generation and consumption, and the daily load curve. Due to the large number and variety of nodes on the information chain, the use of public chains can ensure the openness and transparency of user node information. All nodes on the information chain compete with each other through a consensus mechanism based on integrity value to generate bookkeeping right nodes. The integrity value relies on the transaction center node to realize the coupling between the supervision chain and the information chain. At the same time, the user information of all nodes in the information chain can be traced back, and cannot be tampered with, enabling self-determination and self-management of transaction power.

本发明的实质性效果包括:利用多链式区块链可以将交易信息分链存储的特性,建立以交易链为中心链,电能链、信息链和监督链为辅助链的多链式区块链架构;结合多链式区块链架构兼顾经济、安全与监督属性的作用,达到提高交易性能和安全性的目的;通过将权威证明共识机制进行改进,使得联盟链内部节点间的共识效率大大提高;使节点间交易的可靠性和高效性得到保障;在对交易进行网络安全校核的同时,约束产消用户节点的交易以及共识行为,为解决基于单链式区块链架构的电力交易方法性能低下等问题提供决策支持和理论支撑。The substantive effects of the present invention include: using the multi-chain block chain to store transaction information in separate chains, establishing a multi-chain block with the transaction chain as the central chain, and the power chain, information chain and supervision chain as auxiliary chains Chain architecture; combined with the multi-chain blockchain architecture taking into account the role of economy, security and supervision attributes, to achieve the purpose of improving transaction performance and security; by improving the consensus mechanism of authoritative proof, the consensus efficiency among the internal nodes of the alliance chain is greatly improved Improve; ensure the reliability and efficiency of transactions between nodes; while performing network security checks on transactions, restrict transactions and consensus behaviors of production and consumption user nodes, in order to solve power transactions based on single-chain blockchain architecture Provide decision support and theoretical support for problems such as low performance of the method.

附图说明Description of drawings

图1是本发明实施例的流程图;Fig. 1 is the flowchart of the embodiment of the present invention;

图2是本发明实施例的多链式区块链架构图;Fig. 2 is a multi-chain blockchain architecture diagram of an embodiment of the present invention;

图3是本发明实施例的电能链与交易链耦合运行图;Fig. 3 is the coupling operation diagram of the electric energy chain and the transaction chain of the embodiment of the present invention;

图4是本发明实施例的节点竞争记账权流程图;Fig. 4 is a flow chart of nodes competing for accounting rights according to an embodiment of the present invention;

图5是本发明实施例的产消用户设备电气接线拓扑示意图;Fig. 5 is a schematic diagram of electrical wiring topology of production and consumption user equipment according to an embodiment of the present invention;

图6是本发明实施例的安全校核前产消用户间的交易结果图;Fig. 6 is a transaction result diagram between production and consumption users before the security check in the embodiment of the present invention;

图7是本发明实施例的安全校核后产消用户间的交易结果图;Fig. 7 is a transaction result diagram between production and consumption users after the security check of the embodiment of the present invention;

图8是本发明实施例的100次业务后产消用户节点诚信值变化图;Fig. 8 is a graph showing changes in credit value of user nodes after 100 transactions of the embodiment of the present invention;

图9是本发明实施例的基于诚信值的产消用户间节点交易情况图。Fig. 9 is a diagram of node transactions between prosumer users based on credit value according to an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合实施例,对本技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions will be clearly and completely described below in conjunction with the embodiments. Apparently, the described embodiments are only some of the embodiments of the present invention, not all of them. the embodiment. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

应当理解,在本发明的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that in various embodiments of the present invention, the sequence numbers of the processes do not mean the order of execution, and the execution order of the processes should be determined by their functions and internal logic, rather than by the implementation order of the embodiments of the present invention. The implementation process constitutes no limitation.

应当理解,在本发明中,“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be understood that in the present invention, "comprising" and "having" and any variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to Those steps or elements are not explicitly listed, but may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.

应当理解,在本发明中,“多个”是指两个或两个以上。“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。“包含A、B和C”、“包含A、B、C”是指A、B、C三者都包含,“包含A、B或C”是指包含A、B、C三者之一,“包含A、B和/或C”是指包含A、B、C三者中任1个或任2个或3个。It should be understood that in the present invention, "plurality" means two or more. "And/or" is just an association relationship describing associated objects, which means that there can be three kinds of relationships, for example, and/or B, which can mean: A exists alone, A and B exist at the same time, and B exists alone. . The character "/" generally indicates that the contextual objects are an "or" relationship. "Includes A, B and C", "Includes A, B, C" means that A, B, and C are all included, "includes A, B, or C" means includes one of A, B, and C, "Containing A, B and/or C" means containing any 1 or any 2 or 3 of A, B and C.

下面以具体的实施例对本发明的技术方案进行详细说明。实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solution of the present invention will be described in detail below with specific examples. The embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

实施例:Example:

基于多链式区块链架构的电力交易方法,包括如图1所示的以下步骤:The power trading method based on the multi-chain blockchain architecture includes the following steps as shown in Figure 1:

预先构建多链式区块链架构,多个区块链之间通过若干共有节点耦合,并设置交易目标函数和约束条件;Pre-build a multi-chain blockchain architecture, multiple blockchains are coupled through several common nodes, and set transaction objective functions and constraints;

产生交易需求时,各节点根据预设的交易目标函数和约束条件以签订智能合约的方式进行交易,并根据基于诚信值的记账权共识算法竞争记账权,交易过程中由共有节点对不同区块链之间的信息进行跨链处理。When a transaction demand is generated, each node conducts the transaction by signing a smart contract according to the preset transaction objective function and constraints, and competes for the bookkeeping right according to the bookkeeping right consensus algorithm based on the integrity value. Information between blockchains is processed across chains.

其中,预先构建多链式区块链架构如图2所示,包括:构建交易链、监督链、信息链和电能链,其中设置调度中心节点作为交易链、监督链和电能链的共有节点,设置交易中心节点作为交易链、信息链和监督链的共有节点,其余节点为产消用户。Among them, the pre-built multi-chain blockchain architecture is shown in Figure 2, including: building a transaction chain, a supervision chain, an information chain, and an electric energy chain. Set the trading center node as the common node of the transaction chain, information chain and supervision chain, and the remaining nodes are production and consumption users.

信息链采用去中心化的公有链,用于为想要参与微电网电力零售交易的产消用户节点进行注册登记;电能链采用中心化的私有链,调度中心节点作为中心节点负责生成新区块,其他节点不具有更改新区块中信息的权利,电能链上各个区块用于存储系统的物理信息;交易链作为主链,采用多中心化的联盟链,只存储节点的交易信息,依靠交易中心节点和调度中心节点与其它三个侧链的信息耦合;监督链采用多中心化的联盟链,用于评定产消用户交易行为的诚信值,各个区块用于存储交易节点的诚信值信息。The information chain adopts a decentralized public chain, which is used to register the production and consumption user nodes who want to participate in the microgrid power retail transaction; the electric energy chain adopts a centralized private chain, and the scheduling center node is responsible for generating new blocks as the central node. Other nodes do not have the right to change the information in the new block. Each block on the energy chain is used to store the physical information of the system; the transaction chain is used as the main chain, using a multi-centralized alliance chain, which only stores the transaction information of the nodes and relies on the transaction center Nodes and dispatch center nodes are coupled with the information of the other three side chains; the supervision chain adopts a multi-centralized alliance chain to evaluate the integrity value of the transaction behavior of production and consumption users, and each block is used to store the integrity value information of the transaction node.

对比现有的单链式区块链,本实施例所提出的多链式区块链结构具有如下特点:交易信息、用户信息、物理信息以及监督信息分开部署,交易链分别和信息链、电能链、监督链耦合且独立的运行。现有的单链式区块链上不仅需要存储交易信息,同时为了满足物理约束,还要包含电能输送信息,造成区块链容量剧增,性能下降等问题。另外,单链式区块链缺乏监督信息,无法实现对产消用户交易行为的有效约束。本实施例所提出的多链式区块链系统中,交易链作为主链依靠交易中心节点和调度中心,实现与其它三个侧链的信息耦合。交易链采用多中心化的联盟链,只存储节点的交易信息,实现产消用户节点间交易方案的高效存储和实施;电能链采用中心化的私有链,调度中心作为中心节点负责生成新区块,其他节点不具有更改新区块中信息的权利。电能链上各个区块存储系统的物理信息,实现交易方案的快速且安全的校核;监督链采用多中心化的联盟链,各个区块存储交易节点的诚信值信息,实现对产消用户交易行为的有效评定;信息链采用去中心化的公有链,产消用户节点想要参与微电网的电力零售交易,必须要在该链注册登记。产消用户将自身发电功率以及负荷功率等信息录入系统中,有效避免交易节点恶意篡改信息的行为。Compared with the existing single-chain blockchain, the multi-chain blockchain structure proposed in this embodiment has the following characteristics: transaction information, user information, physical information and supervision information are deployed separately, and the transaction chain is separately connected to the information chain and electric energy The chain and supervision chain are coupled and run independently. The existing single-chain blockchain not only needs to store transaction information, but also includes power transmission information in order to meet physical constraints, resulting in problems such as a sharp increase in blockchain capacity and performance degradation. In addition, the single-chain blockchain lacks supervision information and cannot effectively restrain the transaction behavior of prosumer users. In the multi-chain blockchain system proposed in this embodiment, the transaction chain as the main chain relies on the transaction center node and the dispatch center to realize information coupling with the other three side chains. The transaction chain adopts a multi-centralized alliance chain, which only stores the transaction information of the nodes, and realizes the efficient storage and implementation of the transaction scheme between the production and consumption user nodes; the electric energy chain adopts a centralized private chain, and the dispatch center is responsible for generating new blocks as the central node. Other nodes do not have the right to change the information in the new block. Each block on the energy chain stores the physical information of the system to realize the fast and safe verification of the transaction plan; the supervision chain adopts a multi-centralized alliance chain, and each block stores the integrity value information of the transaction node to realize the transaction of production and consumption users Effective evaluation of behavior; the information chain adopts a decentralized public chain, and the production and consumption user nodes must register in the chain if they want to participate in the power retail transaction of the microgrid. Prosumer users enter information such as their own power generation and load power into the system, effectively avoiding malicious tampering of information by trading nodes.

本发明的多链式区块链结构具有如下特点:The multi-chain block chain structure of the present invention has the following characteristics:

点对点交易的多中心化交易链的设计。利用微电网内部产消用户收益最大为目标函数,建立交易优化模型,实现在满足产消节点电能需求的同时,尽量减少产消用户与大电网交易的几率。交易链采用多中心化的联盟链,节点的准入机制取决于节点在信息链上的基本信息以及历史诚信值,这使得产消用户间的交易更加安全且高效的运行。交易链上所有节点通过改进的权益证明共识算法(proof of authority,PoA)达成共识。The design of a multi-centralized transaction chain for point-to-point transactions. Using the maximum profit of production and consumption users inside the microgrid as the objective function, a transaction optimization model is established to realize the reduction of the probability of transactions between production and consumption users and the large power grid while meeting the power demand of production and consumption nodes. The transaction chain adopts a multi-centralized alliance chain, and the node access mechanism depends on the basic information of the node on the information chain and the historical integrity value, which makes the transaction between production and consumption users more secure and efficient. All nodes on the transaction chain reach a consensus through the improved proof of authority (PoA) consensus algorithm.

网络安全校核的中心化电能链设计。电能链的中心节点为调度节点,调度节点作为交易的第三方,不涉及经济利益问题。同时,调度中心的校核信息会发布到私有链上由其它节点进行验证,保障校核信息的可靠性。因此,设立该节点作为私有链的中心节点,不仅可以保证电能安全校核的高效性,而且避免了单节点校核所产生的不透明性和不公开性。Centralized power chain design for network security verification. The central node of the electric energy chain is the scheduling node, and the scheduling node is the third party of the transaction, which does not involve economic interests. At the same time, the verification information of the dispatch center will be released to the private chain for verification by other nodes to ensure the reliability of the verification information. Therefore, setting up this node as the central node of the private chain can not only ensure the efficiency of power security verification, but also avoid the opacity and non-disclosure caused by single-node verification.

约束产消用户行为的多中心化监督链的设计。在监督链系统中,交易中心节点作为耦合交易链和监督链的节点,将交易链的最终结算信息发布到监督链网络中,网络中活跃的节点可以申请计算本交易周期内节点的诚信值。在此基础上,依据改进PoA共识算法在全网达成共识。最终被验证通过的节点诚信值将被写入到区块链上,作为下次交易的优先参考依据。The design of a multi-center supervision chain that constrains production and consumption user behavior. In the supervision chain system, the transaction center node, as the node coupling the transaction chain and the supervision chain, publishes the final settlement information of the transaction chain to the supervision chain network, and the active nodes in the network can apply to calculate the integrity value of the node in the current transaction cycle. On this basis, according to the improved PoA consensus algorithm, a consensus is reached in the whole network. The integrity value of the node that is finally verified will be written into the blockchain as a priority reference for the next transaction.

基于去中心化的信息链的设计。信息链上每个节点都带有一条完整的区块信息,存储产消者地址、自身发用电情况以及日负荷曲线等信息。由于信息链上节点数量庞大,种类繁多,因此,采用公有链可以保障用户节点信息的公开透明性。所有信息链上的节点通过基于诚信值的共识机制相互竞争产生记账权节点,该诚信值依靠交易中心节点实现监督链与信息链间的耦合。同时,信息链所有节点的用户信息都可以进行追溯,且不可人为篡改,可实现交易电量的自行决策与自我管理。Based on the design of decentralized information chain. Each node on the information chain has a complete block information, which stores information such as the address of the prosumer, its own power generation and consumption, and the daily load curve. Due to the large number and variety of nodes on the information chain, the use of public chains can ensure the openness and transparency of user node information. All nodes on the information chain compete with each other through a consensus mechanism based on integrity value to generate bookkeeping right nodes. The integrity value relies on the transaction center node to realize the coupling between the supervision chain and the information chain. At the same time, the user information of all nodes in the information chain can be traced back, and cannot be tampered with, enabling self-determination and self-management of transaction power.

本实施例的交易链与电能链的耦合运行机制如图3所示:交易链上调度中心节点在记账权节点产生交易新区块后,获取待校核的实时市场交易记录,发布到电能链上。调度中心节点对交易初始方案进行安全校核后,由电能链上其它节点进行验证。验证通过后,由调度中心节点将所形成的交易调整量信息ΔM发布至交易链。由初始记账权节点验证调整方案的有效性。验证通过后,将初始交易方案更新再进行全网发布。The coupling operation mechanism of the transaction chain and the electric energy chain in this embodiment is shown in Figure 3: after the dispatching center node on the transaction chain generates a new transaction block at the accounting authority node, it obtains the real-time market transaction records to be verified and publishes them to the electric energy chain superior. After the dispatch center node checks the security of the initial transaction plan, it is verified by other nodes on the electric energy chain. After the verification is passed, the dispatch center node will publish the formed transaction adjustment information ΔM to the transaction chain. The validity of the adjustment plan is verified by the initial bookkeeping right node. After the verification is passed, the initial transaction plan will be updated and released on the whole network.

本实施例的交易链与信息链的耦合运行机制:交易链和信息链依靠交易中心实现耦合,交易中心负责将信息链上的区块信息发布至交易链上,为下一时段节点间交易电量的预测提供参考。The coupling operation mechanism of the transaction chain and the information chain in this embodiment: the transaction chain and the information chain rely on the transaction center to realize the coupling. forecasts for reference.

本实施例的交易链与监督链的耦合运行机制:交易链上的交易中心节点将安全校核调整后的交易结算信息发布至监督链上。监督链上,活跃节点可以申请计算交易节点的诚信值,之后借助改进的PoA共识机制达成全网共识并形成新区块写入到监督链系统中。交易节点获取区块信息发布至交易链上,该诚信值信息作为下次交易优先推选的评定指标。The coupling operation mechanism of the transaction chain and the supervision chain in this embodiment: the transaction center node on the transaction chain publishes the transaction settlement information after security check and adjustment to the supervision chain. On the supervision chain, active nodes can apply to calculate the integrity value of transaction nodes, and then use the improved PoA consensus mechanism to reach a consensus on the entire network and form a new block to be written into the supervision chain system. The transaction node obtains the block information and publishes it to the transaction chain, and the integrity value information is used as the evaluation index for the priority selection of the next transaction.

跨链的过程中,需要校核耦合节点所递交的区块头信息,包括公私钥技术加密的数字签名和merkle树根。数字签名可保证数据来源的合法性,merkle树根用于验证交易内容的完整性,有效保证跨链过程中数据源的真实性。In the process of cross-chain, it is necessary to check the block header information submitted by the coupling node, including the digital signature encrypted by public-private key technology and the merkle tree root. The digital signature can guarantee the legitimacy of the data source, and the merkle tree root is used to verify the integrity of the transaction content, effectively ensuring the authenticity of the data source in the cross-chain process.

在微电网内部,每个产消用户根据智能电表采集的分布式电源的发电功率以及自身的用电功率,对该时段可交易电量进行定量预测。同时,以产消用户的经济收益最大为目标,优化决策各自的购电或售电功率,微电网内部缺电或者余电部分将由外网收购。在多边交易中,购电方和售电方需要发起买/卖偏差电量交易需求,以消除实际发用电量与计划值的偏差。当处于卖方市场环境下,交易目标函数是售电用户总体获益最高。当处于买方市场环境下,交易目标为要求购电用户购买电价最低。本实施例以卖方市场为例,交易的目标函数如下:In the microgrid, each production and consumption user makes quantitative predictions on the amount of tradable electricity in this period based on the power generated by the distributed power source collected by the smart meter and its own power consumption. At the same time, with the goal of maximizing the economic benefits of production and consumption users, optimize the decision-making of their respective power purchases or sales power, and the internal power shortage or surplus power of the microgrid will be purchased from the external network. In a multilateral transaction, the power purchaser and the power seller need to initiate a purchase/sell transaction demand for deviation power to eliminate the deviation between the actual power generation and consumption and the planned value. When in a seller's market environment, the transaction objective function is the highest overall benefit for electricity sellers. When in a buyer's market environment, the transaction goal is to require electricity purchasers to purchase electricity at the lowest price. In this embodiment, the seller's market is taken as an example, and the objective function of the transaction is as follows:

Figure BDA0003564828220000101
Figure BDA0003564828220000101

式中St表示售电用户在t时刻总体收益函数;ΩA表示售电方的集合;

Figure BDA0003564828220000102
表示售电用户m在t时刻的出售电量单价;
Figure BDA0003564828220000103
表示售电用户m在t时刻的出售电量;
Figure BDA0003564828220000104
表示相对于出售电量的成本函数,具体表示为:In the formula, S t represents the overall revenue function of electricity sellers at time t; Ω A represents the set of electricity sellers;
Figure BDA0003564828220000102
Indicates the unit price of electricity sold by user m at time t;
Figure BDA0003564828220000103
Indicates the electricity sold by electricity seller m at time t;
Figure BDA0003564828220000104
Represents the cost function relative to the electricity sold, specifically expressed as:

Figure BDA0003564828220000105
Figure BDA0003564828220000105

式中a、b、c分别表示对应电量

Figure BDA0003564828220000106
的成本系数。In the formula, a, b, and c respectively represent the corresponding power
Figure BDA0003564828220000106
cost factor.

在售电方和购电方存在电量平衡,可表示为:There is an electricity balance between the electricity seller and the electricity buyer, which can be expressed as:

Figure BDA0003564828220000107
Figure BDA0003564828220000107

式中ΩB表示购电方的集合;

Figure BDA0003564828220000108
表示第n个购电方在t时段的需求电量。In the formula, Ω B represents the set of power buyers;
Figure BDA0003564828220000108
Indicates the electricity demand of the nth electricity purchaser in the period t.

售电方可以选择的售电量范围为:The range of electricity sales that the electricity seller can choose is:

Figure BDA0003564828220000109
Figure BDA0003564828220000109

式中

Figure BDA00035648282200001010
分别表示第m个售电方在t时段可出售电量的上下限。In the formula
Figure BDA00035648282200001010
Respectively represent the upper and lower limits of the electricity that the mth electricity seller can sell in the t period.

交易链选取多中心化的联盟链,所有节点区块存储点对点交易所在配电系统的交易信息。交易中心节点作为监督节点,将联盟链上产消用户的交易信息发布至监督链,监督链中活跃节点申请计算产消用户节点的诚信值,并向所有监督链发布。由于,权威证明共识机制(proof of authority,PoA)生成区块更快,可扩展能力强。The transaction chain selects a multi-centralized alliance chain, and all node blocks store the transaction information of the point-to-point exchange in the power distribution system. As a supervisory node, the transaction center node publishes the transaction information of the prosumer users on the alliance chain to the supervision chain, and the active nodes in the supervision chain apply to calculate the integrity value of the prosumer user nodes, and publish it to all supervision chains. Because the authority proof consensus mechanism (proof of authority, PoA) generates blocks faster and has strong scalability.

电能链是在微电网中自建的私有区块链,该链仅为区域内的同一电压级的产消用户提供服务。基于多中心化的交易链,所有产消者市场达成的交易方案在具体实施之前,必须通过网络安全校核,满足电力系统的安全约束。因此,设计交易链与电能链的耦合运行方式,提出基于中心化电能链网络安全校核方法,实现对交易成交方案D的公平校核和合理调整。The electric energy chain is a self-built private blockchain in the microgrid, which only provides services for production and consumption users of the same voltage level in the region. Based on the multi-centralized transaction chain, all transaction plans reached in the prosumer market must pass the network security check to meet the security constraints of the power system before they are implemented. Therefore, the coupling operation mode of the transaction chain and the electric energy chain is designed, and a network security verification method based on the centralized electric energy chain is proposed to realize a fair verification and reasonable adjustment of the transaction transaction plan D.

电能链选取中心化的私有链,所有节点区块存储点对点交易所在配电系统的物理数据,如交易电量、能源类型等。调度中心作为私有链网络中的中心节点,负责实施节点电能安全性分析,并生成最终区块,电能链中其他节点只拥有监督区块信息准确性的功能。这不仅可以提高电能安全校核的效率而且保障电能安全校核的公平性。The electric energy chain selects a centralized private chain, and all node blocks store the physical data of the point-to-point exchange in the power distribution system, such as transaction power, energy type, etc. As the central node in the private chain network, the dispatch center is responsible for implementing node power security analysis and generating the final block. Other nodes in the power chain only have the function of supervising the accuracy of block information. This can not only improve the efficiency of electric energy security check but also ensure the fairness of electric energy security check.

电能安全校核分为非自由态和自由态2个方面,本实施例重点考虑线路传输功率平衡约束的非自由态安全校核,而自由态安全校核则反映在线路潮流约束和联络线割集潮流约束上。Electric energy safety check is divided into two aspects: non-free state and free state. This embodiment focuses on the non-free state safety check of the line transmission power balance constraint, while the free state safety check is reflected in the line power flow constraint and tie line cut Set current constraints.

微电网中点对点交易的平衡约束为:The balance constraints of point-to-point transactions in the microgrid are:

Figure BDA0003564828220000111
Figure BDA0003564828220000111

式中:ΔPi为点对点交易调整量(售电节点i的调整量);ΔLj为点对点交易调整量(购电节点j的调整量);{GP}为所有点对点交易的售电集合;{LP}为所有点对点交易的购电集合。In the formula: ΔP i is the point-to-point transaction adjustment amount (the adjustment amount of the electricity sales node i); ΔL j is the point-to-point transaction adjustment amount (the adjustment amount of the electricity purchase node j); {G P } is the electricity sales set of all point-to-point transactions; {L P } is the power purchase set of all peer-to-peer transactions.

考虑热稳定和动稳定的线路潮流约束:Consider thermally and dynamically stable line power flow constraints:

Figure BDA0003564828220000112
Figure BDA0003564828220000112

式中:Pl,max为支路l的潮流限制,可以取热稳定和动稳定约束中值小者;Pl,0为支路l的初始潮流;ΔPl为支路l的潮流变化量;{L}为所有线路集合。In the formula: P l,max is the power flow limitation of branch l, and the smaller value of the thermal stability and dynamic stability constraints can be taken; P l,0 is the initial power flow of branch l; ΔP l is the power flow change of branch l ; {L} is the set of all lines.

考虑动稳定的联络线割集潮流约束:Consider the dynamic and stable tie line cut set power flow constraint:

Figure BDA0003564828220000113
Figure BDA0003564828220000113

式中:PC,max为割集C的潮流限制,可取为动稳定约束;

Figure BDA0003564828220000114
为割集C的初始潮流和;
Figure BDA0003564828220000115
为割集C的潮流变化量;{Ccut}为所有联络线割集集合。In the formula: P C,max is the power flow limit of the cut set C, which can be taken as the dynamic stability constraint;
Figure BDA0003564828220000114
is the initial power flow sum of the cut set C;
Figure BDA0003564828220000115
is the power flow variation of cut set C; {C cut } is the set of cut sets of all contact lines.

在实际基于区块链的市场交易过程中,交易链上的产消者经过动态博弈后,达到纳什均衡,得到最终交易方案,之后利用与之耦合的电能链,完成节点交易电量的安全性校核,形成区块调整信息。In the actual market transaction process based on the blockchain, the producers and consumers on the transaction chain reach the Nash equilibrium after a dynamic game, and obtain the final transaction plan, and then use the power chain coupled with it to complete the security calibration of the node transaction power. core to form block adjustment information.

基于多中心化的监督链,交易中心在交易结算后,将交易信息发布到监督链上。监督链上所有节点对交易链节点的诚信值进行计算并达成共识,在此基础上,交易中心将诚信值由大到小进行排序并将节点诚信值发布到交易链。诚信值越高的节点在下一周期的交易中越具有优先推荐权。因此,本实施例所设计的交易链与监督链的耦合运行方式,有效实现了交易链与监督链信息的互通。Based on the multi-center supervision chain, the transaction center will publish the transaction information to the supervision chain after the transaction is settled. All nodes on the supervision chain calculate and reach a consensus on the integrity value of the transaction chain nodes. On this basis, the transaction center sorts the integrity value from large to small and publishes the node integrity value to the transaction chain. A node with a higher integrity value will have the priority to recommend in the next cycle of transactions. Therefore, the coupling operation mode of the transaction chain and the supervision chain designed in this embodiment effectively realizes the information exchange between the transaction chain and the supervision chain.

监督链选取多中心化的联盟链,所有节点区块存储点对点交易的结算信息,以便验证和计算交易节点的诚信值。交易中心节点(配电系统以外的第三方盈利企业)和产消者都可以作为监督链节点。监督链节点由全体产消用户节点投票选出,并根据历史累计诚信值综合拟定。监督链节点群体确认后,由系统内活跃节点申请执行交易节点诚信值的计算。The supervision chain selects a multi-centralized alliance chain, and all node blocks store the settlement information of point-to-point transactions in order to verify and calculate the integrity value of transaction nodes. Both transaction center nodes (third-party profit-making enterprises outside the power distribution system) and prosumers can serve as supervision chain nodes. The nodes of the supervision chain are voted by all production and consumption user nodes, and are comprehensively formulated according to the historical cumulative integrity value. After the confirmation of the supervision chain node group, the active nodes in the system apply for the calculation of the integrity value of the transaction node.

电力交易过程中,交易双方会出现违约问题。售电方的实际发电量与成交电量不对等,导致购电方需要以高于微电网内部电力零售电价去购买外网电量,这不仅损害了购电方的经济利益而且不利于发挥分布式光伏发电的环保效益优势;而购电方在签订智能合约后,其所用电量超过约定值,将会导致售电方利益受损。同时,作为购电方没有节省用电这一行为缺乏环保意识。因此,本实施例以智能合约的完成情况作为产消用户诚信值的计算依据,计算方法如下所示:In the process of power trading, there will be problems of breach of contract between the two parties. The actual power generation of the power seller is not equal to the transaction volume, which leads to the need for the power buyer to purchase electricity from the external grid at a price higher than the internal retail price of the microgrid. This not only damages the economic interests of the power buyer but also is not conducive to the development of distributed photovoltaics. The advantages of environmental protection benefits of power generation; and after the power purchaser signs the smart contract, if the power consumption exceeds the agreed value, the interests of the power seller will be damaged. At the same time, as a power purchaser, the act of not saving electricity lacks environmental awareness. Therefore, this embodiment uses the completion of the smart contract as the calculation basis for the integrity value of the production and consumption users, and the calculation method is as follows:

假设

Figure BDA0003564828220000121
表示产消用户j在t时段内为售电用户,
Figure BDA0003564828220000122
表示产消用户j在t时段内为购电用户。由于产消用户j不能同时处于售电和购电两种状态,所以产消用户的状态约束可以表示为:suppose
Figure BDA0003564828220000121
Indicates that the production and consumption user j is a power selling user in the period t,
Figure BDA0003564828220000122
Indicates that prosumer user j is an electricity purchaser within t period. Since the prosumer user j cannot be in the two states of selling electricity and purchasing electricity at the same time, the state constraints of the prosumer user can be expressed as:

Figure BDA0003564828220000123
Figure BDA0003564828220000123

结合上述产消者的状态约束,可以得到产消用户节点诚信值的计算标准为:Combined with the state constraints of the above prosumers, the calculation standard for the integrity value of prosumer user nodes can be obtained as follows:

Figure BDA0003564828220000124
Figure BDA0003564828220000124

式中:

Figure BDA0003564828220000125
表示产消用户j的t时段前的诚信值;Qij表示产消用户j和产消用户i在智能合约中成交的电量;
Figure BDA0003564828220000126
表示产消用户j处于售电状态时所产生的实际电量;
Figure BDA0003564828220000127
表示产消用户j处于购电状态时所消耗的实际电量。In the formula:
Figure BDA0003564828220000125
Indicates the integrity value of prosumer user j before period t; Q ij represents the amount of electricity traded between prosumer user j and prosumer user i in the smart contract;
Figure BDA0003564828220000126
Indicates the actual electricity generated by prosumer user j in the state of selling electricity;
Figure BDA0003564828220000127
Indicates the actual power consumed by prosumer user j in the power purchasing state.

当产消用户想要参与微电网内部电力零售交易时,需要对其身份信息进行必要的登记注册。由于产消用户数量庞大,信息的实时性较强,信息密度也更高。因此,信息链采取去中心化的公有链构建方式,使得产消用户的基本信息公开透明且更具有可验证性。信息链中所有节点均可自行选择是否参与记账权竞争,无需预先设定。交易中心等拥有服务器集群的大型节点具备最高的算力及存储能力,一般作为全节点运行,负责输出算力等各类工作。而产消用户大多数为轻型节点,仅参与校核等工作。另外交易中心具有特殊性,既需要参与信息链的构成,又需要与交易链的产消用户和调度中心构成交易链。信息链不仅具有收集和整理电力交易用户基本信息的功用,而且还可以防止信息被恶意篡改,使得信息链上的数据信息成为交易方案的可靠参考依据。When production and consumption users want to participate in the internal power retail transaction of the microgrid, they need to register their identity information. Due to the large number of production and consumption users, the real-time information is stronger and the information density is higher. Therefore, the information chain adopts a decentralized public chain construction method, making the basic information of production and consumption users open, transparent and more verifiable. All nodes in the information chain can choose whether to participate in the bookkeeping right competition without presetting. Large-scale nodes with server clusters such as trading centers have the highest computing power and storage capacity, and generally operate as full nodes, responsible for outputting computing power and other tasks. Most of the prosumer users are light nodes and only participate in verification and other work. In addition, the transaction center has particularity. It not only needs to participate in the formation of the information chain, but also needs to form a transaction chain with the production and consumption users of the transaction chain and the dispatch center. The information chain not only has the function of collecting and organizing the basic information of power trading users, but also prevents information from being maliciously tampered with, making the data information on the information chain a reliable reference for trading plans.

信息链根据用户的身份信息,产生一对密钥Pa和Pb,当用户是产消者时,用户需提供分布式发电装置的信息。在此基础上,信息链会生成分布式发电装置的公钥和私钥,区块链系统会根据产消用户对应的公钥,完成节点身份的可靠验证。系统会根据节点的公钥与用户信息生成数字证书,网络内活跃节点将网络内信息收集打包并形成新区块,新区块经其他节点验证通过后被写入到区块链中。The information chain generates a pair of keys P a and P b according to the identity information of the user. When the user is a prosumer, the user needs to provide the information of the distributed power generation device. On this basis, the information chain will generate the public key and private key of the distributed power generation device, and the blockchain system will complete the reliable verification of the node identity according to the public key corresponding to the prosumer user. The system will generate a digital certificate based on the node's public key and user information, and the active nodes in the network will collect and package the information in the network to form a new block, and the new block will be written into the blockchain after being verified by other nodes.

数字证书的引入是为了更好的对加入系统的用户进行管理,当数字证书被写入到区块链系统后,用户会与信息链签署一份智能合约,该智能合约的目的就是保障各用户的权益。当某些用户在交易链中进行恶意交易时,该用户节点的数字证书状态会被扣分。当该用户被扣除一定分数后,智能合约会根据合约内容,与相关用户解除合约并废除信息链中该用户的数字证书,导致该用户无法进行电能交易。The introduction of digital certificates is to better manage the users who join the system. When the digital certificates are written into the blockchain system, the users will sign a smart contract with the information chain. The purpose of this smart contract is to protect each user. rights and interests. When some users conduct malicious transactions in the transaction chain, the digital certificate status of the user node will be deducted points. When the user is deducted a certain amount of points, the smart contract will terminate the contract with the relevant user and abolish the user's digital certificate in the information chain according to the content of the contract, resulting in the user being unable to conduct energy transactions.

在传统的PoA共识算法中,需要事先指定一组授权节点,这些授权节点拥有联盟链的记账权限。因此,不需要依靠算力来竞争记账权,有效减少了资源浪费并提高了区块的生成速度。但是,考虑到系统中可能存在恶意节点或者节点间的交易缺乏诚信度等问题。本实施例将PoA共识算法中的授权节点选取方式进行改进,引入信用积分和分级机制,使得改进的PoA共识算法不仅保留原有优势而且使节点的交易和共识行为得到有效监督。In the traditional PoA consensus algorithm, it is necessary to specify a group of authorized nodes in advance, and these authorized nodes have the accounting authority of the alliance chain. Therefore, there is no need to rely on computing power to compete for bookkeeping rights, effectively reducing the waste of resources and increasing the block generation speed. However, considering that there may be malicious nodes in the system or transactions between nodes lack integrity and other issues. This embodiment improves the selection method of authorized nodes in the PoA consensus algorithm, and introduces credit points and grading mechanisms, so that the improved PoA consensus algorithm not only retains the original advantages but also effectively supervises the transaction and consensus behavior of nodes.

本实施例采用信用积分代表节点在微电网中的公信度,按照其共识工作表现和历史交易诚信度来增加或减少产消用户节点的信用积分。在此基础上,通过分级机制实现对节点权限的控制,从而充分调动各节点主动参与管理联盟链的积极性,保证系统安全高效地运行。节点的信用积分变更方式如下所示。In this embodiment, credit points are used to represent the credibility of nodes in the microgrid, and the credit points of prosumer user nodes are increased or decreased according to their consensus performance and historical transaction integrity. On this basis, the control of node authority is realized through the hierarchical mechanism, so as to fully mobilize the enthusiasm of each node to actively participate in the management of the alliance chain, and ensure the safe and efficient operation of the system. The way to change the credit score of the node is as follows.

Figure BDA0003564828220000131
式中:Rj为节点的累计信用积分;α为共识诚信所占的权重;β为交易诚信所占的权重;sj为节点共识贡献值,当节点在t时段完成有效共识,那么sj的值为1,否则为0;
Figure BDA0003564828220000132
为节点交易诚信值进行效益型标准化后的数值,具体计算方法为:
Figure BDA0003564828220000131
In the formula: R j is the cumulative credit score of the node; α is the weight of consensus integrity; β is the weight of transaction integrity; s j is the node consensus contribution value, when the node completes the effective consensus in t period, then s j The value of is 1, otherwise it is 0;
Figure BDA0003564828220000132
It is the value after benefit-based standardization of the node transaction integrity value. The specific calculation method is:

Figure BDA0003564828220000133
Figure BDA0003564828220000133

式中:

Figure BDA0003564828220000134
分别代表在t时段的所有节点中交易诚信值的最大和最小值。In the formula:
Figure BDA0003564828220000134
Represent the maximum and minimum values of the transaction integrity value in all nodes in the period t, respectively.

基于上述节点信用积分变更方式将节点划分为三个等级:一级节点可成为联盟链上的权威节点;二级节点为验证节点;三级节点为普通节点。Nodes are divided into three levels based on the above-mentioned node credit point change method: first-level nodes can become authoritative nodes on the alliance chain; second-level nodes are verification nodes; third-level nodes are ordinary nodes.

在系统构建的初始阶段,取排名前30%的机构为一级节点,轮流负责用自己的私钥签名来创建并广播区块。剩余节点为二级节点,轮流检查已签名的区块是否合法。进入运行阶段后,新加入的节点默认为三级节点,不具备创建区块和验证区块的权利。所有节点都有共享数据的权利。三级节点加入后在完成区块链上的数据同步并正常运行三个月的情况下成为二级节点。一级节点签署创建一个合法区块会增加一定的信用积分,创建一个无效或虚假区块就会被扣除信用积分,当积分低于设定的阈值就会被降为二级,其位置由二级节点中积分最高的节点填补。同样,二级节点验证一个有效区块会增加信用积分,审计失误或者故意作弊也会被扣除信用积分,积分低于阈值降为三级。各级节点共享数据行为均不加分。In the initial stage of system construction, the top 30% of institutions are selected as first-level nodes, which are responsible for creating and broadcasting blocks with their own private key signatures in turn. The remaining nodes are secondary nodes, which check whether the signed blocks are legal in turn. After entering the operation phase, the newly joined nodes are defaulted as third-level nodes, and do not have the right to create blocks and verify blocks. All nodes have the right to share data. After the third-level node joins, it will become a second-level node after completing the data synchronization on the blockchain and running normally for three months. The first-level node will add a certain amount of credit points to create a legal block, and the credit points will be deducted when creating an invalid or false block. The node with the highest score among the level nodes is filled. Similarly, the verification of a valid block by the second-level node will increase the credit points, and the credit points will also be deducted for audit errors or intentional cheating. The points are lower than the threshold and downgraded to the third level. No points will be added for the behavior of sharing data between nodes at all levels.

在本实施例所提出的多链式区块链系统中,交易链和监督链被设计为联盟链形式。因此,采用改进的PoA算法作为这两个链的共识机制,不仅可以保证高效共识而且能够约束产消用户节点的交易行为。In the multi-chain blockchain system proposed in this embodiment, the transaction chain and supervision chain are designed in the form of alliance chains. Therefore, using the improved PoA algorithm as the consensus mechanism of the two chains can not only ensure efficient consensus but also constrain the transaction behavior of production and consumption user nodes.

为了实现以诚信值影响节点经济效益的目的,本实施例提出基于诚信值的记账权共识算法:In order to achieve the purpose of influencing the economic benefits of nodes with integrity value, this embodiment proposes a consensus algorithm for bookkeeping rights based on integrity value:

Figure BDA0003564828220000141
Figure BDA0003564828220000141

式中:H为哈希函数;Dj为产消用户j的根哈希值;Kj表示产消用户j计算的随机数;Cj表示产消用户j的诚信值;Ndiffer表示计算难度系数。In the formula: H is a hash function; D j is the root hash value of prosumer user j; K j represents the random number calculated by prosumer user j; C j represents the integrity value of prosumer user j; N differ represents the difficulty of calculation coefficient.

从上式可以看出,节点的诚信值与节点获取记账权的概率成正相关,诚信值越大的节点越容易获取记账权利。由此,该共识算法可以形成良性循环,使得产消用户节点有意愿遵守智能合约,使自身利益最大化,同时,借助交易中心节点在监督链与信息链间进行信息传递实现两链的相互耦合。产消用户竞争记账权的规定流程如图4所示。It can be seen from the above formula that the integrity value of a node is positively correlated with the probability of the node obtaining the bookkeeping right, and the node with a higher integrity value is easier to obtain the bookkeeping right. As a result, the consensus algorithm can form a virtuous circle, so that the production and consumption user nodes are willing to abide by the smart contract and maximize their own interests. At the same time, the mutual coupling of the two chains is achieved by using the transaction center node to transmit information between the supervision chain and the information chain . Figure 4 shows the regulation process for production and consumption users to compete for bookkeeping rights.

考虑到节点的诚信值是评定节点智能合约完成情况的标志,因此,本实施例所提出的产消用户节点间的交易方法不仅考虑到安全校核问题,而且有效保证诚信值最高的节点拥有优先交易权。具体的交易算法如下表1所示。Considering that the integrity value of a node is a sign to evaluate the completion of the node's smart contract, the transaction method between production and consumption user nodes proposed in this embodiment not only takes into account the security check problem, but also effectively ensures that the node with the highest integrity value has priority trading rights. The specific trading algorithm is shown in Table 1 below.

表1基于网络安全校核和诚信值的交易算法Table 1 Transaction algorithm based on network security check and integrity value

Figure BDA0003564828220000142
Figure BDA0003564828220000142

Figure BDA0003564828220000151
Figure BDA0003564828220000151

本实施例的方法及系统的实际效果:The actual effect of the method and system of the present embodiment:

为了验证本实施例所提基于多链式区块链的电力交易方法的可行性,利用solidity语言编写智能合约,使用JavaScript、metamask插件、atom、以太坊平台以及web3.js开发微电网交易平台。假设某次参与电力交易的用户编号为0到5号,这些用户设备的电气接线情况如图5所示。仿真交易场景包括5个产消用户以及1个大电网,这六个用户均对应一个交易链节点。电能链节点数设为3,其中调度中心节点作为电能链与交易链的耦合节点,其余2个节点由产消用户1和产消用户2担任。监督链节点数设为2,其中交易中心节点作为监督链的中心节点,剩下的一个节点由调度中心节点担任。信息链节点数与交易链节点数相同,且由同类用户组成。产消者向电网公司售电的价格为0.5元/(kW·h),向电网公司购电的价格为1.0元/(kW·h)。假定共识诚信所占权重为0.4,交易诚信所占权重为0.6。In order to verify the feasibility of the power trading method based on the multi-chain blockchain proposed in this embodiment, the smart contract is written in solidity language, and the microgrid trading platform is developed using JavaScript, metamask plug-in, atom, Ethereum platform and web3.js. Assuming that the user numbers participating in a power transaction are 0 to 5, the electrical wiring of these user equipment is shown in Figure 5. The simulated transaction scenario includes 5 production and consumption users and 1 large power grid, and each of these six users corresponds to a transaction chain node. The number of nodes in the electric energy chain is set to 3, among which the dispatching center node serves as the coupling node between the electric energy chain and the transaction chain, and the remaining two nodes are served by prosumer user 1 and prosumer user 2. The number of supervision chain nodes is set to 2, in which the trading center node is the central node of the supervision chain, and the remaining node is the dispatching center node. The number of nodes in the information chain is the same as the number of nodes in the transaction chain, and it is composed of similar users. Prosumers sell electricity to the grid company at a price of 0.5 yuan/(kW·h), and purchase electricity from the grid company at a price of 1.0 yuan/(kW·h). Assume that the weight of consensus integrity is 0.4, and the weight of transaction integrity is 0.6.

在每个时段产消用户会根据自身发电量和用电量向区块链系统发出状态信息。假设某个时段有三个产消用户处于缺电状态(后面简称为购电用户),剩下用户在该时段处于售电状态(以下统称为售电用户)。由于以太坊等主流区块链地址为42位,因此,本实施例采用简化后的8位地址描述,如产消用户1地址为0xx00x01,电网公司地址为0xx00x00。产消者在交易开始前的初始报价信息如表2所示。In each period, production and consumption users will send status information to the blockchain system according to their own power generation and power consumption. Assume that in a certain period of time, there are three prosumer users who are in a state of power shortage (hereinafter referred to as power purchase users), and the remaining users are in a state of electricity sales during this period (hereinafter collectively referred to as power sellers). Since the addresses of mainstream blockchains such as Ethereum are 42 bits, this embodiment adopts a simplified 8-bit address description, for example, the address of prosumer user 1 is 0xx00x01, and the address of the power grid company is 0xx00x00. The initial quotation information of prosumers before the transaction starts is shown in Table 2.

表2产消用户节点初始报价Table 2 Initial quotation of prosumer user nodes

产消用户Prosumer users 产消用户地址Prosumer user address 初始报价/(元·(kW·h)<sup>-1</sup>)Initial quotation/(yuan·(kW·h)<sup>-1</sup>) 需求功率/kWDemand power/kW 11 0xx00x010xx00x01 0.740.74 3030 22 0xx00x020xx00x02 0.750.75 110110 33 0xx00x030xx00x03 0.770.77 -80-80 44 0xx00x040xx00x04 0.790.79 -40-40 55 0xx00x050xx00x05 0.720.72 6060

图6和图7分别展示了经过电能链校核前和校核后的产消用户间的交易方案。从图中可以看出经过电能链的安全校核之后,产消用户2共裁剪了18.5kW功率,按比例分配,裁剪与产消者3的交易功率3.5kW、与产消者4的交易功率6.2kW、与大电网的交易功率8.8。然而,产消用户2与电网公司间的功率裁剪无法满足机组自由约束,安全校核无法通过,造成点对点交易失败。Figure 6 and Figure 7 show the transaction schemes between prosumer users before and after the verification of the power chain, respectively. It can be seen from the figure that after the safety check of the power chain, the prosumer user 2 cuts a total of 18.5kW of power, which is distributed in proportion, and cuts the transaction power of 3.5kW with prosumer 3 and the transaction power of prosumer 4 6.2kW, and the transaction power with the large power grid is 8.8. However, the power cut between prosumer user 2 and the grid company cannot meet the unit freedom constraints, and the safety check cannot pass, resulting in the failure of point-to-point transactions.

此时,调度中心节点给出产消用户2的点对点交易范围即该节点购买的功率不得大于87.5kW。在此基础上,产消者2经过重新优化决策后,达成新的交易方案。从图6和图7的对比偏差可以看出,大电网与产消者间的交易功率降低了18.5kW。由此可以得出,经过安全校核后的新交易方案满足自由和非自由约束,无需再对交易功率进行裁剪,点对点交易顺利完成。At this time, the dispatching center node gives the point-to-point transaction range of prosumer user 2, that is, the power purchased by this node must not exceed 87.5kW. On this basis, Prosumer 2 reaches a new transaction plan after re-optimizing its decision-making. It can be seen from the comparative deviation of Figure 6 and Figure 7 that the transaction power between the large power grid and the prosumer has decreased by 18.5kW. From this, it can be concluded that the new transaction scheme after security verification satisfies free and non-free constraints, and there is no need to cut the transaction power, and the point-to-point transaction is successfully completed.

若节点的行为模式不发生变化,系统中所有节点参与大约100次交易后,节点的诚信值将逐渐稳定。因此,本文基于节点诚信值的评定方法对随机生成的100次业务进行仿真,可以得到图8的网络节点诚信值变化情况。从图中可以明显看出有些节点拥有更高的诚信值,说明该节点拥有更高的交易诚信度和共识诚信度。按照算法机制的设计,产消用户的交易优先权取决于该节点诚信值的大小。If the behavior pattern of the nodes does not change, after all nodes in the system participate in about 100 transactions, the integrity value of the nodes will gradually stabilize. Therefore, this paper simulates 100 randomly generated services based on the evaluation method of node integrity value, and can obtain the change of network node integrity value in Figure 8. It can be clearly seen from the figure that some nodes have higher integrity values, indicating that the nodes have higher transaction integrity and consensus integrity. According to the design of the algorithm mechanism, the transaction priority of prosumer users depends on the integrity value of the node.

基于此诚信值对这些节点的交易进行仿真,节点的诚信值最高的节点拥有优先交易选择权。因此,各个节点的交易量成交额如图9所示,其中节点6代表大电网。结合节点的诚信值变化图可以看出,节点2的诚信值为0.7,在所有节点中的诚信值最低,不具备交易优先选择权。该节点在本轮交易周期结束后会有部分需求没发满足,只能以高于微电网内部电力零售电价与大电网进行交易,完成偏差电量的平衡。Based on this integrity value, the transactions of these nodes are simulated, and the node with the highest integrity value has the priority transaction option. Therefore, the transaction volume of each node is shown in Figure 9, where node 6 represents the large power grid. Combining with the integrity value change graph of the nodes, it can be seen that the integrity value of node 2 is 0.7, which is the lowest among all nodes, and does not have the transaction priority. After the end of the current round of trading cycle, some of the demand of this node will not be met, so it can only trade with the large power grid at a price higher than that of the internal power retail price of the micro-grid to complete the balance of deviation power.

综上所述,本实施例所提出的基于多链式区块链系统的电力交易方法不仅可以实现交易的网络安全校核而且有效约束节点的交易行为,使得节点间的交易过程更加安全高效。To sum up, the power trading method based on the multi-chain blockchain system proposed in this embodiment can not only realize the network security check of the transaction but also effectively constrain the transaction behavior of nodes, making the transaction process between nodes safer and more efficient.

在多链式区块链系统中,交易数据、物理数据、节点诚信值计算数据、节点身份信息数据分链部署,交易链每秒可处理交易数量为12笔,而单链式区块链每秒处理的交易数量为6笔。单链式区块链上的区块确认时间包括节点身份登记信息、交易信息和校核调整信息的确认过程,总确认时间为29.64s。多链式区块链中交易信息的确认在交易链中进行,确认时间为10.32s;校核调整信息的确认在电能链中进行,由于电能链采用私有链且节点数目较少,因此,确认时间较短为3.47s;节点身份信息的确认在信息链中进行,由于只包含登陆信息等数据,因此,确认时间为3.14s;监督链起到监督节点交易行为的作用,虽然增加了区块确认平均时间,但是也有效保障交易的可靠实施。因此,节点的诚信值计算信息的确认在监督链中进行,由于包含节点数目较少,确认时间短,为2.35s。多链式区块链总的确认时间短于单链式区块链。由此可见,在点对点交易场景下,多链式区块链系统具有更高的交易处理效率和性能。In a multi-chain blockchain system, transaction data, physical data, node integrity value calculation data, and node identity information data are deployed in separate chains. The transaction chain can handle 12 transactions per second, while the single-chain blockchain can process 12 transactions per second. The number of transactions processed per second is 6. The block confirmation time on the single-chain blockchain includes the confirmation process of node identity registration information, transaction information and check adjustment information, and the total confirmation time is 29.64s. The confirmation of transaction information in the multi-chain blockchain is carried out in the transaction chain, and the confirmation time is 10.32s; the confirmation of the verification and adjustment information is carried out in the electric energy chain. Since the electric energy chain adopts a private chain and the number of nodes is small, the confirmation The shortest time is 3.47s; the confirmation of node identity information is carried out in the information chain. Since only login information and other data are included, the confirmation time is 3.14s; the supervision chain plays the role of supervising the transaction behavior of nodes, although the block Confirm the average time, but also effectively guarantee the reliable implementation of transactions. Therefore, the confirmation of the integrity value calculation information of the nodes is carried out in the supervision chain. Due to the small number of nodes involved, the confirmation time is short, 2.35s. The total confirmation time of the multi-chain blockchain is shorter than that of the single-chain blockchain. It can be seen that in the peer-to-peer transaction scenario, the multi-chain blockchain system has higher transaction processing efficiency and performance.

本实施例利用多链式区块链系统可以将交易信息分链存储的特性,建立以交易链为中心链,电能链、信息链和监督链为辅助链的多链式区块链架构。结合多链式区块链架构兼顾经济、安全与监督属性的作用,构建产消用户节点间的交易优化模型,达到提高交易性能和安全性的目的。通过将权威证明共识机制进行改进,使得联盟链内部节点间的共识效率大大提高。在此基础上,提出基于多链式区块链架构的电力交易方法,使节点间交易的可靠性和高效性得到保障。算例分析表明,本实施例所提出的基于多链式区块链架构的电力交易方法能够保障交易的安全性和高效性,在对交易进行网络安全校核的同时,约束产消用户节点的交易以及共识行为。This embodiment utilizes the feature that the multi-chain blockchain system can store transaction information in separate chains, and establishes a multi-chain blockchain architecture with the transaction chain as the central chain and the power chain, information chain, and supervision chain as auxiliary chains. Combined with the multi-chain blockchain architecture taking into account the role of economy, security and supervision attributes, a transaction optimization model between production and consumption user nodes is constructed to achieve the purpose of improving transaction performance and security. By improving the authority proof consensus mechanism, the consensus efficiency among the internal nodes of the alliance chain is greatly improved. On this basis, a power transaction method based on a multi-chain blockchain architecture is proposed to ensure the reliability and efficiency of transactions between nodes. The analysis of the calculation example shows that the power transaction method based on the multi-chain blockchain architecture proposed in this embodiment can guarantee the security and efficiency of the transaction. Transactions and Consensus Behavior.

通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中可以根据需要而将上述功能分配由不同的功能模块完成,即将具体装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that for the convenience and brevity of the description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different Module completion means that the internal structure of a specific device is divided into different functional modules to complete all or part of the functions described above.

在本申请所提供的实施例中,应该理解到,所揭露的结构和方法,可以通过其它的方式实现。例如,以上所描述的关于结构的实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个结构,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,结构或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed structures and methods may be implemented in other ways. For example, the above-described embodiments about the structure are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be Combinations may either be integrated into another structure, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of structures or units may be in electrical, mechanical or other forms.

作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。A unit described as a separate component may or may not be physically separated, and a component shown as a unit may be one physical unit or multiple physical units, which may be located in one place or distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申请实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in the embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If an integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium Among them, several instructions are included to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods in various embodiments of the present application. The above-mentioned storage medium includes: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk, and other various media that can store program codes.

以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above content is only the specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application, and should covered within the scope of protection of this application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (4)

1.基于多链式区块链架构的电力交易方法,其特征在于,包括以下步骤:1. A method for power trading based on a multi-chain block chain architecture, characterized in that it comprises the following steps: 预先构建多链式区块链架构,多个区块链之间通过若干共有节点耦合,并设置交易目标函数和约束条件;Pre-build a multi-chain blockchain architecture, multiple blockchains are coupled through several common nodes, and set transaction objective functions and constraints; 产生交易需求时,各节点根据预设的交易目标函数和约束条件以签订智能合约的方式进行交易,并根据基于诚信值的记账权共识算法竞争记账权,交易过程中由共有节点对不同区块链之间的信息进行跨链处理;When a transaction demand is generated, each node conducts the transaction by signing a smart contract according to the preset transaction objective function and constraints, and competes for the bookkeeping right according to the bookkeeping right consensus algorithm based on the integrity value. Cross-chain processing of information between blockchains; 所述预先构建多链式区块链架构,包括:构建交易链、监督链、信息链和电能链,其中设置调度中心节点作为交易链、监督链和电能链的共有节点,设置交易中心节点作为交易链、信息链和监督链的共有节点,其余节点为产消用户;The pre-built multi-chain block chain architecture includes: building a transaction chain, a supervision chain, an information chain, and an electric energy chain, wherein the dispatching center node is set as a common node of the transaction chain, the supervision chain, and the electric energy chain, and the transaction center node is set as a Common nodes of the transaction chain, information chain and supervision chain, and the rest of the nodes are prosumer users; 所述信息链采用去中心化的公有链,用于为想要参与微电网电力零售交易的产消用户节点进行注册登记;所述电能链采用中心化的私有链,调度中心节点作为中心节点负责生成新区块,其他节点不具有更改新区块中信息的权利,电能链上各个区块用于存储系统的物理信息;所述交易链作为主链,采用多中心化的联盟链,只存储节点的交易信息,依靠交易中心节点和调度中心节点与其它三个侧链的信息耦合;所述监督链采用多中心化的联盟链,用于评定产消用户交易行为的诚信值,各个区块用于存储交易节点的诚信值信息;The information chain adopts a decentralized public chain, which is used to register the production and consumption user nodes who want to participate in the microgrid power retail transaction; the power chain adopts a centralized private chain, and the dispatching center node is responsible as the central node To generate a new block, other nodes do not have the right to change the information in the new block. Each block on the energy chain is used to store the physical information of the system; The transaction information depends on the information coupling between the transaction center node and the dispatch center node and the other three side chains; the supervision chain adopts a multi-centralized alliance chain to evaluate the integrity value of the transaction behavior of the production and consumption users, and each block is used for Store the integrity value information of transaction nodes; 所述交易目标函数,包括:The transaction objective function includes:
Figure FDA0003914341690000011
Figure FDA0003914341690000011
式中St表示售电用户在t时刻总体收益函数;ΩA表示售电方的集合;
Figure FDA0003914341690000012
表示售电用户m在t时刻的出售电量单价;
Figure FDA0003914341690000013
表示售电用户m在t时刻的出售电量;
Figure FDA0003914341690000014
表示相对于出售电量的成本函数,表示为:
In the formula, S t represents the overall revenue function of electricity sellers at time t; Ω A represents the set of electricity sellers;
Figure FDA0003914341690000012
Indicates the unit price of electricity sold by user m at time t;
Figure FDA0003914341690000013
Indicates the electricity sold by electricity seller m at time t;
Figure FDA0003914341690000014
Represents the cost function relative to the electricity sold, expressed as:
Figure FDA0003914341690000015
Figure FDA0003914341690000015
式中a、b、c分别表示对应电量
Figure FDA0003914341690000016
的成本系数;
In the formula, a, b, and c respectively represent the corresponding power
Figure FDA0003914341690000016
cost factor;
在售电方和购电方存在电量平衡,表示为:There is an electricity balance between the electricity seller and the electricity buyer, expressed as:
Figure FDA0003914341690000017
Figure FDA0003914341690000017
式中ΩB表示购电方的集合;
Figure FDA0003914341690000018
表示第n个购电方在t时段的需求电量;
In the formula, Ω B represents the set of power buyers;
Figure FDA0003914341690000018
Indicates the electricity demand of the nth electricity purchaser in the period t;
售电方选择的售电量范围为:The range of electricity sales selected by the electricity seller is:
Figure FDA0003914341690000021
Figure FDA0003914341690000021
式中
Figure FDA0003914341690000022
分别表示第m个售电方在t时段可出售电量的上下限;
In the formula
Figure FDA0003914341690000022
Respectively represent the upper and lower limits of the electricity sold by the mth electricity seller in the t period;
所述约束条件,包括:The constraints include: 微电网中点对点交易的平衡约束为:The balance constraints of point-to-point transactions in the microgrid are:
Figure FDA0003914341690000023
Figure FDA0003914341690000023
式中:ΔPi为售电节点i的调整量;ΔLj为购电节点j的调整量;{GP}为所有点对点交易的售电集合;{LP}为所有点对点交易的购电集合;In the formula: ΔP i is the adjustment amount of power selling node i; ΔL j is the adjustment amount of power purchasing node j; {G P } is the set of electricity sales of all point-to-point transactions; {L P } is the set of power purchases of all point-to-point transactions ; 考虑热稳定和动稳定的线路潮流约束:Consider thermally and dynamically stable line power flow constraints:
Figure FDA0003914341690000024
Figure FDA0003914341690000024
式中:Pl,max为支路l的潮流限制,取热稳定和动稳定约束中值小者;Pl,0为支路l的初始潮流;ΔPl为支路l的潮流变化量;{L}为所有线路集合;In the formula: P l,max is the power flow limitation of branch l, whichever is smaller in the middle value of thermal stability and dynamic stability constraints; P l,0 is the initial power flow of branch l; ΔP l is the power flow variation of branch l; {L} is the set of all lines; 考虑动稳定的联络线割集潮流约束:Consider the dynamic and stable tie line cut set power flow constraints:
Figure FDA0003914341690000025
Figure FDA0003914341690000025
式中:PC,max为割集C的潮流限制,取为动稳定约束;
Figure FDA0003914341690000026
为割集C的初始潮流和;
Figure FDA0003914341690000027
为割集C的潮流变化量;{Ccut}为所有联络线割集集合;
In the formula: P C,max is the power flow limit of the cut set C, which is taken as the dynamic stability constraint;
Figure FDA0003914341690000026
is the initial power flow sum of the cut set C;
Figure FDA0003914341690000027
is the power flow variation of cut set C; {C cut } is the set of cut sets of all contact lines;
所述基于诚信值的记账权共识算法,包括:The bookkeeping right consensus algorithm based on integrity value includes:
Figure FDA0003914341690000028
Figure FDA0003914341690000028
式中:H为哈希函数;Dj为产消用户j的根哈希值;Kj表示产消用户j计算的随机数;Cj表示产消用户j的诚信值;Ndiffer表示计算难度系数;节点的诚信值与节点获取记账权的概率成正相关,诚信值越大的节点越容易获取记账权利;In the formula: H is a hash function; D j is the root hash value of prosumer user j; K j represents the random number calculated by prosumer user j; C j represents the integrity value of prosumer user j; N differ represents the difficulty of calculation Coefficient; the integrity value of the node is positively correlated with the probability of the node obtaining the bookkeeping right, and the node with the larger the integrity value is easier to obtain the bookkeeping right; 竞争记账权时,产消用户j打包这段时隙内所有的交易数据,并将其递归哈希得到根哈希值Dj,产消用户j进行大量穷举,基于上式找到Kj,将Kj打包进区块中,同时向网络中其他产消用户广播,其他产消用户收到相应的区块后根据上式中对应的Cj对区块进行验证,如验证通过则将对应区块添加到微电网信息链上,产消用户j得到记账奖励,否则删除该区块;所述跨链处理,包括:When competing for bookkeeping rights, prosumer user j packs all transaction data in this time slot, and recursively hashes it to obtain the root hash value D j , prosumer user j performs a large number of exhaustive enumerations, and finds K j based on the above formula, Pack K j into the block and broadcast to other prosumer users in the network at the same time. After receiving the corresponding block, other prosumer users will verify the block according to the corresponding C j in the above formula. If the verification is passed, the corresponding The block is added to the microgrid information chain, and the production and consumption user j gets the bookkeeping reward, otherwise the block is deleted; the cross-chain processing includes: 交易链与电能链的跨链处理:调度中心节点在交易链的记账权节点产生交易新区块后,获取待校核的实时市场交易记录,并在安全校核通过后发布到电能链上;电能链上其它节点进行验证,验证通过后,由调度中心节点将所形成的交易调整量信息ΔM发布至交易链,由初始记账权节点验证调整方案的有效性,验证通过后,将初始交易方案更新再进行全网发布;Cross-chain processing of the transaction chain and the energy chain: the dispatching center node obtains the real-time market transaction records to be verified after the transaction chain's bookkeeping right node generates a new transaction block, and releases it to the energy chain after passing the security verification; Other nodes on the electric energy chain conduct verification. After the verification is passed, the dispatching center node will publish the formed transaction adjustment information ΔM to the transaction chain, and the initial bookkeeping right node will verify the validity of the adjustment plan. After the verification is passed, the initial transaction The plan is updated and released on the whole network; 交易链与信息链的跨链处理:交易中心节点将信息链上的区块信息发布至交易链上,为下一时段节点间交易电量的预测提供参考;Cross-chain processing of the transaction chain and the information chain: the transaction center node publishes the block information on the information chain to the transaction chain, providing a reference for the prediction of the transaction power between nodes in the next period; 交易链与监督链的跨链处理:交易中心节点将安全校核调整后的交易结算信息发布至监督链上,监督链上节点选择性计算交易节点的诚信值,之后借助共识机制达成全网共识并形成新区块写入到监督链系统中,交易节点获取区块信息发布至交易链上,该诚信值信息作为下次交易优先推选的评定指标。Cross-chain processing of the transaction chain and the supervision chain: the transaction center node publishes the transaction settlement information after the security check and adjustment to the supervision chain, and the nodes on the supervision chain selectively calculate the integrity value of the transaction node, and then use the consensus mechanism to reach a consensus on the entire network And form a new block and write it into the supervision chain system, the transaction node obtains the block information and publishes it to the transaction chain, and the integrity value information is used as the evaluation index for the next transaction priority selection.
2.根据权利要求1所述的基于多链式区块链架构的电力交易方法,其特征在于,所述诚信值以智能合约的完成情况作为计算依据,计算过程包括:2. The power trading method based on the multi-chain blockchain architecture according to claim 1, wherein the integrity value is calculated based on the completion of the smart contract, and the calculation process includes:
Figure FDA0003914341690000031
表示产消用户j在t时段内为售电用户,
Figure FDA0003914341690000032
表示产消用户j在t时段内为购电用户,由于产消用户j不能同时处于售电和购电两种状态,所以产消用户的状态约束表示为:
set up
Figure FDA0003914341690000031
Indicates that the production and consumption user j is a power selling user in the period t,
Figure FDA0003914341690000032
Indicates that prosumer user j is an electricity purchaser during the period t. Since prosumer user j cannot be in the states of selling electricity and purchasing electricity at the same time, the state constraints of prosumer users are expressed as:
Figure FDA0003914341690000033
Figure FDA0003914341690000033
产消用户节点诚信值的计算标准为:The calculation standard for the integrity value of production and consumption user nodes is:
Figure FDA0003914341690000034
Figure FDA0003914341690000034
式中:
Figure FDA0003914341690000035
表示产消用户j的t时段前的诚信值;Qij表示产消用户j和产消用户i在智能合约中成交的电量;
Figure FDA0003914341690000036
表示产消用户j处于售电状态时所产生的实际电量;
Figure FDA0003914341690000037
表示产消用户j处于购电状态时所消耗的实际电量。
In the formula:
Figure FDA0003914341690000035
Indicates the integrity value of prosumer user j before period t; Q ij represents the amount of electricity traded between prosumer user j and prosumer user i in the smart contract;
Figure FDA0003914341690000036
Indicates the actual electricity generated by prosumer user j in the state of selling electricity;
Figure FDA0003914341690000037
Indicates the actual power consumed by prosumer user j in the power purchasing state.
3.根据权利要求2所述的基于多链式区块链架构的电力交易方法,其特征在于,所述多链式区块链架构中,各节点之间通过基于多中心化联盟链的共识机制进行信用积分计算和权限分级,包括:3. The power trading method based on the multi-chain blockchain architecture according to claim 2, characterized in that, in the multi-chain blockchain architecture, each node passes a consensus based on a multi-centralized alliance chain Mechanism for credit score calculation and permission classification, including: 节点的信用积分变更方式:How to change the node's credit points:
Figure FDA0003914341690000041
Figure FDA0003914341690000041
式中:Rj为节点的累计信用积分;α为共识诚信所占的权重;β为交易诚信所占的权重;sj为节点共识贡献值,当节点在t时段完成有效共识,那么sj的值为1,否则为0;
Figure FDA0003914341690000042
为节点交易诚信值进行效益型标准化后的数值,具体计算方法为:
In the formula: R j is the cumulative credit score of the node; α is the weight of consensus integrity; β is the weight of transaction integrity; s j is the node consensus contribution value, when the node completes the effective consensus in t period, then s j The value of is 1, otherwise it is 0;
Figure FDA0003914341690000042
It is the value after benefit-based standardization of the node transaction integrity value. The specific calculation method is:
Figure FDA0003914341690000043
Figure FDA0003914341690000043
式中:
Figure FDA0003914341690000044
分别代表在t时段的所有节点中交易诚信值的最大和最小值;
In the formula:
Figure FDA0003914341690000044
Respectively represent the maximum and minimum values of the transaction integrity value in all nodes in the t period;
基于上述节点信用积分变更方式将节点划分为三个等级:一级节点为联盟链上的权威节点;二级节点为验证节点;三级节点为普通节点;在系统构建的初始阶段,取排名前30%的机构为一级节点,轮流负责用自己的私钥签名来创建并广播区块;剩余节点为二级节点,轮流检查已签名的区块是否合法;进入运行阶段后,新加入的节点默认为三级节点,不具备创建区块和验证区块的权利;所有节点都有共享数据的权利;各节点的运行结果根据预设条件进行加分或减分,当信用积分跨越预设的权限分级界线时自动调整分级。Nodes are divided into three levels based on the above-mentioned node credit point change method: the first-level nodes are authoritative nodes on the alliance chain; the second-level nodes are verification nodes; the third-level nodes are ordinary nodes; 30% of the institutions are first-level nodes, which take turns to create and broadcast blocks with their own private key signatures; the remaining nodes are second-level nodes, which take turns to check whether the signed blocks are legal; The default is a third-level node, which does not have the right to create blocks and verify blocks; all nodes have the right to share data; the operating results of each node will be added or subtracted according to preset conditions, when the credit score exceeds the preset Automatically adjust the grading when the permission grading boundary is reached.
4.根据权利要求1所述的基于多链式区块链架构的电力交易方法,其特征在于,所述注册登记的过程包括:信息链根据用户的身份信息,产生一对密钥Pa和Pb,当用户是产消用户时,用户需提供分布式发电装置的信息,在此基础上,信息链会生成分布式发电装置的公钥和私钥,区块链系统会根据产消用户对应的公钥,完成节点身份的可靠验证,系统会根据节点的公钥与用户信息生成数字证书,网络内活跃节点将网络内信息收集打包并形成新区块,新区块经其他节点验证通过后被写入到区块链中。4. The power trading method based on the multi-chain block chain architecture according to claim 1, wherein the registration process includes: the information chain generates a pair of keys P a and P b , when the user is a prosumer user, the user needs to provide the information of the distributed power generation device. On this basis, the information chain will generate the public key and private key of the distributed power generation device, and the blockchain system will The corresponding public key completes the reliable verification of the identity of the node. The system will generate a digital certificate based on the public key of the node and user information. The active nodes in the network will collect and package the information in the network and form a new block. The new block is verified by other nodes. written into the blockchain.
CN202210305350.3A 2022-03-25 2022-03-25 Power trading method based on multi-chain blockchain architecture Active CN114663091B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210305350.3A CN114663091B (en) 2022-03-25 2022-03-25 Power trading method based on multi-chain blockchain architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210305350.3A CN114663091B (en) 2022-03-25 2022-03-25 Power trading method based on multi-chain blockchain architecture

Publications (2)

Publication Number Publication Date
CN114663091A CN114663091A (en) 2022-06-24
CN114663091B true CN114663091B (en) 2023-01-31

Family

ID=82031284

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210305350.3A Active CN114663091B (en) 2022-03-25 2022-03-25 Power trading method based on multi-chain blockchain architecture

Country Status (1)

Country Link
CN (1) CN114663091B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115358810B (en) * 2022-07-27 2025-06-06 国电南瑞科技股份有限公司 Main-side chain and side-chain dual-chain interactive power trading interaction method, device and storage medium
CN115577985B (en) * 2022-12-06 2023-04-07 国网浙江省电力有限公司金华供电公司 A multi-device consensus method for electric power blockchain
CN116384988B (en) * 2023-06-06 2023-08-18 国网浙江省电力有限公司营销服务中心 Block chain-based electric charge settlement method and system
CN116668987B (en) * 2023-06-07 2024-02-02 湖北工业大学 Side chain-based internet of vehicles data sharing method and system
CN117670541B (en) * 2023-12-05 2024-07-09 云南大学 Double-chain distributed power transaction system and method with optimized performance

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110636113A (en) * 2019-08-23 2019-12-31 上海电力大学 Blockchain Byzantine fault-tolerant consensus method, system, device and storage medium
CN112055002A (en) * 2020-08-24 2020-12-08 杭州云象网络技术有限公司 Cross-link network supervision method based on public governance link
CN113095940A (en) * 2021-04-29 2021-07-09 平安科技(深圳)有限公司 Isomorphic multilink-based transaction processing method, blockchain system, device and medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11146380B2 (en) * 2017-08-03 2021-10-12 Parity Technologies Ltd. Methods and systems for a heterogeneous multi-chain framework
CN110415093A (en) * 2019-07-11 2019-11-05 上海电器科学研究所(集团)有限公司 A smart energy gateway for user-side microgrid power transactions
CN111932253A (en) * 2020-08-11 2020-11-13 华北电力大学(保定) Electric energy transaction method based on credit consensus mechanism
CN112419055A (en) * 2020-11-11 2021-02-26 华北电力大学 Day-ahead energy scheduling platform established by market operation with participation of multiple producers and consumers
CN113626876B (en) * 2021-07-22 2023-12-19 三峡大学 Consensus method based on power grid block chain

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110636113A (en) * 2019-08-23 2019-12-31 上海电力大学 Blockchain Byzantine fault-tolerant consensus method, system, device and storage medium
CN112055002A (en) * 2020-08-24 2020-12-08 杭州云象网络技术有限公司 Cross-link network supervision method based on public governance link
CN113095940A (en) * 2021-04-29 2021-07-09 平安科技(深圳)有限公司 Isomorphic multilink-based transaction processing method, blockchain system, device and medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A blockchain-based secure transaction model for distributed energy in Industrial Internet of Things;Wei Hu;《Alexandria Engineering Journal》;20201031;第1-10页 *
Cloud- Edge Integrated State Identification;Wei Hu 等;《power on》;20211208;第1094-1909页 *
Model-driven approach for the design of Multi-Chain Smart Contracts;Ankica Barisic 等;《(BRAINS》;20211227;第1-12页 *
微网电力交易的多链式区块链动态分区方法设计与实现;周强等;《电子器件》;20200820(第04期);第771-777页 *

Also Published As

Publication number Publication date
CN114663091A (en) 2022-06-24

Similar Documents

Publication Publication Date Title
CN114663091B (en) Power trading method based on multi-chain blockchain architecture
CN109034480B (en) A Distributed Optimal Scheduling Method of Internet Micro-Network Based on Smart Contract
Liu et al. Electric vehicle power trading mechanism based on blockchain and smart contract in V2G network
Hassija et al. A blockchain-based framework for lightweight data sharing and energy trading in V2G network
CN112434343B (en) Virtual power plant safety scheduling and trading method based on dual block chain technology
Moniruzzaman et al. Blockchain and cooperative game theory for peer-to-peer energy trading in smart grids
Said A decentralized electricity trading framework (DETF) for connected EVs: A blockchain and machine learning for profit margin optimization
Lin et al. Blockchain power trading and energy management platform
Saxena et al. Blockchain based transactive energy systems for voltage regulation in active distribution networks
Teng et al. A comprehensive review of energy blockchain: Application scenarios and development trends
Barnawi et al. Path planning for energy management of smart maritime electric vehicles: A blockchain-based solution
CN111932253A (en) Electric energy transaction method based on credit consensus mechanism
Kumar et al. Blockchain based optimized energy trading for e-mobility using quantum reinforcement learning
US20220012806A1 (en) Electricity market trading and evaluation method based on weak centralized consortium blockchain
CN115908048A (en) Method and system for power trading based on block chain in virtual power plant environment
CN112613861A (en) Electric power pre-sale transaction method, device and system based on alliance chain
CN113987080A (en) Blockchain incentive method, device and related products based on reputation consensus
Zhang et al. Security scheduling and transaction mechanism of virtual power plants based on dual blockchains
CN116452334B (en) Multi-carbon transaction method and system for industrial park based on blockchain
Song et al. Reliable reputation review and secure energy transaction of microgrid community based on hybrid blockchain
Ge et al. Blockchain and green certificates based market structure and transaction mechanism of direct power-purchase for industrial users
Yang et al. A double-chain blockchain with economic attributes and network constraints of prosumer transactions
Nie et al. A ring signature trust model for project review based on blockchain smart contract
Yan et al. Blockchain‐based framework of power demand response in China
Devi et al. Demcrp-et: decentralized multi-criteria ranked prosumers energy trading using distributed ledger technology

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