WO2019227609A1 - Blockchain-based smart stock purchase method, device, apparatus and storage medium - Google Patents

Blockchain-based smart stock purchase method, device, apparatus and storage medium Download PDF

Info

Publication number
WO2019227609A1
WO2019227609A1 PCT/CN2018/095354 CN2018095354W WO2019227609A1 WO 2019227609 A1 WO2019227609 A1 WO 2019227609A1 CN 2018095354 W CN2018095354 W CN 2018095354W WO 2019227609 A1 WO2019227609 A1 WO 2019227609A1
Authority
WO
WIPO (PCT)
Prior art keywords
contract
smart contract
smart
transaction
stock
Prior art date
Application number
PCT/CN2018/095354
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 to CN201810537960.XA priority Critical patent/CN108805713A/en
Priority to CN201810537960.X priority
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019227609A1 publication Critical patent/WO2019227609A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06QDATA PROCESSING SYSTEMS OR METHODS, SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06QDATA PROCESSING SYSTEMS OR METHODS, SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/405Establishing or using transaction specific rules

Abstract

The present application belongs to the technical field of blockchains and discloses a blockchain-based smart stock purchasing method. The method comprises the following steps: S1, receiving a contract condition selected by a first user on a client and adding the same to a preset contract template to generate a smart contract; S2, verifying the smart contract according to a preset verification rule; S3, if a verification result is successful, validating the smart contract and executing S4; S4, packaging and saving the validated smart contract to a node of a blockchain, and broadcasting the same via P2P to a block in which both parties of the smart contract are located in the blockchain; S5, executing a routine satisfying a triggering condition; S6, recording an operation executing the routine, and an execution result to a corresponding block and feeding back the same to clients of both parties of the smart contract. The method can be used to make an investment program more flexible, and overcome the limitations of a traditional broker to make investment simpler.

Description

基于区块链的智能股票申购方法、装置、设备及存储介质Intelligent stock purchase method, device, equipment and storage medium based on blockchain
本申请申明享有2018年5月30日递交的申请号为201810537960.X、名称为“基于区块链的智能股票申购方法、装置、设备及存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。This application affirms the priority of the Chinese patent application filed on May 30, 2018 with the application number 201810537960.X and the name "blockchain-based smart stock purchase method, device, equipment and storage medium", the Chinese patent The entire content of the application is incorporated herein by reference.
技术领域Technical field
本申请涉及区块链技术领域,涉及一种基于区块链的智能股票申购方法、装置、设备及存储介质。The present application relates to the field of blockchain technology, and relates to a method, a device, a device, and a storage medium for the purchase of smart stocks based on the blockchain.
背景技术Background technique
股票是一种有价证券,是股份公司在筹集资本时向出资人发行的股份凭证,代表着持有者对股份公司的所有权。而股票交易是指股票投资者之间按照市场价格对已发行上市的股票所进行的买卖。A stock is a kind of marketable securities. It is a share certificate issued by the stock company to the investor when raising capital, and represents the holder's ownership of the stock company. Stock trading refers to the buying and selling of stocks that have been issued and listed by stock investors at market prices.
如今股票作为一种重要的投资途径,被越来越多的投资者所青睐,投资者主要通过券商平台进行股票交易,只要在券商平台注册开户,即可通过电脑、智能手机等工具进行股票交易,操作简单快捷。Today, stocks, as an important investment channel, are favored by more and more investors. Investors mainly trade stocks through the brokerage platform. As long as they register and open an account with the brokerage platform, they can use the computer, smart phone and other tools to trade stocks , The operation is simple and fast.
但是,对于一些中小股票投资者而言,在券商平台上进行股票交易存在无法跨天买卖股票、多人合买等痛点。However, for some small and medium-sized stock investors, there are pain points in trading stocks on the brokerage platform, such as the inability to buy and sell stocks across the sky and multi-person syndication.
发明内容Summary of the invention
本申请要解决的技术问题是为了克服现有技术中中小股票投资者在券商平台无法跨天买卖股票及多人合买等问题,提出了一种基于区块链的智能股票申购方法、装置、设备及存储介质,实现灵活投资方案,打破传统券商的限制,并支持多人合买合卖一支股票、跟买的操作。The technical problem to be solved in this application is to overcome the problems that the medium and small stock investors in the prior art cannot buy and sell stocks across the sky and multi-person syndication on the brokerage platform, and proposes a blockchain-based intelligent stock purchase method, device, Equipment and storage media, to achieve flexible investment solutions, break the restrictions of traditional securities dealers, and support multi-person buy-and-sell stocks and buy-and-buy operations.
本申请是通过下述技术方案来解决上述技术问题:This application solves the above technical problems through the following technical solutions:
一种基于区块链的智能股票申购方法,包括以下步骤:A blockchain-based smart stock purchase method includes the following steps:
S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user ;
S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract;
S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束;S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly;
S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中涉及到的双方当事人所在的区块上;S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart The parties involved in the contract are on the same block;
S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;S5. Periodically traverse the execution status, transaction, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
一种电子装置,所述电子装置上存储有基于区块链的智能股票申购系统,所述基于区块链的智能股票申购系统包括:An electronic device stores a blockchain-based intelligent stock purchase system on the electronic device. The blockchain-based intelligent stock purchase system includes:
合约制定模块,用于接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;A contract formulation module is configured to receive a contract condition selected by a first user on a client and add it to a preset contract template to generate a smart contract. The contract condition includes at least two parties. When the smart contract is a sales contract, One party is a brokerage platform, and the other party is one or more users including the first user. When the smart contract is a viewing contract, one party is the other user and the other party is the Mentioned first user;
合约校验模块,用于根据预设的校验规则对智能合约进行校验,并将校 验结果反馈至所述智能合约中双方当事人的客户端;A contract verification module, configured to verify the smart contract according to a preset verification rule, and feedback the verification result to the clients of both parties in the smart contract;
判断模块,用于判断校验结果是否为校验通过;A judging module for judging whether the verification result is a verification pass;
合约保存模块,用于在校验结果为校验通过后,根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上;The contract saving module is used to package and store smart contracts that are established within the same contract saving interval on a blockchain node according to a preset contract saving interval after the verification result is passed. Broadcast to the block where the two parties in the smart contract and the smart contract are located by means of P2P;
合约执行模块,用于定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;A contract execution module is used to periodically traverse the execution status, transactions, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
记录模块,用于将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。The recording module is configured to record an operation and an execution result of executing the transaction in a corresponding block, and send the execution result to a client of both parties in the smart contract.
一种计算机设备,包括存储器和处理器,所述存储器上存储有可被所述处理器执行的基于区块链的智能股票申购系统,所述系统被所述处理器执行时实现以下步骤的操作:A computer device includes a memory and a processor. The memory stores a blockchain-based intelligent stock purchase system that can be executed by the processor. When the system is executed by the processor, the following steps are implemented. :
S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user ;
S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract;
S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束;S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly;
S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中涉及到的双方当事人所在的区块上;S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart The parties involved in the contract are on the same block;
S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;S5. Periodically traverse the execution status, transaction, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序指令,所述计算机程序指令可被一个或多个处理器执行,以使所述至少一个处理器执行以下步骤的操作:A computer-readable storage medium stores computer program instructions in the computer-readable storage medium, and the computer program instructions are executable by one or more processors, so that the at least one processor performs operations of the following steps. :
S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user ;
S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract;
S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束;S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly;
S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中涉及到的双方当事人所在的区块上;S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart The parties involved in the contract are on the same block;
S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;S5. Periodically traverse the execution status, transaction, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
本申请的积极进步效果在于:The positive progress effect of this application lies in:
1)通过本申请的使用,可以使得投资方案更灵活,打破传统券商的限制,让投资更简单。1) Through the use of this application, the investment scheme can be made more flexible, the restrictions of traditional brokerage firms can be broken, and investment can be made simpler.
2)通过本申请可以支持多人合买/合卖一支股票以及跟买的操作。2) Through this application, it is possible to support multi-person joint buying / selling of one stock and follow-up buying operations.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1示出了本申请基于区块链的智能股票申购方法实施例一的流程图;FIG. 1 shows a flowchart of Embodiment 1 of a smart stock subscription method based on a blockchain in the present application;
图2示出了本申请基于区块链的智能股票申购方法实施例二的流程图;FIG. 2 shows a flowchart of a second embodiment of a smart stock subscription method based on a blockchain according to the present application;
图3示出了本申请基于区块链的智能股票申购方法实施例三的流程图;FIG. 3 shows a flowchart of a third embodiment of a smart stock subscription method based on a blockchain according to the present application;
图4示出了本申请电子装置中基于区块链的智能股票申购系统第一实施例的程序模块示意图;4 shows a schematic diagram of a program module of a first embodiment of a smart stock application system based on a blockchain in an electronic device of the present application;
图5示出了本申请计算机设备一实施例的硬件架构示意图。FIG. 5 is a schematic diagram of a hardware architecture of a computer device according to an embodiment of the present application.
具体实施方式Detailed ways
下面通过实施例的方式进一步说明本申请,但并不因此将本申请限制在所述的实施例范围之中。The following further describes the present application by way of examples, but the present application is not limited to the scope of the examples.
首先,本申请提出一种基于区块链的智能股票申购方法。First, this application proposes a smart stock purchase method based on the blockchain.
在实施例一中,如图1所示,所述的基于区块链的智能股票申购方法包括如下步骤:In the first embodiment, as shown in FIG. 1, the blockchain-based smart stock purchase method includes the following steps:
S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户。S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user .
这里所述第一用户中的“第一”没有特指的意思,仅作为与其他用户的区别使用。所述另一个用户是指区别与所述第一用户的其他用户。The “first” in the first user mentioned here has no specific meaning, and is only used as a difference from other users. The another user refers to another user that is different from the first user.
所述智能合约是指一份能自动执行本需要手动才能完成任务的协议。智能合约就是任何能自行执行部分功能的协议。例如,一份能自动计算合同当 事人待付金额,并安排支付这笔金额的合约。智能合约的使用将减少协议执行过程中的人工干预。The smart contract refers to an agreement that can automatically execute tasks that require manual completion. A smart contract is any protocol that can perform some functions on its own. For example, a contract that automatically calculates the amount to be paid by the parties to a contract and arranges for payment of that amount. The use of smart contracts will reduce manual intervention during protocol execution.
所述合约条件预设在客户端中,包括双方当事人、券商平台、生效时间范围、锚定的股票编号、股票买入或卖出价位、购买股票数量以及触发买入或卖出的股票价位等等。The contract conditions are preset in the client, including the parties, the brokerage platform, the effective time range, the anchored stock number, the stock purchase or offer price, the number of shares purchased, and the price of the stock that triggered the purchase or sale, etc. Wait.
用户登录到客户端后,可以客户端中进行选择,并可以根据需要赋予各合约条件以逻辑关系。After the user logs in to the client, he can choose among the clients, and can give each contract condition a logical relationship as required.
例如:客户设置股票的买入条件为,在两天内某个股票编号的价格低于15.8元就买入,这里要求时间限制是两天内,同时还有满足价格低于15.8元;For example: The customer sets the purchase conditions for stocks to buy within a two-day period when the price of a stock code is less than 15.8 yuan. The time limit here is two days, and the price is less than 15.8 yuan.
再例如:客户设置股票的买入条件为,买入价格低于15.8元的A股票或者B股票,优先买入达到该条件的价格更低的股票。Another example: The customer sets the stock purchase conditions as follows: A stock or B stock with a price lower than 15.8 yuan is preferentially purchased with lower price stocks that meet this condition.
由于股票买卖必须要在券商平台上进行,因而当智能合约是关于买入或卖出股票的买卖型合约时,所述在合约条件中,券商平台作为一方当事人是必不可少的,而且该券商平台应该选择用户开设有账户的券商平台。Since stock trading must be conducted on the brokerage platform, when the smart contract is a sales and purchase type contract for buying or selling stocks, as stated in the contract conditions, the brokerage platform is indispensable as a party, and the brokerage firm The platform should choose the brokerage platform where the user has an account.
另一方当事人可以是一个用户,也可以是多个用户,特别是当多人合买合卖一支股票时,所述另一方当事人就可以是这个进行合买合卖一支股票的多人。The other party may be one user or multiple users, and especially when multiple persons buy and sell one stock, the other party may be the multiple persons who buy and sell one stock.
除了关于买卖股票的智能合约以外,还可以是关于跟买股票的查看型合约,这里所述跟买并不是指直接跟随某个用户进行股票买卖,而是指查看某个用户的买卖记录,供查看方参考是否要跟随。因此,所述一方当事人为具体的某个用户,即被查看方。而另一方当事人就是所述第一用户,即查看方。In addition to the smart contract for buying and selling stocks, it can also be a viewing contract for buying and selling stocks. The buying here does not refer to directly following a user to buy or sell stocks, but to view the buying and selling records of a user. See if the side reference wants to follow. Therefore, the party is a specific user, that is, the party being viewed. The other party is the first user, that is, the viewing party.
需要注意的是,当另一方当事人为多人时,发起制定智能合约的用户必须这多人中一个。It should be noted that when the other party is multiple people, the user who initiated the smart contract must be one of these people.
S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端。S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract.
这里,所述校验规则如下:Here, the verification rules are as follows:
校验智能合约的结构,如智能合约的字节是否超标、格式是否正确;Verify the structure of the smart contract, such as whether the bytes of the smart contract exceed the standard and the format is correct;
校验资金是否满足投资计划,即智能合约中涉及到的各用户在所述券商上设立的账户中的资金总额是否大于或等于投资计划所需的资金总额;Verify whether the funds meet the investment plan, that is, whether the total amount of funds in the account established by each user involved in the smart contract in the brokerage firm is greater than or equal to the total amount of funds required by the investment plan;
校验股票编号是否真实存在;Check whether the stock number really exists;
校验投资时间是否合法(大于当前时间),即智能合约中所写的生效时间是否大于当前时间;Check whether the investment time is legal (greater than the current time), that is, whether the effective time written in the smart contract is greater than the current time;
校验智能合约即将存入的区块链是否合法;Verify whether the blockchain that the smart contract is about to deposit is legal;
校验智能合约中的合约条件是否经所有当事人的同意确认。Check whether the contract conditions in the smart contract are confirmed by the consent of all parties.
S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束。S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly.
所述校验通过要求所述智能合约满足下述全部校验规则:The verification passes that the smart contract meets all the following verification rules:
所述智能合约的字节没有超标;The bytes of the smart contract are not exceeded;
所述智能合约的格式正确;The format of the smart contract is correct;
所述智能合约中涉及到的各用户在所述券商上设立的账户中的资金总额满足投资计划;The total amount of funds in the accounts set up by each user involved in the smart contract in the brokerage firm satisfies the investment plan;
所述智能合约中涉及到的股票编号真实存在;The stock number involved in the smart contract exists;
所述智能合约中所写的生效时间大于当前时间;The effective time written in the smart contract is greater than the current time;
所述智能合约即将存入的区块链合法;The blockchain that the smart contract is about to deposit is legal;
所述智能合约中的合约条件经所有当事人的同意确认。The contract conditions in the smart contract are confirmed by the consent of all parties.
只要有一项校验不通过,则所述智能合约的校验结果为校验失败,该智能合约不成立。As long as one check fails, the verification result of the smart contract is that the verification fails, and the smart contract is not established.
S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上。S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart On the block where both parties are in the contract.
所述区块链(Blockchain)是分布式数据存储、点对点传输、共识机制、加 密算法等计算机技术的新型应用模式。The Blockchain is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithms.
所述S4为智能合约在区块链中的保存方式,属于现有技术,已被广泛应用,此处不再赘述。各区块中保存的内容除了智能合约本身的内容以外,还包括该智能合约记录对应的时间戳。The S4 is a storage method of the smart contract in the blockchain, which belongs to the prior art and has been widely used, and will not be repeated here. In addition to the content of the smart contract itself, the content saved in each block also includes the time stamp corresponding to the smart contract record.
S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务。S5. Periodically traverse the execution status, transaction, and trigger condition of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction.
由于是定期逐条遍历,因此通常需要预设遍历的循环时间。Because it is traversed one by one periodically, it is usually necessary to preset the cycle time of the traversal.
所述执行状态指合约是否生效。合约成立并不等于合约生效,股票申购方可以在智能合约中设置合约的生效日期,比如合约成立于2018.1.1,但股份申购方在合约中声明该合约自2018.2.1起开始执行。The execution status refers to whether the contract is effective. The establishment of a contract does not mean that the contract becomes effective. The stock purchaser can set the effective date of the contract in the smart contract. For example, the contract is established on 2018.1.1, but the stock purchaser declares that the contract will be implemented from 2018.2.1.
所述事务就是指买入或卖出股票的请求,查看某个用户的交易请求等。The transaction refers to a request to buy or sell a stock, to view a transaction request of a certain user, and the like.
所述触发条件就是指买入或卖出股票的请求的生成所要满足的条件,比如当股票代码为100000的股票低于或等于合约中约定的买入价,且买入方的账户中大于或等于实际买入价总额的时候,就表示事务满足触发条件。The trigger condition refers to a condition to be satisfied in generating a request to buy or sell stocks, for example, when the stock code of 100,000 is lower than or equal to the purchase price agreed in the contract, and the buyer ’s account is greater than or When the total purchase price is equal to the total purchase price, it means that the transaction meets the trigger condition.
S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
为防止交易记录被篡改,执行事务的每一个操作和结果,都会被记录到对应的区块中,并将结果发送给各相关用户知晓。To prevent transaction records from being tampered, every operation and result of executing a transaction will be recorded in the corresponding block, and the results will be sent to each relevant user to know.
所述对应的区块就是指各用户和券商平台所在的区块。The corresponding block refers to the block where each user and the brokerage platform are located.
在实施例二中,基于实施例一的基础上,如图2所示,当所述智能合约为买卖型合约时,所述事务为买入或卖出股票的请求,此时S5包括以下分步骤:In the second embodiment, based on the first embodiment, as shown in FIG. 2, when the smart contract is a buying and selling type contract, the transaction is a request to buy or sell a stock. At this time, S5 includes the following points: step:
S511、判断智能合约中的是否仅涉及一个用户,若是执行S515,若否则执行S512。S511. Determine whether only one user is involved in the smart contract. If S515 is performed, otherwise S512 is performed.
如果涉及到多方合买或合卖,则需要在券商平台上建有供多方共享的共 享账号,因此这里需要区分是否仅涉及一个用户。If multi-party joint buying or selling is involved, a shared account for multi-party sharing needs to be established on the brokerage platform, so it is necessary to distinguish here whether only one user is involved.
S512、向智能合约中涉及到的券商平台发送共享账号查询请求,若查询到则执行S514,若查询不到则执行S513;S512. Send a shared account query request to the brokerage platform involved in the smart contract. If the query is found, S514 is executed; if the query is not found, S513 is executed;
所述共享账号为由智能合约中涉及到的各用户共同作为一个股票交易方所共享的账号。The shared account is an account shared by each user involved in the smart contract as a stock transaction party.
S513、指示券商平台创建一个所述共享账户。S513. Instruct the brokerage platform to create one of the shared accounts.
所述共享账号独立于每个用户在券商平台上开设的个人账号,是新建的独立账号,该账号可供这多个用户查看,即这多个用户都拥有查看该共享账号的权限。The shared account is independent of each user's personal account opened on the brokerage platform, and is a newly created independent account that can be viewed by multiple users, that is, the multiple users have the right to view the shared account.
共享账号中的资金来自于有查看权限查看的多个用户的个人账号,即当建立共享账号后,还要将涉及到的各用户的个人账号中的资金按智能合约的约定划入到该共享账号中。The funds in the shared account come from the personal accounts of multiple users who have viewing rights to view, that is, after the shared account is established, the funds in the personal accounts of each user involved must be transferred to the share according to the agreement of the smart contract. Account.
S514、向券商平台发送以所述共享账号作为一个股票交易方的股票交易执行请求,并把该操作记录到各对应的区块中。S514. Send a stock transaction execution request using the shared account as a stock transaction party to the brokerage platform, and record the operation in each corresponding block.
S515、向券商平台发送以所述用户在券商平台上开立的账号作为股票交易方的股票交易执行请求,并把该条操作记录到对应的区块中。S515. Send a stock transaction execution request to the brokerage platform using the account opened by the user on the brokerage platform as a stock transaction party, and record the operation in a corresponding block.
当另一方当事人为一个用户时,则股票买卖直接在券商平台上开立的其个人账号中操作。When the other party is a user, the stock trading is operated directly in its personal account opened on the brokerage platform.
所述对应的区块是指智能合约涉及到的各用户和券商平台所在的区块。The corresponding block refers to the block where each user and the brokerage platform involved in the smart contract are located.
在实施例三中,基于实施例一的基础上,如图3所示,当所述智能合约为查看型合约时,所述事务为查看该用户的交易记录的请求(即俗称的跟买/跟卖操作),此时S5包括以下分步骤:In the third embodiment, based on the first embodiment, as shown in FIG. 3, when the smart contract is a view-type contract, the transaction is a request to view a transaction record of the user (that is, commonly known as a follow-up buy / Follow-up operation), at this time S5 includes the following sub-steps:
S521、接收作为查看方的用户通过客户端发送的记录查看请求,所述请求包括共享方识别码和智能合约识别码。S521. Receive a record viewing request sent by a user who is a viewing party through a client, where the request includes a sharing party identification code and a smart contract identification code.
为了区别各用户和智能合约,会给各个用户和智能合约进行编码区分, 即分配所述的识别码,每个用户和智能合约都会对应一个唯一的识别码。In order to distinguish each user and the smart contract, each user and the smart contract are coded and distinguished, that is, the identification code is allocated, and each user and the smart contract will correspond to a unique identification code.
发送记录查看请求时,请求中会包含共享方识别码和智能合约识别码,共享方和智能合约由作为查看方的用户设定。When sending a record viewing request, the request will include the sharer ID and smart contract ID, and the sharer and smart contract are set by the user who is the viewer.
S522、通过所述智能合约识别码调取相关的智能合约。S522. Retrieve a related smart contract through the smart contract identification code.
所述智能合约保存在区块链中一个节点上,通过智能合约识别码可以直接查找到。The smart contract is stored on a node in the blockchain and can be found directly through the smart contract identification code.
S523、根据所述智能合约中的合约条件判断所述记录查看请求是否真实有效,若是则从记录作为共享方的用户所在的区块链节点上,调取该用户的股票交易记录。S523. Determine whether the record viewing request is true and valid according to the contract conditions in the smart contract, and if yes, retrieve the user's stock transaction record from the blockchain node where the user whose record is the sharer is located.
由于智能合约中可以设定合约的有效期限,此外作为智能合约中的当事人一方也可以毁约。但是区块链的特性是会将每一次的修改/操作都记录下来不会删除,所以在智能合约失效或被毁约后,该智能合约还是存在于区块链中,因此要确认智能合约是否为真实有效,只有在智能合约有效的情况下,才能执行下一步操作(作为共享方的用户的股票交易记录)。Since the validity period of the contract can be set in the smart contract, in addition, as a party in the smart contract, the contract can be broken. However, the characteristic of the blockchain is that every modification / operation is recorded and will not be deleted. Therefore, after the smart contract is invalidated or broken, the smart contract still exists in the blockchain, so it is necessary to confirm whether the smart contract is Real and effective, only when the smart contract is valid, the next operation can be performed (the stock transaction record of the user as the sharing party).
S524、将调取的股票交易记录发送至作为查看方的用户的客户端上。S524: Send the retrieved stock transaction record to the client of the user who is the viewing party.
其次,本申请提出了一种电子装置,所述电子装置上存储有基于区块链的智能股票申购系统20,所述系统20可以被分割为一个或者多个程序模块。Secondly, this application proposes an electronic device. The electronic device stores a smart stock subscription system 20 based on a blockchain. The system 20 can be divided into one or more program modules.
例如,图4示出了所述基于区块链的智能股票申购系统20第一实施例的程序模块示意图,该实施例中,所述系统20可以被分割为合约制定模块201、合约校验模块202、判断模块203、合约保存模块204、合约执行模块205和记录模块206。其中,本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段。以下描述将具体介绍所述程序模块201-206的具体功能。For example, FIG. 4 shows a schematic diagram of a program module of the first embodiment of the blockchain-based smart stock purchase system 20. In this embodiment, the system 20 can be divided into a contract formulation module 201 and a contract verification module. 202. A judgment module 203, a contract saving module 204, a contract execution module 205, and a recording module 206. Among them, the program module referred to in the present application refers to a series of computer program instruction segments capable of performing specific functions. The following description will specifically introduce the specific functions of the program modules 201-206.
所述合约制定模块201用于接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人, 当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;The contract formulation module 201 is configured to receive a contract condition selected by a first user on a client and add it to a preset contract template to generate a smart contract. The contract condition includes at least two parties. When the smart contract is a sales contract When one of the parties is a brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one of the parties is the other user and the other party is Is the first user;
所述合约校验模块202用于根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;The contract verification module 202 is configured to verify a smart contract according to a preset verification rule, and feed the verification result to a client of both parties in the smart contract;
所述判断模块203用于判断校验结果是否为校验通过;The judging module 203 is configured to judge whether the verification result is a verification pass;
所述合约保存模块204用于在校验结果为校验通过后,根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上;The contract saving module 204 is configured to package and store smart contracts established within the same contract saving time interval on a blockchain node according to a preset contract saving time interval after the verification result is passed. , And broadcast to the block where the two parties in the smart contract are located in the blockchain through P2P;
所述合约执行模块205用于定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;The contract execution module 205 is used to periodically traverse the execution status, transaction, and trigger conditions of each established smart contract one by one, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
所述记录模块206用于将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。The recording module 206 is configured to record an operation and an execution result of executing the transaction in a corresponding block, and send the execution result to a client of both parties in the smart contract.
再次,本申请还提出来一种计算机设备。Again, this application also proposes a computer device.
参阅图5所示,是本申请计算机设备一实施例的硬件架构示意图。本实施例中,所述计算机设备2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。例如,可以是智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图所示,所述计算机设备2至少包括,但不限于,可通过系统总线相互通信连接存储器21、处理器22、网络接口23、以及基于区块链的智能股票申购系统20。其中:FIG. 5 is a schematic diagram of a hardware architecture of a computer device according to an embodiment of the present application. In this embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and / or information processing in accordance with an instruction set or stored in advance. For example, it can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of multiple servers). As shown in the figure, the computer device 2 includes at least, but is not limited to, a memory 21, a processor 22, a network interface 23, and a smart stock subscription system 20 based on a blockchain that can communicate with each other through a system bus. among them:
所述存储器21至少包括一种类型的计算机可读存储介质,所述可读存 储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器21可以是所述计算机设备2的内部存储单元,例如该计算机设备2的硬盘或内存。在另一些实施例中,所述存储器21也可以是所述计算机设备2的外部存储设备,例如该计算机设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器21还可以既包括所述计算机设备2的内部存储单元也包括其外部存储设备。本实施例中,所述存储器21通常用于存储安装于所述计算机设备2的操作系统和各类应用软件,例如所述基于区块链的智能股票申购系统20的程序代码等。此外,所述存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 21 includes at least one type of computer-readable storage medium. The readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a random access memory (RAM), Static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, etc. In some embodiments, the memory 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, Flash card, etc. Of course, the memory 21 may also include both an internal storage unit of the computer device 2 and an external storage device thereof. In this embodiment, the memory 21 is generally used to store an operating system and various types of application software installed on the computer device 2, such as program codes of the blockchain-based smart stock purchase system 20. In addition, the memory 21 may also be used to temporarily store various types of data that have been output or will be output.
所述处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制所述计算机设备2的总体操作,例如执行与所述计算机设备2进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器22用于运行所述存储器21中存储的程序代码或者处理数据,例如运行所述的基于区块链的智能股票申购系统20等。The processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 22 is generally used to control the overall operation of the computer device 2, for example, to perform control and processing related to data interaction or communication with the computer device 2. In this embodiment, the processor 22 is configured to run program code or process data stored in the memory 21, for example, to run the blockchain-based intelligent stock purchase system 20 and the like.
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述计算机设备2与其他计算机设备之间建立通信连接。例如,所述网络接口23用于通过网络将所述计算机设备2与外部终端相连,在所述计算机设备2与外部终端之间的建立数据传输通道和通信连接等。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、 Wi-Fi等无线或有线网络。The network interface 23 may include a wireless network interface or a wired network interface. The network interface 23 is generally used to establish a communication connection between the computer device 2 and other computer devices. For example, the network interface 23 is configured to connect the computer device 2 and an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 2 and the external terminal. The network may be an Intranet, the Internet, a Global System for Mobile Communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, 5G Wireless, or wired networks such as Internet, Bluetooth, Wi-Fi.
需要指出的是,图5仅示出了具有组件21-23的计算机设备2,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。It should be noted that FIG. 5 only shows the computer device 2 with components 21-23, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
在本实施例中,存储于存储器21中的所述基于区块链的智能股票申购系统20可以被一个或多个处理器(本实施例为处理器22)所执行,以完成上述基于区块链的智能股票申购方法的操作。In this embodiment, the blockchain-based smart stock purchase system 20 stored in the memory 21 may be executed by one or more processors (processor 22 in this embodiment) to complete the above-mentioned block-based The operation of the smart stock purchase method of the chain.
此外,本申请一种计算机可读存储介质,所述计算机可读存储介质为易失性存储介质,其内存储有计算机程序指令,所述计算机程序指令可被一个或多个处理器执行,以使所述至少一个处理器执行如前述任一项所述的基于区块链的智能股票申购方法的步骤。In addition, a computer-readable storage medium is provided in the present application. The computer-readable storage medium is a volatile storage medium that stores therein computer program instructions that can be executed by one or more processors to The at least one processor is caused to execute the steps of the blockchain-based smart stock purchase method according to any one of the foregoing.
虽然以上描述了本申请的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本申请的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本申请的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本申请的保护范围。Although the specific implementation of the present application is described above, those skilled in the art should understand that this is only an example, and the protection scope of the present application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of this application, but these changes and modifications all fall into the protection scope of this application.

Claims (20)

  1. 一种基于区块链的智能股票申购方法,其特征在于,包括以下步骤:A method for intelligent stock purchase based on a blockchain is characterized in that it includes the following steps:
    S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user ;
    S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract;
    S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束;S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly;
    S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上;S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart On the block where the two parties in the contract are located;
    S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;S5. Periodically traverse the execution status, transaction, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
    S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
  2. 根据权利要求1所述的基于区块链的智能股票申购方法,其特征在于,所述合约条件还包括生效时间范围、锚定的股票编号、股票买入或卖出价位、购买股票数量以及触发买入或卖出的股票价位。The method of claim 1 based on a blockchain-based smart stock purchase, wherein the contract conditions further include an effective time range, an anchored stock number, a stock buy or sell price, the number of stocks purchased, and a trigger The price at which the stock was bought or sold.
  3. 根据权利要求2所述的基于区块链的智能股票申购方法,其特征在于,所述校验通过要求所述智能合约满足下述全部校验规则:所述智能合约的字节没有超标;所述智能合约的格式正确;所述智能合约中涉及到的各用户在所述券商上设立的账户中的资金总额满足投资计划;所述智能合约中涉 及到的股票编号真实存在;所述智能合约中所写的生效时间大于当前时间;所述智能合约即将存入的区块链合法;所述智能合约中的合约条件经所有当事人的同意确认。The method for purchasing a smart stock based on a blockchain according to claim 2, wherein the verification is performed by requiring the smart contract to meet all of the following verification rules: the bytes of the smart contract are not exceeded; The format of the smart contract is correct; the total funds in the accounts established by the users involved in the smart contract in the smart contract meet the investment plan; the stock numbers involved in the smart contract exist; the smart contract The effective time written in is greater than the current time; the blockchain to be stored in the smart contract is legal; the contract conditions in the smart contract are confirmed by the consent of all parties.
  4. 根据权利要求1所述的基于区块链的智能股票申购方法,其特征在于,当所述智能合约为买卖型合约时,所述事务为买入或卖出股票的请求。The method for purchasing a smart stock based on a blockchain according to claim 1, wherein when the smart contract is a buying and selling type contract, the transaction is a request to buy or sell a stock.
  5. 根据权利要求4所述的基于区块链的智能股票申购方法,其特征在于,当所述事务为买入或卖出股票的请求时,所述S5包括以下分步骤:The method of claim 4 for intelligent stock purchase based on a blockchain, wherein when the transaction is a request to buy or sell a stock, the S5 includes the following sub-steps:
    S511、判断智能合约中的是否仅涉及一个用户,若是执行S515,若否则执行S512;S511. Determine whether only one user is involved in the smart contract. If S515 is performed, otherwise S512 is performed.
    S512、向智能合约中涉及到的券商平台发送共享账号查询请求,若查询到则执行S514,若查询不到则执行S513;所述共享账号为由智能合约中涉及到的各用户共同作为一个股票交易方所共享的账号;S512. Send a shared account query request to the brokerage platform involved in the smart contract. If the query is found, S514 is executed. If the query is not found, S513 is executed. The shared account is used by the users involved in the smart contract as a share. Accounts shared by trading parties;
    S513、指示券商平台创建一个所述共享账户;S513. Instruct the brokerage platform to create one of the shared accounts;
    S514、向券商平台发送以所述共享账号作为一个股票交易方的股票交易执行请求,并把该操作记录到各对应的区块中;S514. Send a stock transaction execution request using the shared account as a stock transaction party to the brokerage platform, and record the operation in each corresponding block;
    S515、向券商平台发送以所述用户在券商平台上开立的账号作为股票交易方的股票交易执行请求,并把该条操作记录到对应的区块中。S515. Send a stock transaction execution request to the brokerage platform using the account opened by the user on the brokerage platform as a stock transaction party, and record the operation in a corresponding block.
  6. 根据权利要求1所述的基于区块链的智能股票申购方法,其特征在于,当所述智能合约为查看型合约时,所述事务为查看该用户的交易记录的请求。The method for purchasing a smart stock based on a blockchain according to claim 1, wherein when the smart contract is a viewing contract, the transaction is a request to view a transaction record of the user.
  7. 根据权利要求6所述的基于区块链的智能股票申购方法,其特征在于,当所述事务为查看其他用户的交易记录的请求时,所述S5包括以下分步骤:The method for purchasing a smart stock based on a blockchain according to claim 6, characterized in that when the transaction is a request to view transaction records of other users, the S5 includes the following sub-steps:
    S521、接收作为查看方的用户通过客户端发送的记录查看请求,所述请求包括共享方识别码和智能合约识别码;S521. Receive a record viewing request sent by a user who is a viewing party through a client, where the request includes a sharing party identification code and a smart contract identification code;
    S522、通过所述智能合约识别码调取相关的智能合约;S522. Retrieve a related smart contract through the smart contract identification code;
    S523、根据所述智能合约中的合约条件判断所述记录查看请求是否真实有效,若是则从记录作为共享方的用户所在的区块链节点上,调取该用户的股票交易记录;S523: Determine whether the record viewing request is true and valid according to the contract conditions in the smart contract, and if yes, retrieve the user's stock transaction record from the blockchain node where the record is shared by the user;
    S524、将调取的股票交易记录发送至作为查看方的用户的客户端上。S524: Send the retrieved stock transaction record to the client of the user who is the viewing party.
  8. 一种电子装置,其特征在于,所述电子装置上存储有基于区块链的智能股票申购系统,所述基于区块链的智能股票申购系统包括:An electronic device is characterized in that the electronic device stores a smart stock subscription system based on a blockchain, and the smart stock subscription system based on a blockchain includes:
    合约制定模块,用于接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;A contract formulation module is configured to receive a contract condition selected by a first user on a client and add it to a preset contract template to generate a smart contract. The contract condition includes at least two parties. When the smart contract is a sales contract, One party is a brokerage platform, and the other party is one or more users including the first user. When the smart contract is a viewing contract, one party is the other user and the other party is the Mentioned first user;
    合约校验模块,用于根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;A contract verification module, configured to verify the smart contract according to a preset verification rule, and feedback the verification result to the clients of both parties in the smart contract;
    判断模块,用于判断校验结果是否为校验通过;A judging module for judging whether the verification result is a verification pass;
    合约保存模块,用于在校验结果为校验通过后,根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上;The contract saving module is used to package and store smart contracts that are established within the same contract saving interval on a blockchain node according to a preset contract saving interval after the verification result is passed. Broadcast to the block where the two parties in the smart contract and the smart contract are located by means of P2P;
    合约执行模块,用于定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;A contract execution module is used to periodically traverse the execution status, transactions, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
    记录模块,用于将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。The recording module is configured to record an operation and an execution result of executing the transaction in a corresponding block, and send the execution result to a client of both parties in the smart contract.
  9. 一种计算机设备,包括存储器和处理器,其特征在于,所述存储器上存储有可被所述处理器执行的基于区块链的智能股票申购系统,所述系统被所述处理器执行时实现以下步骤的操作:A computer device includes a memory and a processor, wherein the memory stores a blockchain-based intelligent stock purchase system that can be executed by the processor, and is implemented when the system is executed by the processor. The following steps:
    S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user ;
    S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract;
    S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束;S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly;
    S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上;S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart On the block where the two parties in the contract are located;
    S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;S5. Periodically traverse the execution status, transaction, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
    S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
  10. 根据权利要求9所述的计算机设备,其特征在于,所述合约条件还包括生效时间范围、锚定的股票编号、股票买入或卖出价位、购买股票数量以及触发买入或卖出的股票价位;The computer device according to claim 9, wherein the contract conditions further include an effective time range, an anchored stock number, a stock buy or sell price level, a number of purchased stocks, and a stock triggered to buy or sell Price
    所述校验通过要求所述智能合约满足下述全部校验规则:所述智能合约的字节没有超标;所述智能合约的格式正确;所述智能合约中涉及到的各用户在所述券商上设立的账户中的资金总额满足投资计划;所述智能合约中涉及到的股票编号真实存在;所述智能合约中所写的生效时间大于当前时间;所述智能合约即将存入的区块链合法;所述智能合约中的合约条件经所有当事人的同意确认。The verification requires that the smart contract meets all of the following verification rules: the bytes of the smart contract are not exceeded; the format of the smart contract is correct; each user involved in the smart contract is at the brokerage firm The total amount of funds in the account set up above meets the investment plan; the stock numbers involved in the smart contract exist; the effective time written in the smart contract is greater than the current time; the blockchain that the smart contract is about to deposit Legal; the contract conditions in the smart contract are confirmed by the consent of all parties.
  11. 根据权利要求9所述的计算机设备,其特征在于,当所述智能合约 为买卖型合约时,所述事务为买入或卖出股票的请求。The computer device according to claim 9, characterized in that, when the smart contract is a purchase and sale type contract, the transaction is a request to buy or sell a stock.
  12. 根据权利要求11所述的计算机设备,其特征在于,当所述事务为买入或卖出股票的请求时,所述S5包括以下分步骤:The computer device according to claim 11, wherein when the transaction is a request to buy or sell stock, the S5 includes the following sub-steps:
    S511、判断智能合约中的是否仅涉及一个用户,若是执行S515,若否则执行S512;S511. Determine whether only one user is involved in the smart contract. If S515 is performed, otherwise S512 is performed.
    S512、向智能合约中涉及到的券商平台发送共享账号查询请求,若查询到则执行S514,若查询不到则执行S513;所述共享账号为由智能合约中涉及到的各用户共同作为一个股票交易方所共享的账号;S512. Send a shared account query request to the brokerage platform involved in the smart contract. If the query is found, S514 is executed. If the query is not found, S513 is executed. The shared account is used by the users involved in the smart contract as a share. Accounts shared by trading parties;
    S513、指示券商平台创建一个所述共享账户;S513. Instruct the brokerage platform to create one of the shared accounts;
    S514、向券商平台发送以所述共享账号作为一个股票交易方的股票交易执行请求,并把该操作记录到各对应的区块中;S514. Send a stock transaction execution request using the shared account as a stock transaction party to the brokerage platform, and record the operation in each corresponding block;
    S515、向券商平台发送以所述用户在券商平台上开立的账号作为股票交易方的股票交易执行请求,并把该条操作记录到对应的区块中。S515. Send a stock transaction execution request to the brokerage platform using the account opened by the user on the brokerage platform as a stock transaction party, and record the operation in a corresponding block.
  13. 根据权利要求9所述的计算机设备,其特征在于,当所述智能合约为查看型合约时,所述事务为查看该用户的交易记录的请求。The computer device according to claim 9, wherein when the smart contract is a viewing contract, the transaction is a request to view a transaction record of the user.
  14. 根据权利要求13所述的计算机设备,其特征在于,当所述事务为查看其他用户的交易记录的请求时,所述S5包括以下分步骤:The computer device according to claim 13, wherein when the transaction is a request to view transaction records of other users, the S5 includes the following sub-steps:
    S521、接收作为查看方的用户通过客户端发送的记录查看请求,所述请求包括共享方识别码和智能合约识别码;S521. Receive a record viewing request sent by a user who is a viewing party through a client, where the request includes a sharing party identification code and a smart contract identification code;
    S522、通过所述智能合约识别码调取相关的智能合约;S522. Retrieve a related smart contract through the smart contract identification code;
    S523、根据所述智能合约中的合约条件判断所述记录查看请求是否真实有效,若是则从记录作为共享方的用户所在的区块链节点上,调取该用户的股票交易记录;S523: Determine whether the record viewing request is true and valid according to the contract conditions in the smart contract, and if yes, retrieve the user's stock transaction record from the blockchain node where the record is shared by the user;
    S524、将调取的股票交易记录发送至作为查看方的用户的客户端上。S524: Send the retrieved stock transaction record to the client of the user who is the viewing party.
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序指令,所述计算机程序指令可被一个或多个处理器执 行,以使所述至少一个处理器执行以下步骤的操作:A computer-readable storage medium, characterized in that computer program instructions are stored in the computer-readable storage medium, and the computer program instructions are executable by one or more processors, so that the at least one processor executes The following steps:
    S1、接收第一用户在客户端上选择的合约条件加入到预设的合约模板中生成智能合约;所述合约条件至少包括双方当事人,当所述智能合约为买卖型合约时,其中一方当事人为券商平台,另一方当事人为包含所述第一用户在内的一个或多个用户;当所述智能合约为查看型合约时,其中一方当事人为另一用户,另一方当事人为所述第一用户;S1. Receive the contract conditions selected by the first user on the client and add them to a preset contract template to generate a smart contract. The contract conditions include at least two parties. When the smart contract is a sales contract, one of the parties is On the brokerage platform, the other party is one or more users including the first user; when the smart contract is a viewing contract, one party is another user and the other party is the first user ;
    S2、根据预设的校验规则对智能合约进行校验,并将校验结果反馈至所述智能合约中双方当事人的客户端;S2. The smart contract is verified according to a preset verification rule, and the verification result is fed back to the clients of both parties in the smart contract;
    S3、判断校验结果是否为校验通过,若是则智能合约成立并执行S4,若否则智能合约不成立并直接结束;S3. Determine whether the verification result is a verification pass. If it is, the smart contract is established and S4 is executed; otherwise, the smart contract is not established and ends directly;
    S4、根据预设的合约保存时间间隔,将位于同一个合约保存时间间隔内成立的智能合约打包存入一个区块链的节点上,并通过P2P的方式广播到区块链中与所述智能合约中双方当事人所在的区块上;S4. According to a preset contract retention time interval, the smart contracts established within the same contract retention time interval are packaged and stored on a blockchain node, and broadcast to the blockchain through the P2P method with the smart On the block where the two parties in the contract are located;
    S5、定期逐条遍历各成立的智能合约的执行状态、事务和触发条件,并判断所述事务是否满足所述触发条件,若满足则执行所述事务;S5. Periodically traverse the execution status, transaction, and trigger conditions of each established smart contract, and determine whether the transaction meets the trigger condition, and if it is satisfied, execute the transaction;
    S6、将执行所述事务的操作和执行结果记录到对应的区块中,同时将所述执行结果发送至所述智能合约中双方当事人的客户端。S6. Record the operation and execution result of executing the transaction in the corresponding block, and send the execution result to the clients of both parties in the smart contract.
  16. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述合约条件还包括生效时间范围、锚定的股票编号、股票买入或卖出价位、购买股票数量以及触发买入或卖出的股票价位;The computer-readable storage medium according to claim 15, wherein the contract conditions further include a valid time range, an anchored stock number, a stock buying or selling price level, the number of stocks to be purchased, and triggering a buying or selling The stock price;
    所述校验通过要求所述智能合约满足下述全部校验规则:所述智能合约的字节没有超标;所述智能合约的格式正确;所述智能合约中涉及到的各用户在所述券商上设立的账户中的资金总额满足投资计划;所述智能合约中涉及到的股票编号真实存在;所述智能合约中所写的生效时间大于当前时间;所述智能合约即将存入的区块链合法;所述智能合约中的合约条件经所有当事人的同意确认。The verification requires that the smart contract meets all of the following verification rules: the bytes of the smart contract are not exceeded; the format of the smart contract is correct; each user involved in the smart contract is at the brokerage firm The total amount of funds in the account set up above meets the investment plan; the stock numbers involved in the smart contract exist; the effective time written in the smart contract is greater than the current time; the blockchain that the smart contract is about to deposit Legal; the contract conditions in the smart contract are confirmed by the consent of all parties.
  17. 根据权利要求15所述的计算机可读存储介质,其特征在于,当所述智能合约为买卖型合约时,所述事务为买入或卖出股票的请求。The computer-readable storage medium of claim 15, wherein when the smart contract is a buy-sell contract, the transaction is a request to buy or sell a stock.
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,当所述事务为买入或卖出股票的请求时,所述S5包括以下分步骤:The computer-readable storage medium of claim 17, wherein when the transaction is a request to buy or sell a stock, the S5 includes the following sub-steps:
    S511、判断智能合约中的是否仅涉及一个用户,若是执行S515,若否则执行S512;S511. Determine whether only one user is involved in the smart contract. If S515 is performed, otherwise S512 is performed.
    S512、向智能合约中涉及到的券商平台发送共享账号查询请求,若查询到则执行S514,若查询不到则执行S513;所述共享账号为由智能合约中涉及到的各用户共同作为一个股票交易方所共享的账号;S512. Send a shared account query request to the brokerage platform involved in the smart contract. If the query is found, S514 is executed. If the query is not found, S513 is executed. The shared account is used by the users involved in the smart contract as a share. Accounts shared by trading parties;
    S513、指示券商平台创建一个所述共享账户;S513. Instruct the brokerage platform to create one of the shared accounts;
    S514、向券商平台发送以所述共享账号作为一个股票交易方的股票交易执行请求,并把该操作记录到各对应的区块中;S514. Send a stock transaction execution request using the shared account as a stock transaction party to the brokerage platform, and record the operation in each corresponding block;
    S515、向券商平台发送以所述用户在券商平台上开立的账号作为股票交易方的股票交易执行请求,并把该条操作记录到对应的区块中。S515. Send a stock transaction execution request to the brokerage platform using the account opened by the user on the brokerage platform as a stock transaction party, and record the operation in a corresponding block.
  19. 根据权利要求15所述的计算机可读存储介质,其特征在于,当所述智能合约为查看型合约时,所述事务为查看该用户的交易记录的请求。The computer-readable storage medium of claim 15, wherein when the smart contract is a viewing contract, the transaction is a request to view a transaction record of the user.
  20. 根据权利要求19所述的计算机可读存储介质,其特征在于,当所述事务为查看其他用户的交易记录的请求时,所述S5包括以下分步骤:The computer-readable storage medium according to claim 19, wherein when the transaction is a request to view transaction records of other users, the S5 includes the following sub-steps:
    S521、接收作为查看方的用户通过客户端发送的记录查看请求,所述请求包括共享方识别码和智能合约识别码;S521. Receive a record viewing request sent by a user who is a viewing party through a client, where the request includes a sharing party identification code and a smart contract identification code;
    S522、通过所述智能合约识别码调取相关的智能合约;S522. Retrieve a related smart contract through the smart contract identification code;
    S523、根据所述智能合约中的合约条件判断所述记录查看请求是否真实有效,若是则从记录作为共享方的用户所在的区块链节点上,调取该用户的股票交易记录;S523: Determine whether the record viewing request is true and valid according to the contract conditions in the smart contract, and if yes, retrieve the user's stock transaction record from the blockchain node where the record is shared by the user;
    S524、将调取的股票交易记录发送至作为查看方的用户的客户端上。S524: Send the retrieved stock transaction record to the client of the user who is the viewing party.
PCT/CN2018/095354 2018-05-30 2018-07-12 Blockchain-based smart stock purchase method, device, apparatus and storage medium WO2019227609A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810537960.XA CN108805713A (en) 2018-05-30 2018-05-30 Intelligent stock based on block chain applies to purchase method, apparatus, equipment and storage medium
CN201810537960.X 2018-05-30

Publications (1)

Publication Number Publication Date
WO2019227609A1 true WO2019227609A1 (en) 2019-12-05

Family

ID=64089331

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/095354 WO2019227609A1 (en) 2018-05-30 2018-07-12 Blockchain-based smart stock purchase method, device, apparatus and storage medium

Country Status (2)

Country Link
CN (1) CN108805713A (en)
WO (1) WO2019227609A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109615516A (en) * 2018-12-05 2019-04-12 腾讯科技(深圳)有限公司 Resource transfers method, apparatus, electronic equipment and storage medium
CN109785134A (en) * 2019-01-23 2019-05-21 武汉理工大学 The management system and method for stock exchange are realized with block chain
CN110175854A (en) * 2019-04-28 2019-08-27 阿里巴巴集团控股有限公司 Consume contract processing method and its system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170140408A1 (en) * 2015-11-16 2017-05-18 Bank Of America Corporation Transparent self-managing rewards program using blockchain and smart contracts
CN107038638A (en) * 2017-02-24 2017-08-11 杭州象链网络技术有限公司 A kind of equity registration transaction system construction method based on alliance's chain
CN107943469A (en) * 2017-11-17 2018-04-20 深圳圣马歌科技有限公司 A kind of dissemination method and device of intelligence contract
CN107945021A (en) * 2017-12-07 2018-04-20 杭州趣链科技有限公司 A kind of digital asset management method based on block chain intelligence contract
CN108062671A (en) * 2017-11-03 2018-05-22 深圳市轱辘车联数据技术有限公司 Data trade method, block chain node server and data submit terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170140408A1 (en) * 2015-11-16 2017-05-18 Bank Of America Corporation Transparent self-managing rewards program using blockchain and smart contracts
CN107038638A (en) * 2017-02-24 2017-08-11 杭州象链网络技术有限公司 A kind of equity registration transaction system construction method based on alliance's chain
CN108062671A (en) * 2017-11-03 2018-05-22 深圳市轱辘车联数据技术有限公司 Data trade method, block chain node server and data submit terminal
CN107943469A (en) * 2017-11-17 2018-04-20 深圳圣马歌科技有限公司 A kind of dissemination method and device of intelligence contract
CN107945021A (en) * 2017-12-07 2018-04-20 杭州趣链科技有限公司 A kind of digital asset management method based on block chain intelligence contract

Also Published As

Publication number Publication date
CN108805713A (en) 2018-11-13

Similar Documents

Publication Publication Date Title
AU2020200682B2 (en) Systems and methods of secure provenance for distributed transaction databases
US10673634B2 (en) Crypto integration platform
US20180218176A1 (en) System and method of creating an asset based automated secure agreement
US20190087900A1 (en) Method and system for aggregating and managing data from disparate sources in consolidated storage
US20170278081A1 (en) Cryptographic currency for securities settlement
JP6838000B2 (en) Obfuscation of intentions in transactions using cryptographic techniques
US20200160467A1 (en) Data payment and authentication via a shared data structure
US20190188793A1 (en) System and method of providing escrow wallets and closing wallets for transactions
US9794074B2 (en) Systems and methods for storing and sharing transactional data using distributed computing systems
KR20180108658A (en) Method, Apparatus, and Computer-Readable Medium for Dividend Revenue Based on Flexible Securitization
Collin‐Dufresne et al. On the term structure of default premia in the swap and LIBOR markets
JP2017515252A (en) An apparatus, system, or method that facilitates the transfer of value between parties with low or no confidence
US20160292672A1 (en) Systems and methods of blockchain transaction recordation
US7136834B1 (en) Electronic securities marketplace having integration with order management systems
KR20180074655A (en) Systems and methods for trading, authorizing and settlement of securities transactions using block-chain technology
KR101667697B1 (en) Synchronized Processing of Data By Networked Computing Resources
US20200175596A1 (en) Device, system, and method for transfer of commodities
JP6793224B2 (en) Systems and methods for providing up-to-date transaction information
US20160092988A1 (en) Systems and methods for transferring digital assests using a de-centralized exchange
KR20180037136A (en) A digitally encrypted securities platform and methods and systems therefor
WO2017190175A1 (en) Methods and systems for blockchain based "segmented risk based securities"
US10657607B2 (en) Implementation of payroll smart contract on a distributed ledger
US8583544B2 (en) Systems and methods for facilitating electronic securities transactions
WO2020056975A1 (en) Loan operation method and system based on blockchain, server and storage medium
US10535092B2 (en) Matching techniques for data transaction requests with private attributes

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: 18920532

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE