WO2021018312A1 - Blockchain-based over-the-counter transaction method and system, storage medium, and electronic apparatus - Google Patents

Blockchain-based over-the-counter transaction method and system, storage medium, and electronic apparatus Download PDF

Info

Publication number
WO2021018312A1
WO2021018312A1 PCT/CN2020/110236 CN2020110236W WO2021018312A1 WO 2021018312 A1 WO2021018312 A1 WO 2021018312A1 CN 2020110236 W CN2020110236 W CN 2020110236W WO 2021018312 A1 WO2021018312 A1 WO 2021018312A1
Authority
WO
WIPO (PCT)
Prior art keywords
contract
transaction
unit
user
information
Prior art date
Application number
PCT/CN2020/110236
Other languages
French (fr)
Chinese (zh)
Inventor
邱炜伟
李伟
张帅
蔡亮
张珂杰
Original Assignee
杭州趣链科技有限公司
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
Priority claimed from CN201910694153.3A external-priority patent/CN110443709A/en
Priority claimed from CN201910772367.8A external-priority patent/CN110533533A/en
Application filed by 杭州趣链科技有限公司 filed Critical 杭州趣链科技有限公司
Publication of WO2021018312A1 publication Critical patent/WO2021018312A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • This application relates to the application field of blockchain, and in particular to a blockchain-based OTC transaction method, system, storage medium and electronic device.
  • inter-bank bond transactions are mainly achieved through bilateral negotiations or brokerage company inquiry, and can also be achieved through the trading platform of the Foreign Exchange Trading Center.
  • the over-the-counter bond market has problems such as low transaction efficiency, difficult to trace transaction information, and inability to grasp market information in a timely manner by supervision.
  • a blockchain-based over-the-counter transaction system includes a rights management module, an account module, a market quotation module, a contract management module, and transaction management running on a blockchain Module, where:
  • the authority management module is used to control the data viewing and operation authority of the administrator account and ordinary users through smart contracts, so that the administrator account can view contracts and transactions in the entire market and modify contract templates , Said ordinary users can only view contracts and transactions related to them;
  • the account module is used to manage changes or authentication related to the user's account.
  • the account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
  • the user registration unit is used to receive the identity authentication information filled in by the user and submit the registration request, and bind the blockchain address for the user;
  • the CA authentication unit is used to simultaneously send the identity authentication information filled in by the user to multiple authoritative nodes through the blockchain for data comparison, and receive the comparison result returned by the authoritative node to authenticate the user's identity information Whether it is true or not; if all nodes return the comparison correctly, the user’s identity authentication is passed, and the system adds the user’s blockchain address to the authorized list to authorize the user; if any node returns a comparison error, it will not pass User authentication;
  • the account management unit is used to collect and record user identity information, allocate blockchain accounts for users, and escrow public and private keys;
  • the user login unit is used for users to log in to the blockchain system with the registered account password
  • the user information modification unit is used to improve the user's basic information other than the identity authentication information, and to modify the basic information that the user has filled in;
  • the market quotation module includes a large transaction screen unit, a quotation detail unit, and a click transaction unit, wherein: the large transaction screen unit is used to display bond quotation information issued by all users in the entire market; the quotation details unit is used to display The detailed information of a certain bond quotation; the click transaction unit is used to receive the transaction process initiated by the user on a certain quotation in the transaction screen, or receive the transaction process initiated by a batch of quotations in the transaction screen, and determine Detailed information of both parties to the transaction and the subject of the transaction;
  • the contract management module includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, among which:
  • the template management unit includes template making and template display, the template making function is only open to administrators, and the template display is used to display contract templates made by the administrator to ordinary users;
  • the contract signing unit includes contract generation and contract signing.
  • the contract generation is used to generate contract elements according to the detailed information of the transaction parties and the target obtained by clicking the transaction unit, and generate the contract to be signed according to the contract template formulated by the administrator;
  • the contract signing is used to send the contract information to be signed to both parties of the transaction obtained by clicking the transaction unit, and to receive the contract signed by both parties to the transaction, mark the signed contract as an effective contract, and send it to the historical contract unit. Then upload the contract to the blockchain for recording;
  • the contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit; the contract to be signed is invalidated after the signing time limit is exceeded and enters the historical contract unit;
  • the historical contract unit is used to display the valid contracts signed and completed by both parties to the transaction generated in the contract signing unit, and used to display contracts to be signed that are invalidated after the signing time limit;
  • the transaction management module includes a new intention unit and a current position unit, wherein:
  • the new intention unit is used to receive a new buying or selling intention quotation initiated by the user, and after the user fills in all the elements of the transaction intention, the quotation is sent to the transaction large screen unit for display;
  • the current position holding unit is used to display the bonds and cash balance currently held by the user.
  • the above-mentioned blockchain-based over-the-counter trading system has the following advantages: the system provides online quotation and trading platforms for participating institutions in the over-the-counter bond market; provides registration, identity authentication, login, quotation, transaction, contract signing, Complete functional modules for contract management and position management; replace paper contracts with electronic contracts to improve contract signing efficiency and reduce contract management difficulty; add supervisory agencies, ie administrators, to blockchain nodes to improve supervision efficiency.
  • the system also provides customers with online contract signing and online bond trading functions to improve the efficiency of over-the-counter bond transactions and improve the liquidity of the inter-bank bond market.
  • the system is based on the underlying blockchain, and data cannot be tampered with. By uploading account information and transaction information to the chain, it is convenient to trace the transaction history and improve supervision efficiency.
  • all the contract records of the contract signing unit are secured through the blockchain, and the secured data includes the blockchain addresses of the signing parties and the time stamp at the time of signing, and the electronic contract documents containing the electronic signatures of both parties.
  • the identity authentication of the user in the CA authentication unit uses blockchain-based distributed CA authentication.
  • a blockchain-based OTC transaction method which is implemented based on the blockchain-based OTC transaction system of any of the various embodiments of the present application , The method specifically includes the following steps:
  • the user browses the large-screen transaction unit and views the quotation details unit, and selects the quotation to be traded;
  • the blockchain address of the bidder and the details of the offer generate the contract to be signed;
  • the confirmation opinion is no, the user gives up signing the contract, the contract is invalidated, and enters the historical contract unit; when the confirmation opinion is yes, it is judged whether the contract has exceeded the signing time limit; when the judgment result is yes, then The contract is invalidated and enter the historical contract unit; when the judgment result is no, the user can use the electronic signature to sign the contract; then judge whether the bidder has signed the contract, if the judgment result is no, judge whether the contract has exceeded the signing time limit, judge If the result is yes, the contract is invalidated and enter the historical contract unit. If the judgment result is no, then continue to judge whether the bidder has signed the contract; if the judgment result is yes, the contract takes effect;
  • the system clears the bonds and funds of both parties through the transaction records on the blockchain, and then changes the positions of both parties through the clearing results, that is, settlement.
  • the method further includes:
  • the logical judgment in the transaction control process of the smart contract includes: the user's bond holdings and the bond balance verification when the user sells the transaction; the user's cash balance when the user buys the transaction Inspection; control of signing time limit when electronic contract is signed; on-chain storage of transaction record details, electronic contract hash, and electronic contract files; control of different permissions between administrator accounts and ordinary user accounts; users complete a buy or sell transaction ,
  • the system liquidates the bonds and funds held by the user according to the underlying bonds of the transaction and the transaction amount, and changes the balance of the bonds and funds.
  • the method before signing the contract, the method further includes:
  • Defining a smart contract to perform over-the-counter transactions according to the smart contract, and the method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the smart contract;
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • the formal verification specification satisfies the following conditions: the uploaded file information structure corresponding to the uploaded file information structure is uploaded according to the file information, the recipient information, and the feedbacker information. , The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; check the loop The body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  • the method further includes: during formal verification, the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the loop body array length is ignored, and the loop body is ignored. Temporary variable value overflow; judge whether the internal state variable exists, if the internal state variable already exists, then the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a success flag code on the chain, Get the built formal verification model.
  • a blockchain-based over-the-counter transaction method which includes the following steps:
  • the method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the over-the-counter smart contract;
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • the formal verification specification satisfies the following conditions: the uploaded file information structure corresponding to the uploaded file information structure is uploaded according to the file information, the recipient information, and the feedbacker information. , The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; check the loop The body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  • the method further includes: during formal verification, the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the loop body array length is ignored, and the loop body is ignored. Temporary variable value overflow; judge whether the internal state variable exists, if the internal state variable already exists, then the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a success flag code on the chain, Get the built formal verification model.
  • an over-the-counter transaction system based on a blockchain.
  • the system includes a rights management module, an account module, a market quotation module, a contract management module, Transaction management module; wherein: the authority management module is used to control the data viewing authority and operation authority of the administrator account and ordinary users according to the smart contract; wherein the data viewing authority of the administrator account includes viewing contracts and transaction records of the entire market
  • the operation authority of the administrator account includes the authority to modify the contract template, the data viewing authority of the ordinary user includes the authority to view the contract and transaction related to the user;
  • the account module is used to manage changes related to the user account Or authentication;
  • the market quotation module is used to display bond quotation information issued by all users in the entire market;
  • the contract management module is used to generate a contract to be signed according to the contract template and the acquired transaction information, and to The contract is sent to both parties to the transaction for signing;
  • the transaction management module is used to send the received quotation information to the market quotation module and display the user's asset information.
  • the account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein: the user registration unit is used to receive user identity authentication information and Submit a registration request to bind the user to the corresponding blockchain address; the CA authentication unit is used to send the user's identity authentication information to multiple authoritative nodes through the blockchain, and receive each of the authoritative nodes The returned comparison result is used to verify the authenticity of the user’s identity information; if the comparison results of all the authoritative nodes are correct, the user’s corresponding blockchain address is added to the authorized list to pass the user’s registration Request; if the comparison result of the authoritative node shows an error, the user’s registration request is rejected; the account management unit: used to collect and record the user’s identity information, assign the user a blockchain account and escrow public keys and private
  • the user login unit used to log in to the blockchain system according to the registered account password entered by the user; the user information modification unit is used to manage and modify other basic
  • the CA authentication unit is also used to authenticate the user identity according to the distributed CA authentication rules based on the blockchain.
  • the market quotation module includes a large transaction screen unit, a quotation detail unit, and a click transaction unit, wherein: the large transaction screen unit is used to display bond quotation information issued by all users in the entire market; The quotation detail unit is used to display the detailed information of a single bond quotation; the click transaction unit is used to receive a single transaction process initiated by the user for a certain quotation in the transaction screen or batches initiated for a certain batch of quotations Transaction process, and determine the details of both parties to the transaction and the subject of the transaction.
  • the contract management module includes a template management unit, a contract signing unit, a contract to be signed, and a historical contract unit
  • the template management unit is used for the administrator to make templates and show management to ordinary users The contract template made by the administrator
  • the contract signing unit is used to generate contract elements based on the detailed information of the transaction parties and the transaction target obtained by the click transaction unit, and generate the contract to be signed based on the contract elements and the contract template made by the administrator , Send the contract information to be signed to both parties to the transaction, and receive the signed contract signed by both parties, mark the signed contract as an effective contract, send the effective contract to the historical contract unit
  • the contract to be signed is uploaded and recorded
  • the contract to be signed unit is used to display the contract to be signed generated in the contract signing unit or the contract to be signed by the bidding party, and the contract to be signed that exceeds the signing time limit is invalidated, And the invalidated contract to be signed is sent to the historical contract unit;
  • the historical contract unit is used to display the effective contract and the invalidated
  • the contract signing record in the contract signing unit is stored by the blockchain, and the contract signing record includes the blockchain addresses of the signing parties and the signing timestamp, and the electronic contract file containing the electronic signatures of both parties .
  • the transaction management module includes a new intention unit and a current position holding unit, wherein: the new intention unit is used to receive a new buying intention quotation or a selling intention quotation initiated by the user, and placing The buying intention quotation and the selling intention quotation are sent to the large transaction screen unit; the current position holding unit is used to display the bonds and cash balance currently held by the user.
  • a blockchain-based OTC transaction method which is implemented based on the blockchain-based OTC transaction system of any of the various embodiments of the present application
  • the method specifically includes the following steps: obtaining a transaction quotation selected by the user, the transaction quotation being selected by the user based on the bond quotation information in the transaction large screen unit and the detailed information of a single bond quotation in the quotation detail unit Check the user’s asset information to ensure that the transaction offer is within the user’s asset control range; obtain the blockchain addresses of both parties to the transaction, and based on the detailed information of the transaction offer and the transaction
  • the blockchain addresses of both parties generate the contract to be signed; the transaction parties include the user and the bidder; send the contract to be signed to the transaction parties and obtain the contract signing result; according to the contract signing result and the transaction Record the clearing of the assets of the two parties to the transaction, and change the positions of the two parties to the transaction according to the clearing result.
  • the sending the contract to be signed to the two parties to the transaction and obtaining the result of contract signing includes: sending the contract to be signed to the two parties to the transaction and obtaining confirmation from the two parties to the transaction Opinion; if the confirmation opinions of both parties to the transaction are both yes, and both parties to the transaction complete the signing of the contract to be signed within the signing time limit, then the contract signed by both parties to the transaction is marked as an effective contract.
  • the method further includes: if the confirmation opinion of either of the two parties to the transaction is no, or, either of the two parties to the transaction fails to complete the contract to be signed within the signing time limit. Signed, the contract to be signed is invalidated, and the invalid contract to be signed is sent to the historical contract unit.
  • the method further includes: controlling the logical judgment in the transaction flow according to the smart contract, the logical judgment including the verification of the user asset information, the judgment of the signing time limit, the storage of transaction information, The use of account permissions and the liquidation and change of assets during the transaction.
  • the method further includes: defining a smart contract; defining a formal verification specification to regulate the functions, loop body, return value, and internal state variables of each contract method related to the smart contract in the smart contract The property value of the change; determine whether the smart contract meets the description in the formal verification specification, if the smart contract meets the description in the formal verification specification, send the smart contract to the transaction parties for signing ; If the smart contract does not meet the description in the formal verification specification, the smart contract is modified until the smart contract meets the description in the formal verification specification.
  • the method further includes: performing an over-the-counter transaction according to the smart contract to declare and implement the data structure and contract method of the smart contract.
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • the defined formal verification specification includes: uploading according to the file information, uploading the recipient information, and uploading the feedback information corresponding to the uploaded file information structure, The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; verify the loop body No overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  • the method further includes: performing an over-the-counter transaction according to the smart contract to declare and implement the data structure and contract method of the smart contract.
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • the defined formal verification specification includes: uploading according to the file information, uploading the recipient information, and uploading the feedback information corresponding to the uploaded file information structure, The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; verify the loop body No overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  • the method further includes: keeping the incoming parameter parameters within the preset parameter range of the application layer; ignoring the overflow of the length of the loop body array; ignoring the temporary variable value in the loop body The overflow; judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a successful sign code on the chain, and the construction is completed According to the formal verification model, the smart contract is formally verified.
  • an electronic device including a memory and a processor, characterized in that a computer program is stored in the memory, and the processor is configured to run the computer program to execute the computer program.
  • a storage medium in which a computer program is stored, wherein the computer program is configured to execute any one of the various embodiments of the present application when running.
  • the described OTC transaction method based on blockchain.
  • Fig. 1 is a basic structure diagram of a blockchain-based over-the-counter transaction system according to an embodiment of the application.
  • Fig. 2 is a structural block diagram of a blockchain-based over-the-counter transaction system according to a specific embodiment of the application.
  • Figure 3 is a flowchart of formal verification of smart contracts in an embodiment of the application.
  • Figure 4 is a schematic diagram of a formal verification model of a smart contract in an embodiment of the application.
  • Fig. 5 is a flowchart of a blockchain-based OTC transaction method according to an embodiment of the application.
  • Fig. 6 is a flowchart of a blockchain-based OTC transaction method according to a specific embodiment of the application.
  • Fig. 7 is a flowchart of formal verification of a smart contract according to a specific embodiment of the application.
  • first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with “first” and “second” may explicitly or implicitly include at least one of the features.
  • a plurality of means at least two, such as two, three, etc., unless specifically defined otherwise.
  • everal means at least one, such as one, two, etc., unless otherwise specifically defined.
  • Figure 1 is a basic architecture diagram of a blockchain-based over-the-counter transaction system according to an embodiment of the application.
  • the system includes a rights management module, an account module, a market quotation module, and Contract management module and transaction management module, including:
  • the authority management module is used to control the data viewing and operation authority of the administrator account and ordinary users through smart contracts, so that the administrator account can view contracts and transactions in the entire market and modify contract templates , Said ordinary users can only view contracts and transactions related to them.
  • the account module is used to manage changes or authentication related to the user's account.
  • the account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
  • the user registration unit is used to receive the identity authentication information filled in by the user and submit the registration request, and bind the blockchain address for the user;
  • the CA authentication unit is used to simultaneously send the identity authentication information filled in by the user to multiple authoritative nodes through the blockchain for data comparison, and receive the comparison result returned by the authoritative node to authenticate the user's identity information Whether it is true or not; if all nodes return the comparison correctly, the user’s identity authentication is passed, and the system adds the user’s blockchain address to the authorized list to authorize the user; if any node returns a comparison error, it will not pass User authentication;
  • the account management unit is used to collect and record user identity information, allocate blockchain accounts for users, and escrow public and private keys;
  • the user login unit is used for users to log in to the blockchain system with the registered account password
  • the user information modification unit is used to complete the user's basic information except for the identity authentication information, and to modify the basic information that the user has filled in.
  • the market quotation module includes a large trading screen unit, a quotation detail unit and a click transaction unit, among which:
  • the large trading screen unit is used to display bond quotation information issued by all users in the entire market;
  • the quotation details unit is used to display detailed information of a bond quotation
  • the click transaction unit is used to receive the transaction process initiated by the user on a certain quotation in the large transaction screen, or receive the transaction process initiated by a batch of quotations in the large transaction screen, and determine the detailed information of the transaction parties and the transaction target.
  • the contract management module includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, among which:
  • the template management unit includes template making and template display, the template making function is only open to administrators, and the template display is used to display contract templates made by the administrator to ordinary users;
  • the contract signing unit includes contract generation and contract signing.
  • the contract generation is used to generate contract elements according to the detailed information of the transaction parties and the target obtained by clicking the transaction unit, and generate the contract to be signed according to the contract template formulated by the administrator;
  • the contract signing is used to send the contract information to be signed to both parties of the transaction obtained by clicking the transaction unit, and to receive the contract signed by both parties to the transaction, mark the signed contract as an effective contract, and send it to the historical contract unit. Then upload the contract to the blockchain for recording;
  • the contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit; the contract to be signed is invalidated after the signing time limit is exceeded and enters the historical contract unit;
  • the historical contract unit is used to display the valid contracts signed and completed by both parties to the transaction generated in the contract signing unit, and used to display the contracts to be signed that are invalidated after the signing time limit.
  • the transaction management module includes a new intention unit and a current position unit, wherein:
  • the new intention unit is used to receive a new buying or selling intention quotation initiated by the user, and after the user fills in all the elements of the transaction intention, the quotation is sent to the transaction large screen unit for display; the current position holding unit , Used to display the bond and cash balance currently held by the user.
  • the beneficial effects of this application are as follows:
  • the blockchain-based over-the-counter trading system provided by this application provides online quotation and trading platforms for participating institutions in the over-the-counter bond market, as well as providing registration, identity authentication, login, quotation, and transaction , Complete functional modules for contract signing, contract management, and position management; replace paper contracts with electronic contracts, improve contract signing efficiency, and reduce contract management difficulties; add regulatory agencies, namely administrators, to blockchain nodes to improve supervision efficiency.
  • the system also provides customers with online contract signing and online bond trading functions to improve the efficiency of over-the-counter bond transactions and improve the liquidity of the inter-bank bond market.
  • the system is based on the underlying blockchain, and data cannot be tampered with. By uploading account information and transaction information to the chain, it is convenient to trace the transaction history and improve supervision efficiency.
  • all the contract records of the contract signing unit are secured through the blockchain, and the secured data includes the blockchain addresses of the signing parties and the time stamp at the time of signing, and the electronic contract documents containing the electronic signatures of both parties.
  • Blockchain technology is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain is a new type of decentralized protocol that can safely store digital currency transactions or other data. The information cannot be forged or tampered with.
  • the confirmation of transactions on the blockchain is completed by all nodes on the blockchain, and the consensus algorithm To ensure its consistency, it has the characteristics of decentralization, openness, independence, security and anonymity.
  • the identity authentication of the user in the CA authentication unit uses blockchain-based distributed CA authentication.
  • FIG. 2 is a structural block diagram of the blockchain-based over-the-counter trading system according to a specific embodiment of the application, as shown in Figure 2.
  • the blockchain-based over-the-counter trading system includes a rights management module 210, an account module 220, a market quotation module 230, a contract management module 240, and a transaction management module 250 running on the underlying blockchain; among them:
  • the authority management module 210 is used to control the data viewing authority and operation authority of the administrator account and ordinary users according to the smart contract; wherein the data viewing authority of the administrator account includes the authority to view contracts and transaction records of the entire market.
  • the operating authority of the account includes the authority to modify the contract template, and the data viewing authority of the ordinary user includes the authority to view contracts and transactions related to the user;
  • the account module 220 is used to manage changes or authentication related to user accounts; the market quotation module 230 is used to display bond quotation information issued by all users in the entire market.
  • the contract management module 240 is configured to generate a contract to be signed according to the contract template and the acquired transaction information, and send the contract to be signed to both parties to the transaction for signing;
  • the transaction management module 250 is configured to send the received quotation information to the market quotation module 230 and display the user's asset information.
  • the account module 220 includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
  • the user registration unit is used to receive the user's identity authentication information and submit a registration request to bind the user to the corresponding blockchain address;
  • the CA authentication unit is used to send the user's identity authentication information to multiple authoritative nodes through the blockchain, and receive the comparison result returned by each of the authoritative nodes to verify whether the user's identity information is authentic; If the comparison result of the authoritative node is correct, the blockchain address corresponding to the user is added to the authorized list to pass the user’s registration request; if the comparison result of the authoritative node shows an error, the user’s request will be rejected Registration request;
  • the account management unit used to collect and record the user's identity information, allocate blockchain accounts and escrow public and private keys for users;
  • the user login unit used to log in to the blockchain system according to the registered account password entered by the user;
  • the user information modification unit is used to manage and modify other basic information of the user.
  • the CA authentication unit is also used to authenticate the user identity according to the distributed CA authentication rules based on the blockchain.
  • the market quotation module 230 includes a large trading screen unit, a quotation detail unit, and a click transaction unit, wherein:
  • the large transaction screen unit is used to display bond quotation information issued by all users in the entire market; the quotation detail unit is used to display detailed information of a single bond quotation; the click transaction unit is used to receive user-specific A single transaction process initiated by a certain quotation on the large screen or a batch transaction process initiated for a certain batch of quotations, and the detailed information of the transaction parties and the transaction target is determined.
  • the contract management module 240 includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, wherein:
  • the template management unit is used for the administrator to make templates and to show ordinary users the contract templates made by the administrator;
  • the contract signing unit is used to generate contract elements according to the detailed information of the transaction parties and the transaction target obtained by the click transaction unit, and generate the contract to be signed according to the contract elements and the contract template prepared by the administrator, and send the pending contract to both parties Sign the contract information, receive the signed contract signed by both parties to the transaction, mark the signed contract as an effective contract, send the effective contract to the historical contract unit, and upload the effective contract And records;
  • the contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit, to invalidate the contract to be signed that exceeds the signing time limit, and to send the invalid contract to be signed to The historical contract unit;
  • the historical contract unit is used to display valid contracts and invalid contracts to be signed.
  • the contract signing record in the contract signing unit is stored via a blockchain, and the contract signing record includes the blockchain addresses of the signing parties, the signing timestamp, and the electronic contract file containing the electronic signatures of both parties .
  • the transaction management module 250 includes a new intention unit and a current position unit, wherein: the new intention unit is used to receive a new buying intention quotation or selling intention quotation initiated by the user, and The buying intention quotation and the selling intention quotation are sent to the large transaction screen unit.
  • the current position holding unit is used to display the bonds and cash balance currently held by the user.
  • This application also provides an over-the-counter transaction method for blockchain, which includes the following steps:
  • the method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the over-the-counter smart contract.
  • Smart contract is a computer protocol designed to spread, verify or execute contracts in an information-based way. Smart contracts allow trusted transactions without a third party, which are traceable and irreversible. Executing contracts written in code and storing information in an immutable blockchain causes certain risks and problems, so the security of the contract is particularly important.
  • This application provides a set of common OTC transaction process related smart contract formal verification models, and provides a set of secure formal verification for OTC smart contract related businesses Standards.
  • This method is designed based on software formal verification methods, and improves the security of smart contracts for over-the-counter transactions in contract design.
  • the formal verification method provided by this method has universality. This method can be used for development and security auditing of smart contracts related to over-the-counter transactions, and it can be very suitable for business systems such as over-the-counter transactions.
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • an over-the-counter smart contract has the following properties: (a) The data structure contains uploaded file information, the recipient information structure contains recipient information, and the feedback information structure contains feedback information.
  • the uploaded file information structure contains at least two fields: the project file primary key and the file hash.
  • the recipient information structure contains at least one field of the project file process progress primary key.
  • the feedback information structure contains at least the project file primary key, file hash, and Is there a dispute about these three fields.
  • the state variable contains the main key of the record project file to the uploaded file information, the mapping of the feedbacker information, and the mapping of the main key of the project file process progress to the recipient information.
  • File information on-chain, recipient information on-chain, and feedbacker information on-chain, the three contract methods respectively loop the incoming parameters in the loop, and put each input parameter into the corresponding data structure In the variables.
  • Figure 3 is a flow chart of formal verification of smart contracts in an embodiment of the application.
  • the formal verification specification satisfies the following conditions: uploading according to the file information, uploading the recipient information and all
  • the feedback information on the chain corresponds to the incoming file information structure, the recipient information structure, and the feedback information structure to verify that the file information is on the chain and the recipient information is uploaded.
  • Chain and the return value of the feedbacker s information on the chain; verify that the loop body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the over-the-counter transaction
  • the state variables of the data structure in the method change, and other state variables remain unchanged.
  • the formal verification specification satisfies the following conditions: (a) The formal verification specification is executed according to the function method, and the function method is required to be executed correctly, the purpose is to verify whether the smart contract is in accordance with the formal verification model Go design. (b) According to the uploaded file information structure, the recipient information structure and the feedback information corresponding to the upload of the file information, the recipient information, and the feedback information The structure is checked and different return values are obtained. When the relevant information is on the chain, if the information already exists on the chain, an error message will be returned; if it does not exist, the subsequent on-chain business process will be performed, and the successful on-chain will be returned. information.
  • the transaction After uploading the file information on the chain, the recipient information on the chain, and the feedbacker information on the chain is initiated, the transaction is verified on the chain to not exist, and the OTC transaction information is assigned to the corresponding field according to the corresponding logic, the candidate object and the OTC trader
  • the corresponding field of the information state variable is equal to the expected value, and other fields and state variables are equal to the original value.
  • Fig. 4 is a schematic diagram of a formal verification model of a smart contract in an embodiment of the application. As shown in Fig. 4, constructing a formal verification model of a smart contract specifically includes the following steps:
  • the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the loop body array length is ignored, and the overflow of the temporary variable value in the loop body is ignored; the internal state variable is judged whether it exists, If the internal state variable already exists, the formal verification returns an on-chain failure code; if the internal state variable does not exist, the formal verification returns an on-chain success flag code, and a built formal verification model is obtained.
  • the incoming parameter parameters are kept within the controllable range of the application layer, and will not cause the incoming parameter group to overflow, and the parameter overflow will cause the formal verification to fail, and the correct form cannot be obtained.
  • Calibration results The overflow of the length of the loop body array is ignored, and the overflow of the temporary variable value in the loop body is ignored. Since control has been done at the application layer, there is no risk of overflow of the array length and the risk of overflow of the temporary variable value in the loop. Ignore these two items without formal verification, and get more accurate verification results.
  • Figure 5 is a flowchart of a blockchain-based OTC transaction method according to an embodiment of the application. As shown in Figure 5, the method is based on any of the various embodiments of the application. System implementation, the method specifically includes the following steps:
  • the user browses the large-screen transaction unit and views the quotation details unit, and selects the quotation to be transacted; (2) the user clicks the click transaction unit, and the system first verifies the user’s cash balance or Bond balance, ensure that the purchase amount does not exceed the cash balance, and that the number of bonds sold does not exceed the bond balance; then generate a contract to be signed based on the blockchain address of the user and the bidder and the details of the quotation; (3) the user confirms the contract Whether the content is correct, when the confirmation opinion is no, the user gives up signing the contract, the contract is invalidated, and enters the historical contract unit; when the confirmation opinion is yes, it is judged whether the contract has exceeded the signing time limit; when the judgment result is yes, the contract is invalidated.
  • the logical judgment includes: the user's bond holdings and the bond balance verification when the user sells the transaction; The verification of the user’s cash balance; the control of the signing time limit when signing the electronic contract; the on-chain storage of transaction record details, electronic contract hashes, and electronic contract documents; control of different permissions between the administrator account and the ordinary user account; the user completes a For a buy or sell transaction, the system liquidates the bonds and funds held by the user according to the target bond of the transaction and the transaction amount, and changes the balance of the bonds and funds.
  • the smart contract before signing the contract, the smart contract needs to be verified, which specifically includes the following steps:
  • the method of the over-the-counter transaction includes the declaration and implementation of the data structure and contract method of the smart contract; (2) Define formal verification specifications, To standardize the function, loop body, return value, and property value changes of the internal state variables of each contract method related to the smart contract in the smart contract; (3) Use the formal verification specification to perform formal verification on the smart contract , To check whether the over-the-counter transaction method meets the description of the formal verification specification; if it does, it means the smart contract is safe; if it does not, modify the smart contract until the formal verification description complies with the over-the-counter transaction function In the relevant implementation.
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • the formal verification specification satisfies the following conditions: the uploaded file information structure corresponding to the uploaded file information structure is uploaded according to the file information, the recipient information, and the feedbacker information. , The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; check the loop The body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  • the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the length of the loop body array is ignored, and the overflow of the temporary variable value in the loop body is ignored; Judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a successful sign code on the chain, and the constructed formal verification is obtained model.
  • FIG. 6 is a flowchart of the blockchain-based over-the-counter transaction method according to a specific embodiment of the application, as shown in FIG. As shown, the method includes step S610 to step S650:
  • Step S610 Obtain a transaction quotation selected by the user, the transaction quotation selected by the user according to the bond quotation information in the large transaction screen unit and the detailed information of a single bond quotation in the quotation detail unit;
  • Step S620 verify the user's asset information to ensure that the transaction quotation is within the user's asset control range
  • Step S630 Obtain the blockchain addresses of the transaction parties, and generate a contract to be signed according to the detailed information of the transaction quotation and the blockchain addresses of the transaction parties; the transaction parties include the user and the offerer;
  • Step S640 Send the contract to be signed to both parties to the transaction, and obtain the contract signing result
  • Step S650 liquidate the assets of both parties to the transaction according to the result of the contract signing and the transaction records, and change the positions of the two parties to the transaction according to the result of the settlement.
  • the process of signing a contract by both parties to the transaction is specifically: sending the contract to be signed to the parties to the transaction, and obtaining the confirmation opinions of the parties to the transaction; if the confirmation opinions of both parties to the transaction are both yes , And both parties to the transaction complete the signing of the contract to be signed within the signing time limit, then the contract signed by both parties to the transaction is marked as an effective contract.
  • the confirmation opinion of either of the two parties to the transaction is no, or any one of the two parties to the transaction does not complete the signing of the contract to be signed within the signing time limit, the The contract to be signed is voided, and the voided contract to be signed is sent to the historical contract unit.
  • the logical judgment in the transaction process is controlled according to the smart contract, the logical judgment including the verification of the user asset information, the judgment of the signing time limit, the storage of transaction information, the use of account permissions, and the transaction Asset liquidation and changes in the process.
  • FIG. 7 is a flowchart of formal verification of a smart contract according to a specific embodiment of the application. As shown in FIG. 7, the method includes steps S710 to S740:
  • Step S710 Define a smart contract
  • Step S720 Define formal verification specifications to regulate the function, loop body, return value, and attribute value changes of internal state variables of each contract method related to the smart contract in the smart contract;
  • Step S730 Determine whether the smart contract meets the description in the formal verification specification, and if the smart contract meets the description in the formal verification specification, send the smart contract to the transaction parties for signing;
  • Step S740 If the smart contract does not meet the description in the formal verification specification, modify the smart contract until the smart contract meets the description in the formal verification specification.
  • over-the-counter transactions are performed according to the smart contract to declare and implement the data structure and contract method of the smart contract.
  • the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain;
  • the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
  • the defined formal verification specification includes: uploading according to the file information, uploading the recipient information, and uploading the feedback information corresponding to the uploaded file information structure, The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; verify the loop body No overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  • the formal verification of the smart contract according to the formal verification model includes: keeping the incoming parameter parameters within a preset parameter range of the application layer; ignoring the length of the loop body array Overflow; Ignore the overflow of the temporary variable value in the loop body; judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns the chain failure code; if the internal state variable does not exist, the formal The verification returns a successful logo code on the chain, and a built formal verification model is obtained, and the smart contract is formally verified according to the formal verification model.
  • This embodiment also provides an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the foregoing method embodiments.
  • the aforementioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the aforementioned processor, and the input-output device is connected to the aforementioned processor.
  • the foregoing processor may be configured to execute the following steps through a computer program:
  • S3 Obtain the blockchain addresses of both parties to the transaction, and generate a contract to be signed according to the detailed information of the transaction quotation and the blockchain addresses of both parties to the transaction; the parties to the transaction include the user and the bidder;
  • the embodiment of the present application may provide a storage medium for implementation.
  • the storage medium stores a computer program; when the computer program is executed by the processor, any one of the blockchain-based over-the-counter transaction methods in the foregoing embodiments is implemented.

Abstract

A blockchain-based over-the-counter transaction method and system, a storage medium, and an electronic apparatus. The blockchain-based over-the-counter transaction system comprises: a permissions management module, used for controlling data viewing permissions of ordinary users and system administrators; an account module, used for user registration, identity authentication, login and basic information modification, and for implementing blockchain-based distributed CA authentication; a market condition module, used for displaying market-wide bond quotations, responding to click completion requests of users, controlling automatic transaction executions according to conditions, and recording transaction processes on a blockchain; a contract management module, used for generating, signing and managing bond transaction contracts, and recording contract signature processes on the blockchain; a transaction management module, used for users to initiate new transaction intentions, and for settling funds and bond positions of users according to data recorded on the blockchain. The present invention can thus increase quotation and completion efficiency, transaction security and bond market liquidity for over-the-counter bond transactions.

Description

基于区块链的场外交易方法、系统、存储介质和电子装置Block chain-based over-the-counter transaction method, system, storage medium and electronic device
相关申请Related application
本申请要求2019年7月30日申请的,申请号为201910694153.3,发明名称为“一种基于区块链的银行间的场外债券交易系统”和2019年8月21日申请的,申请号为201910772367.8,发明名称为“一种场外交易智能合约的形式验证方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires applications on July 30, 2019, the application number is 201910694153.3, the title of the invention is "a blockchain-based over-the-counter bond trading system" and the application on August 21, 2019, the application number is 201910772367.8, the priority of a Chinese patent application entitled "A Formal Verification Method for Over-the-Counter Smart Contracts", the entire content of which is incorporated into this application by reference.
技术领域Technical field
本申请涉及区块链的应用领域,具体涉及一种基于区块链的场外交易方法、系统、存储介质和电子装置。This application relates to the application field of blockchain, and in particular to a blockchain-based OTC transaction method, system, storage medium and electronic device.
背景技术Background technique
当前,银行间场债券交易主要通过双边协商或者经纪公司询价达成,也可通过外汇交易中心的交易平台达成。总体来看,场外债券市场存在交易效率较低,成交信息难以追溯,监管不能及时掌握市场信息等问题。Currently, inter-bank bond transactions are mainly achieved through bilateral negotiations or brokerage company inquiry, and can also be achieved through the trading platform of the Foreign Exchange Trading Center. In general, the over-the-counter bond market has problems such as low transaction efficiency, difficult to trace transaction information, and inability to grasp market information in a timely manner by supervision.
发明内容Summary of the invention
根据本申请的各种实施例,提供一种基于区块链的场外交易系统,所述系统包括运行在区块链上的权限管理模块、账户模块、市场行情模块、合约管理模块以及交易管理模块,其中:According to various embodiments of the present application, a blockchain-based over-the-counter transaction system is provided. The system includes a rights management module, an account module, a market quotation module, a contract management module, and transaction management running on a blockchain Module, where:
所述权限管理模块,用于通过智能合约对管理员账户与普通用户的数据查看以及操作权限做出控制,以实现所述的管理员账户可查看全市场的合约与交易以及对合约模板作出修改,所述的普通用户只能查看与自己相关的合约与交易;The authority management module is used to control the data viewing and operation authority of the administrator account and ordinary users through smart contracts, so that the administrator account can view contracts and transactions in the entire market and modify contract templates , Said ordinary users can only view contracts and transactions related to them;
所述账户模块用于管理与用户的账户相关的变更或者认证,所述账户模块包括用户注册单元、CA认证单元、账户管理单元、用户登陆单元以及用户信息修改单元,其中:The account module is used to manage changes or authentication related to the user's account. The account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
用户注册单元,用于接收用户填写的身份认证信息并提交注册请求,并为用户绑定区块链地址;The user registration unit is used to receive the identity authentication information filled in by the user and submit the registration request, and bind the blockchain address for the user;
所述CA认证单元,用于将用户填写的身份认证信息通过区块链同时发送给多个权威节点进行数据比对,并接收所述的权威节点返回的比对结果,以认证用户的身份信息是否真实;若全部节点返回比对正确,则通过用户的身份认证,系统将该用户的区块链地址加入被授权列表中,对该用户进行授权;若存在节点返回比对错误,则不通过用户身份认证;The CA authentication unit is used to simultaneously send the identity authentication information filled in by the user to multiple authoritative nodes through the blockchain for data comparison, and receive the comparison result returned by the authoritative node to authenticate the user's identity information Whether it is true or not; if all nodes return the comparison correctly, the user’s identity authentication is passed, and the system adds the user’s blockchain address to the authorized list to authorize the user; if any node returns a comparison error, it will not pass User authentication;
所述账户管理单元,用于收集与记录用户身份信息,并为用户分配区块链账户,托管公私钥;The account management unit is used to collect and record user identity information, allocate blockchain accounts for users, and escrow public and private keys;
用户登陆单元,用于用户使用已注册的账号密码登陆至本区块链系统;The user login unit is used for users to log in to the blockchain system with the registered account password;
用户信息修改单元,用于完善用户除身份认证信息之外的基本信息,并用于修改用户已填写的基本信息;The user information modification unit is used to improve the user's basic information other than the identity authentication information, and to modify the basic information that the user has filled in;
所述市场行情模块包括交易大屏单元、报价详情单元以及点击成交单元,其中:所述交易大屏单元,用于展示全市场所有用户发布的债券报价信息;所述报价详情单元,用于展示某一笔债券报价的详细信息; 所述点击成交单元,用于接收用户对交易大屏中某笔报价发起的交易流程,或者接收交易大屏中某一批报价批量发起的交易流程,并确定交易双方以及交易标的的详细信息;The market quotation module includes a large transaction screen unit, a quotation detail unit, and a click transaction unit, wherein: the large transaction screen unit is used to display bond quotation information issued by all users in the entire market; the quotation details unit is used to display The detailed information of a certain bond quotation; the click transaction unit is used to receive the transaction process initiated by the user on a certain quotation in the transaction screen, or receive the transaction process initiated by a batch of quotations in the transaction screen, and determine Detailed information of both parties to the transaction and the subject of the transaction;
所述合约管理模块包括模板管理单元、合约签署单元、待签署合约单元以及历史合约单元,其中:The contract management module includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, among which:
所述模板管理单元,包括模板制作与模板展示,所述的模板制作功能只对管理员开放,所述的模板展示用于向普通用户展示管理员制定的合约模板;The template management unit includes template making and template display, the template making function is only open to administrators, and the template display is used to display contract templates made by the administrator to ordinary users;
所述合约签署单元,包括合约生成与合约签署,合约生成用于根据点击成交单元所获得的交易双方及标的的详细信息生成合约要素,并根据所管理员制定的合约模板生成待签署合约;所述合约签署用于向点击成交单元所获得的交易双方发送待签署合约信息,并接收交易双方盖上各自电子签章的合约,并将该签署合约标记为已生效合约,发送给历史合约单元,然后将该合约上传至区块链中进行记录;The contract signing unit includes contract generation and contract signing. The contract generation is used to generate contract elements according to the detailed information of the transaction parties and the target obtained by clicking the transaction unit, and generate the contract to be signed according to the contract template formulated by the administrator; The contract signing is used to send the contract information to be signed to both parties of the transaction obtained by clicking the transaction unit, and to receive the contract signed by both parties to the transaction, mark the signed contract as an effective contract, and send it to the historical contract unit. Then upload the contract to the blockchain for recording;
所述待签署合约单元,用于展示合约签署单元中生成的待签署合约或待报价方签署的合约;待签署合约超过签署时限后作废,进入历史合约单元;The contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit; the contract to be signed is invalidated after the signing time limit is exceeded and enters the historical contract unit;
所述历史合约单元,用于展示合约签署单元中生成的交易双方签署完成的已生效合约,以及用于展示超过签署时限后作废的待签署合约;The historical contract unit is used to display the valid contracts signed and completed by both parties to the transaction generated in the contract signing unit, and used to display contracts to be signed that are invalidated after the signing time limit;
所述交易管理模块包括新建意向单元和当前持仓单元,其中:The transaction management module includes a new intention unit and a current position unit, wherein:
所述新建意向单元,用于接收用户发起的一笔新的买入或卖出意向报价,接收用户填写交易意向的所有要素之后,将报价发送至交易大屏单元进行展示;The new intention unit is used to receive a new buying or selling intention quotation initiated by the user, and after the user fills in all the elements of the transaction intention, the quotation is sent to the transaction large screen unit for display;
所述当前持仓单元,用于展示用户当前所持有的债券以及现金余额。The current position holding unit is used to display the bonds and cash balance currently held by the user.
上述基于区块链的场外交易系统具有以下优点:该系统为场外债券市场参与机构,提供了线上报价以及交易平台;提供了从注册、身份认证、登陆、报价、成交、合约签署、合约管理、持仓管理的完备功能模块;以电子合约取代纸质合约,提高合约签署效率,降低合约管理难度;将监管机构,即管理员,加入区块链节点,提高监管效能。所述系统还为客户提供了在线合约签署与在线债券交易功能,提高场外债券交易效率,提高银行间债券市场流动性。另外,该系统架构在底层区块链之上,数据不可篡改,通过将账户信息、成交信息上链,便于追溯交易历史,提高监管效能。The above-mentioned blockchain-based over-the-counter trading system has the following advantages: the system provides online quotation and trading platforms for participating institutions in the over-the-counter bond market; provides registration, identity authentication, login, quotation, transaction, contract signing, Complete functional modules for contract management and position management; replace paper contracts with electronic contracts to improve contract signing efficiency and reduce contract management difficulty; add supervisory agencies, ie administrators, to blockchain nodes to improve supervision efficiency. The system also provides customers with online contract signing and online bond trading functions to improve the efficiency of over-the-counter bond transactions and improve the liquidity of the inter-bank bond market. In addition, the system is based on the underlying blockchain, and data cannot be tampered with. By uploading account information and transaction information to the chain, it is convenient to trace the transaction history and improve supervision efficiency.
在其中一个实施例中,所述合约签署单元的合约全数记录通过区块链进行保全,保全数据包括签署双方的区块链地址以及签署时的时间戳、包含双方电子签名的电子合约文件。In one of the embodiments, all the contract records of the contract signing unit are secured through the blockchain, and the secured data includes the blockchain addresses of the signing parties and the time stamp at the time of signing, and the electronic contract documents containing the electronic signatures of both parties.
在其中一个实施例中,所述CA认证单元中的用户的身份认证使用基于区块链的分布式CA认证。In one of the embodiments, the identity authentication of the user in the CA authentication unit uses blockchain-based distributed CA authentication.
根据本申请的各种实施例,还提供一种基于区块链的场外交易方法,所述方法基于本申请的各种实施例中任一项的基于区块链的场外交易系统来实现,该方法具体包括如下步骤:According to various embodiments of the present application, there is also provided a blockchain-based OTC transaction method, which is implemented based on the blockchain-based OTC transaction system of any of the various embodiments of the present application , The method specifically includes the following steps:
用户浏览所述的交易大屏单元并查看报价详情单元,选择需成交的报价;The user browses the large-screen transaction unit and views the quotation details unit, and selects the quotation to be traded;
用户点击所述的点击成交单元,所述的系统首先校验用户的持有现金余额或债券余额,确保买入金额不超过现金余额,确保卖出债券张数不超过债券余额;然后根据用户和报价方的区块链地址以及该报价的详情生成待签署合约;The user clicks on the click transaction unit, and the system first verifies the user’s cash balance or bond balance to ensure that the purchase amount does not exceed the cash balance, and that the number of bonds sold does not exceed the bond balance; The blockchain address of the bidder and the details of the offer generate the contract to be signed;
用户确认合约内容是否无误,当确认意见为否,则用户放弃签署合约,合约作废,进入历史合约单元; 当确认意见为是,则判断合约是否已超过签署时限;当判断结果为是时,则合约作废,进入历史合约单元;当判断结果为否,则用户可以使用电子签章签署该合约;再判断报价方是否已签署合约,若判断结果为否,则判断合约是否已超过签署时限,判断结果为是,则合约作废,进入历史合约单元,判断结果为否,则继续判断报价方是否已签署合约;判断结果为是,则合约生效;The user confirms whether the content of the contract is correct. When the confirmation opinion is no, the user gives up signing the contract, the contract is invalidated, and enters the historical contract unit; when the confirmation opinion is yes, it is judged whether the contract has exceeded the signing time limit; when the judgment result is yes, then The contract is invalidated and enter the historical contract unit; when the judgment result is no, the user can use the electronic signature to sign the contract; then judge whether the bidder has signed the contract, if the judgment result is no, judge whether the contract has exceeded the signing time limit, judge If the result is yes, the contract is invalidated and enter the historical contract unit. If the judgment result is no, then continue to judge whether the bidder has signed the contract; if the judgment result is yes, the contract takes effect;
系统通过区块链上的交易记录对交易双方进行债券以及资金的清算,然后通过清算结果对交易双方进行持仓变更,即结算。The system clears the bonds and funds of both parties through the transaction records on the blockchain, and then changes the positions of both parties through the clearing results, that is, settlement.
在其中一个实施例中,所述方法还包括:In one of the embodiments, the method further includes:
根据智能合约交控制易流程中的逻辑判断:其中,所述逻辑判断包括:用户在卖出交易时的用户持仓债券以及债券余额校验;用户在买入交易时的用户持有现金余额的校验;电子合约签署时签署时限的控制;交易记录详情、电子合约哈希、电子合约文件的上链存储;管理员账户与普通用户账户不同权限的控制;用户完成一笔买入或卖出交易,系统根据交易的标的债券以及交易金额对用户持仓的债券以及资金进行清算,并对债券以及资金的余额进行变更。According to the logical judgment in the transaction control process of the smart contract, the logical judgment includes: the user's bond holdings and the bond balance verification when the user sells the transaction; the user's cash balance when the user buys the transaction Inspection; control of signing time limit when electronic contract is signed; on-chain storage of transaction record details, electronic contract hash, and electronic contract files; control of different permissions between administrator accounts and ordinary user accounts; users complete a buy or sell transaction , The system liquidates the bonds and funds held by the user according to the underlying bonds of the transaction and the transaction amount, and changes the balance of the bonds and funds.
在其中一个实施例中,在签署合约之前,所述方法还包括:In one of the embodiments, before signing the contract, the method further includes:
定义智能合约,以根据所述智能合约进行场外交易,所述场外交易的方法包括对所述智能合约的数据结构、合约方法的声明与实现;Defining a smart contract to perform over-the-counter transactions according to the smart contract, and the method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the smart contract;
定义形式验证规范,以规范所述智能合约中每个与智能合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;Define formal verification specifications to regulate the function, loop body, return value and attribute value changes of internal state variables of each smart contract related contract method in the smart contract;
利用所述形式验证规范对所述智能合约进行形式验证,以检查所述场外交易的方法实现是否符合所述形式验证规范的描述;若符合则代表所述智能合约安全;若不符合则修改所述智能合约,直至形式验证描述符合场外交易功能中相关实现。Use the formal verification specification to perform formal verification on the smart contract to check whether the implementation of the over-the-counter transaction method complies with the description of the formal verification specification; if it complies, it means the smart contract is safe; if it does not comply, modify The smart contract until the formal verification description conforms to the relevant implementation in the over-the-counter transaction function.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
在其中一个实施例中,所述形式验证规范满足如下条件:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。In one of the embodiments, the formal verification specification satisfies the following conditions: the uploaded file information structure corresponding to the uploaded file information structure is uploaded according to the file information, the recipient information, and the feedbacker information. , The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; check the loop The body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
在其中一个实施例中,所述方法还包括:形式验证时,传入的入参参数保持在应用层的可控范围内;忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出;判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型。In one of the embodiments, the method further includes: during formal verification, the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the loop body array length is ignored, and the loop body is ignored. Temporary variable value overflow; judge whether the internal state variable exists, if the internal state variable already exists, then the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a success flag code on the chain, Get the built formal verification model.
根据本申请的各种实施例,还提供一种基于区块链的场外交易方法,所述方法包括如下步骤:According to various embodiments of the present application, there is also provided a blockchain-based over-the-counter transaction method, which includes the following steps:
定义场外交易智能合约,进行场外交易,所述场外交易的方法包括对所述场外交易智能合约的数据结 构、合约方法的声明与实现;Defining an over-the-counter smart contract to conduct over-the-counter transactions. The method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the over-the-counter smart contract;
定义形式验证规范,以描述所述场外交易的方法所实现的功能,并规范所述智能合约中每个场外交易合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;Define formal verification specifications to describe the functions implemented by the over-the-counter transaction method, and standardize the functions, loop body, return value and internal state variable properties of each contract method related to the over-the-counter transaction contract in the smart contract Value change
利用所述形式验证规范对所述场外交易智能合约进行形式验证,根据所述形式验证模型,检查所述场外交易的方法实现是否符合所述形式验证规范的描述;若符合则代表所述场外交易智能合约安全;若不符合则修改所述场外交易智能合约,直至形式验证描述符合场外交易功能中相关实现。Use the formal verification specification to perform formal verification on the over-the-counter smart contract, and according to the formal verification model, check whether the implementation of the over-the-counter transaction complies with the description of the formal verification specification; The over-the-counter smart contract is safe; if not, the over-the-counter smart contract is modified until the formal verification description complies with the relevant implementation of the over-the-counter function.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
在其中一个实施例中,所述形式验证规范满足如下条件:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。In one of the embodiments, the formal verification specification satisfies the following conditions: the uploaded file information structure corresponding to the uploaded file information structure is uploaded according to the file information, the recipient information, and the feedbacker information. , The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; check the loop The body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
在其中一个实施例中,所述方法还包括:形式验证时,传入的入参参数保持在应用层的可控范围内;忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出;判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型。In one of the embodiments, the method further includes: during formal verification, the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the loop body array length is ignored, and the loop body is ignored. Temporary variable value overflow; judge whether the internal state variable exists, if the internal state variable already exists, then the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a success flag code on the chain, Get the built formal verification model.
根据本申请的各种实施例,还提供一种基于区块链的场外交易系统,所述系统包括运行在底层区块链上的权限管理模块、账户模块、市场行情模块、合约管理模块、交易管理模块;其中:所述权限管理模块,用于根据智能合约控制管理员账户和普通用户的数据查看权限以及操作权限;其中,管理员账户的数据查看权限包括查看全市场的合约以及交易记录的权限,管理员账户的操作权限包括修改合约模板的权限,所述普通用户的数据查看权限包括查看与自己相关的合约与交易的权限;所述账户模块,用于管理与用户账户相关的变更或者认证;所述市场行情模块,用于显示全市场中所有用户发布的债券报价信息;所述合约管理模块,用于根据合约模板以及获取的交易信息生成待签署合约,并将所述待签署合约发送至交易双方进行签署;所述交易管理模块,用于将接收到的报价信息发送至所述市场行情模块,以及展示用户的资产信息。According to various embodiments of the present application, there is also provided an over-the-counter transaction system based on a blockchain. The system includes a rights management module, an account module, a market quotation module, a contract management module, Transaction management module; wherein: the authority management module is used to control the data viewing authority and operation authority of the administrator account and ordinary users according to the smart contract; wherein the data viewing authority of the administrator account includes viewing contracts and transaction records of the entire market The operation authority of the administrator account includes the authority to modify the contract template, the data viewing authority of the ordinary user includes the authority to view the contract and transaction related to the user; the account module is used to manage changes related to the user account Or authentication; the market quotation module is used to display bond quotation information issued by all users in the entire market; the contract management module is used to generate a contract to be signed according to the contract template and the acquired transaction information, and to The contract is sent to both parties to the transaction for signing; the transaction management module is used to send the received quotation information to the market quotation module and display the user's asset information.
在其中一个实施例中,所述账户模块包括用户注册单元、CA认证单元、账户管理单元、用户登陆单元以及用户信息修改单元,其中:所述用户注册单元,用于接收用户的身份认证信息并提交注册请求,以对用户与对应的区块链地址进行绑定;所述CA认证单元,用于将用户的身份认证信息通过区块链发送至多个权威节点,并接收每一所述权威节点返回的比对结果,以认证用户的身份信息是否真实;若所有所述权威节点的比对结果均显示无误,则将用户对应的区块链地址添加至被授权列表中,以通过用户的注册请求;若所述权威节点的比对结果显示错误,则驳回用户的注册请求;所述账户管理单元:用于收集与记录用户的身份信息,为用户分配区块链账户以及托管公钥和私钥;所述用户登陆单元:用于根据用户输 入的已注册账号密码登录至区块链系统;所述用户信息修改单元,用于管理与修改用户的其他基本信息。In one of the embodiments, the account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein: the user registration unit is used to receive user identity authentication information and Submit a registration request to bind the user to the corresponding blockchain address; the CA authentication unit is used to send the user's identity authentication information to multiple authoritative nodes through the blockchain, and receive each of the authoritative nodes The returned comparison result is used to verify the authenticity of the user’s identity information; if the comparison results of all the authoritative nodes are correct, the user’s corresponding blockchain address is added to the authorized list to pass the user’s registration Request; if the comparison result of the authoritative node shows an error, the user’s registration request is rejected; the account management unit: used to collect and record the user’s identity information, assign the user a blockchain account and escrow public keys and private The user login unit: used to log in to the blockchain system according to the registered account password entered by the user; the user information modification unit is used to manage and modify other basic information of the user.
在其中一个实施例中,所述CA认证单元还用于根据基于区块链的分布式CA认证规则对用户身份进行认证。In one of the embodiments, the CA authentication unit is also used to authenticate the user identity according to the distributed CA authentication rules based on the blockchain.
在其中一个实施例中,所述市场行情模块包括交易大屏单元、报价详情单元以及点击成交单元,其中:所述交易大屏单元,用于显示全市场中所有用户发布的债券报价信息;所述报价详情单元,用于显示单笔债券报价的详细信息;所述点击成交单元,用于接收用户针对交易大屏中的某一报价发起的单笔交易流程或者针对某一批报价发起的批量交易流程,并确定交易双方以及交易标的详细信息。In one of the embodiments, the market quotation module includes a large transaction screen unit, a quotation detail unit, and a click transaction unit, wherein: the large transaction screen unit is used to display bond quotation information issued by all users in the entire market; The quotation detail unit is used to display the detailed information of a single bond quotation; the click transaction unit is used to receive a single transaction process initiated by the user for a certain quotation in the transaction screen or batches initiated for a certain batch of quotations Transaction process, and determine the details of both parties to the transaction and the subject of the transaction.
在其中一个实施例中,所述合约管理模块包括模板管理单元、合约签署单元、待签署合约单元以及历史合约单元,其中:所述模板管理单元,用于管理员制作模板以及向普通用户展示管理员制作的合约模板;所述合约签署单元,用于根据所述点击成交单元获取的交易双方以及交易标的详细信息生成合约要素,并根据所述合约要素以及管理员制作的合约模板生成待签署合约,向交易双方发送待签署合约信息,并接收交易双方盖签章后的签署合约,并将所述签署合约标记为已生效合约,将所述已生效合约发送至所述历史合约单元,对所述已生效合约进行上传与记录;所述待签署合约单元,用于展示所述合约签署单元中生成的待签署合约或待报价方签署的合约,对超过签署时限的待签署合约进行作废处理,并将作废的待签署合约发送至所述历史合约单元;所述历史合约单元,用于展示已生效合约以及作废的待签署合约。In one of the embodiments, the contract management module includes a template management unit, a contract signing unit, a contract to be signed, and a historical contract unit, wherein: the template management unit is used for the administrator to make templates and show management to ordinary users The contract template made by the administrator; the contract signing unit is used to generate contract elements based on the detailed information of the transaction parties and the transaction target obtained by the click transaction unit, and generate the contract to be signed based on the contract elements and the contract template made by the administrator , Send the contract information to be signed to both parties to the transaction, and receive the signed contract signed by both parties, mark the signed contract as an effective contract, send the effective contract to the historical contract unit, The contract to be signed is uploaded and recorded; the contract to be signed unit is used to display the contract to be signed generated in the contract signing unit or the contract to be signed by the bidding party, and the contract to be signed that exceeds the signing time limit is invalidated, And the invalidated contract to be signed is sent to the historical contract unit; the historical contract unit is used to display the effective contract and the invalidated contract to be signed.
在其中一个实施例中,所述合约签署单元中的合约签署记录通过区块链进行存储,所述合约签署记录包括签署双方的区块链地址以及签署时间戳以及包含双方电子签名的电子合约文件。In one of the embodiments, the contract signing record in the contract signing unit is stored by the blockchain, and the contract signing record includes the blockchain addresses of the signing parties and the signing timestamp, and the electronic contract file containing the electronic signatures of both parties .
在其中一个实施例中,所述交易管理模块包括新建意向单元和当前持仓单元,其中:所述新建意向单元,用于接收用户发起的新的买入意向报价或者卖出意向报价,并将所述买入意向报价以及所述卖出意向报价发送至所述交易大屏单元;所述当前持仓单元,用于展示用户当前所持有的债券以及现金余额。In one of the embodiments, the transaction management module includes a new intention unit and a current position holding unit, wherein: the new intention unit is used to receive a new buying intention quotation or a selling intention quotation initiated by the user, and placing The buying intention quotation and the selling intention quotation are sent to the large transaction screen unit; the current position holding unit is used to display the bonds and cash balance currently held by the user.
根据本申请的各种实施例,还提供一种基于区块链的场外交易方法,所述方法基于本申请的各种实施例中任一项的基于区块链的场外交易系统来实现,该方法具体包括如下步骤:获取用户选择的交易报价,所述交易报价为所述用户根据所述交易大屏单元中的债券报价信息以及所述报价详情单元中单笔债券报价的详细信息选择的;校验所述用户的资产信息,以确保所述交易报价在所述用户的资产支配范围;获取所述交易双方的区块链地址,并根据所述交易报价的详细信息以及所述交易双方的区块链地址生成待签署合约;所述交易双方包括所述用户和报价方;将所述待签署合约发送至所述交易双方,并获取合约签署结果;根据所述合约签署结果以及交易记录对所述交易双方的资产进行清算,并根据清算结果对所述交易双方进行持仓变更。According to various embodiments of the present application, there is also provided a blockchain-based OTC transaction method, which is implemented based on the blockchain-based OTC transaction system of any of the various embodiments of the present application The method specifically includes the following steps: obtaining a transaction quotation selected by the user, the transaction quotation being selected by the user based on the bond quotation information in the transaction large screen unit and the detailed information of a single bond quotation in the quotation detail unit Check the user’s asset information to ensure that the transaction offer is within the user’s asset control range; obtain the blockchain addresses of both parties to the transaction, and based on the detailed information of the transaction offer and the transaction The blockchain addresses of both parties generate the contract to be signed; the transaction parties include the user and the bidder; send the contract to be signed to the transaction parties and obtain the contract signing result; according to the contract signing result and the transaction Record the clearing of the assets of the two parties to the transaction, and change the positions of the two parties to the transaction according to the clearing result.
在其中一个实施例中,所述将所述待签署合约发送至所述交易双方,并获取合约签署结果包括:将所述待签署合约发送至所述交易双方,并获取所述交易双方的确认意见;若所述交易双方的确认意见均为是,且所述交易双方均在签署时限内完成所述待签署合约的签署,则将所述交易双方签署后的合约标记为已生效合约。In one of the embodiments, the sending the contract to be signed to the two parties to the transaction and obtaining the result of contract signing includes: sending the contract to be signed to the two parties to the transaction and obtaining confirmation from the two parties to the transaction Opinion; if the confirmation opinions of both parties to the transaction are both yes, and both parties to the transaction complete the signing of the contract to be signed within the signing time limit, then the contract signed by both parties to the transaction is marked as an effective contract.
在其中一个实施例中,所述方法还包括:若所述交易双方中的任意一方的确认意见为否,或者, 所述交易双方中的任意一方未在签署时限内完成所述待签署合约的签署,则对所述待签署合约进行作废处理,并将作废的待签署合约发送至历史合约单元。In one of the embodiments, the method further includes: if the confirmation opinion of either of the two parties to the transaction is no, or, either of the two parties to the transaction fails to complete the contract to be signed within the signing time limit. Signed, the contract to be signed is invalidated, and the invalid contract to be signed is sent to the historical contract unit.
在其中一个实施例中,所述方法还包括:根据所述智能合约控制交易流程中的逻辑判断,所述逻辑判断包括所述用户资产信息的校验、签署时限的判断、交易信息的存储、账户权限的使用以及交易过程中的资产清算与变更。In one of the embodiments, the method further includes: controlling the logical judgment in the transaction flow according to the smart contract, the logical judgment including the verification of the user asset information, the judgment of the signing time limit, the storage of transaction information, The use of account permissions and the liquidation and change of assets during the transaction.
在其中一个实施例中,所述方法还包括:定义智能合约;定义形式验证规范,以规范所述智能合约中每个与智能合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;判断所述智能合约是否符合所述形式验证规范中的描述,若所述智能合约符合所述形式验证规范中的描述,则将所述智能合约发送至所述交易双方进行签署;若所述智能合约不符合所述形式验证规范中的描述,则对所述智能合约进行修改,直至所述智能合约符合所述形式验证规范中的描述。In one of the embodiments, the method further includes: defining a smart contract; defining a formal verification specification to regulate the functions, loop body, return value, and internal state variables of each contract method related to the smart contract in the smart contract The property value of the change; determine whether the smart contract meets the description in the formal verification specification, if the smart contract meets the description in the formal verification specification, send the smart contract to the transaction parties for signing ; If the smart contract does not meet the description in the formal verification specification, the smart contract is modified until the smart contract meets the description in the formal verification specification.
在其中一个实施例中,所述方法还包括:根据所述智能合约进行场外交易,以对所述智能合约的数据结构、合约方法的声明与实现。In one of the embodiments, the method further includes: performing an over-the-counter transaction according to the smart contract to declare and implement the data structure and contract method of the smart contract.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
在其中一个实施例中,所述定义形式验证规范包括:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。In one of the embodiments, the defined formal verification specification includes: uploading according to the file information, uploading the recipient information, and uploading the feedback information corresponding to the uploaded file information structure, The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; verify the loop body No overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
在其中一个实施例中,所述方法还包括:根据所述智能合约进行场外交易,以对所述智能合约的数据结构、合约方法的声明与实现。In one of the embodiments, the method further includes: performing an over-the-counter transaction according to the smart contract to declare and implement the data structure and contract method of the smart contract.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
在其中一个实施例中,所述定义形式验证规范包括:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。In one of the embodiments, the defined formal verification specification includes: uploading according to the file information, uploading the recipient information, and uploading the feedback information corresponding to the uploaded file information structure, The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; verify the loop body No overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
在其中一个实施例中,所述方法还包括:将传入的入参参数保持在应用层的预设参数范围内;忽略所述循环体数组长度的溢出;忽略所述循环体内的临时变量值的溢出;判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型,并根据所述形式验证模型对所述智能合约进行形式校验。In one of the embodiments, the method further includes: keeping the incoming parameter parameters within the preset parameter range of the application layer; ignoring the overflow of the length of the loop body array; ignoring the temporary variable value in the loop body The overflow; judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a successful sign code on the chain, and the construction is completed According to the formal verification model, the smart contract is formally verified.
根据本申请的各种实施例,还提供一种电子装置,包括存储器和处理器,其特征在于,所述存储 器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行本申请的各种实施例中任一项所述的基于区块链的场外交易方法。According to various embodiments of the present application, there is also provided an electronic device, including a memory and a processor, characterized in that a computer program is stored in the memory, and the processor is configured to run the computer program to execute the computer program. The blockchain-based over-the-counter transaction method described in any of the various embodiments of the application.
根据本申请的各种实施例,还提供一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行本申请的各种实施例中任一项所述的基于区块链的场外交易方法。According to various embodiments of the present application, there is also provided a storage medium in which a computer program is stored, wherein the computer program is configured to execute any one of the various embodiments of the present application when running. The described OTC transaction method based on blockchain.
附图说明Description of the drawings
为了更好地描述和说明这里公开的那些发明的实施例和/或示例,可以参考一幅或多幅附图。用于描述附图的附加细节或示例不应当被认为是对所公开的发明、目前描述的实施例和/或示例以及目前理解的这些发明的最佳模式中的任何一者的范围的限制。In order to better describe and illustrate the embodiments and/or examples of the inventions disclosed herein, one or more drawings may be referred to. The additional details or examples used to describe the drawings should not be considered as limiting the scope of any of the disclosed inventions, the currently described embodiments and/or examples, and the best mode of these inventions currently understood.
图1为本申请实施例的基于区块链的场外交易系统的基本架构图。Fig. 1 is a basic structure diagram of a blockchain-based over-the-counter transaction system according to an embodiment of the application.
图2为本申请具体实施例的基于区块链的场外交易系统的结构框图。Fig. 2 is a structural block diagram of a blockchain-based over-the-counter transaction system according to a specific embodiment of the application.
图3为本申请实施例中对智能合约进行形式验证的流程图。Figure 3 is a flowchart of formal verification of smart contracts in an embodiment of the application.
图4为本申请实施例中智能合约的形式验证模型的示意图。Figure 4 is a schematic diagram of a formal verification model of a smart contract in an embodiment of the application.
图5为本申请实施例的基于区块链的场外交易方法的流程图。Fig. 5 is a flowchart of a blockchain-based OTC transaction method according to an embodiment of the application.
图6为本申请具体实施例的基于区块链的场外交易方法的流程图。Fig. 6 is a flowchart of a blockchain-based OTC transaction method according to a specific embodiment of the application.
图7为本申请具体实施例的对智能合约进行形式验证的流程图。Fig. 7 is a flowchart of formal verification of a smart contract according to a specific embodiment of the application.
具体实施方式Detailed ways
为了便于理解本申请,为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图对本申请的具体实施方式做详细的说明。在下面的描述中阐述了很多具体细节以便于充分理解本申请,附图中给出了本申请的较佳实施方式。但是,本申请可以以许多不同的形式来实现,并不限于本文所描述的实施方式。相反地,提供这些实施方式的目的是使对本申请的公开内容理解的更加透彻全面。本申请能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本申请内涵的情况下做类似改进,因此本申请不受下面公开的具体实施例的限制。In order to facilitate the understanding of this application and to make the above-mentioned objectives, features and advantages of this application more obvious and understandable, the specific implementations of this application will be described in detail below with reference to the accompanying drawings. In the following description, many specific details are set forth in order to fully understand the application, and the preferred embodiments of the application are given in the accompanying drawings. However, this application can be implemented in many different forms and is not limited to the implementation described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of this application more thorough and comprehensive. This application can be implemented in many other ways different from those described here, and those skilled in the art can make similar improvements without departing from the connotation of this application, so this application is not limited by the specific embodiments disclosed below.
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。在本申请的描述中,“若干”的含义是至少一个,例如一个,两个等,除非另有明确具体的限定。In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present application, "a plurality of" means at least two, such as two, three, etc., unless specifically defined otherwise. In the description of this application, "several" means at least one, such as one, two, etc., unless otherwise specifically defined.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述具体的实施方式的目的,不是旨在于限制本申请。本文所使用的术语“及/或”包括一个或多个相关的所列项目的任意的和所有的组合。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of this application. The terminology used herein is only for the purpose of describing specific embodiments, and is not intended to limit the application. The term "and/or" as used herein includes any and all combinations of one or more related listed items.
以下将对本申请提供的基于区块链的场外交易方法、系统、存储介质和电子装置作进一步说明:The following will further explain the blockchain-based OTC transaction methods, systems, storage media, and electronic devices provided in this application:
图1为本申请实施例的基于区块链的场外交易系统的基本架构图,如图1所示,所述系统包括运行在 区块链上的权限管理模块、账户模块、市场行情模块、合约管理模块以及交易管理模块,其中:Figure 1 is a basic architecture diagram of a blockchain-based over-the-counter transaction system according to an embodiment of the application. As shown in Figure 1, the system includes a rights management module, an account module, a market quotation module, and Contract management module and transaction management module, including:
所述权限管理模块,用于通过智能合约对管理员账户与普通用户的数据查看以及操作权限做出控制,以实现所述的管理员账户可查看全市场的合约与交易以及对合约模板作出修改,所述的普通用户只能查看与自己相关的合约与交易。The authority management module is used to control the data viewing and operation authority of the administrator account and ordinary users through smart contracts, so that the administrator account can view contracts and transactions in the entire market and modify contract templates , Said ordinary users can only view contracts and transactions related to them.
所述账户模块用于管理与用户的账户相关的变更或者认证,所述账户模块包括用户注册单元、CA认证单元、账户管理单元、用户登陆单元以及用户信息修改单元,其中:The account module is used to manage changes or authentication related to the user's account. The account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
用户注册单元,用于接收用户填写的身份认证信息并提交注册请求,并为用户绑定区块链地址;The user registration unit is used to receive the identity authentication information filled in by the user and submit the registration request, and bind the blockchain address for the user;
所述CA认证单元,用于将用户填写的身份认证信息通过区块链同时发送给多个权威节点进行数据比对,并接收所述的权威节点返回的比对结果,以认证用户的身份信息是否真实;若全部节点返回比对正确,则通过用户的身份认证,系统将该用户的区块链地址加入被授权列表中,对该用户进行授权;若存在节点返回比对错误,则不通过用户身份认证;The CA authentication unit is used to simultaneously send the identity authentication information filled in by the user to multiple authoritative nodes through the blockchain for data comparison, and receive the comparison result returned by the authoritative node to authenticate the user's identity information Whether it is true or not; if all nodes return the comparison correctly, the user’s identity authentication is passed, and the system adds the user’s blockchain address to the authorized list to authorize the user; if any node returns a comparison error, it will not pass User authentication;
所述账户管理单元,用于收集与记录用户身份信息,并为用户分配区块链账户,托管公私钥;The account management unit is used to collect and record user identity information, allocate blockchain accounts for users, and escrow public and private keys;
用户登陆单元,用于用户使用已注册的账号密码登陆至本区块链系统;The user login unit is used for users to log in to the blockchain system with the registered account password;
用户信息修改单元,用于完善用户除身份认证信息之外的基本信息,并用于修改用户已填写的基本信息。The user information modification unit is used to complete the user's basic information except for the identity authentication information, and to modify the basic information that the user has filled in.
所述市场行情模块包括交易大屏单元、报价详情单元以及点击成交单元,其中:The market quotation module includes a large trading screen unit, a quotation detail unit and a click transaction unit, among which:
所述交易大屏单元,用于展示全市场所有用户发布的债券报价信息;The large trading screen unit is used to display bond quotation information issued by all users in the entire market;
所述报价详情单元,用于展示某一笔债券报价的详细信息;The quotation details unit is used to display detailed information of a bond quotation;
所述点击成交单元,用于接收用户对交易大屏中某笔报价发起的交易流程,或者接收交易大屏中某一批报价批量发起的交易流程,并确定交易双方以及交易标的的详细信息。The click transaction unit is used to receive the transaction process initiated by the user on a certain quotation in the large transaction screen, or receive the transaction process initiated by a batch of quotations in the large transaction screen, and determine the detailed information of the transaction parties and the transaction target.
所述合约管理模块包括模板管理单元、合约签署单元、待签署合约单元以及历史合约单元,其中:The contract management module includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, among which:
所述模板管理单元,包括模板制作与模板展示,所述的模板制作功能只对管理员开放,所述的模板展示用于向普通用户展示管理员制定的合约模板;The template management unit includes template making and template display, the template making function is only open to administrators, and the template display is used to display contract templates made by the administrator to ordinary users;
所述合约签署单元,包括合约生成与合约签署,合约生成用于根据点击成交单元所获得的交易双方及标的的详细信息生成合约要素,并根据所管理员制定的合约模板生成待签署合约;所述合约签署用于向点击成交单元所获得的交易双方发送待签署合约信息,并接收交易双方盖上各自电子签章的合约,并将该签署合约标记为已生效合约,发送给历史合约单元,然后将该合约上传至区块链中进行记录;The contract signing unit includes contract generation and contract signing. The contract generation is used to generate contract elements according to the detailed information of the transaction parties and the target obtained by clicking the transaction unit, and generate the contract to be signed according to the contract template formulated by the administrator; The contract signing is used to send the contract information to be signed to both parties of the transaction obtained by clicking the transaction unit, and to receive the contract signed by both parties to the transaction, mark the signed contract as an effective contract, and send it to the historical contract unit. Then upload the contract to the blockchain for recording;
所述待签署合约单元,用于展示合约签署单元中生成的待签署合约或待报价方签署的合约;待签署合约超过签署时限后作废,进入历史合约单元;The contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit; the contract to be signed is invalidated after the signing time limit is exceeded and enters the historical contract unit;
所述历史合约单元,用于展示合约签署单元中生成的交易双方签署完成的已生效合约,以及用于展示超过签署时限后作废的待签署合约。The historical contract unit is used to display the valid contracts signed and completed by both parties to the transaction generated in the contract signing unit, and used to display the contracts to be signed that are invalidated after the signing time limit.
所述交易管理模块包括新建意向单元和当前持仓单元,其中:The transaction management module includes a new intention unit and a current position unit, wherein:
所述新建意向单元,用于接收用户发起的一笔新的买入或卖出意向报价,接收用户填写交易意向的所 有要素之后,将报价发送至交易大屏单元进行展示;所述当前持仓单元,用于展示用户当前所持有的债券以及现金余额。The new intention unit is used to receive a new buying or selling intention quotation initiated by the user, and after the user fills in all the elements of the transaction intention, the quotation is sent to the transaction large screen unit for display; the current position holding unit , Used to display the bond and cash balance currently held by the user.
本申请的有益效果如下:本申请提供的基于区块链的场外交易系统为场外债券市场参与机构提供了线上报价以及交易平台,以及提供了从注册、身份认证、登陆、报价、成交、合约签署、合约管理、持仓管理的完备功能模块;以电子合约取代纸质合约,提高合约签署效率,降低合约管理难度;将监管机构,即管理员,加入区块链节点,提高监管效能。该系统还为客户提供了在线合约签署与在线债券交易功能,提高场外债券交易效率,提高银行间债券市场流动性。另外,该系统架构在底层区块链之上,数据不可篡改,通过将账户信息、成交信息上链,便于追溯交易历史,提高监管效能。The beneficial effects of this application are as follows: The blockchain-based over-the-counter trading system provided by this application provides online quotation and trading platforms for participating institutions in the over-the-counter bond market, as well as providing registration, identity authentication, login, quotation, and transaction , Complete functional modules for contract signing, contract management, and position management; replace paper contracts with electronic contracts, improve contract signing efficiency, and reduce contract management difficulties; add regulatory agencies, namely administrators, to blockchain nodes to improve supervision efficiency. The system also provides customers with online contract signing and online bond trading functions to improve the efficiency of over-the-counter bond transactions and improve the liquidity of the inter-bank bond market. In addition, the system is based on the underlying blockchain, and data cannot be tampered with. By uploading account information and transaction information to the chain, it is convenient to trace the transaction history and improve supervision efficiency.
在其中一个实施例中,所述合约签署单元的合约全数记录通过区块链进行保全,保全数据包括签署双方的区块链地址以及签署时的时间戳、包含双方电子签名的电子合约文件。In one of the embodiments, all the contract records of the contract signing unit are secured through the blockchain, and the secured data includes the blockchain addresses of the signing parties and the time stamp at the time of signing, and the electronic contract documents containing the electronic signatures of both parties.
区块链技术是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链是一种新型去中心化协议,能安全地存储数字货币交易或其他数据,信息不可伪造和篡改,区块链上的交易确认由区块链上的所有节点共同完成,由共识算法保证其一致性,具有去中心化、开放性、独立性、安全性、匿名性的特性。Blockchain technology is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is a new type of decentralized protocol that can safely store digital currency transactions or other data. The information cannot be forged or tampered with. The confirmation of transactions on the blockchain is completed by all nodes on the blockchain, and the consensus algorithm To ensure its consistency, it has the characteristics of decentralization, openness, independence, security and anonymity.
在其中一个实施例中,所述CA认证单元中的用户的身份认证使用基于区块链的分布式CA认证。In one of the embodiments, the identity authentication of the user in the CA authentication unit uses blockchain-based distributed CA authentication.
以下,将通过以下具体实施例对所述基于区块链的场外交易系统做进一步的说明,图2为本申请具体实施例的基于区块链的场外交易系统的结构框图,如图2所示,该基于区块链的场外交易系统包括运行在底层区块链上的权限管理模块210、账户模块220、市场行情模块230、合约管理模块240、交易管理模块250;其中:In the following, the blockchain-based over-the-counter trading system will be further explained through the following specific embodiments. Figure 2 is a structural block diagram of the blockchain-based over-the-counter trading system according to a specific embodiment of the application, as shown in Figure 2. As shown, the blockchain-based over-the-counter trading system includes a rights management module 210, an account module 220, a market quotation module 230, a contract management module 240, and a transaction management module 250 running on the underlying blockchain; among them:
所述权限管理模块210,用于根据智能合约控制管理员账户和普通用户的数据查看权限以及操作权限;其中,管理员账户的数据查看权限包括查看全市场的合约以及交易记录的权限,管理员账户的操作权限包括修改合约模板的权限,所述普通用户的数据查看权限包括查看与自己相关的合约与交易的权限;The authority management module 210 is used to control the data viewing authority and operation authority of the administrator account and ordinary users according to the smart contract; wherein the data viewing authority of the administrator account includes the authority to view contracts and transaction records of the entire market. The operating authority of the account includes the authority to modify the contract template, and the data viewing authority of the ordinary user includes the authority to view contracts and transactions related to the user;
所述账户模块220,用于管理与用户账户相关的变更或者认证;所述市场行情模块230,用于显示全市场中所有用户发布的债券报价信息。The account module 220 is used to manage changes or authentication related to user accounts; the market quotation module 230 is used to display bond quotation information issued by all users in the entire market.
所述合约管理模块240,用于根据合约模板以及获取的交易信息生成待签署合约,并将所述待签署合约发送至交易双方进行签署;The contract management module 240 is configured to generate a contract to be signed according to the contract template and the acquired transaction information, and send the contract to be signed to both parties to the transaction for signing;
所述交易管理模块250,用于将接收到的报价信息发送至所述市场行情模块230,以及展示用户的资产信息。The transaction management module 250 is configured to send the received quotation information to the market quotation module 230 and display the user's asset information.
在其中一个实施例中,所述账户模块220包括用户注册单元、CA认证单元、账户管理单元、用户登陆单元以及用户信息修改单元,其中:In one of the embodiments, the account module 220 includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
所述用户注册单元,用于接收用户的身份认证信息并提交注册请求,以对用户与对应的区块链地址进行绑定;The user registration unit is used to receive the user's identity authentication information and submit a registration request to bind the user to the corresponding blockchain address;
所述CA认证单元,用于将用户的身份认证信息通过区块链发送至多个权威节点,并接收每一所述权 威节点返回的比对结果,以认证用户的身份信息是否真实;若所有所述权威节点的比对结果均显示无误,则将用户对应的区块链地址添加至被授权列表中,以通过用户的注册请求;若所述权威节点的比对结果显示错误,则驳回用户的注册请求;The CA authentication unit is used to send the user's identity authentication information to multiple authoritative nodes through the blockchain, and receive the comparison result returned by each of the authoritative nodes to verify whether the user's identity information is authentic; If the comparison result of the authoritative node is correct, the blockchain address corresponding to the user is added to the authorized list to pass the user’s registration request; if the comparison result of the authoritative node shows an error, the user’s request will be rejected Registration request;
所述账户管理单元:用于收集与记录用户的身份信息,为用户分配区块链账户以及托管公钥和私钥;The account management unit: used to collect and record the user's identity information, allocate blockchain accounts and escrow public and private keys for users;
所述用户登陆单元:用于根据用户输入的已注册账号密码登录至区块链系统;The user login unit: used to log in to the blockchain system according to the registered account password entered by the user;
所述用户信息修改单元,用于管理与修改用户的其他基本信息。The user information modification unit is used to manage and modify other basic information of the user.
在其中一个实施例中,所述CA认证单元还用于根据基于区块链的分布式CA认证规则对用户身份进行认证。In one of the embodiments, the CA authentication unit is also used to authenticate the user identity according to the distributed CA authentication rules based on the blockchain.
在其中一个实施例中,所述市场行情模块230包括交易大屏单元、报价详情单元以及点击成交单元,其中:In one of the embodiments, the market quotation module 230 includes a large trading screen unit, a quotation detail unit, and a click transaction unit, wherein:
所述交易大屏单元,用于显示全市场中所有用户发布的债券报价信息;所述报价详情单元,用于显示单笔债券报价的详细信息;所述点击成交单元,用于接收用户针对交易大屏中的某一报价发起的单笔交易流程或者针对某一批报价发起的批量交易流程,并确定交易双方以及交易标的详细信息。The large transaction screen unit is used to display bond quotation information issued by all users in the entire market; the quotation detail unit is used to display detailed information of a single bond quotation; the click transaction unit is used to receive user-specific A single transaction process initiated by a certain quotation on the large screen or a batch transaction process initiated for a certain batch of quotations, and the detailed information of the transaction parties and the transaction target is determined.
在其中一个实施例中,所述合约管理模块240包括模板管理单元、合约签署单元、待签署合约单元以及历史合约单元,其中:In one of the embodiments, the contract management module 240 includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, wherein:
所述模板管理单元,用于管理员制作模板以及向普通用户展示管理员制作的合约模板;The template management unit is used for the administrator to make templates and to show ordinary users the contract templates made by the administrator;
所述合约签署单元,用于根据所述点击成交单元获取的交易双方以及交易标的详细信息生成合约要素,并根据所述合约要素以及管理员制作的合约模板生成待签署合约,向交易双方发送待签署合约信息,并接收交易双方盖签章后的签署合约,并将所述签署合约标记为已生效合约,将所述已生效合约发送至所述历史合约单元,对所述已生效合约进行上传与记录;The contract signing unit is used to generate contract elements according to the detailed information of the transaction parties and the transaction target obtained by the click transaction unit, and generate the contract to be signed according to the contract elements and the contract template prepared by the administrator, and send the pending contract to both parties Sign the contract information, receive the signed contract signed by both parties to the transaction, mark the signed contract as an effective contract, send the effective contract to the historical contract unit, and upload the effective contract And records;
所述待签署合约单元,用于展示所述合约签署单元中生成的待签署合约或待报价方签署的合约,对超过签署时限的待签署合约进行作废处理,并将作废的待签署合约发送至所述历史合约单元;The contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit, to invalidate the contract to be signed that exceeds the signing time limit, and to send the invalid contract to be signed to The historical contract unit;
所述历史合约单元,用于展示已生效合约以及作废的待签署合约。The historical contract unit is used to display valid contracts and invalid contracts to be signed.
在其中一个实施例中,所述合约签署单元中的合约签署记录通过区块链进行存储,所述合约签署记录包括签署双方的区块链地址以及签署时间戳以及包含双方电子签名的电子合约文件。In one of the embodiments, the contract signing record in the contract signing unit is stored via a blockchain, and the contract signing record includes the blockchain addresses of the signing parties, the signing timestamp, and the electronic contract file containing the electronic signatures of both parties .
在其中一个实施例中,所述交易管理模块250包括新建意向单元和当前持仓单元,其中:所述新建意向单元,用于接收用户发起的新的买入意向报价或者卖出意向报价,并将所述买入意向报价以及所述卖出意向报价发送至所述交易大屏单元。所述当前持仓单元,用于展示用户当前所持有的债券以及现金余额。In one of the embodiments, the transaction management module 250 includes a new intention unit and a current position unit, wherein: the new intention unit is used to receive a new buying intention quotation or selling intention quotation initiated by the user, and The buying intention quotation and the selling intention quotation are sent to the large transaction screen unit. The current position holding unit is used to display the bonds and cash balance currently held by the user.
本申请还提供一种区块链的场外交易方法,所述方法包括以下步骤:This application also provides an over-the-counter transaction method for blockchain, which includes the following steps:
(1)定义场外交易智能合约,进行场外交易,所述场外交易的方法包括对所述场外交易智能合约的数据结构、合约方法的声明与实现。(2)定义形式验证规范,以描述所述场外交易的方法所实现的功能,并规范所述智能合约中每个场外交易合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性 值变化。(3)利用所述形式验证规范对所述场外交易智能合约进行形式验证,根据所述形式验证模型,检查所述场外交易的方法实现是否符合所述形式验证规范的描述;若符合则代表所述场外交易智能合约安全;若不符合则修改所述场外交易智能合约,直至形式验证描述符合场外交易功能中相关实现。(1) Defining an over-the-counter smart contract to conduct over-the-counter transactions. The method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the over-the-counter smart contract. (2) Define formal verification specifications to describe the functions implemented by the over-the-counter transaction method, and standardize the function, loop body, return value and internal state of the contract method related to each over-the-counter transaction contract in the smart contract The attribute value of the variable changes. (3) Use the formal verification specification to perform formal verification on the over-the-counter smart contract, and check whether the implementation of the over-the-counter transaction method meets the description of the formal verification specification according to the formal verification model; It means that the over-the-counter smart contract is safe; if not, the over-the-counter smart contract is modified until the formal verification description complies with the relevant implementation of the over-the-counter transaction function.
智能合约(Smart contract)是一种旨在以信息化方式传播、验证或执行合约的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。执行用代码书写的合约并且在一个不可改变的区块链中存储信息造成一定的风险和问题,因此合约的安全行尤为重要。Smart contract (Smart contract) is a computer protocol designed to spread, verify or execute contracts in an information-based way. Smart contracts allow trusted transactions without a third party, which are traceable and irreversible. Executing contracts written in code and storing information in an immutable blockchain causes certain risks and problems, so the security of the contract is particularly important.
上述区块链的场外交易方法的有益效果如下:本申请提供了一套通用的场外交易流程相关的智能合约形式验证模型,为场外交易智能合约相关业务提供了一套安全形式化验证的标准。本方法基于软件形式化验证方法进行设计,在合约设计上面提高场外交易智能合约的安全性。本方法提供的形式化验证方法具有通用性,对于场外交易相关的智能合约都可以使用本方法进行开发和安全审计,对于场外交易一类业务系统而言,可以很好的适用。The beneficial effects of the above-mentioned blockchain OTC trading method are as follows: This application provides a set of common OTC transaction process related smart contract formal verification models, and provides a set of secure formal verification for OTC smart contract related businesses Standards. This method is designed based on software formal verification methods, and improves the security of smart contracts for over-the-counter transactions in contract design. The formal verification method provided by this method has universality. This method can be used for development and security auditing of smart contracts related to over-the-counter transactions, and it can be very suitable for business systems such as over-the-counter transactions.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
具体地,场外交易智能合约的定义具有如下性质:(a)数据结构包含上传文件信息,接受者信息结构体包含接受者信息,反馈信息结构体包含反馈者信息。上传文件信息结构体至少包含项目文件主键、文件哈希这两个字段,接受者信息结构体至少包含项目文件流程进展主键这一个字段,反馈者信息结构体至少包含项目文件主键、文件哈希、是否有争议这三个字段。(b)状态变量包含记录项目文件主键到上传文件信息,反馈者信息的映射、项目文件流程进展主键到接受者信息的映射。(c)文件信息上链、接受者信息上链和反馈者信息上链,三个合约方法分别将传入的参数在循环体内进行循环遍历,将每一个入参参数放入对应的数据结构内的变量中。Specifically, the definition of an over-the-counter smart contract has the following properties: (a) The data structure contains uploaded file information, the recipient information structure contains recipient information, and the feedback information structure contains feedback information. The uploaded file information structure contains at least two fields: the project file primary key and the file hash. The recipient information structure contains at least one field of the project file process progress primary key. The feedback information structure contains at least the project file primary key, file hash, and Is there a dispute about these three fields. (b) The state variable contains the main key of the record project file to the uploaded file information, the mapping of the feedbacker information, and the mapping of the main key of the project file process progress to the recipient information. (c) File information on-chain, recipient information on-chain, and feedbacker information on-chain, the three contract methods respectively loop the incoming parameters in the loop, and put each input parameter into the corresponding data structure In the variables.
图3为本申请实施例中对智能合约进行形式验证的流程图,如图3所示,所述形式验证规范满足如下条件:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。Figure 3 is a flow chart of formal verification of smart contracts in an embodiment of the application. As shown in Figure 3, the formal verification specification satisfies the following conditions: uploading according to the file information, uploading the recipient information and all The feedback information on the chain corresponds to the incoming file information structure, the recipient information structure, and the feedback information structure to verify that the file information is on the chain and the recipient information is uploaded. Chain and the return value of the feedbacker’s information on the chain; verify that the loop body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the over-the-counter transaction The state variables of the data structure in the method change, and other state variables remain unchanged.
具体地,所述形式验证规范满足如下条件:(a)所述形式验证规范依据函数方法执行,并要求所述函数方法能够正确的执行,目的是为了验证智能合约是否按照了形式化验证的模型去进行设计。(b)根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到不同的返回值,在进行相关信息上链时,假如该信息已经存在链上,则返回错误信息;若不存在,则进行之后的上链业务流程,返回成功上链信息。(c)检验所述循环体不会存在溢出风险;由于在应用层已经做了控制,约定循环变量不会溢出,且循环次数不会被改变。(d)在所述场外交易智能合约定义时,调用函数,确保不会抛出异常;所述函数调用后,所述场 外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。在上传文件信息上链,接受者信息上链,反馈者信息上链发起后,经过链上验证该交易不存在,将场外交易信息按相应逻辑赋值给相应字段,候选对象和场外交易人信息状态变量的相应字段等于预期值,其他字段和状态变量等于原值。Specifically, the formal verification specification satisfies the following conditions: (a) The formal verification specification is executed according to the function method, and the function method is required to be executed correctly, the purpose is to verify whether the smart contract is in accordance with the formal verification model Go design. (b) According to the uploaded file information structure, the recipient information structure and the feedback information corresponding to the upload of the file information, the recipient information, and the feedback information The structure is checked and different return values are obtained. When the relevant information is on the chain, if the information already exists on the chain, an error message will be returned; if it does not exist, the subsequent on-chain business process will be performed, and the successful on-chain will be returned. information. (c) Verify that the loop body does not have the risk of overflow; since control has been done at the application layer, it is agreed that the loop variable will not overflow, and the number of loops will not be changed. (d) When defining the OTC smart contract, call the function to ensure that no exception will be thrown; after the function is called, the state variable of the data structure in the OTC trading method changes, and other state variables remain constant. After uploading the file information on the chain, the recipient information on the chain, and the feedbacker information on the chain is initiated, the transaction is verified on the chain to not exist, and the OTC transaction information is assigned to the corresponding field according to the corresponding logic, the candidate object and the OTC trader The corresponding field of the information state variable is equal to the expected value, and other fields and state variables are equal to the original value.
图4为本申请实施例中智能合约的形式验证模型的示意图,如图4所示,构建智能合约的形式验证模型具体包括以下步骤:Fig. 4 is a schematic diagram of a formal verification model of a smart contract in an embodiment of the application. As shown in Fig. 4, constructing a formal verification model of a smart contract specifically includes the following steps:
形式验证时,传入的入参参数保持在应用层的可控范围内;忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出;判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型。During the formal verification, the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the loop body array length is ignored, and the overflow of the temporary variable value in the loop body is ignored; the internal state variable is judged whether it exists, If the internal state variable already exists, the formal verification returns an on-chain failure code; if the internal state variable does not exist, the formal verification returns an on-chain success flag code, and a built formal verification model is obtained.
具体地,所述形式验证时,传入的入参参数保持在应用层的可控范围内,不会导致入参数组溢出,参数的溢出会导致形式化校验失败,得不到正确的形式化校验结果。忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出。由于在应用层已经做了控制,所以不存在数组长度溢出的风险以及循环体内的临时变量值溢出的风险。忽略掉这两项不进行形式化校验,得到更准确的校验结果。判断所述内部状态变量是否存在,如果已存在,形式验证返回上链失败码,返回上链失败标志码,则代表该内部状态变量为重复数据,无法再次发起该方法的调用;如果所述内部状态变量不存在,形式验证返回上链成功标志码。返回上链成功标志码,则代表整个方法功能能够正确的运行,安全校验通过。Specifically, during the formal verification, the incoming parameter parameters are kept within the controllable range of the application layer, and will not cause the incoming parameter group to overflow, and the parameter overflow will cause the formal verification to fail, and the correct form cannot be obtained. Calibration results. The overflow of the length of the loop body array is ignored, and the overflow of the temporary variable value in the loop body is ignored. Since control has been done at the application layer, there is no risk of overflow of the array length and the risk of overflow of the temporary variable value in the loop. Ignore these two items without formal verification, and get more accurate verification results. Judge whether the internal state variable exists, if it already exists, the formal verification returns the chaining failure code, and the chaining failure flag code is returned, which means that the internal state variable is duplicate data and the method cannot be called again; if the internal The state variable does not exist, and the formal verification returns a successful logo code. The return of the successful sign code on the chain means that the entire method function can operate correctly and the safety verification has passed.
图5为本申请实施例的基于区块链的场外交易方法的流程图,如图5所示,该方法基于本申请的各种实施例中任一项的基于区块链的场外交易系统来实现,该方法具体包括如下步骤:Figure 5 is a flowchart of a blockchain-based OTC transaction method according to an embodiment of the application. As shown in Figure 5, the method is based on any of the various embodiments of the application. System implementation, the method specifically includes the following steps:
(1)用户浏览所述的交易大屏单元并查看报价详情单元,选择需成交的报价;(2)用户点击所述的点击成交单元,所述的系统首先校验用户的持有现金余额或债券余额,确保买入金额不超过现金余额,确保卖出债券张数不超过债券余额;然后根据用户和报价方的区块链地址以及该报价的详情生成待签署合约;(3)用户确认合约内容是否无误,当确认意见为否,则用户放弃签署合约,合约作废,进入历史合约单元;当确认意见为是,则判断合约是否已超过签署时限;当判断结果为是时,则合约作废,进入历史合约单元;当判断结果为否,则用户可以使用电子签章签署该合约;再判断报价方是否已签署合约,若判断结果为否,则判断合约是否已超过签署时限,判断结果为是,则合约作废,进入历史合约单元,判断结果为否,则继续判断报价方是否已签署合约;判断结果为是,则合约生效;(4)系统通过区块链上的交易记录对交易双方进行债券以及资金的清算,然后通过清算结果对交易双方进行持仓变更,即结算。(1) The user browses the large-screen transaction unit and views the quotation details unit, and selects the quotation to be transacted; (2) the user clicks the click transaction unit, and the system first verifies the user’s cash balance or Bond balance, ensure that the purchase amount does not exceed the cash balance, and that the number of bonds sold does not exceed the bond balance; then generate a contract to be signed based on the blockchain address of the user and the bidder and the details of the quotation; (3) the user confirms the contract Whether the content is correct, when the confirmation opinion is no, the user gives up signing the contract, the contract is invalidated, and enters the historical contract unit; when the confirmation opinion is yes, it is judged whether the contract has exceeded the signing time limit; when the judgment result is yes, the contract is invalidated. Enter the historical contract unit; when the judgment result is no, the user can use the electronic signature to sign the contract; then judge whether the bidder has signed the contract, if the judgment result is no, judge whether the contract has exceeded the signing time limit, and the judgment result is yes , The contract is invalidated, enter the historical contract unit, the judgment result is no, then continue to judge whether the bidder has signed the contract; the judgment result is yes, then the contract takes effect; (4) The system uses the transaction records on the blockchain to conduct transactions on both parties Bonds and funds are cleared, and then the positions of both parties to the transaction are changed through the clearing results, that is, settlement.
在其中一个实施例中,根据智能合约交控制易流程中的逻辑判断:其中,所述逻辑判断包括:用户在卖出交易时的用户持仓债券以及债券余额校验;用户在买入交易时的用户持有现金余额的校验;电子合约签署时签署时限的控制;交易记录详情、电子合约哈希、电子合约文件的上链存储;管理员账户与普通用户账户不同权限的控制;用户完成一笔买入或卖出交易,系统根据交易的标的债券以及交易金额对用户持仓的债券以及资金进行清算,并对债券以及资金的余额进行变更。In one of the embodiments, according to the logical judgment in the transaction control process of the smart contract: wherein, the logical judgment includes: the user's bond holdings and the bond balance verification when the user sells the transaction; The verification of the user’s cash balance; the control of the signing time limit when signing the electronic contract; the on-chain storage of transaction record details, electronic contract hashes, and electronic contract documents; control of different permissions between the administrator account and the ordinary user account; the user completes a For a buy or sell transaction, the system liquidates the bonds and funds held by the user according to the target bond of the transaction and the transaction amount, and changes the balance of the bonds and funds.
在其中一个实施例中,在签署合约之前,还需要对智能合约进行验证,具体包括如下步骤:In one of the embodiments, before signing the contract, the smart contract needs to be verified, which specifically includes the following steps:
(1)定义智能合约,以根据所述智能合约进行场外交易,所述场外交易的方法包括对所述智能合约的数据结构、合约方法的声明与实现;(2)定义形式验证规范,以规范所述智能合约中每个与智能合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;(3)利用所述形式验证规范对所述智能合约进行形式验证,以检查所述场外交易的方法实现是否符合所述形式验证规范的描述;若符合则代表所述智能合约安全;若不符合则修改所述智能合约,直至形式验证描述符合场外交易功能中相关实现。(1) Define a smart contract to conduct over-the-counter transactions according to the smart contract. The method of the over-the-counter transaction includes the declaration and implementation of the data structure and contract method of the smart contract; (2) Define formal verification specifications, To standardize the function, loop body, return value, and property value changes of the internal state variables of each contract method related to the smart contract in the smart contract; (3) Use the formal verification specification to perform formal verification on the smart contract , To check whether the over-the-counter transaction method meets the description of the formal verification specification; if it does, it means the smart contract is safe; if it does not, modify the smart contract until the formal verification description complies with the over-the-counter transaction function In the relevant implementation.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
在其中一个实施例中,所述形式验证规范满足如下条件:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。In one of the embodiments, the formal verification specification satisfies the following conditions: the uploaded file information structure corresponding to the uploaded file information structure is uploaded according to the file information, the recipient information, and the feedbacker information. , The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; check the loop The body does not overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
在其中一个实施例中,形式验证时,传入的入参参数保持在应用层的可控范围内;忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出;判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型。In one of the embodiments, during the formal verification, the incoming parameter parameters are kept within the controllable range of the application layer; the overflow of the length of the loop body array is ignored, and the overflow of the temporary variable value in the loop body is ignored; Judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a successful sign code on the chain, and the constructed formal verification is obtained model.
以下,将通过以下具体实施例对所述基于区块链的场外交易方法做进一步的说明,图6为本申请具体实施例的基于区块链的场外交易方法的流程图,如图6所示,该方法包括步骤S610至步骤S650:Hereinafter, the blockchain-based over-the-counter transaction method will be further described through the following specific embodiments. FIG. 6 is a flowchart of the blockchain-based over-the-counter transaction method according to a specific embodiment of the application, as shown in FIG. As shown, the method includes step S610 to step S650:
步骤S610:获取用户选择的交易报价,所述交易报价为所述用户根据所述交易大屏单元中的债券报价信息以及所述报价详情单元中单笔债券报价的详细信息选择的;Step S610: Obtain a transaction quotation selected by the user, the transaction quotation selected by the user according to the bond quotation information in the large transaction screen unit and the detailed information of a single bond quotation in the quotation detail unit;
步骤S620:校验所述用户的资产信息,以确保所述交易报价在所述用户的资产支配范围;Step S620: verify the user's asset information to ensure that the transaction quotation is within the user's asset control range;
步骤S630:获取所述交易双方的区块链地址,并根据所述交易报价的详细信息以及所述交易双方的区块链地址生成待签署合约;所述交易双方包括所述用户和报价方;Step S630: Obtain the blockchain addresses of the transaction parties, and generate a contract to be signed according to the detailed information of the transaction quotation and the blockchain addresses of the transaction parties; the transaction parties include the user and the offerer;
步骤S640:将所述待签署合约发送至所述交易双方,并获取合约签署结果;Step S640: Send the contract to be signed to both parties to the transaction, and obtain the contract signing result;
步骤S650:根据所述合约签署结果以及交易记录对所述交易双方的资产进行清算,并根据清算结果对所述交易双方进行持仓变更。Step S650: liquidate the assets of both parties to the transaction according to the result of the contract signing and the transaction records, and change the positions of the two parties to the transaction according to the result of the settlement.
在其中一个实施例中,交易双方签署合约的过程具体为:将所述待签署合约发送至所述交易双方,并获取所述交易双方的确认意见;若所述交易双方的确认意见均为是,且所述交易双方均在签署时限内完成所述待签署合约的签署,则将所述交易双方签署后的合约标记为已生效合约。In one of the embodiments, the process of signing a contract by both parties to the transaction is specifically: sending the contract to be signed to the parties to the transaction, and obtaining the confirmation opinions of the parties to the transaction; if the confirmation opinions of both parties to the transaction are both yes , And both parties to the transaction complete the signing of the contract to be signed within the signing time limit, then the contract signed by both parties to the transaction is marked as an effective contract.
在其中一个实施例中,若所述交易双方中的任意一方的确认意见为否,或者,所述交易双方中的任意一方未在签署时限内完成所述待签署合约的签署,则对所述待签署合约进行作废处理,并将作废的待签署合约发送至历史合约单元。In one of the embodiments, if the confirmation opinion of either of the two parties to the transaction is no, or any one of the two parties to the transaction does not complete the signing of the contract to be signed within the signing time limit, the The contract to be signed is voided, and the voided contract to be signed is sent to the historical contract unit.
在其中一个实施例中,根据所述智能合约控制交易流程中的逻辑判断,所述逻辑判断包括所述用户资产信息的校验、签署时限的判断、交易信息的存储、账户权限的使用以及交易过程中的资产清算与变更。In one of the embodiments, the logical judgment in the transaction process is controlled according to the smart contract, the logical judgment including the verification of the user asset information, the judgment of the signing time limit, the storage of transaction information, the use of account permissions, and the transaction Asset liquidation and changes in the process.
图7为本申请具体实施例的对智能合约进行形式验证的流程图,如图7所示,该方法包括步骤S710至步骤S740:FIG. 7 is a flowchart of formal verification of a smart contract according to a specific embodiment of the application. As shown in FIG. 7, the method includes steps S710 to S740:
步骤S710:定义智能合约;Step S710: Define a smart contract;
步骤S720:定义形式验证规范,以规范所述智能合约中每个与智能合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;Step S720: Define formal verification specifications to regulate the function, loop body, return value, and attribute value changes of internal state variables of each contract method related to the smart contract in the smart contract;
步骤S730:判断所述智能合约是否符合所述形式验证规范中的描述,若所述智能合约符合所述形式验证规范中的描述,则将所述智能合约发送至所述交易双方进行签署;Step S730: Determine whether the smart contract meets the description in the formal verification specification, and if the smart contract meets the description in the formal verification specification, send the smart contract to the transaction parties for signing;
步骤S740:若所述智能合约不符合所述形式验证规范中的描述,则对所述智能合约进行修改,直至所述智能合约符合所述形式验证规范中的描述。Step S740: If the smart contract does not meet the description in the formal verification specification, modify the smart contract until the smart contract meets the description in the formal verification specification.
在其中一个实施例中,根据所述智能合约进行场外交易,以对所述智能合约的数据结构、合约方法的声明与实现。In one of the embodiments, over-the-counter transactions are performed according to the smart contract to declare and implement the data structure and contract method of the smart contract.
在其中一个实施例中,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。In one of the embodiments, the definition of the smart contract includes uploading file information on-chain, recipient information on-chain, and feedbacker information on-chain; the data structure includes uploaded file information structure, recipient information structure, and feedback Information structure.
在其中一个实施例中,所述定义形式验证规范包括:根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;检验所述循环体不溢出;在所述智能合约定义时,调用函数,不会抛出异常;所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。In one of the embodiments, the defined formal verification specification includes: uploading according to the file information, uploading the recipient information, and uploading the feedback information corresponding to the uploaded file information structure, The recipient information structure and the feedback information structure are checked to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedback information on the chain; verify the loop body No overflow; when the smart contract is defined, the function is called without throwing an exception; after the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
在其中一个实施例中,根据所述形式验证模型对所述智能合约进行形式校验包括:将传入的入参参数保持在应用层的预设参数范围内;忽略所述循环体数组长度的溢出;忽略所述循环体内的临时变量值的溢出;判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型,并根据所述形式验证模型对所述智能合约进行形式校验。In one of the embodiments, the formal verification of the smart contract according to the formal verification model includes: keeping the incoming parameter parameters within a preset parameter range of the application layer; ignoring the length of the loop body array Overflow; Ignore the overflow of the temporary variable value in the loop body; judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns the chain failure code; if the internal state variable does not exist, the formal The verification returns a successful logo code on the chain, and a built formal verification model is obtained, and the smart contract is formally verified according to the formal verification model.
本实施例还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。This embodiment also provides an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the foregoing method embodiments.
可选地,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。Optionally, the aforementioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the aforementioned processor, and the input-output device is connected to the aforementioned processor.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the foregoing processor may be configured to execute the following steps through a computer program:
S1,获取用户选择的交易报价,所述交易报价为所述用户根据所述交易大屏单元中的债券报价信息以及所述报价详情单元中单笔债券报价的详细信息选择的;S1. Obtain a transaction quotation selected by a user, the transaction quotation selected by the user based on bond quotation information in the large transaction screen unit and detailed information of a single bond quotation in the quotation detail unit;
S2,校验所述用户的资产信息,以确保所述交易报价在所述用户的资产支配范围;S2, verifying the user's asset information to ensure that the transaction quotation is within the user's asset control range;
S3,获取所述交易双方的区块链地址,并根据所述交易报价的详细信息以及所述交易双方的区块链地址生成待签署合约;所述交易双方包括所述用户和报价方;S3: Obtain the blockchain addresses of both parties to the transaction, and generate a contract to be signed according to the detailed information of the transaction quotation and the blockchain addresses of both parties to the transaction; the parties to the transaction include the user and the bidder;
S4,将所述待签署合约发送至所述交易双方,并获取合约签署结果;S4, sending the contract to be signed to the two parties to the transaction, and obtaining the contract signing result;
S5,根据所述合约签署结果以及交易记录对所述交易双方的资产进行清算,并根据清算结果对所述交易双方进行持仓变更。S5, liquidating the assets of the two parties to the transaction according to the result of the contract signing and the transaction records, and changing the positions of the two parties to the transaction according to the result of the settlement.
需要说明的是,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the above-mentioned embodiments and alternative implementations, and this embodiment will not be repeated here.
另外,结合上述实施例中的基于区块链的场外交易方法,本申请实施例可提供一种存储介质来实现。该存储介质上存储有计算机程序;该计算机程序被处理器执行时实现上述实施例中的任意一种基于区块链的场外交易方法。In addition, in combination with the blockchain-based over-the-counter transaction method in the foregoing embodiment, the embodiment of the present application may provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by the processor, any one of the blockchain-based over-the-counter transaction methods in the foregoing embodiments is implemented.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, All should be considered as the scope of this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express a few implementation modes of the present application, and their description is relatively specific and detailed, but they should not be understood as a limitation on the scope of the patent application. It should be pointed out that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can be made, and these all fall within the protection scope of this application. Therefore, the scope of protection of the patent of this application shall be subject to the appended claims.

Claims (31)

  1. 一种基于区块链的场外交易系统,其特征在于,所述系统包括运行在区块链上的权限管理模块、账户模块、市场行情模块、合约管理模块以及交易管理模块,其中:A blockchain-based over-the-counter transaction system, characterized in that the system includes a rights management module, an account module, a market quotation module, a contract management module and a transaction management module running on the blockchain, wherein:
    所述权限管理模块,用于通过智能合约对管理员账户与普通用户的数据查看以及操作权限做出控制,以实现所述的管理员账户可查看全市场的合约与交易以及对合约模板作出修改,所述的普通用户只能查看与自己相关的合约与交易;The authority management module is used to control the data viewing and operation authority of the administrator account and ordinary users through smart contracts, so that the administrator account can view contracts and transactions in the entire market and modify contract templates , Said ordinary users can only view contracts and transactions related to them;
    所述账户模块用于管理与用户的账户相关的变更或者认证,所述账户模块包括用户注册单元、CA认证单元、账户管理单元、用户登陆单元以及用户信息修改单元,其中:The account module is used to manage changes or authentication related to the user's account. The account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit, and a user information modification unit, wherein:
    用户注册单元,用于接收用户填写的身份认证信息并提交注册请求,并为用户绑定区块链地址;The user registration unit is used to receive the identity authentication information filled in by the user and submit the registration request, and bind the blockchain address for the user;
    所述CA认证单元,用于将用户填写的身份认证信息通过区块链同时发送给多个权威节点进行数据比对,并接收所述的权威节点返回的比对结果,以认证用户的身份信息是否真实;若全部节点返回比对正确,则通过用户的身份认证,系统将该用户的区块链地址加入被授权列表中,对该用户进行授权;若存在节点返回比对错误,则不通过用户身份认证;The CA authentication unit is used to simultaneously send the identity authentication information filled in by the user to multiple authoritative nodes through the blockchain for data comparison, and receive the comparison result returned by the authoritative node to authenticate the user's identity information Whether it is true or not; if all nodes return the comparison correctly, the user’s identity authentication is passed, and the system adds the user’s blockchain address to the authorized list to authorize the user; if any node returns a comparison error, it will not pass User authentication;
    所述账户管理单元,用于收集与记录用户身份信息,并为用户分配区块链账户,托管公私钥;The account management unit is used to collect and record user identity information, allocate blockchain accounts for users, and escrow public and private keys;
    用户登陆单元,用于用户使用已注册的账号密码登陆至本区块链系统;The user login unit is used for users to log in to the blockchain system with the registered account password;
    用户信息修改单元,用于完善用户除身份认证信息之外的基本信息,并用于修改用户已填写的基本信息;The user information modification unit is used to improve the user's basic information other than the identity authentication information, and to modify the basic information that the user has filled in;
    所述市场行情模块包括交易大屏单元、报价详情单元以及点击成交单元,其中:The market quotation module includes a large trading screen unit, a quotation detail unit and a click transaction unit, among which:
    所述交易大屏单元,用于展示全市场所有用户发布的债券报价信息;The large trading screen unit is used to display bond quotation information issued by all users in the entire market;
    所述报价详情单元,用于展示某一笔债券报价的详细信息;The quotation details unit is used to display detailed information of a bond quotation;
    所述点击成交单元,用于接收用户对交易大屏中某笔报价发起的交易流程,或者接收交易大屏中某一批报价批量发起的交易流程,并确定交易双方以及交易标的的详细信息;The click transaction unit is used to receive the transaction process initiated by the user on a certain quotation in the transaction screen, or receive the transaction process initiated by a batch of quotations in the transaction screen, and determine the detailed information of the transaction parties and the transaction target;
    所述合约管理模块包括模板管理单元、合约签署单元、待签署合约单元以及历史合约单元,其中:The contract management module includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, among which:
    所述模板管理单元,包括模板制作与模板展示,所述的模板制作功能只对管理员开放,所述的模板展示用于向普通用户展示管理员制定的合约模板;The template management unit includes template making and template display, the template making function is only open to administrators, and the template display is used to display contract templates made by the administrator to ordinary users;
    所述合约签署单元,包括合约生成与合约签署,合约生成用于根据点击成交单元所获得的交易双方及标的的详细信息生成合约要素,并根据所管理员制定的合约模板生成待签署合约;所述合约签署用于向点击成交单元所获得的交易双方发送待签署合约信息,并接收交易双方盖上各自电子签章的合约,并将该签署合约标记为已生效合约,发送给历史合约单元,然后将该合约上传至区块链中进行记录;The contract signing unit includes contract generation and contract signing. The contract generation is used to generate contract elements according to the detailed information of the transaction parties and the target obtained by clicking the transaction unit, and generate the contract to be signed according to the contract template formulated by the administrator; The contract signing is used to send the contract information to be signed to both parties of the transaction obtained by clicking the transaction unit, and to receive the contract signed by both parties to the transaction, mark the signed contract as an effective contract, and send it to the historical contract unit. Then upload the contract to the blockchain for recording;
    所述待签署合约单元,用于展示合约签署单元中生成的待签署合约或待报价方签署的合约;待签署合约超过签署时限后作废,进入历史合约单元;The contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit; the contract to be signed is invalidated after the signing time limit is exceeded and enters the historical contract unit;
    所述历史合约单元,用于展示合约签署单元中生成的交易双方签署完成的已生效合约,以及用于展示超过签署时限后作废的待签署合约;The historical contract unit is used to display the valid contracts signed and completed by both parties to the transaction generated in the contract signing unit, and used to display contracts to be signed that are invalidated after the signing time limit;
    所述交易管理模块包括新建意向单元和当前持仓单元,其中:The transaction management module includes a new intention unit and a current position unit, wherein:
    所述新建意向单元,用于接收用户发起的一笔新的买入或卖出意向报价,接收用户填写交易意向的所有要素之后,将报价发送至交易大屏单元进行展示;The new intention unit is used to receive a new buying or selling intention quotation initiated by the user, and after the user fills in all the elements of the transaction intention, the quotation is sent to the transaction large screen unit for display;
    所述当前持仓单元,用于展示用户当前所持有的债券以及现金余额。The current position holding unit is used to display the bonds and cash balance currently held by the user.
  2. 根据权利要求1所述的基于区块链的场外交易系统,其特征在于,所述合约签署单元的合约全数记录通过区块链进行保全,保全数据包括签署双方的区块链地址以及签署时的时间戳、包含双方电子签名的电子合约文件。The blockchain-based over-the-counter transaction system according to claim 1, wherein all the contract records of the contract signing unit are preserved through the blockchain, and the preservation data includes the blockchain addresses of the signing parties and the signing time. The timestamp of, the electronic contract file containing the electronic signatures of both parties.
  3. 根据权利要求1所述的基于区块链的场外交易系统,其特征在于,所述CA认证单元中的用户的身份认证使用基于区块链的分布式CA认证。The block chain-based over-the-counter transaction system according to claim 1, wherein the identity authentication of the user in the CA authentication unit uses blockchain-based distributed CA authentication.
  4. 一种基于区块链的场外交易方法,其特征在于,所述方法基于权利要求1-3中的任一项的基于区块链的场外交易系统来实现,该方法具体包括如下步骤:A blockchain-based over-the-counter transaction method, characterized in that the method is implemented based on the blockchain-based over-the-counter transaction system of any one of claims 1-3, and the method specifically includes the following steps:
    用户浏览所述的交易大屏单元并查看报价详情单元,选择需成交的报价;The user browses the large-screen transaction unit and views the quotation details unit, and selects the quotation to be traded;
    用户点击所述的点击成交单元,所述的系统首先校验用户的持有现金余额或债券余额,确保买入金额不超过现金余额,确保卖出债券张数不超过债券余额;然后根据用户和报价方的区块链地址以及该报价的详情生成待签署合约;The user clicks on the click transaction unit, and the system first verifies the user’s cash balance or bond balance to ensure that the purchase amount does not exceed the cash balance, and that the number of bonds sold does not exceed the bond balance; The blockchain address of the bidder and the details of the offer generate the contract to be signed;
    用户确认合约内容是否无误,当确认意见为否,则用户放弃签署合约,合约作废,进入历史合约单元;当确认意见为是,则判断合约是否已超过签署时限;当判断结果为是时,则合约作废,进入历史合约单元;当判断结果为否,则用户可以使用电子签章签署该合约;再判断报价方是否已签署合约,若判断结果为否,则判断合约是否已超过签署时限,判断结果为是,则合约作废,进入历史合约单元,判断结果为否,则继续判断报价方是否已签署合约;判断结果为是,则合约生效;The user confirms whether the content of the contract is correct. When the confirmation opinion is no, the user gives up signing the contract, the contract is invalidated, and enters the historical contract unit; when the confirmation opinion is yes, it is judged whether the contract has exceeded the signing time limit; when the judgment result is yes, then The contract is invalidated and enter the historical contract unit; when the judgment result is no, the user can use the electronic signature to sign the contract; then judge whether the bidder has signed the contract, if the judgment result is no, judge whether the contract has exceeded the signing time limit, judge If the result is yes, the contract is invalidated and enter the historical contract unit. If the judgment result is no, then continue to judge whether the bidder has signed the contract; if the judgment result is yes, the contract takes effect;
    系统通过区块链上的交易记录对交易双方进行债券以及资金的清算,然后通过清算结果对交易双方进行持仓变更,即结算。The system clears the bonds and funds of both parties through the transaction records on the blockchain, and then changes the positions of both parties through the clearing results, that is, settlement.
  5. 根据权利要求4所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The OTC transaction method based on blockchain according to claim 4, wherein the method further comprises:
    根据智能合约交控制易流程中的逻辑判断:其中,所述逻辑判断包括:According to the logical judgment in the smart contract transaction control process: wherein, the logical judgment includes:
    用户在卖出交易时的用户持仓债券以及债券余额校验;Verification of the user's holding bonds and bond balance when the user sells;
    用户在买入交易时的用户持有现金余额的校验;Verification of the user's cash balance held by the user in the purchase transaction;
    电子合约签署时签署时限的控制;Control of the signing time limit when signing electronic contracts;
    交易记录详情、电子合约哈希、电子合约文件的上链存储;On-chain storage of transaction record details, electronic contract hash, and electronic contract files;
    管理员账户与普通用户账户不同权限的控制;Different authority control of administrator account and ordinary user account;
    用户完成一笔买入或卖出交易,系统根据交易的标的债券以及交易金额对用户持仓的债券以及资金进行清算,并对债券以及资金的余额进行变更。The user completes a buy or sell transaction, and the system liquidates the bonds and funds held by the user according to the target bond of the transaction and the transaction amount, and changes the balance of the bonds and funds.
  6. 根据权利要求4所述的基于区块链的场外交易方法,其特征在于,在签署合约之前,所述方法还包括:The block chain-based over-the-counter transaction method according to claim 4, characterized in that, before signing the contract, the method further comprises:
    定义智能合约,以根据所述智能合约进行场外交易,所述场外交易的方法包括对所述智能合约的数据结构、合约方法的声明与实现;Defining a smart contract to perform over-the-counter transactions according to the smart contract, and the method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the smart contract;
    定义形式验证规范,以规范所述智能合约中每个与智能合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;Define formal verification specifications to regulate the function, loop body, return value and attribute value changes of internal state variables of each smart contract related contract method in the smart contract;
    利用所述形式验证规范对所述智能合约进行形式验证,以检查所述场外交易的方法实现是否符合所述形式验证规范的描述;若符合则代表所述智能合约安全;若不符合则修改所述智能合约,直至形式验证描述符合场外交易功能中相关实现。Use the formal verification specification to perform formal verification on the smart contract to check whether the implementation of the over-the-counter transaction method complies with the description of the formal verification specification; if it complies, it means the smart contract is safe; if it does not comply, modify The smart contract until the formal verification description conforms to the relevant implementation in the over-the-counter transaction function.
  7. 根据权利要求6所述的基于区块链的场外交易方法,其特征在于,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。The block chain-based over-the-counter transaction method according to claim 6, wherein the definition of the smart contract includes uploading file information on the chain, recipient information on the chain, and feedbacker information on the chain; the data structure Including uploaded file information structure, recipient information structure and feedback information structure.
  8. 根据权利要求7所述的基于区块链的场外交易方法,其特征在于,所述形式验证规范满足如下条件:The blockchain-based OTC transaction method according to claim 7, wherein the formal verification specification meets the following conditions:
    根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者信息上链以及所述反馈者信息上链的返回值;According to the uploaded file information structure, the recipient information structure, and the feedback information structure corresponding to the file information uploading, the recipient information uploading, and the feedback information uploading Check to obtain the return value of the file information uploading, the recipient information uploading, and the feedbacker information uploading;
    检验所述循环体不溢出;Check that the loop body does not overflow;
    在所述智能合约定义时,调用函数,不会抛出异常;When the smart contract is defined, the function is called without throwing an exception;
    所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。After the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  9. 根据权利要求6所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The blockchain-based over-the-counter transaction method according to claim 6, wherein the method further comprises:
    形式验证时,传入的入参参数保持在应用层的可控范围内;During formal verification, the incoming parameters are kept within the controllable range of the application layer;
    忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出;Ignore the overflow of the length of the loop body array, and at the same time ignore the overflow of the temporary variable value in the loop body;
    判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型。Judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a successful sign code on the chain, and the constructed formal verification is obtained model.
  10. 一种基于区块链的场外交易方法,其特征在于,所述方法包括如下步骤:A blockchain-based OTC transaction method, characterized in that the method includes the following steps:
    定义场外交易智能合约,进行场外交易,所述场外交易的方法包括对所述场外交易智能合约的数据结构、合约方法的声明与实现;Defining an over-the-counter smart contract to conduct over-the-counter transactions. The method of the over-the-counter transaction includes the declaration and realization of the data structure and contract method of the over-the-counter smart contract;
    定义形式验证规范,以描述所述场外交易的方法所实现的功能,并规范所述智能合约中每个场外交易合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;Define formal verification specifications to describe the functions implemented by the over-the-counter transaction method, and standardize the functions, loop body, return value and internal state variable properties of each contract method related to the over-the-counter transaction contract in the smart contract Value change
    利用所述形式验证规范对所述场外交易智能合约进行形式验证,根据所述形式验证模型,检查所述场外交易的方法实现是否符合所述形式验证规范的描述;若符合则代表所述场外交易智能合约安全;若不符合则修改所述场外交易智能合约,直至形式验证描述符合场外交易功能中相关实现。Use the formal verification specification to perform formal verification on the over-the-counter smart contract, and according to the formal verification model, check whether the implementation of the over-the-counter transaction complies with the description of the formal verification specification; The over-the-counter smart contract is safe; if not, the over-the-counter smart contract is modified until the formal verification description complies with the relevant implementation of the over-the-counter function.
  11. 根据权利要求10所述的基于区块链的场外交易方法,其特征在于,所述场外交易智能合约的定义包括上传文件信息上链、接受者信息上链和反馈者信息上链;所述数据结构包括上传文件信息结构体、 接受者信息结构体和反馈信息结构体。The blockchain-based over-the-counter transaction method according to claim 10, wherein the definition of the over-the-counter smart contract includes uploading file information on the chain, recipient information on the chain, and feedbacker information on the chain; The data structure includes uploaded file information structure, recipient information structure and feedback information structure.
  12. 根据权利要求11所述的基于区块链的场外交易方法,其特征在于,所述形式验证规范满足如下条件:The blockchain-based OTC transaction method according to claim 11, wherein the formal verification specification satisfies the following conditions:
    所述形式验证规范依据函数方法执行,且根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到不同的返回值;The formal verification specification is executed according to a function method, and is based on the uploading of the file information, the uploading of the recipient information, and the uploading of the feedbacker information corresponding to the uploaded file information structure and the recipient The information structure body and the feedback information structure body are checked to obtain different return values;
    检验所述循环体不溢出;Check that the loop body does not overflow;
    在所述场外交易智能合约定义时,调用函数,不会抛出异常;When the over-the-counter smart contract is defined, the function is called without throwing an exception;
    所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。After the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  13. 根据权利要求12所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The block chain-based OTC transaction method according to claim 12, characterized in that the method further comprises:
    形式验证时,传入的入参参数保持在应用层的可控范围内;During formal verification, the incoming parameters are kept within the controllable range of the application layer;
    忽略所述循环体数组长度的溢出,同时忽略所述循环体内的临时变量值的溢出;Ignore the overflow of the length of the loop body array, and at the same time ignore the overflow of the temporary variable value in the loop body;
    判断所述内部状态变量是否存在,如果已存在,形式验证返回上链失败码;如果所述内部状态变量不存在,形式验证返回上链成功标志码。It is judged whether the internal state variable exists, and if it already exists, the formal verification returns a link failure code; if the internal state variable does not exist, the formal verification returns a link success flag code.
  14. 一种基于区块链的场外交易系统,其特征在于,所述系统包括运行在底层区块链上的权限管理模块、账户模块、市场行情模块、合约管理模块、交易管理模块;其中:A blockchain-based over-the-counter transaction system, characterized in that the system includes a rights management module, an account module, a market quotation module, a contract management module, and a transaction management module running on the underlying blockchain; wherein:
    所述权限管理模块,用于根据智能合约控制管理员账户和普通用户的数据查看权限以及操作权限;其中,管理员账户的数据查看权限包括查看全市场的合约以及交易记录的权限,管理员账户的操作权限包括修改合约模板的权限,所述普通用户的数据查看权限包括查看与自己相关的合约与交易的权限;The authority management module is used to control the data viewing authority and operation authority of the administrator account and ordinary users according to the smart contract; wherein, the data viewing authority of the administrator account includes the authority to view contracts and transaction records of the entire market, and the administrator account The operation authority of includes the authority to modify the contract template, and the data viewing authority of the ordinary user includes the authority to view contracts and transactions related to the user;
    所述账户模块,用于管理与用户账户相关的变更或者认证;所述市场行情模块,用于显示全市场中所有用户发布的债券报价信息;The account module is used to manage changes or authentication related to user accounts; the market quotation module is used to display bond quotation information issued by all users in the entire market;
    所述合约管理模块,用于根据合约模板以及获取的交易信息生成待签署合约,并将所述待签署合约发送至交易双方进行签署;The contract management module is used to generate a contract to be signed according to the contract template and the acquired transaction information, and send the contract to be signed to both parties to the transaction for signing;
    所述交易管理模块,用于将接收到的报价信息发送至所述市场行情模块,以及展示用户的资产信息。The transaction management module is used to send the received quotation information to the market quotation module and display the user's asset information.
  15. 根据权利要求14所述的基于区块链的场外交易系统,其特征在于,所述账户模块包括用户注册单元、CA认证单元、账户管理单元、用户登陆单元以及用户信息修改单元,其中:The blockchain-based over-the-counter transaction system according to claim 14, wherein the account module includes a user registration unit, a CA authentication unit, an account management unit, a user login unit and a user information modification unit, wherein:
    所述用户注册单元,用于接收用户的身份认证信息并提交注册请求,以对用户与对应的区块链地址进行绑定;The user registration unit is used to receive the user's identity authentication information and submit a registration request to bind the user to the corresponding blockchain address;
    所述CA认证单元,用于将用户的身份认证信息通过区块链发送至多个权威节点,并接收每一所述权威节点返回的比对结果,以认证用户的身份信息是否真实;若所有所述权威节点的比对结果均显示无误,则将用户对应的区块链地址添加至被授权列表中,以通过用户的注册请求;若所述权威节点的比对结果显示错误,则驳回用户的注册请求;The CA authentication unit is used to send the user's identity authentication information to multiple authoritative nodes through the blockchain, and receive the comparison result returned by each of the authoritative nodes to verify whether the user's identity information is authentic; If the comparison result of the authoritative node is correct, the blockchain address corresponding to the user is added to the authorized list to pass the user’s registration request; if the comparison result of the authoritative node shows an error, the user’s request will be rejected Registration request;
    所述账户管理单元:用于收集与记录用户的身份信息,为用户分配区块链账户以及托管公钥和私钥;The account management unit: used to collect and record the user's identity information, allocate blockchain accounts and escrow public and private keys for users;
    所述用户登陆单元:用于根据用户输入的已注册账号密码登录至区块链系统;The user login unit: used to log in to the blockchain system according to the registered account password entered by the user;
    所述用户信息修改单元,用于管理与修改用户的其他基本信息。The user information modification unit is used to manage and modify other basic information of the user.
  16. 根据权利要求15所述的基于区块链的场外交易系统,其特征在于,所述CA认证单元还用于根据基于区块链的分布式CA认证规则对用户身份进行认证。The blockchain-based over-the-counter transaction system according to claim 15, wherein the CA authentication unit is further configured to authenticate the user's identity according to the distributed CA authentication rules based on the blockchain.
  17. 根据权利要求14所述的基于区块链的场外交易系统,其特征在于,所述市场行情模块包括交易大屏单元、报价详情单元以及点击成交单元,其中:The block chain-based over-the-counter trading system according to claim 14, wherein the market quotation module includes a large trading screen unit, a quotation detail unit, and a click transaction unit, wherein:
    所述交易大屏单元,用于显示全市场中所有用户发布的债券报价信息;The large transaction screen unit is used to display bond quotation information issued by all users in the entire market;
    所述报价详情单元,用于显示单笔债券报价的详细信息;The quotation detail unit is used to display detailed information of a single bond quotation;
    所述点击成交单元,用于接收用户针对交易大屏中的某一报价发起的单笔交易流程或者针对某一批报价发起的批量交易流程,并确定交易双方以及交易标的详细信息。The click transaction unit is used to receive a single transaction process initiated by a user for a certain quotation in the transaction screen or a batch transaction process initiated for a certain batch of quotations, and to determine detailed information of the transaction parties and the transaction target.
  18. 根据权利要求17所述的基于区块链的场外交易系统,其特征在于,所述合约管理模块包括模板管理单元、合约签署单元、待签署合约单元以及历史合约单元,其中:The blockchain-based over-the-counter transaction system according to claim 17, wherein the contract management module includes a template management unit, a contract signing unit, a contract to be signed unit, and a historical contract unit, wherein:
    所述模板管理单元,用于管理员制作模板以及向普通用户展示管理员制作的合约模板;The template management unit is used for the administrator to make templates and to show ordinary users the contract templates made by the administrator;
    所述合约签署单元,用于根据所述点击成交单元获取的交易双方以及交易标的详细信息生成合约要素,并根据所述合约要素以及管理员制作的合约模板生成待签署合约,向交易双方发送待签署合约信息,并接收交易双方盖签章后的签署合约,并将所述签署合约标记为已生效合约,将所述已生效合约发送至所述历史合约单元,对所述已生效合约进行上传与记录;The contract signing unit is used to generate contract elements according to the detailed information of the transaction parties and the transaction target obtained by the click transaction unit, and generate the contract to be signed according to the contract elements and the contract template prepared by the administrator, and send the pending contract to both parties Sign the contract information, receive the signed contract signed by both parties to the transaction, mark the signed contract as an effective contract, send the effective contract to the historical contract unit, and upload the effective contract And records;
    所述待签署合约单元,用于展示所述合约签署单元中生成的待签署合约或待报价方签署的合约,对超过签署时限的待签署合约进行作废处理,并将作废的待签署合约发送至所述历史合约单元;The contract to be signed unit is used to display the contract to be signed or the contract to be signed by the bidder generated in the contract signing unit, to invalidate the contract to be signed that exceeds the signing time limit, and to send the invalid contract to be signed to The historical contract unit;
    所述历史合约单元,用于展示已生效合约以及作废的待签署合约。The historical contract unit is used to display valid contracts and invalid contracts to be signed.
  19. 根据权利要求18所述的基于区块链的场外交易系统,其特征在于,所述合约签署单元中的合约签署记录通过区块链进行存储,所述合约签署记录包括签署双方的区块链地址以及签署时间戳以及包含双方电子签名的电子合约文件。The blockchain-based over-the-counter transaction system according to claim 18, wherein the contract signing record in the contract signing unit is stored through a blockchain, and the contract signing record includes the blockchains of both signing parties. Address and signing timestamp and electronic contract document containing both parties' electronic signatures.
  20. 根据权利要求14所述的基于区块链的场外交易系统,其特征在于,所述交易管理模块包括新建意向单元和当前持仓单元,其中:The block chain-based over-the-counter transaction system according to claim 14, wherein the transaction management module includes a new intention unit and a current position unit, wherein:
    所述新建意向单元,用于接收用户发起的新的买入意向报价或者卖出意向报价,并将所述买入意向报价以及所述卖出意向报价发送至所述交易大屏单元;The new intention unit is configured to receive a new buying intention offer or selling intention offer initiated by a user, and send the buying intention offer and the selling intention offer to the large transaction screen unit;
    所述当前持仓单元,用于展示用户当前所持有的债券以及现金余额。The current position holding unit is used to display the bonds and cash balance currently held by the user.
  21. 一种基于区块链的场外交易方法,其特征在于,所述方法基于权利要求14-20中的任一项的基于区块链的场外交易系统来实现,所述方法包括:A blockchain-based over-the-counter transaction method, characterized in that the method is implemented based on the blockchain-based over-the-counter transaction system of any one of claims 14-20, and the method comprises:
    获取用户选择的交易报价,所述交易报价为所述用户根据所述交易大屏单元中的债券报价信息以及所述报价详情单元中单笔债券报价的详细信息选择的;Obtaining a transaction quotation selected by the user, the transaction quotation selected by the user according to the bond quotation information in the large transaction screen unit and the detailed information of a single bond quotation in the quotation detail unit;
    校验所述用户的资产信息,以确保所述交易报价在所述用户的资产支配范围;Verifying the user's asset information to ensure that the transaction quotation is within the user's asset control range;
    获取所述交易双方的区块链地址,并根据所述交易报价的详细信息以及所述交易双方的区块链地址生成待签署合约;所述交易双方包括所述用户和报价方;Obtain the blockchain addresses of both parties to the transaction, and generate a contract to be signed according to the detailed information of the transaction quotation and the blockchain addresses of both parties to the transaction; the parties to the transaction include the user and the bidder;
    将所述待签署合约发送至所述交易双方,并获取合约签署结果;Send the contract to be signed to the two parties to the transaction, and obtain the result of the contract signing;
    根据所述合约签署结果以及交易记录对所述交易双方的资产进行清算,并根据清算结果对所述交易双方进行持仓变更。The assets of both parties to the transaction are cleared according to the result of the contract signing and the transaction records, and the positions of the two parties to the transaction are changed according to the clearing result.
  22. 根据权利要求21所述的基于区块链的场外交易方法,其特征在于,所述将所述待签署合约发送至所述交易双方,并获取合约签署结果包括:The block chain-based over-the-counter transaction method of claim 21, wherein the sending the contract to be signed to the two parties to the transaction and obtaining the result of the contract signing comprises:
    将所述待签署合约发送至所述交易双方,并获取所述交易双方的确认意见;Send the contract to be signed to the two parties to the transaction, and obtain the confirmation opinions of the two parties;
    若所述交易双方的确认意见均为是,且所述交易双方均在签署时限内完成所述待签署合约的签署,则将所述交易双方签署后的合约标记为已生效合约。If the confirmation opinions of both parties to the transaction are both yes, and both parties to the transaction complete the signing of the contract to be signed within the signing time limit, then the contract signed by both parties to the transaction is marked as an effective contract.
  23. 根据权利要求22所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The method for over-the-counter transactions based on blockchain according to claim 22, wherein the method further comprises:
    若所述交易双方中的任意一方的确认意见为否,或者,所述交易双方中的任意一方未在签署时限内完成所述待签署合约的签署,则对所述待签署合约进行作废处理,并将作废的待签署合约发送至历史合约单元。If the confirmation opinion of either of the two parties to the transaction is no, or any one of the two parties to the transaction fails to complete the signing of the contract to be signed within the signing time limit, the contract to be signed is invalidated, And send the invalidated contract to be signed to the historical contract unit.
  24. 根据权利要求21所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The block chain-based OTC transaction method according to claim 21, characterized in that the method further comprises:
    根据所述智能合约控制交易流程中的逻辑判断,所述逻辑判断包括所述用户资产信息的校验、签署时限的判断、交易信息的存储、账户权限的使用以及交易过程中的资产清算与变更。According to the logic judgment in the smart contract control transaction process, the logic judgment includes the verification of the user's asset information, the judgment of the signing time limit, the storage of transaction information, the use of account permissions, and the asset clearing and change during the transaction .
  25. 根据权利要求21所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The block chain-based OTC transaction method according to claim 21, characterized in that the method further comprises:
    定义智能合约;Define smart contracts;
    定义形式验证规范,以规范所述智能合约中每个与智能合约相关的合约方法的功能、循环体、返回值和内部状态变量的属性值变化;Define formal verification specifications to regulate the function, loop body, return value and attribute value changes of internal state variables of each smart contract related contract method in the smart contract;
    判断所述智能合约是否符合所述形式验证规范中的描述,若所述智能合约符合所述形式验证规范中的描述,则将所述智能合约发送至所述交易双方进行签署;Judging whether the smart contract meets the description in the formal verification specification, and if the smart contract meets the description in the formal verification specification, sending the smart contract to both parties to the transaction for signing;
    若所述智能合约不符合所述形式验证规范中的描述,则对所述智能合约进行修改,直至所述智能合约符合所述形式验证规范中的描述。If the smart contract does not meet the description in the formal verification specification, the smart contract is modified until the smart contract meets the description in the formal verification specification.
  26. 根据权利要求25所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The block chain-based OTC transaction method according to claim 25, wherein the method further comprises:
    根据所述智能合约进行场外交易,以对所述智能合约的数据结构、合约方法的声明与实现。Perform over-the-counter transactions according to the smart contract to declare and implement the data structure and contract method of the smart contract.
  27. 根据权利要求26所述的基于区块链的场外交易方法,其特征在于,所述智能合约的定义包括上传文件信息上链,接受者信息上链以及反馈者信息上链;所述数据结构包括上传文件信息结构体、接受者信息结构体和反馈信息结构体。The block chain-based over-the-counter transaction method according to claim 26, wherein the definition of the smart contract includes uploading file information on the chain, recipient information on the chain, and feedbacker information on the chain; the data structure Including uploaded file information structure, recipient information structure and feedback information structure.
  28. 根据权利要求27所述的基于区块链的场外交易方法,其特征在于,所述定义形式验证规范包括:The blockchain-based over-the-counter transaction method of claim 27, wherein the defined formal verification specification comprises:
    根据所述文件信息上链、所述接受者信息上链和所述反馈者信息上链对应传入的所述上传文件信息结构体、所述接受者信息结构体和所述反馈信息结构体进行校验,得到所述文件信息上链、所述接受者 信息上链以及所述反馈者信息上链的返回值;According to the uploaded file information structure, the recipient information structure, and the feedback information structure corresponding to the file information uploading, the recipient information uploading, and the feedback information uploading Check to obtain the return values of the file information on the chain, the recipient information on the chain, and the feedbacker information on the chain;
    检验所述循环体不溢出;Check that the loop body does not overflow;
    在所述智能合约定义时,调用函数,不会抛出异常;When the smart contract is defined, the function is called without throwing an exception;
    所述函数调用后,所述场外交易的方法中数据结构的状态变量发生改变,其他状态变量保持不变。After the function is called, the state variables of the data structure in the over-the-counter trading method change, and other state variables remain unchanged.
  29. 根据权利要求28所述的基于区块链的场外交易方法,其特征在于,所述方法还包括:The OTC transaction method based on blockchain according to claim 28, wherein the method further comprises:
    将传入的入参参数保持在应用层的预设参数范围内;Keep the incoming parameter parameters within the preset parameter range of the application layer;
    忽略所述循环体数组长度的溢出;Ignore the overflow of the loop body array length;
    忽略所述循环体内的临时变量值的溢出;Ignore the overflow of the temporary variable value in the loop body;
    判断内部状态变量是否存在,若所述内部状态变量已存在,则形式验证返回上链失败码;若所述内部状态变量不存在,则形式验证返回上链成功标志码,得到构建好的形式验证模型,并根据所述形式验证模型对所述智能合约进行形式校验。Judge whether the internal state variable exists, if the internal state variable already exists, the formal verification returns a failure code on the chain; if the internal state variable does not exist, the formal verification returns a successful sign code on the chain, and the constructed formal verification is obtained Model, and perform formal verification on the smart contract according to the formal verification model.
  30. 一种电子装置,包括存储器和处理器,其特征在于,所述存储器中存储有计算机程序,所述处理器被设置为运行所述计算机程序以执行权利要求21至29中任一项所述的基于区块链的场外交易方法。An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the computer program described in any one of claims 21 to 29 OTC transaction method based on blockchain.
  31. 一种存储介质,其特征在于,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行权利要求21至29中任一项所述的基于区块链的场外交易方法。A storage medium, characterized in that a computer program is stored in the storage medium, wherein the computer program is set to execute the blockchain-based off-site according to any one of claims 21 to 29 when running. Trading method.
PCT/CN2020/110236 2019-07-30 2020-08-20 Blockchain-based over-the-counter transaction method and system, storage medium, and electronic apparatus WO2021018312A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201910694153.3 2019-07-30
CN201910694153.3A CN110443709A (en) 2019-07-30 2019-07-30 A kind of over-the-counter bond transaction system of the interbank based on block chain
CN201910772367.8A CN110533533A (en) 2019-08-21 2019-08-21 A kind of Formal Verification of over-the-counter trading intelligence contract
CN201910772367.8 2019-08-21

Publications (1)

Publication Number Publication Date
WO2021018312A1 true WO2021018312A1 (en) 2021-02-04

Family

ID=74229228

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/110236 WO2021018312A1 (en) 2019-07-30 2020-08-20 Blockchain-based over-the-counter transaction method and system, storage medium, and electronic apparatus

Country Status (1)

Country Link
WO (1) WO2021018312A1 (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104240128A (en) * 2013-06-09 2014-12-24 黄柯 Fixed-income security quoted price information exhibiting and interacting method and system
CN106469414A (en) * 2015-08-20 2017-03-01 三竹资讯股份有限公司 Mobile stock open platform device and method
CN106504069A (en) * 2016-11-03 2017-03-15 广州普惠创新金融信息服务有限公司 A kind of automatic response method of transaction in assets information, device and system
CN107507089A (en) * 2017-07-17 2017-12-22 凯美瑞德(苏州)信息科技股份有限公司 A kind of method and apparatus that trader's transaction commodity are configured
CN107783758A (en) * 2016-08-25 2018-03-09 北京航空航天大学 A kind of intelligent contract engineering method
CN108764720A (en) * 2018-05-28 2018-11-06 魏巧萍 A kind of block chain bond issue purchase transfer system
CN109064309A (en) * 2018-07-02 2018-12-21 浙江大学 A kind of small micro- loan transaction system and method for commerce based on alliance's chain
CN109375899A (en) * 2018-09-25 2019-02-22 杭州趣链科技有限公司 A kind of method of formal verification Solidity intelligence contract
US20190139136A1 (en) * 2015-07-09 2019-05-09 Templum, Inc. Systems and methods for trading, clearing and settling securities transactions using blockchain technology
CN110443709A (en) * 2019-07-30 2019-11-12 杭州趣链科技有限公司 A kind of over-the-counter bond transaction system of the interbank based on block chain
CN110533533A (en) * 2019-08-21 2019-12-03 杭州趣链科技有限公司 A kind of Formal Verification of over-the-counter trading intelligence contract

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104240128A (en) * 2013-06-09 2014-12-24 黄柯 Fixed-income security quoted price information exhibiting and interacting method and system
US20190139136A1 (en) * 2015-07-09 2019-05-09 Templum, Inc. Systems and methods for trading, clearing and settling securities transactions using blockchain technology
CN106469414A (en) * 2015-08-20 2017-03-01 三竹资讯股份有限公司 Mobile stock open platform device and method
CN107783758A (en) * 2016-08-25 2018-03-09 北京航空航天大学 A kind of intelligent contract engineering method
CN106504069A (en) * 2016-11-03 2017-03-15 广州普惠创新金融信息服务有限公司 A kind of automatic response method of transaction in assets information, device and system
CN107507089A (en) * 2017-07-17 2017-12-22 凯美瑞德(苏州)信息科技股份有限公司 A kind of method and apparatus that trader's transaction commodity are configured
CN108764720A (en) * 2018-05-28 2018-11-06 魏巧萍 A kind of block chain bond issue purchase transfer system
CN109064309A (en) * 2018-07-02 2018-12-21 浙江大学 A kind of small micro- loan transaction system and method for commerce based on alliance's chain
CN109375899A (en) * 2018-09-25 2019-02-22 杭州趣链科技有限公司 A kind of method of formal verification Solidity intelligence contract
CN110443709A (en) * 2019-07-30 2019-11-12 杭州趣链科技有限公司 A kind of over-the-counter bond transaction system of the interbank based on block chain
CN110533533A (en) * 2019-08-21 2019-12-03 杭州趣链科技有限公司 A kind of Formal Verification of over-the-counter trading intelligence contract

Similar Documents

Publication Publication Date Title
CN108428122B (en) Trade financing method and system on distributed account book
US11830094B2 (en) Data payment and authentication via a shared data structure
US20220222243A1 (en) Systems and methods for blockchain rule synchronization
US11734686B2 (en) Automated event processing computing platform for handling and enriching blockchain data
US11265326B2 (en) Automated event processing computing platform for handling and enriching blockchain data
US20230063172A1 (en) Hierarchical consensus protocol framework for implementing electronic transaction processing systems
US20180075536A1 (en) Multiparty reconciliation systems and methods
Hartmann et al. Applying blockchain to the Australian carbon market
CN111418184B (en) Credible insurance letter based on block chain
KR20180074655A (en) Systems and methods for trading, authorizing and settlement of securities transactions using block-chain technology
CN111127168A (en) Photovoltaic financing leasing method and system based on block chain and storage medium
US20180204216A1 (en) Transaction settlement systems and methods
CN110691066A (en) Distributed ledger system for anonymous transaction management
TWI691924B (en) Carbon trading system and carbon trading platform
US20120089502A1 (en) Method and system for routing ioi's and trade orders
KR102303711B1 (en) Method, system and non-transitory computer-readable recording medium for supporting securities short sale
US20230083351A1 (en) System and method for providing patent title insurance with centralized and distributed data architectures
GB2578168A (en) Computer-implemented method and system for digital signing of transactions
JP2023510320A (en) Systems and Methods for Secure Peer-to-Peer Transmission of Content in Distributed Ledger Networks
WO2021018312A1 (en) Blockchain-based over-the-counter transaction method and system, storage medium, and electronic apparatus
US20230098169A1 (en) System and method for providing patent title insurance with centralized and distributed data architectures
US20180285882A1 (en) Activity management systems and methods
US20220084128A1 (en) System and method for providing patent title insurance with centralized and distributed data architectures
US20170039650A1 (en) Method and system for the discovery, visualization, communication, alerting, capture and subsequent reporting of user actions and market information relating to the trading requirements and activities of investment management firms
WO2018170469A1 (en) Transaction settlement systems and methods

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20847511

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20847511

Country of ref document: EP

Kind code of ref document: A1