A Decentralized Trading Method for Carbon Emission Trading Exchanges
By adopting decentralized trading methods in carbon emission exchanges, using blockchain technology and smart contracts, splitting the transaction process and using consensus algorithms and external matching systems, the trust crisis and security problems in centralized exchanges are solved, providing a safe and trustworthy trading environment.
Patent Information
- Application Number
- CN202310404428.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2043-04-17
AI Technical Summary
There are problems such as trust crisis, excessive exchange rights and insecurity in centralized databases in existing centralized exchanges in carbon emission trading, making it difficult to ensure the security and credibility of transactions.
By adopting decentralized trading methods in carbon emission exchanges, using blockchain technology and smart contracts, the transaction process is split into two parts: transaction generation and transaction confirmation, and through an adaptive consensus algorithm and external matching system, third-party participation is reduced and peer-to-peer transactions are realized.
It solves the trust crisis and security issues in centralized exchanges, provides a safe and trustworthy trading environment, and reduces the problems of excessive exchange rights and insecure of centralized databases.
Smart Images

Figure CN116471077B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a decentralized trading method for a carbon emission exchange, belonging to the field of blockchain technology. Background Art
[0002] With the continuous development of Internet and computer technologies in today's world, asset digitization has also become increasingly mature. Currently, common digitizable assets include, but are not limited to, stocks, bonds, options, ABS, currencies, etc. In particular, carbon emission rights, which have been gaining popularity in recent years, are also one of the products that can be digitized. All the above-listed digitized assets have a certain degree of value attributes, and since they are not physical goods, they can be traded online efficiently. However, although online trading is convenient and fast and can be operated across regions, it also brings challenges to security, such as: the security of the exchange, the trustworthiness of both trading parties, the guaranteeability of the trading process and results, immutability, etc.
[0003] As a technology that has emerged in recent years, blockchain is a distributed database storage technology that is immutable and contains the entire history. The huge block data set contains the entire history of each transaction. Therefore, it has also been widely applied in the financial field. Its natural data immutability and decentralization characteristics make the information recorded by blockchain more authentic and reliable, which can help people solve the problem of mutual distrust. Summary of the Invention
[0004] The object of the present invention is to provide a decentralized trading method for a carbon emission exchange. By thoroughly analyzing the business processes of traditional exchanges, the entire trading process is split into two parts: transaction generation and transaction confirmation for innovation. At the same time, an adapted consensus algorithm and blockchain technology are adopted to eliminate the trust crisis between both parties while reducing the participation of third parties, realizing peer-to-peer trading.
[0005] To achieve the above object, the present invention is realized through the following technical solutions:
[0006] A decentralized trading method for a carbon emission exchange, characterized by including the following steps:
[0007] Step 1: Assign node types to users according to smart contracts, where the node types include access nodes, pure trading nodes, and bookkeeping nodes;
[0008] The access nodes have access rights and do not have any other rights;
[0009] The pure trading nodes have trading rights after paying a deposit and can participate in transactions; they have the right to vote but not the right to be elected; they do not have the right to vote when they do not have trading rights; the deposit will be locked when conducting transactions or elections;
[0010] The accountable node has all the permissions of a pure trading node; it has the right to be elected; it does not have the right to be elected when it has no trading right; if it needs to conduct transactions or elections, its margin is locked and it remains for more than 3 consensus cycles;
[0011] Step 2: Verify whether the user has the trading right and whether the user's margin amount reaches the minimum margin for allowing trading behavior; after both of the above are verified, the user enters the external matching system and conducts competitive trading in the external matching system. After the buyer and seller are successfully matched and reach a trading intention, the order is sent to the consensus module;
[0012] Step 3: All eligible nodes vote for the accountable node. The eligible nodes include pure trading nodes and accountable nodes. The number of votes is recorded in the database by the smart contract, and the initial round number cycle = 0;
[0013] Step 4: Obtain the smart contract data, assign values to the top n accountable nodes with the most votes in the entire blockchain, and assign values from 1 to n in descending order of the number of votes as the prospective accounting nodes;
[0014] Step 5: Start the consensus for this round of cycle. The prospective accounting nodes take turns to act as the bookkeeper to host the consensus until the end of a cycle;
[0015] Step 6: The bookkeeper in the current time period collects transaction information and packs it into a pre-prepare(n, h, a, s, m) message, where n is the assignment of the current node, h is the block height, a is the digest of the message m, m is the request message sent by the client, and s is the signature of the n node, , where k is a random number generated by the random number generator, and r is the signature before converting the byte characters, is the user's private key; broadcast the pre-prepare message;
[0016] Step 7: All prospective accounting nodes that receive the pre-prepare message convert the pre-prepare message into a prepare(n, h, a, s, m) message and broadcast it;
[0017] Step 8: After all prospective accounting nodes receive the prepare message, they start to accumulate the number of prepare messages of different bookkeepers prepareAmount in memory. When prepareAmount > f + 1, f is the maximum number of Byzantine nodes, the node starts to confirm each transaction in the block and attach the verification result to each transaction, and then broadcasts a verification result message commit(n, h, a, s, m);
[0018] Step 9: Each prospective bookkeeping node starts to accumulate the number of commit messages commitAmount with different bookkeepers but the same judgment result. When commitAmount > 2f + 1 and other conditions are correct, this message has reached an agreement and enters the passed state, and the passed transactions in the block are packed into the final block final. This block is an irreversible fixed block;
[0019] Step 10: All consensus nodes start a timer when receiving a message. When the timer expires and no agreement has been reached, they abandon the current consensus, discard it, and start the next round of consensus;
[0020] Step 11: When n prospective bookkeeping nodes complete one cycle, return and loop through Steps 4 - 7 to start the next round of loop; when cycle reaches the maximum number of rounds, initialize cycle = 0 and return to Step 2 to start the next round of cycle loop.
[0021] Preferably, the smart contract includes a voting contract: recording the number of votes of users voting for bookkeeping nodes; a user distribution contract: recording the basic information of user nodes, judging the user type, and distributing corresponding legal permissions; a node type change contract: changing the node type of users; a carbon emission right distribution contract: recording the balance of users' carbon emission equivalents; a margin contract: storing users' margins and recording the balance of users' margins; an asset contract: an account - type contract for recording, storing, or transferring fund assets.
[0022] Preferably, the method further includes an inspector node. The inspector has the right to submit anomalies; the inspector checks all nodes or node behaviors with potential risks on the blockchain, locks a part of the margin when submitting an anomaly report; if the anomaly is confirmed to be true, it can obtain the margin of the violator; the pure trading node has all the permissions of the inspector node.
[0023] Preferably, the specific method for judging the user type and distributing corresponding legal permissions is as follows:
[0024] Judge whether the user has trading qualifications. If the user does not have trading qualifications, then judge whether it applies to be an inspector. If it does not apply, the application fails. If it applies, it pays the margin and enters the smart contract to become an inspector;
[0025] If the user has trading qualifications, then determine whether its application type is a pure trading node or a bookkeeping node, pay the corresponding margin according to the application type, and become a pure trading node or a bookkeeping node.
[0026] Preferably, the bookkeeping node can choose whether to serve users,
[0027] If it chooses to serve users, it enters the consensus state and informs the user of the final result;
[0028] If you choose not to provide the service, the number of waiting rounds will be recorded. If the number of waiting rounds is less than or equal to the remaining consensus rounds in this cycle, the next account keeper will be replaced; if the number of waiting rounds is greater than or equal to the remaining consensus rounds in this cycle, the pure transaction nodes of the transaction will be notified that no account keeper will accept the order in this cycle.
[0029] Preferably, the specific method of changing the node type of a user is as follows:
[0030] The access node can be converted into a picket node by paying a sufficient deposit and has picket node authority;
[0031] Access nodes or picket nodes become pure trading nodes and obtain trading node permissions by obtaining trading qualifications, paying sufficient margin, and downloading designated data;
[0032] The picketer node becomes a bookkeeping node by obtaining trading qualifications, replenishing margin, and downloading all blockchain data, and obtains all the permissions of the bookkeeping node;
[0033] Pure transaction nodes pay the margin, download all data to become accountable nodes, and obtain all the permissions of accountable nodes;
[0034] The accounting nodes rank themselves in the top n positions through elections and become quasi-accounting nodes, and then take turns to become accounting nodes.
[0035] Preferably, the picket node picketing steps are as follows:
[0036] Call the smart contract to verify whether the user has the right to submit exceptions. If the condition is met, the patrol node is allowed to submit transaction patrol information;
[0037] The inspector node will submit the inspector node and the inspection information, and pay the reporting deposit to check whether the inspector node has violated the rules. If there is any violation, the reporting deposit will be deducted and the address will be locked to enter the consensus stage;
[0038] During the consensus phase, if the person being monitored is a quasi-accounting node or accounting node in this accounting cycle, the abnormal confirmation will be placed on the last block accounting of this cycle;
[0039] If the report is not approved, and the picket node is checked to have not reported any violations, the report deposit of the picket node will be returned to the picket node account through the contract;
[0040] If the report is approved, the deposit paid by the inspector will be distributed to the inspector node, quasi-accounting node, and accounting node.
[0041] Preferably, the specific generation process of the signature s is as follows:
[0042] Step 6-1, calculate , and convert the data type of e to an integer, where is the transpose of the message, , is the preprocessing output string of the user using the SM3 hashing method, is the "or" operator;
[0043] Step 6-2, generate a random number using a random number generator;
[0044] Step 6-3, calculate the elliptic curve point , G represents the base point, and convert 's data type to an integer;
[0045] Step 6-4, calculate , where η represents the range of k values. If or , then return to Step 6-2, otherwise continue to Step 6-5;
[0046] Step 6-5, calculate . If , then return to the second step. If s is not equal to 0, obtain the value of s, convert the data type of s to a byte string, and the signature of the message m is s.
[0047] Preferably, the n = 21.
[0048] The trading method is to disassemble the trading process of a traditional exchange into two stages: trading generation and trading confirmation. In the present invention, the trading generation stage is still generated by the trading matching system, while the trading confirmation stage runs on the blockchain. The data is generated by an external system, passed into the consensus method, and the data legitimacy is verified by the consensus nodes.
[0049] A decentralized trading system implemented based on a blockchain includes a user entity, a consensus method EPBFT, a smart contract, a trusted blockchain system, an external storage IPFS, and an external matching business system.
[0050] The advantages of the present invention are as follows: The present invention solves the problems of trust in direct interaction between both parties, excessive rights of the exchange, and insecurity of the centralized database that have not been solved by the current centralized exchanges. By designing a new trading rule, using a trusted consortium blockchain, a smart contract, an adapted consensus algorithm, and an external matching system, the advantages of the traditional centralized exchange are exerted while weakening its disadvantages, enabling users to have a safe and trusted trading environment. Description of the Drawings
[0051] The accompanying drawings are used to provide a further understanding of the present invention and form a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation to the present invention.
[0052] Figure 1 This is a schematic diagram of the overall design of the system of the present invention.
[0053] Figure 2 This is a schematic diagram of the node application process structure of the present invention.
[0054] Figure 3 This is a schematic diagram of the node transfer structure of the present invention.
[0055] Figure 4 This is a schematic diagram of the consensus algorithm structure of the present invention.
[0056] Figure 5 This is a schematic diagram of the user determination process structure of the present invention.
[0057] Figure 6 This is a schematic diagram of the smart contract structure of the present invention.
[0058] Figure 7 This is a schematic diagram of the transaction buyer process structure of the present invention.
[0059] Figure 8 This is a schematic diagram of the transaction seller process structure of the present invention.
[0060] Figure 9 This is a comparison diagram of the transaction method of the present invention and the transaction method of traditional exchanges. Specific embodiments
[0061] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0062] Embodiment 1
[0063] The decentralized carbon emission rights trading method based on blockchain of the present invention includes six entities: user entities, improved consensus method EPBFT (Electoral Practical Byzantine Fault Tolerance), smart contracts, trusted blockchain systems, external storage IPFS, and external matching business systems, and the entities interact with each other.
[0064] The trusted blockchain system adopts the consortium blockchain mode, sets up a super supervision node, issues users' trading rights by this super supervision node, also issues users' access authorizations by this super node, and audits the registered carbon emission rights amount by this super supervision node. In principle, the super supervision node is served by the government department.
[0065] A smart contract is a piece of code that will be automatically triggered to automatically complete a specific transaction process when the conditions are met when both parties have an asset transaction on the blockchain. Smart contracts allow for trusted transactions without a third party, and these transactions are traceable and irreversible; smart contracts can also be an account, which we call a contract account, which means they have a balance, which means that certain assets can be stored on the smart contract. In the present invention, the contract account is used to deposit and withdraw margin. Such accounts cannot be manipulated manually and they are deployed on the blockchain network of the present invention and run as programs.
[0066] The said smart contract is an agreement that can enable numerous participating parties to automatically execute certain commitments on it, such as Figure 6 , the smart contracts created by the present invention include but are not limited to the following: Voting.sol (voting contract) for all users to vote for candidates and record the votes of all candidates; UserIssued.sol (user issuance contract) for recording the basic information of user nodes, judging user types, and issuing corresponding legitimate permissions; UserChange.sol (node type change contract) for changing the node type of users; CarbonIssued.sol (carbon emission right issuance contract) for issuing users' carbon emission rights and recording the balance of users' carbon emission equivalents; Deposit.sol (margin contract) for depositing users' margin and recording the balance of users' margin; Assets.sol (asset contract) for recording and depositing or transferring funds and assets of nodes in an account type contract.
[0067] IPFS InterPlanetary File System is a hypermedia text transfer protocol that uses decentralized sharding encryption storage technology and has the characteristics of low cost, high efficiency, high security, privacy, and decentralization.
[0068] User entities are further divided into access nodes, scrutineer nodes, pure trading nodes, and bookkeeping nodes, among which the bookkeeping nodes can be promoted to quasi-bookkeeping nodes or node bookkeeping nodes.
[0069] Embodiment 2
[0070] The overall structure of the decentralized carbon emission trading system and method based on blockchain is the same as that of Example 1. In the present invention, the user entity is the transaction party and maintenance node of the entire transaction system, and is the operation and maintenance core of the entire system. In order to match the actual transaction scenario and the self-improvement consensus algorithm, the present invention sets four user entities.
[0071] Specific permissions and roles of user entities:
[0072] Access node (N0): only has access rights and no other permissions.
[0073] Patrol Node (N1): Has the right to submit exceptions; Patrol nodes can check all nodes or node behaviors with hidden dangers on the blockchain. When submitting an exception report, a part of the deposit needs to be locked (to prevent malicious disruption of community order, or nodes use this method to conduct high-concurrency attacks. If the Patrol node violates the rules, its deposit and locked address will be deducted. The lock duration and other penalties are automatically controlled by the smart contract and are not controlled by humans). If the exception is confirmed to be true, a certain proportion of the illegal node deposit can be obtained as a reward (a certain proportion is set mainly to prevent some illegal nodes from changing accounts to report themselves in order to protect themselves). When the Patrol node finds an exception, it submits the exception report to the "accounting node" of the current time, and the "accounting node" and "quasi-accounting node" vote in this round of consensus. If the "suspect" is the "quasi-accounting node" or "accounting node" of this accounting cycle, the abnormal confirmation will be placed on the last block accounting of this cycle.
[0074] Pure trading node (N2): has all the permissions of the picket node, and the reward and punishment methods are also synchronized; after obtaining the trading right and paying the "security deposit", it can participate in legal transactions on the trading day; it can obtain the right to vote, but cannot obtain the right to be elected; if there is no trading right, it automatically does not have the right to vote; if it is necessary to conduct transactions or node elections, the security deposit will be locked.
[0075] Accounting Node (N3): It has all the permissions of the patrol node and the pure transaction node, and the reward and punishment methods are also synchronized; it can obtain the right to be elected; if it does not have the right to trade, it automatically does not have the right to be elected; the accounting node becomes a quasi-accounting node through canvassing elections, and the quasi-accounting node can become an accounting node within the accounting cycle; if it is necessary to conduct transactions or node elections, or be elected, the margin will be locked and maintained for a certain number of trading days.
[0076] Pure transaction nodes are light nodes that only store part of the data; accounting nodes are full nodes that need to have a complete blockchain ledger, occupy memory to synchronize all blockchain data, can independently verify all transactions on the blockchain and update data in real time, and can be responsible for blockchain transactions and broadcast verification.
[0077] At the same time, various types of nodes can be changed if certain conditions are met, that is, the node type can be upgraded or downgraded, and the change of node type is completely controlled by the smart contract.
[0078] Reference Figure 2 , the node application of this model has the following process:
[0079] N0 permissions are issued when users enter the system;
[0080] If the smart contract verifies that there is no trading qualification but the deposit has been paid, the N1 permission will be issued;
[0081] After verification by the smart contract, if the trading qualification exists and the minimum margin has been paid, the N2 permission will be issued;
[0082] If you have N2 permissions and pay a sufficient deposit, you will be issued N3 permissions;
[0083] If Nmax = N0, it is a visited node;
[0084] If Nmax = N1, it is a picket node;
[0085] If Nmax = N2, it is a quasi-transaction node;
[0086] If Nmax = N3, it is a bookkeeping node.
[0087] Example 3
[0088] The overall structure of the decentralized carbon emission trading system and method based on blockchain is the same as that of Examples 1-2. The user node setting method in the present invention is dynamically adjustable, that is, the four types of user entities can be changed under the rules of the smart contract. Although this setting increases the complexity of the entire system, it also makes the entire system more flexible and increases the user experience of the system users, allowing users to change the nature of their own nodes according to actual needs to conduct corresponding business.
[0089] refer to Figure 3 Node flow diagram, the conditions and process of node change in this model are as follows:
[0090] N0 nodes can be converted to N1 nodes by paying sufficient deposit, thereby gaining patrol node rights.
[0091] N0 or N1 nodes can become N2 nodes by obtaining trading qualifications, paying sufficient margin, and downloading specified data, thereby obtaining trading node permissions.
[0092] The N1 node becomes the N3 node by obtaining trading qualifications, replenishing the margin, downloading all the blockchain data, or having the N2 node replenish the margin and download all the data, thereby obtaining all the permissions of the bookkeeping node.
[0093] The N3 bookkeeping node can become a quasi-bookkeeping node by ranking among the top 21 through an election vote, and then become a bookkeeping node by taking turns.
[0094] Embodiment 4
[0095] The overall composition of the decentralized carbon emission trading system and method implemented based on the blockchain is the same as that of Embodiments 1-3. The consensus method is usually the security core of the entire blockchain system. In the EPBFT adopted in the present invention, the algorithm model refers to Figure 4 , in this consensus algorithm, the normal operation of the blockchain depends on the "consensus nodes", which are generated by voting of all the nodes in the network. The "bookkeeping nodes" can receive transaction fees while packing transactions and can preside over the execution of the proposals voted by the community.
[0096] This consensus algorithm first selects a certain number of quasi-bookkeeping nodes by voting of pure transaction nodes and bookkeeping nodes. Within a certain period of time, the system sequentially selects a quasi-bookkeeping node to collect messages for consensus and obtain the result, and then records it on the blockchain ledger to form tamper-proof data.
[0097] a. Before the formal start of the consensus algorithm, all "admission nodes (pure transaction nodes, bookkeeping nodes)" need to vote for the "bookkeeping nodes" first. The number of votes is dynamic and is recorded in the exclusive database by the smart contract.
[0098] b. First, initialize the round number cycle = 0.
[0099] c. Obtain the smart contract data, assign the top 21 bookkeeping nodes with the highest number of votes in the entire blockchain, and assign the numbers num = 1-21 in descending order of the number of votes.
[0100] d. Start the consensus for this round. The 21 "consensus nodes" take turns to serve as the "bookkeeping nodes" to preside over the consensus until the end of 3 rounds (one cycle), that is, a total of 63 blocks are generated in one cycle.
[0101] e. The "bookkeeping node" in the current time period collects information, packs it into a pre-prepare(n, h, a, s, m) message, where n = user.num is the num value of the current node in step c, h is the block height, a is the digest of the message m, is the signature of the n node, and m is the request message sent by the client. Broadcast the pre-prepare message.
[0102] f. All "consensus nodes" that receive the pre-prepare message convert the pre-prepare message into a prepare(n, h, a, s, m) message and broadcast it. Here, the meanings of n, h, a, s, and m are the same as those in the pre-prepare message (this step is to prevent "quasi-bookkeeping nodes" from losing contact with "bookkeeping nodes" or the nodes not having established communication yet).
[0103] g. After all "consensus nodes" receive the prepare message, they start accumulating the number of prepare messages with different ns in memory, namely prepareAmount. When prepareAmount > f + 1, the node starts to verify each transaction in the block, attaches the verification result to each transaction, and then broadcasts a verification result message: commit(n, h, a, s, m).
[0104] h. Each "consensus node" starts accumulating the number of commit messages with different ns but the same determination result, namely commitAmount. When commitAmount > 2f + 1 and other conditions are correct, it is considered that the message has reached an agreement, enters the passed state, and packages the transactions that can pass in the block into the final block final. This block is an irreversible fixed block.
[0105] i. When all consensus nodes receive a message, they start a timer. When the timer expires and no agreement has been reached, they abandon the current consensus, discard it, and start the next round of consensus.
[0106] j. When the number of "bookkeeping nodes" num > 21, return and loop through steps e - h, that is, start the next round of loop; when cycle > 3, return to step b and start the loop for the next round of cycle.
[0107] It should be noted that the consensus algorithm adopted in the present invention will adopt the consistency protocol, checkpoint protocol, and view switching protocol in the practical Byzantine fault tolerance algorithm.
[0108] Embodiment 5
[0109] The overall composition of the decentralized carbon emission rights trading system and method implemented based on the blockchain is the same as that in Embodiments 1 - 4. In the present invention, users are the most important factors supporting the operation of the entire system, and business is an important factor maintaining the survival of the system. Buyers bid to purchase carbon emission rights in this system, sellers bid to sell carbon emission rights, and the "bookkeeper" charges a transaction fee after the transaction between the buyer and the seller is successful and records the transaction information of both parties on the blockchain to achieve an immutable and traceable legal proof record.
[0110] Due to the reasonable settings of the present invention, whether a transaction is legal or not requires 21 "consensus nodes" to jointly review and vote. The success rate of cheating by both buyers and sellers and "consensus nodes" is extremely low. Therefore, buyers or node sellers can compete to become "bookkeepers" to save a large amount of transaction fees.
[0111] It should be noted that during the repeated experiments, we found that setting 21 consensus nodes is closest to the peak of the normal distribution of performance and the lowest possibility of cheating. Therefore, in the present invention, the consensus node n = 21 is set. And in the simulation experiment with 1 server, 21 nodes, 100M bandwidth, and a random delay of less than 200ms, it shows that the throughput of the present invention approaches 170,000 transactions per second. At present, it can be fully used for the application scenario of carbon emission rights trading.
[0112] The following will be combined with Figure 7 and Figure 8 introduce the behavior process of both trading parties.
[0113] Before the user enters the trading system, the system will first determine the user type. The system will first access the smart contract data to verify whether user.TxnAuthorization=true holds, that is, to verify whether the user has the right to trade; secondly, it will access the smart contract data to verify whether userMargin>= buyerMargin holds, that is, to verify whether the user's margin amount reaches the minimum margin required for allowing trading behavior.
[0114] If the above two items do not meet the standards, the non-compliance conditions will be notified to the user.
[0115] After the above two items are both verified to be established, the user is allowed to enter the external matching system, and competitive trading is carried out in the external matching system. After the buyer and seller are successfully matched and reach a trading intention, the order is sent to the consensus layer and handed over to the consensus module for review and the operation of putting the order on the chain.
[0116] For various reasons, the "bookkeeper" can choose whether to serve the user. If it chooses to serve the user, it enters the consensus state and informs the user of the final result; if the "bookkeeper" in this round does not provide services, it records user.Waiting, that is, the waiting round. If user.Waiting<=42-num-now.cycle, that is, the waiting round is less than or equal to the remaining consensus rounds of this cycle, then it waits for the next bookkeeper to replace; if user.Waiting>42-num-now.cycle, it notifies both trading parties that there is no bookkeeper to accept the order in this cycle, and it is up to both parties to decide whether to wait or whether to cancel or re-match the transaction.
[0117] The conclusion of a transaction requires the private keys of all parties to sign, in order to enhance security, identity authentication, non-repudiation, non-forgery and other related features. Almost all signature methods in the present invention adopt the Chinese commercial digital signature algorithm SM2, using an elliptic curve over the prime field GF(p) of 256 bits, and the equation is: ;
[0118] During the data transmission process, the relevant users use their private keys to sign, and the consensus nodes retrieve the public keys of the relevant users to authenticate the users.
[0119] The user user's signature message M should:
[0120] a. Set ;
[0121] b. Calculate , and convert the data type of e to an integer;
[0122] c. Generate a random number using a random number generator;
[0123] d. Calculate the elliptic curve point , and convert the data type of to an integer;
[0124] e. Calculate , if or then return to step c;
[0125] f. Calculate , if then return to step c;
[0126] Convert the data types of r and s to byte strings, and the signature of message M is (r, s).
[0127] The transaction records passed by the consensus layer and recorded on the blockchain are legal records. After the data is uploaded to the blockchain, the smart contract will send the seller's profit, the buyer's carbon emission rights, and the bookkeeper's commission to their respective designated accounts. After a certain time limit, the margin of each party will also be unlocked for each party to withdraw cash in the margin custody contract.
[0128] During the transaction process, different from the traditional transaction method, the present invention places the transaction confirmation stage on the blockchain, that is, the entire transaction process is split into a matching process and a confirmation process. This move will achieve the purpose of significantly reducing the rights of transaction handlers (institutions) without affecting performance, making the possibility of tampering with transaction data drop exponentially. The comparison between the present invention and the traditional transaction method is as Figure 9 shown.
[0129] Example 6
[0130] The overall structure of the decentralized carbon emission trading system and method based on blockchain is the same as that of Examples 1-5. In order to prevent "accounting nodes" or "quasi-accounting nodes" from cheating, the patrol node can provide corresponding evidence to prove the existence of cheating. Anyone with patrol authority can submit a report, that is, "patrol nodes", "pure transaction nodes" and "accounting nodes" can submit abnormal reports.
[0131] As an important act to maintain the security of blockchain and community, reporting is an important step to prevent and prevent accounting errors. Nodes with conclusive evidence of cheating confirmed by voting will be punished, their "security deposit" will be confiscated, and they will be deprived of their trading, voting and election qualifications.
[0132] The reporting and confirmation steps are as follows:
[0133] a. The user logs in to the exception report submission page and logs in.
[0134] b. The system calls the contract to check whether user.exceptionPermissions=true is true, that is, to verify whether the user has the right to submit exceptions. If the condition is met, the user is allowed to enter the exception report submission page.
[0135] c. The user submits the cheating node and cheating report and pays a certain amount of "reporting deposit". This is to prevent some malicious nodes from disrupting the community order, or the node uses this reporting method to conduct high-concurrency attacks. If the picket node violates the rules, the "deposit" will be deducted and the address will be locked. The locking time depends on the situation. The trigger condition is to call the contract to check whether user.reportMargin>=reportMarginSys is true. If the condition is met, the abnormal report is allowed to be submitted to the consensus stage.
[0136] d. If reportObject==now.consensuser, that is, the "suspect" is the "consensus node" of this accounting cycle, then the abnormal confirmation is placed in , that is, the last block of this cycle is recorded.
[0137] e. If the report is not approved and no violation is found during the inspection, the reporting node "security deposit" will be returned to the user's original account through the contract.
[0138] f. If the report is approved and it is verified that cheating or node violations do exist, the "patrol node", "consensus node" and system account will be allocated the "security deposit" of the illegal node in a certain proportion.
[0139] In summary, the decentralized trading system and method based on blockchain implemented for carbon emission rights exchanges disclosed in the present invention mainly solve the problems that have not been solved by current centralized exchanges, such as the trust in direct interaction between both parties, the excessive power of the exchange, and the insecurity of the centralized database. The present invention gives full play to the advantages of traditional centralized exchanges while weakening their disadvantages through a trusted consortium blockchain, smart contracts, an adapted consensus algorithm, an external matching system, and a certain game method, enabling users to have a safe and trustworthy trading environment. Major exchanges can also profit from maintaining this trading system, and national regulatory agencies can also track and control the issuance and transfer of carbon emission rights according to this trading model. The data is also securely stored without being leaked. The present invention is not solely applicable to the trading of carbon emission rights in the future. Because it can withstand high TPS requests, with some modifications, it can fully handle the trading of valuable digital assets such as stocks, futures, bonds, options, and ABS, and has strong innovation, development, and application value.
[0140] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, for those skilled in the art, they can still modify the technical solutions recorded in the foregoing embodiments, or equivalently replace some of the technical features. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A decentralized trading method for a carbon emission trading exchange, characterized in that, It includes the following steps: Step 1: Allocate node types for users according to the smart contract. The node types include access nodes, pure trading nodes, and bookkeeping nodes; The access nodes have access rights and no other rights; After paying the margin, the pure trading nodes have the right to trade and can participate in transactions; they have the right to vote but not the right to be elected; they do not have the right to vote when they do not have the right to trade; the margin will be locked when conducting transactions or elections; The bookkeeping nodes have all the rights of the pure trading nodes; they have the right to be elected; they do not have the right to be elected when they do not have the right to trade; if they need to conduct transactions, elections, or be elected, their margin will be locked and maintained for more than 3 consensus cycles; Step 2: Verify whether the user has the right to trade and whether the user's margin amount reaches the minimum margin for allowing trading behavior; after both of the above are verified, the user enters the external matching system and conducts competitive trading in the external matching system. After the buyer and seller are successfully matched and reach a trading intention, the order is sent to the consensus module; Step 3: All eligible nodes vote for the bookkeeping nodes. The eligible nodes include pure trading nodes and bookkeeping nodes. The number of votes is recorded in the database by the smart contract, and the initial round number cycle = 0; Step 4: Obtain the smart contract data, assign values to the top n bookkeeping nodes with the most votes in the entire blockchain, and assign values from 1 to n in descending order of the number of votes as the quasi-bookkeeping nodes; Step 5: Start the consensus for this round. The quasi-bookkeeping nodes take turns serving as the bookkeeper to host the consensus until the end of a cycle; Step 6: The accounting node in the current time period collects transaction information and packages it into a pre-prepare(n, h, a, s, m) message, where n is the assignment of the current node, h is the block height, a is the digest of message m, m is the request message sent by the client, and s is the signature of node n, , where k is a random number generated by a random number generator, and r is the signature before converting byte characters, is the user's private key; broadcast the pre-prepare message; Step 7: All quasi-bookkeeping nodes that receive the pre-prepare message convert the pre-prepare message into a prepare(n, h, a, s, m) message and broadcast it; Step 8: After all quasi-bookkeeping nodes receive the prepare message, they start to accumulate the number of prepare messages prepareAmount of different bookkeepers in the memory. When prepareAmount > f + 1 (f is the maximum number of Byzantine nodes), the nodes start to confirm each transaction in the block and attach the verification result to each transaction, and then broadcast a verification result message commit(n, h, a, s, m); Step 9: Each quasi-bookkeeping node starts to accumulate the number of commit messages commitAmount of different bookkeepers but with the same judgment result. When commitAmount > 2f + 1 and other conditions are correct, the message has reached an agreement and enters the passed state, and the passed transactions in the block are packaged into the final block final. This block is an irreversible fixed block; Step 10: All consensus nodes start a timer when receiving a message. When the timer expires and no agreement is reached, they abandon this consensus, discard it, and start the next round of consensus; Step 11: When the n quasi-bookkeepers complete a cycle, return and loop through steps 4 - 7 to start the next round of loop; when cycle reaches the maximum number of rounds, initialize the round number cycle = 0, and return to step 2 to start the next round of cycle loop; The smart contract includes a voting contract: recording the number of votes cast by users for the accountable nodes; user Issuing contract: record basic information of user nodes, determine user types, and issue corresponding legal permissions; Node type change contract: changes the user's node type; Carbon emission rights issuance contract: records the user's carbon emission equivalent balance; Margin contract: deposits the user's margin and records the user's margin balance; Asset contract: records and deposits or transfers fund assets account-type contract; The method also includes a picket node, the picket has the right to submit anomalies; the picket checks all nodes or node behaviors with hidden dangers on the blockchain, and locks a part of the deposit when submitting anomaly reports; if the anomaly is confirmed to be true, the violator's deposit can be obtained; the pure transaction node has all the rights of the picket node; The picketing steps of the picketer node are as follows: Call the smart contract to verify whether the user has the right to submit exceptions. If the condition is met, the patrol node is allowed to submit transaction patrol information; The inspector node will submit the inspector node and the inspection information, and pay the reporting deposit to check whether the inspector node has violated the rules. If there is any violation, the reporting deposit will be deducted and the address will be locked to enter the consensus stage; During the consensus phase, if the person being monitored is a quasi-accounting node or accounting node in this accounting cycle, the abnormal confirmation will be placed on the last block accounting of this cycle; If the report is not approved, and the picket node is checked to have not reported any violations, the report deposit of the picket node will be returned to the picket node account through the contract; If the report is approved, the deposit paid by the inspector will be distributed to the inspector node, quasi-accounting node, and accounting node.
2. The decentralized trading method for a carbon emission trading exchange according to claim 1, characterized in that, The specific method of determining the user type and issuing the corresponding legal authority is as follows: Determine whether the user has trading qualifications. If not, determine whether to apply for a patrol. If not, the application fails. If applied, pay a deposit and send it to the smart contract to become a patrol. If there is trading qualification, its application type is determined as a pure trading node or an accounting node. The corresponding deposit is paid according to the application type to become a pure trading node or an accounting node.
3. The decentralized trading method for a carbon emission trading exchange according to claim 1, characterized in that, The accounting node can choose whether to serve the user. If you choose to serve the user, you will enter the consensus state and inform the user of the final result; If you choose not to provide the service, the number of waiting rounds will be recorded. If the number of waiting rounds is less than or equal to the remaining consensus rounds in this cycle, the next account keeper will be replaced; if the number of waiting rounds is greater than or equal to the remaining consensus rounds in this cycle, the pure transaction nodes of the transaction will be notified that no account keeper will accept the order in this cycle.
4. The decentralized trading method for a carbon emission trading exchange according to claim 1, characterized in that, The specific method for changing the user's node type is as follows: The access node can be converted into a picket node by paying a sufficient deposit and has picket node authority; Access nodes or picket nodes become pure trading nodes and obtain trading node permissions by obtaining trading qualifications, paying sufficient margin, and downloading designated data; The picketer node becomes a bookkeeping node by obtaining trading qualifications, replenishing margin, and downloading all blockchain data, and obtains all the permissions of the bookkeeping node; Pure trading nodes supplement margin and download all data to become bookkeeping nodes, obtaining all the permissions of bookkeeping nodes; Bookkeeping nodes elect and vote to rank themselves among the top n to become quasi-bookkeeping nodes, and then take turns to become bookkeeping nodes.
5. The decentralized trading method for a carbon emissions exchange according to claim 1, wherein, The specific generation process of the signature s is as follows: Step 6-1, calculate , and convert the data type of e to an integer, where is the transpose of the message, , is the preprocessing output string of the user using the SM3 hashing method, is the "OR" operator; Step 6-2, generate a random number using a random number generator ; Step 6-3, calculate the elliptic curve points , where G represents the base point, and convert the data type to an integer; Step 6-4, calculate , where η represents the range of values of k. If or then return to Step 6-2; otherwise, continue with Step 6-5; Step 6-5, calculate ; if then return to the second step. If s is not equal to 0, obtain the value of s, convert the data type of s to a byte string, and then the signature of the message m is s.
6. The decentralized trading method for a carbon emissions exchange according to claim 1, wherein, The n = 21.
7. A decentralized trading system for a carbon emissions exchange, wherein, The trading system can execute the method described in any one of claims 1-6, including a user entity, a consensus method EPBFT, a smart contract, a trusted blockchain system, an external storage IPFS, and an external matching business system.
Citation Information
Patent Citations
Block chain-based trusted access and cross-domain authentication method in named data network
CN113935016A