CN110046166A - Block chain-based timing task scheduling method and device - Google Patents
Block chain-based timing task scheduling method and device Download PDFInfo
- Publication number
- CN110046166A CN110046166A CN201910322758.XA CN201910322758A CN110046166A CN 110046166 A CN110046166 A CN 110046166A CN 201910322758 A CN201910322758 A CN 201910322758A CN 110046166 A CN110046166 A CN 110046166A
- Authority
- CN
- China
- Prior art keywords
- main chain
- task
- chain
- timing
- transaction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2255—Hash tables
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2471—Distributed queries
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/275—Synchronous replication
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Data Mining & Analysis (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Software Systems (AREA)
- Marketing (AREA)
- General Business, Economics & Management (AREA)
- Computing Systems (AREA)
- Technology Law (AREA)
- Strategic Management (AREA)
- Economics (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Development Economics (AREA)
- Computational Linguistics (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明的实施方式涉及计算机技术领域,更具体地,本发明的实施方式涉及基于区块链的定时任务调度方法及装置,存储介质和电子设备。The embodiments of the present invention relate to the field of computer technology, and more particularly, the embodiments of the present invention relate to a method and apparatus for scheduling scheduled tasks based on blockchain, a storage medium and an electronic device.
背景技术Background technique
本部分旨在为权利要求中陈述的本发明的实施方式提供背景或上下文,此处的描述不因为包括在本部分中就承认是现有技术。This section is intended to provide a background or context for the embodiments of the invention recited in the claims, and the description herein is not admitted to be prior art by inclusion in this section.
区块链作为一种新兴的分布式基础架构,其本质应当为一个去中心化的数据库,现在已经被广泛的应用于证券交易、电子商务、社交通讯以及文件存储等众多领域。As an emerging distributed infrastructure, the essence of blockchain should be a decentralized database, and it has been widely used in many fields such as securities trading, e-commerce, social communication and file storage.
发明内容SUMMARY OF THE INVENTION
但是,在一些技术中,一方面,由于现有的区块链平台交易性能相对低下,交易处理速度较慢,无法满足用户频繁交易以及交易时效的需求;另一方面,各区块链之间会使用不同的业务合约,无法在一个区块链平台上执行大量高频率的交易。However, in some technologies, on the one hand, due to the relatively low transaction performance of the existing blockchain platform, the transaction processing speed is slow, which cannot meet the needs of users for frequent transactions and transaction timeliness; Using different business contracts, it is impossible to execute a large number of high-frequency transactions on one blockchain platform.
因此,在现有技术中,如何将主链的定时任务转移至侧链执行,仍然缺少对应的系统的、标准的数据处理方法。Therefore, in the prior art, how to transfer the timing task of the main chain to the side chain for execution still lacks a corresponding systematic and standard data processing method.
为此,非常需要一种改进的基于区块链的定时任务调度方法及装置、存储介质和电子设备,以实现定时任务在主链和侧链之间的高效调度。Therefore, there is a great need for an improved method and device for scheduling scheduled tasks based on blockchain, storage media and electronic equipment, so as to achieve efficient scheduling of scheduled tasks between the main chain and the side chain.
在本上下文中,本发明的实施方式期望提供一种基于区块链的定时任务调度方法和装置、存储介质和电子设备。In this context, the embodiments of the present invention are expected to provide a blockchain-based timing task scheduling method and apparatus, storage medium and electronic device.
根据本公开的一个方面,提供一种基于区块链的定时任务调度方法,包括:According to one aspect of the present disclosure, a method for scheduling scheduled tasks based on blockchain is provided, including:
响应于对主链的一任务调度指令,以开始对所述主链进行业务监听;In response to a task scheduling instruction to the main chain, to start business monitoring on the main chain;
在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步,并在与所述主链同步完成后执行所述定时任务;After monitoring that the timing task is on the main chain, synchronize the original user state with the main chain, and execute the timing task after the synchronization with the main chain is completed;
响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链;In response to a task stop instruction, the user state after executing the scheduled task is synchronized to the main chain;
在监听到所述执行定时任务后的用户状态同步至所述主链后,结束所述定时任务。After monitoring the synchronization of the user state after the execution of the timing task to the main chain, the timing task is ended.
在本公开的一种示例性实施例中,所述对所述主链进行业务监听包括:In an exemplary embodiment of the present disclosure, the performing service monitoring on the main chain includes:
通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希;Monitor the transaction that submits the scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
根据所述交易哈希获取所述提交定时任务的交易在所述主链中所在区块,并根据所述区块的区块头查询对应的哈希值;Obtain the block in the main chain where the transaction submitting the timing task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block;
根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。Calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original Merkle tree hash value in the block header in the main chain to determine Whether the transaction submitting the scheduled task is uploaded in the main chain.
在本公开的一种示例性实施例中,所述在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步包括:In an exemplary embodiment of the present disclosure, after monitoring that the timing task is on the main chain, the synchronization of the original user state with the main chain includes:
在监听到所述定时任务在所述主链上链后,发起确定所述定时任务在所述主链的状态的交易并上链;After monitoring that the timed task is on the main chain, initiate a transaction to determine the state of the timed task on the main chain and put it on the chain;
在确定所述定时任务在所述主链的状态后,与所述主链进行原始用户状态同步;After determining the state of the timing task in the main chain, perform original user state synchronization with the main chain;
在同步操作完成后,发起完成同步的交易并上链。After the synchronization operation is completed, the transaction that has completed the synchronization is initiated and uploaded to the chain.
在本公开的一种示例性实施例中,所述在确定所述定时任务在所述主链的状态后,与所述主链同步原始用户状态包括:In an exemplary embodiment of the present disclosure, after determining the state of the timing task on the main chain, synchronizing the original user state with the main chain includes:
通过转接桥调用主链同步状态接口,以发起与所述主链同步原始用户状态的交易,并将同步结果返回所述主链。The main chain synchronization state interface is called through the transfer bridge to initiate a transaction that synchronizes the original user state with the main chain, and the synchronization result is returned to the main chain.
在本公开的一种示例性实施例中,所述方法还包括:In an exemplary embodiment of the present disclosure, the method further includes:
通过转接桥监听与所述主链同步原始用户状态的交易,以确定同步原始用户状态的操作是否完成。The transaction of synchronizing the original user state with the main chain is monitored through the transfer bridge to determine whether the operation of synchronizing the original user state is completed.
在本公开的一种示例性实施例中,所述执行所述定时任务包括:In an exemplary embodiment of the present disclosure, the performing the timing task includes:
根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链。The contract is invoked to execute the scheduled task according to the timing rules in the scheduled task, and the task result is consensus on the chain.
在本公开的一种示例性实施例中,所述根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链包括:In an exemplary embodiment of the present disclosure, the invoking a contract to execute the timing task according to the timing rules in the timing task, and uploading the task result to the chain by consensus includes:
由出块节点的定时合约执行器根据定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点;The timing contract executor of the block-producing node initiates a timing transaction according to the timing contract, and sends the block to be confirmed including the timing transaction to each voting node;
所述投票节点的定时合约执行器执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果并返回至所述出块节点;The timing contract executor of the voting node executes the timing transaction, generates a block-producing voting result according to the execution result of the timing transaction, and returns it to the block-producing node;
所述出块节点根据各所述投票节点返回的所述出块投票结果判断是否对所述定时任务结果出块上链。The block producing node judges whether to produce a block on the chain based on the block producing voting result returned by each of the voting nodes.
在本公开的一种示例性实施例中,所述任务停止指令的生成包括:In an exemplary embodiment of the present disclosure, the generating of the task stop instruction includes:
根据所述定时任务中的定时规则生成任务停止指令;或者Generate a task stop instruction according to the timing rule in the timing task; or
在监听到停止定时任务的交易在所述主链上链时,发起所述停止定时任务的交易以生成任务停止指令。When it is detected that the transaction for stopping the timing task is on the main chain, the transaction for stopping the timing task is initiated to generate a task stop instruction.
在本公开的一种示例性实施例中,所述将执行定时任务后的用户状态同步至所述主链包括:In an exemplary embodiment of the present disclosure, the synchronizing the user state after executing the scheduled task to the main chain includes:
通过转接桥调用所述主链的同步状态接口以发起将所述定时任务的执行结果返回至所述主链的同步交易,以将执行定时任务后的用户状态同步至所述主链。The synchronization status interface of the main chain is invoked through the switching bridge to initiate a synchronization transaction that returns the execution result of the timing task to the main chain, so as to synchronize the user status after executing the timing task to the main chain.
在本公开的一种示例性实施例中,所述在监听到所述执行定时任务后的用户状态同步至所述主链后,结束所述定时任务包括:In an exemplary embodiment of the present disclosure, after monitoring the synchronization of the user state after the execution of the timed task to the main chain, ending the timed task includes:
在监听到所述主链完成所述执行定时任务后的用户状态的同步后,发起主链状态同步完成的交易并上链;After monitoring the synchronization of the user state after the main chain completes the execution of the scheduled task, initiate a transaction completed by the synchronization of the main chain state and upload it to the chain;
发起针对所述主链的结束定时任务的交易,以使所述主链执行结束定时任务的交易。Initiating a transaction for the end timing task of the main chain, so that the main chain executes the transaction for ending the timing task.
在本公开的一种示例性实施例中,在监听到所述主链执行结束定时任务的交易后,所述方法还包括:In an exemplary embodiment of the present disclosure, after listening to the main chain executing the transaction of ending the timing task, the method further includes:
发起确认结束定时任务的交易,以结束所述定时任务。A transaction confirming the end of the timing task is initiated to end the timing task.
根据本公开的一个方面,提供一种基于区块链的定时任务调度方法,包括:According to one aspect of the present disclosure, a method for scheduling scheduled tasks based on blockchain is provided, including:
基于对主链的一任务调度指令,为所述主链配置侧链以使所述侧链开启对所述主链的业务监听;Based on a task scheduling instruction for the main chain, configure a side chain for the main chain to enable the side chain to enable service monitoring on the main chain;
所述侧链在监听到定时任务在所述主链上链后,与所述主链执行原始用户状态同步,并在所述侧链执行所述定时任务;After monitoring the timing task on the main chain, the side chain performs the original user state synchronization with the main chain, and executes the timing task on the side chain;
所述侧链响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链以更新所述主链;In response to a task stop instruction, the side chain synchronizes the user state after executing the scheduled task to the main chain to update the main chain;
在所述侧链监听到所述主链将执行定时任务后的用户状态同步完成后,在所述主链和所述侧链结束所述定时任务。After the side chain monitors the synchronization of the user state after the main chain will perform the timing task, the timing task ends on the main chain and the side chain.
在本公开的一种示例性实施例中,所述侧链开启对所述主链的业务监听包括:In an exemplary embodiment of the present disclosure, enabling the side chain to monitor services on the main chain includes:
所述侧链通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希;The side chain monitors the transactions of the specified address of the main chain for submitting timed tasks through the transfer bridge to obtain its transaction hash;
根据所述交易哈希获取所述提交定时任务的交易在所述主链中的所在区块,并根据所述区块的区块头查询对应的哈希值;Obtain the block in the main chain where the transaction submitting the timing task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block;
根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。Calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original Merkle tree hash value in the block header in the main chain to determine Whether the transaction submitting the scheduled task is uploaded in the main chain.
在本公开的一种示例性实施例中,所述在所述主链提交定时任务时,所述方法还包括:In an exemplary embodiment of the present disclosure, when the main chain submits the scheduled task, the method further includes:
在所述主链锁定管理用户。Lock management users on the main chain.
在本公开的一种示例性实施例中,所述侧链监听到在所述主链提交的定时任务后,与所述主链执行原始用户状态同步包括:In an exemplary embodiment of the present disclosure, after the side chain monitors the timed task submitted by the main chain, performing original user state synchronization with the main chain includes:
所述侧链在监听到所述定时任务在所述主链上链后,在所述侧链发起确定所述定时任务在所述主链的状态的交易并上链;After monitoring that the timing task is on the main chain, the side chain initiates a transaction to determine the status of the timing task on the main chain on the side chain and uploads it to the chain;
所述侧链在确认所述主链的定时任务后,发起同步主链原始用户状态的交易,以用于与所述主链同步原始用户状态;After confirming the timing task of the main chain, the side chain initiates a transaction for synchronizing the original user state of the main chain, so as to synchronize the original user state with the main chain;
当所述侧链确认完成原始用户状态同步后,在所述侧链发起侧链状态同步完成的交易并上链。After the sidechain confirms that the synchronization of the original user state is completed, the sidechain initiates a transaction completed by the sidechain state synchronization and uploads it to the chain.
在本公开的一种示例性实施例中,所述侧链发起同步主链原始用户状态的交易以用于与所述主链同步原始用户状态包括:In an exemplary embodiment of the present disclosure, the side chain initiating a transaction for synchronizing the original user state of the main chain for synchronizing the original user state with the main chain includes:
所述侧链通过转接桥调用所述主链同步状态接口,以发起同步主链原始用户状态的交易,并将同步结果返回至所述主链。The side chain invokes the main chain synchronization state interface through the transfer bridge to initiate a transaction for synchronizing the original user state of the main chain, and returns the synchronization result to the main chain.
在本公开的一种示例性实施例中,所述侧链确认完成原始用户状态同步的方法包括:In an exemplary embodiment of the present disclosure, the method for confirming completion of the original user state synchronization by the side chain includes:
所述侧链通过转接桥监听所述主链的同步原始用户状态的交易以确定所述同步原始用户状态的操作是否完成。The side chain monitors the transaction of synchronizing the original user state of the main chain through the transit bridge to determine whether the operation of synchronizing the original user state is completed.
在本公开的一种示例性实施例中,所述侧链所述执行所述定时任务包括:In an exemplary embodiment of the present disclosure, the execution of the timing task by the side chain includes:
所述侧链节点根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链。The side chain node invokes the contract to execute the scheduled task according to the timing rule in the scheduled task, and uploads the task result to the chain by consensus.
在本公开的一种示例性实施例中,所述侧链节点根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链包括:In an exemplary embodiment of the present disclosure, the side chain node invokes a contract to execute the timed task according to the timed rules in the timed task, and uploading the task result to the chain by consensus includes:
所述侧链的出块节点的定时合约执行器调用定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点;The timing contract executor of the block-producing node of the side chain invokes the timing contract to initiate a timing transaction, and sends the block to be confirmed including the timing transaction to each voting node;
所述投票节点的定时合约执行器调用定时合约执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果,并将所述出块投票结果返回至所述出块节点;The timing contract executor of the voting node invokes the timing contract to execute the timing transaction, generates a block-producing voting result according to the execution result of the timing transaction, and returns the block-producing voting result to the block-producing node;
所述出块节点根据所述投票节点返回的出块投票结果判断是否对所述定时任务结果出块上链。The block producing node judges whether to produce a block on the chain according to the block producing voting result returned by the voting node.
在本公开的一种示例性实施例中,所述侧链响应于一任务停止指令包括:In an exemplary embodiment of the present disclosure, the side chain in response to a task stop instruction includes:
所述侧链根据所述定时任务中的定时规则生成任务停止指令;或者The side chain generates a task stop instruction according to the timing rule in the timing task; or
所述侧链在监听到在所述主链发起的结束定时任务的交易时,在所述侧链发起结束定时任务的交易并上链。When the side chain monitors the transaction that ends the timing task initiated by the main chain, the side chain initiates the transaction that ends the timing task and uploads it to the chain.
在本公开的一种示例性实施例中,所述与所述主链同步用户状态以更新所述主链包括:In an exemplary embodiment of the present disclosure, synchronizing the user state with the main chain to update the main chain includes:
所述侧链通过转接桥调用所述主链同步状态接口以发起将定时任务的执行结果返回至所述主链的同步交易,以将所述侧链的定时任务执行结果返回所述主链,以实现对所述主链用户状态的更新。The side chain invokes the main chain synchronization status interface through the transfer bridge to initiate a synchronization transaction that returns the execution result of the timed task to the main chain, so as to return the execution result of the timed task of the side chain to the main chain , so as to update the user status of the main chain.
在本公开的一种示例性实施例中,所述在所述侧链监听到所述主链将执行定时任务后的用户状态同步完成后,在所述主链和侧链结束所述定时任务包括:In an exemplary embodiment of the present disclosure, after the side chain monitors that the main chain will perform the timing task after the user state synchronization is completed, the main chain and the side chain end the timing task include:
所述侧链在监听到所述主链的同步操作完成后,发起完成主链状态同步的交易并上链;After monitoring the completion of the synchronization operation of the main chain, the side chain initiates a transaction to complete the synchronization of the state of the main chain and uploads it to the chain;
所述侧链发起针对所述主链的结束定时任务的交易,以使所述主链执行所述结束定时任务的交易,并在确认同步操作完成后将所述结束定时任务的交易在所述主链上链以结束所述定时任务。The side chain initiates a transaction for the end timing task of the main chain, so that the main chain executes the transaction for the end timing task, and after confirming that the synchronization operation is completed, the transaction for the end timing task is stored in the main chain. The main chain is on-chain to end the timing task.
在本公开的一种示例性实施例中,所述侧链在监听到所述主链的结束定时任务的交易在所述主链上链后,所述方法还包括:In an exemplary embodiment of the present disclosure, after the side chain monitors that the transaction of the end timing task of the main chain is on the main chain, the method further includes:
所述侧链发起侧链确认结束定时任务的交易并上链,以用于在所述侧链结束所述定时任务。The side chain initiates the transaction of the side chain to confirm the end of the timing task and uploads the transaction, so as to end the timing task on the side chain.
在本公开的一种示例性实施例中,所述方法还包括:In an exemplary embodiment of the present disclosure, the method further includes:
所述主链对管理用户进行解锁。The main chain unlocks management users.
根据本公开的一个方面,提供一种基于区块链的定时任务调度装置,包括:According to an aspect of the present disclosure, a block chain-based timing task scheduling device is provided, including:
业务监听模块,用于响应于对主链的一任务调度指令,以开始对所述主链进行业务监听;a service monitoring module, used for starting a service monitoring on the main chain in response to a task scheduling instruction on the main chain;
第一任务执行模块,用于在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步,并在与所述主链同步完成后执行所述定时任务;The first task execution module is configured to synchronize the original user state with the main chain after monitoring that the timing task is on the main chain, and execute the timing task after the synchronization with the main chain is completed;
第一任务停止模块,用于响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链;a first task stop module, used for synchronizing the user state after executing the timed task to the main chain in response to a task stop instruction;
任务结束模块,用于在监听到所述执行定时任务后的用户状态与所述主链同步完成后,结束所述定时任务。The task end module is configured to end the timed task after monitoring the synchronization of the user state and the main chain after the execution of the timed task is completed.
在本公开的一种示例性实施例中,所述业务监听模块包括:In an exemplary embodiment of the present disclosure, the service monitoring module includes:
交易哈希获取模块,用于通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希;The transaction hash acquisition module is used to monitor the transaction of the specified address of the main chain that submits the timed task through the transfer bridge to acquire its transaction hash;
区块头查询模块,用于根据所述交易哈希获取所述提交定时任务的交易在所述主链中所在区块,并根据所述区块的区块头查询对应的哈希值;a block header query module, configured to obtain the block in the main chain where the transaction submitting the timing task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block;
哈希值比对模块,用于根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。The hash value comparison module is used to calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original Merkle tree hash value in the block header in the main chain Compare the hash value of the Er tree to determine whether the transaction that submits the scheduled task is uploaded in the main chain.
在本公开的一种示例性实施例中,所述第一任务执行模块包括:In an exemplary embodiment of the present disclosure, the first task execution module includes:
定时任务确认模块,用于在监听到所述定时任务在所述主链上链后,发起确定所述定时任务在所述主链的状态的交易并上链;A timing task confirmation module, configured to initiate a transaction to determine the status of the timing task on the main chain after monitoring that the timing task is on the main chain, and upload it to the chain;
用户状态同步模块,用于在确定所述定时任务在所述主链的状态后,与所述主链进行原始用户状态同步;a user state synchronization module, configured to synchronize the original user state with the main chain after determining the state of the timing task in the main chain;
同步完成模块,用于在同步操作完成后,发起完成同步的交易并上链。The synchronization completion module is used to initiate the synchronization transaction and upload it to the chain after the synchronization operation is completed.
在本公开的一种示例性实施例中,所述用户状态同步模块包括:In an exemplary embodiment of the present disclosure, the user state synchronization module includes:
主链同步状态接口调用模块,用于通过转接桥调用主链同步状态接口,以发起与所述主链同步原始用户状态的交易,并将同步结果返回所述主链。The main chain synchronization state interface calling module is used to call the main chain synchronization state interface through the transfer bridge to initiate a transaction that synchronizes the original user state with the main chain, and returns the synchronization result to the main chain.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
同步结果确认模块,用于通过转接桥监听与所述主链同步原始用户状态的交易,以确定同步原始用户状态的操作是否完成。The synchronization result confirmation module is used to monitor the transaction of synchronizing the original user state with the main chain through the transfer bridge, so as to determine whether the operation of synchronizing the original user state is completed.
在本公开的一种示例性实施例中,所述第一任务执行模块包括:In an exemplary embodiment of the present disclosure, the first task execution module includes:
定时任务执行模块,用于根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链。The timed task execution module is used to call the contract to execute the timed task according to the timed rules in the timed task, and upload the task result to the chain by consensus.
在本公开的一种示例性实施例中,所述定时任务执行模块包括:In an exemplary embodiment of the present disclosure, the timing task execution module includes:
交易发起模块,用于由出块节点的定时合约执行器根据定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点;A transaction initiation module, used by the timing contract executor of the block-producing node to initiate timing transactions according to the timing contracts, and sending the blocks to be confirmed including the timing transactions to each voting node;
出块投票结果生成模块,用于所述投票节点的定时合约执行器执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果并返回至所述出块节点;A block voting result generation module, used for the timing contract executor of the voting node to execute the timing transaction, generate a block voting result according to the execution result of the timing transaction, and return it to the block generation node;
定时任务出块模块,用于所述出块节点根据各所述投票节点返回的所述出块投票结果判断是否对所述定时任务结果出块上链。The timing task block generation module is used for the block generation node to determine whether to generate a block for the timing task result and upload it to the chain according to the block generation voting results returned by each of the voting nodes.
在本公开的一种示例性实施例中,所述第一任务停止模块包括:In an exemplary embodiment of the present disclosure, the first task stopping module includes:
停止指令生成模块,用于根据所述定时任务中的定时规则生成任务停止指令;和/或A stop instruction generation module, configured to generate a task stop instruction according to the timing rule in the timing task; and/or
停止指令监听模块,用于在监听到停止定时任务的交易在所述主链上链时,发起所述停止定时任务的交易以生成任务停止指令。The stop instruction monitoring module is configured to initiate the transaction to stop the timed task to generate a task stop instruction when the transaction for stopping the timed task is monitored on the main chain.
在本公开的一种示例性实施例中,所述第一任务停止模块还包括:In an exemplary embodiment of the present disclosure, the first task stopping module further includes:
任务结果返回模块,用于通过转接桥调用所述主链的同步状态接口以发起将所述定时任务的执行结果返回至所述主链的同步交易,以将执行定时任务后的用户状态同步至所述主链。The task result return module is used to call the synchronization state interface of the main chain through the transfer bridge to initiate a synchronization transaction that returns the execution result of the timed task to the main chain, so as to synchronize the user state after executing the timed task to the main chain.
在本公开的一种示例性实施例中,所述任务结束模块包括:In an exemplary embodiment of the present disclosure, the task end module includes:
用户状态监听模块,用于在监听到所述主链完成所述执行定时任务后的用户状态的同步后,发起主链状态同步完成的交易并上链;The user state monitoring module is used to initiate a transaction completed by the synchronization of the state of the main chain and upload it to the chain after monitoring the synchronization of the user state after the main chain completes the execution of the timed task;
主链定时任务结束模块,用于发起针对所述主链的结束定时任务的交易,以使所述主链执行结束定时任务的交易。The main chain timing task ending module is used for initiating a transaction for ending the timing task of the main chain, so that the main chain executes the transaction for ending the timing task.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
定时任务结束模块,用于发起确认结束定时任务的交易,以结束所述定时任务。The timing task ending module is used for initiating a transaction confirming the ending of the timing task to end the timing task.
根据本公开的一个方面,提供一种基于区块链的定时任务调度装置,包括:According to an aspect of the present disclosure, a block chain-based timing task scheduling device is provided, including:
侧链分配模块,用于基于对主链的一任务调度指令,为所述主链配置侧链以使所述侧链开启对所述主链的业务监听;a side chain allocation module, configured to configure a side chain for the main chain based on a task scheduling instruction to the main chain, so that the side chain enables service monitoring on the main chain;
第二任务执行模块,用于所述侧链在监听到定时任务在所述主链上链后,与所述主链执行用户状态同步,以用于在所述侧链执行所述定时任务;The second task execution module is used for the side chain to synchronize with the main chain execution user state after monitoring that the timing task is on the main chain, so as to execute the timing task on the side chain;
第二任务停止模块,用于所述侧链响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链以更新所述主链;The second task stop module is used for the side chain to synchronize the user state after executing the scheduled task to the main chain in response to a task stop instruction to update the main chain;
任务完结模块,用于在所述侧链监听到所述主链将执行定时任务后的用户状态同步完成后,在所述主链和所述侧链结束所述定时任务。The task completion module is configured to end the scheduled task on the main chain and the side chain after the side chain monitors the synchronization of the user state after the main chain will perform the scheduled task.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
交易哈希获取模块,用于所述侧链通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希;A transaction hash acquisition module, used for the side chain to monitor the transaction of the timed task submission of the specified address of the main chain through the transfer bridge to acquire its transaction hash;
区块头查询模块,用于根据所述交易哈希获取所述提交定时任务的交易在所述主链中的所在区块,并根据所述区块的区块头查询对应的哈希值;a block header query module, configured to obtain the block in the main chain where the transaction that submits the timing task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block;
哈希值比对模块,用于根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。The hash value comparison module is used to calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original Merkle tree hash value in the block header in the main chain The hash value of the tree is compared to determine whether the transaction that submits the scheduled task is uploaded in the main chain.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
用户状态锁定模块,用于在所述主链提交定时任务时,在所述主链锁定管理用户。The user state locking module is used to lock and manage users on the main chain when the main chain submits timed tasks.
在本公开的一种示例性实施例中,所述第二任务执行模块包括:In an exemplary embodiment of the present disclosure, the second task execution module includes:
定时任务侧链确定模块,用于所述侧链在监听到所述定时任务在所述主链上链后,在所述侧链发起确定所述定时任务在所述主链的状态的交易并上链;The timing task side chain determination module is used for the side chain to initiate a transaction to determine the status of the timing task in the main chain after monitoring that the timing task is on the main chain, and to initiate a transaction on the side chain to determine the status of the timing task in the main chain. on the chain;
原始用户状态同步模块,用于所述侧链在确认所述主链的定时任务后,发起同步主链原始用户状态的交易,以用于与所述主链同步原始用户状态;The original user state synchronization module is used for the side chain to initiate a transaction to synchronize the original user state of the main chain after confirming the timing task of the main chain, so as to synchronize the original user state with the main chain;
原始用户状态侧链确认模块,用于当所述侧链确认完成原始用户状态同步后,在所述侧链发起侧链状态同步完成的交易并上链。The original user state side chain confirmation module is used to initiate a transaction completed by the side chain state synchronization on the side chain after the side chain confirms that the synchronization of the original user state is completed and upload it to the chain.
在本公开的一种示例性实施例中,所述原始用户状态同步模块包括:In an exemplary embodiment of the present disclosure, the original user state synchronization module includes:
主链同步状态接口调用模块,用于所述侧链通过转接桥调用所述主链同步状态接口,以发起同步主链原始用户状态的交易,并将同步结果返回至所述主链。The main chain synchronization state interface calling module is used for the side chain to call the main chain synchronization state interface through the transfer bridge to initiate a transaction for synchronizing the original user state of the main chain, and return the synchronization result to the main chain.
在本公开的一种示例性实施例中,所述原始用户状态侧链确认模块包括:In an exemplary embodiment of the present disclosure, the original user state side chain confirmation module includes:
主链同步交易监听模块,用于所述侧链通过转接桥监听所述主链的同步原始用户状态的交易以确定所述同步原始用户状态的操作是否完成。The main chain synchronization transaction monitoring module is used for the side chain to monitor the transaction of synchronizing the original user state of the main chain through the transfer bridge to determine whether the operation of synchronizing the original user state is completed.
在本公开的一种示例性实施例中,所述第二任务执行模块包括:In an exemplary embodiment of the present disclosure, the second task execution module includes:
定时任务侧链执行模块,用于所述侧链节点根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链。The timing task side chain execution module is used for the side chain node to invoke the contract to execute the timing task according to the timing rules in the timing task, and to upload the task result to the chain by consensus.
在本公开的一种示例性实施例中,所述定时任务侧链执行模块包括:In an exemplary embodiment of the present disclosure, the timing task side chain execution module includes:
出块节点执行模块,用于所述侧链的出块节点的定时合约执行器调用定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点;The block-producing node execution module is used for the timing contract executor of the block-producing node of the side chain to call the timing contract to initiate a timing transaction, and send the block to be confirmed containing the timing transaction to each voting node;
投票节点执行模块,用于所述投票节点的定时合约执行器调用定时合约执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果,并将所述出块投票结果返回至所述出块节点;The voting node execution module is used for the timing contract executor of the voting node to call the timing contract to execute the timing transaction, generate a block voting result according to the execution result of the timing transaction, and return the block voting result to the Describe the block node;
任务结果出块模块,用于所述出块节点根据所述投票节点返回的出块投票结果判断是否对所述定时任务结果出块上链。The task result block generation module is used for the block generation node to determine whether to generate a block for the timed task result and upload it to the chain according to the block generation voting result returned by the voting node.
在本公开的一种示例性实施例中,所述第二任务停止模块包括:In an exemplary embodiment of the present disclosure, the second task stop module includes:
停止指令侧链生成模块,用于所述侧链根据所述定时任务中的定时规则生成任务停止指令;和/或A stop instruction side chain generation module, for the side chain to generate a task stop instruction according to the timing rule in the timing task; and/or
停止指令侧链监听模块,用于所述侧链在监听到在所述主链发起的结束定时任务的交易时,在所述侧链发起结束定时任务的交易并上链。A stop command side chain monitoring module is used for the side chain to initiate a transaction to end the timed task on the side chain and upload the transaction when the side chain monitors the transaction initiated on the main chain to end the timed task.
在本公开的一种示例性实施例中,所述第二任务停止模块还包括:In an exemplary embodiment of the present disclosure, the second task stopping module further includes:
任务结果返回模块,用于所述侧链通过转接桥调用所述主链同步状态接口以发起将定时任务的执行结果返回至所述主链的同步交易,以将所述侧链的定时任务执行结果返回所述主链,以实现对所述主链用户状态的更新。The task result return module is used for the side chain to call the main chain synchronization state interface through the transfer bridge to initiate a synchronization transaction that returns the execution result of the timed task to the main chain, so as to return the timed task of the side chain to the synchronization transaction. The execution result is returned to the main chain, so as to update the user status of the main chain.
在本公开的一种示例性实施例中,所述任务完结模块包括:In an exemplary embodiment of the present disclosure, the task completion module includes:
主链同步完成模块,用于所述侧链在监听到所述主链的同步操作完成后,发起完成主链状态同步的交易并上链;The main chain synchronization completion module is used for the side chain to initiate a transaction to complete the synchronization of the main chain state and upload it to the chain after monitoring the completion of the synchronization operation of the main chain;
定时任务主链结束模块,用于所述侧链发起针对所述主链的结束定时任务的交易,以使所述主链执行所述结束定时任务的交易,并在确认同步操作完成后将所述结束定时任务的交易在所述主链上链以结束所述定时任务。The timing task main chain end module is used for the side chain to initiate a transaction for the end timing task of the main chain, so that the main chain executes the transaction of the end timing task, and after confirming that the synchronization operation is completed, the The transaction that ends the timing task is chained on the main chain to end the timing task.
在本公开的一种示例性实施例中,所述任务完结模块还包括:In an exemplary embodiment of the present disclosure, the task completion module further includes:
定时任务侧链结束模块,用于所述侧链发起侧链确认结束定时任务的交易并上链,以用于在所述侧链结束所述定时任务。The timing task side chain ending module is used for the side chain to initiate the side chain to confirm the transaction of ending the timing task and upload it to the chain, so as to end the timing task on the side chain.
在本公开的一种示例性实施例中,所述装置还包括:In an exemplary embodiment of the present disclosure, the apparatus further includes:
用户解锁模块,用于所述主链对管理用户进行解锁。The user unlocking module is used for the main chain to unlock the management user.
根据本公开的一个方面,提供一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项实施例中所述的基于区块链的定时任务调度方法。According to one aspect of the present disclosure, there is provided a storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the blockchain-based timing task scheduling method described in any of the foregoing embodiments.
根据本公开的一个方面,提供一种电子设备,包括:According to one aspect of the present disclosure, there is provided an electronic device, comprising:
处理器;以及processor; and
存储器,用于存储所述处理器的可执行指令;a memory for storing executable instructions for the processor;
其中,所述处理器配置为经由执行所述可执行指令来执行上述任意一项所述的基于区块链的定时任务调度方法。Wherein, the processor is configured to execute the block chain-based timing task scheduling method described in any one of the above by executing the executable instructions.
根据本发明实施方式的定时任务调度方法,通过预先为主链分配对应的侧链,使侧链可以实时监听在主链提交的交易;并在监听到主链提交定时任务后,将主链的原始用户状态同步至侧链,使得侧链可以执行对应的定时任务,从而实现将主链的定时任务自动转移到指定的侧链执行,有效的解决主链定时任务执行效率低的问题。并在侧链结束定时任务后将执行定时任务后的用户状态同步至主链,进而减少主链的交易总量,降低主链的交易开销。According to the timing task scheduling method of the embodiment of the present invention, by pre-assigning the corresponding side chain to the main chain, the side chain can monitor the transactions submitted on the main chain in real time; The original user state is synchronized to the side chain, so that the side chain can execute the corresponding scheduled tasks, so as to realize the automatic transfer of the scheduled tasks of the main chain to the designated side chain for execution, effectively solving the problem of low execution efficiency of the scheduled tasks of the main chain. And after the side chain finishes the timed task, the user status after executing the timed task is synchronized to the main chain, thereby reducing the total transaction volume of the main chain and the transaction overhead of the main chain.
附图说明Description of drawings
通过参考附图阅读下文的详细描述,本发明示例性实施方式的上述以及其他目的、特征和优点将变得易于理解。在附图中,以示例性而非限制性的方式示出了本发明的若干实施方式,其中:The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown by way of example and not limitation, wherein:
图1示意性地示出了根据本发明实施方式的一种基于区块链的定时任务调度方法的流程图;1 schematically shows a flowchart of a method for scheduling scheduled tasks based on blockchain according to an embodiment of the present invention;
图2示意性地示出了根据本发明实施方式的侧链对主链进行业务监听的方法流程图;FIG. 2 schematically shows a flow chart of a method for performing service monitoring on a main chain by a side chain according to an embodiment of the present invention;
图3示意性地示出了根据本发明实施方式的侧链与主链进行原始用户状态同步的方法流程图;3 schematically shows a flow chart of a method for synchronizing the original user state between the side chain and the main chain according to an embodiment of the present invention;
图4示意性地示出了根据本发明实施方式的侧链将定时任务执行结果共识上链的方法流程图;FIG. 4 schematically shows a flow chart of a method for a side chain to upload a timed task execution result consensus to the chain according to an embodiment of the present invention;
图5示意性地示出了根据本发明实施方式的结束定时任务的方法流程图;FIG. 5 schematically shows a flowchart of a method for ending a timing task according to an embodiment of the present invention;
图6示意性地示出了根据本发明实施方式的另一种基于区块链的定时任务调度方法的流程图;FIG. 6 schematically shows a flowchart of another method for scheduling scheduled tasks based on blockchain according to an embodiment of the present invention;
图7示意性地示出了根据本发明实施方式的一种基于区块链的定时任务调度装置的方框图;7 schematically shows a block diagram of a block chain-based timing task scheduling apparatus according to an embodiment of the present invention;
图8示意性地示出了根据本发明实施方式的另一种基于区块链的定时任务调度装置的方框图;FIG. 8 schematically shows a block diagram of another block chain-based timing task scheduling apparatus according to an embodiment of the present invention;
图9示出了根据本发明实施方式的存储介质的示意图;以及FIG. 9 shows a schematic diagram of a storage medium according to an embodiment of the present invention; and
图10示意性示出了根据发明实施方式的电子设备的方框图。Figure 10 schematically shows a block diagram of an electronic device according to an embodiment of the invention.
在附图中,相同或对应的标号表示相同或对应的部分。In the drawings, the same or corresponding reference numerals denote the same or corresponding parts.
具体实施方式Detailed ways
下面将参考若干示例性实施方式来描述本发明的原理和精神。应当理解,给出这些实施方式仅仅是为了使本领域技术人员能够更好地理解进而实现本发明,而并非以任何方式限制本发明的范围。相反,提供这些实施方式是为了使本公开更加透彻和完整,并且能够将本公开的范围完整地传达给本领域的技术人员。The principles and spirit of the present invention will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are only given for those skilled in the art to better understand and implement the present invention, but not to limit the scope of the present invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
本领域技术人员知道,本发明的实施方式可以实现为一种系统、装置、设备、方法或计算机程序产品。因此,本公开可以具体实现为以下形式,即:完全的硬件、完全的软件(包括固件、驻留软件、微代码等),或者硬件和软件结合的形式。As will be appreciated by those skilled in the art, embodiments of the present invention may be implemented as a system, apparatus, device, method or computer program product. Accordingly, the present disclosure may be embodied in entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
根据本发明的实施方式,提供一种基于区块链的定时任务调度方法、基于区块链的定时任务调度装置、存储介质和电子设备。According to an embodiment of the present invention, a method for scheduling a scheduled task based on a blockchain, a device for scheduling a scheduled task based on a blockchain, a storage medium and an electronic device are provided.
在本文中,附图中的任何元素数量均用于示例而非限制,以及任何命名都仅用于区分,而不具有任何限制含义。Herein, any number of elements in the figures is for illustration and not limitation, and any designation is for distinction only and does not have any limiting meaning.
下面参考本发明的若干代表性实施方式,详细阐述本发明的原理和精神。The principles and spirit of the present invention are described in detail below with reference to several representative embodiments of the present invention.
发明概述SUMMARY OF THE INVENTION
本发明人发现,现有技术中,已有的区块链平台受到交易单机执行、单机存储、单区块链的共识效率等原因,导致区块链平台的交易性能都比较低下,无法满足用户频繁交易的需求。并且,现有的技术方案中,各区块链平台之间使用不同的业务合约,使得各区块链内的定时交易任务也仅能在各自所在的区块链平台中执行,导致无法在一个区块链平台高频率的执行定时交易任务。The inventors found that in the prior art, the existing blockchain platforms suffer from the single-machine execution of transactions, single-machine storage, and the consensus efficiency of a single blockchain, resulting in relatively low transaction performance of the blockchain platforms, which cannot satisfy users’ needs. The need for frequent transactions. In addition, in the existing technical solution, different business contracts are used between the blockchain platforms, so that the timed transaction tasks in each blockchain can only be executed in the blockchain platform where they are located, resulting in the inability to perform transactions in one blockchain. The chain platform frequently executes timed transaction tasks.
鉴于上述内容,本发明的基本思想在于:通过预先为主链分配对应的侧链,一方面,可以使侧链实时监听在主链提交以及上链的交易;并在监听到主链提交定时任务后,将主链的原始用户状态同步至侧链,使得侧链可以执行对应的定时任务,从而实现将主链的定时任务自动转移到指定的侧链执行,有效的解决主链定时任务执行效率低的问题。另一发面,通过在侧链结束定时任务后将执行定时任务后的用户状态同步至主链,进一步的减少主链的交易总量,降低主链的交易开销,并且提升交易速度。In view of the above, the basic idea of the present invention is: by pre-assigning the corresponding side chain to the main chain, on the one hand, the side chain can monitor the transactions submitted and uploaded on the main chain in real time; After that, the original user status of the main chain is synchronized to the side chain, so that the side chain can execute the corresponding scheduled tasks, so as to realize the automatic transfer of the scheduled tasks of the main chain to the designated side chain for execution, and effectively solve the main chain timed task execution efficiency. low problem. On the other hand, by synchronizing the user status after executing the timed task to the main chain after the sidechain finishes the timed task, the total transaction volume of the main chain is further reduced, the transaction overhead of the main chain is reduced, and the transaction speed is improved.
在介绍了本发明的基本原理之后,下面具体介绍本发明的各种非限制性实施方式。Having introduced the basic principles of the present invention, various non-limiting embodiments of the present invention are described in detail below.
示例性方法Exemplary method
下面结合图1来描述根据本发明示例性实施方式的基于区块链的定时任务调度方法。The block chain-based timing task scheduling method according to an exemplary embodiment of the present invention will be described below with reference to FIG. 1 .
参考图1,所述基于区块链的定时任务调度方法可以包括以下步骤:Referring to Figure 1, the blockchain-based timing task scheduling method may include the following steps:
S11、响应于对主链的一任务调度指令,以开始对所述主链进行业务监听;S11, in response to a task scheduling instruction to the main chain, to start monitoring the main chain for services;
S12、在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步,并在与所述主链同步完成后执行所述定时任务;S12. After monitoring that the timing task is on the main chain, perform original user state synchronization with the main chain, and execute the timing task after the synchronization with the main chain is completed;
S13、响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链;S13, in response to a task stop instruction, synchronize the user state after executing the timed task to the main chain;
S14、在监听到所述执行定时任务后的用户状态同步至所述主链后,结束所述定时任务。S14. After monitoring the synchronization of the user state after the execution of the timed task to the main chain, end the timed task.
在本发明实施方式的基于区块链的定时任务调度方法中,通过预先为主链分配对应的侧链,使侧链可以实时监听在主链提交的交易;并在监听到主链提交定时任务后,将主链的原始用户状态同步至侧链,使得侧链可以执行对应的定时任务,从而实现将主链的定时任务自动转移到指定的侧链执行,有效的解决主链定时任务执行效率低的问题。并在侧链结束定时任务后将执行定时任务后的用户状态同步至主链,进而减少主链的交易总量,降低主链的交易开销。。In the method for scheduling scheduled tasks based on blockchain in the embodiment of the present invention, by pre-assigning the corresponding side chain to the main chain, the side chain can monitor the transactions submitted on the main chain in real time; After that, the original user status of the main chain is synchronized to the side chain, so that the side chain can execute the corresponding scheduled tasks, so as to realize the automatic transfer of the scheduled tasks of the main chain to the designated side chain for execution, and effectively solve the main chain timed task execution efficiency. low problem. And after the side chain finishes the timed task, the user status after executing the timed task is synchronized to the main chain, thereby reducing the total transaction volume of the main chain and the transaction overhead of the main chain. .
在步骤S11中,响应于对主链的一任务调度指令,以开始对所述主链进行业务监听。In step S11, in response to a task scheduling instruction to the main chain, the service monitoring of the main chain is started.
在本公开的示例性实施方式中,对于侧链来说,用户可以为主链分配对应的侧链,从而使侧链对主链上提交和上链的交易进行监听。其中,侧链可以是由POS(Proof ofStake,股权证明)、BFT(Byzantine Fault Tolerance,拜占庭容错)等共识为主的区块链。具体来说,侧链可以包括转接桥、侧链合约以及侧链定时合约执行器。其中,转接桥作为侧链的一部分,使侧链各节点可以通过转接桥对主链区块和交易进行监听。侧链合约则是对应于主链业务合约的合约。侧链定时合约执行器可以用于根据定时合约,轮循并执行定时交易。In the exemplary embodiment of the present disclosure, for a side chain, a user can assign a corresponding side chain to the main chain, so that the side chain can monitor the transactions submitted and uploaded on the main chain. Among them, the side chain can be a consensus-based blockchain such as POS (Proof of Stake), BFT (Byzantine Fault Tolerance, Byzantine Fault Tolerance). Specifically, the side chain can include a transfer bridge, a side chain contract, and a side chain timing contract executor. Among them, the transfer bridge is a part of the side chain, so that each node of the side chain can monitor the blocks and transactions of the main chain through the transfer bridge. The side chain contract is the contract corresponding to the main chain business contract. The sidechain timed contract executor can be used to rotate and execute timed transactions according to the timed contract.
其中,转接桥可以具有查询用户状态功能(quey status)、执行同步交易功能(execute status status)以及执行完结定时器功能(execute finish timing)。具体来说,上述的查询用户状态功能为调用主链合约中的导出状态方法(export StatusResult)。侧链调用主链导出方法后,可以导出所有关联用户地址(relate Address)的用户状态,并做好侧链合约用户状态的初始化。上述的执行同步交易功能,即调用主链合约中主链同步状态(sync Status Status)方法发起同步交易,把侧链定时器的执行结果,即侧链执行定时任务后的用户状态结果返回主链的过程。同时,转接桥还可以不断监听主链的同步交易,来确定同步是否成功。上述的执行完结定时器功能,可以调用主链合约中完结定时任务(finish Timing)方法,在侧链所有用户的状态同步完成后,侧链发起对主链的完结定时任务交易,从而彻底完成主链的定时任务。The switching bridge may have a function of querying user status (quey status), a function of executing a synchronous transaction (execute status status), and a function of executing finish timing (execute finish timing). Specifically, the above function of querying user status is to call the export status method (export StatusResult) in the main chain contract. After the side chain calls the main chain export method, it can export the user state of all related user addresses (relate Address), and initialize the user state of the side chain contract. The above-mentioned synchronous transaction function is to call the main chain synchronization status (sync Status Status) method in the main chain contract to initiate a synchronous transaction, and return the execution result of the side chain timer, that is, the user status result after the side chain executes the timing task, to the main chain. the process of. At the same time, the transfer bridge can also continuously monitor the synchronization transactions of the main chain to determine whether the synchronization is successful. The above execution completion timer function can call the finish Timing method in the main chain contract. After the status of all users in the side chain is synchronized, the side chain initiates the completion timing task transaction on the main chain, thereby completely completing the main chain. The timing task of the chain.
上述的侧链合约是对应于主链业务合约的合约,可以包括确认提交定时任务(sure Sumit Timing)。转接桥监听到主链的提交定时任务(sumit Timing)交易并确定上链后,侧链由出块节点发起执行确定提交定时任务的交易,并带上主链的定时任务的参数(time Params),提交到侧链。The above-mentioned side chain contract is a contract corresponding to the main chain business contract, which may include sure Sumit Timing. After the transfer bridge monitors the main chain's submission timing task (sumit Timing) transaction and confirms that it is on the chain, the side chain is initiated by the block-producing node to execute the transaction that determines the submission timing task, and brings the main chain's timing task parameters (time Params). ), submitted to the sidechain.
在区块链成员为主链分配对应的侧链后,还可以为侧链配置需要监听的主链合约地址和需要使用的区块链账号。此外,一条主链可以对应一条或多条侧链,即主链的定时任务可以分配到至少一条侧链中执行。由于主链中可以包含多个合约,则主链合约与侧链则可以是多对多的关系,其中,主链中的一个合约可以对应一条执行其定时任务的侧链。之后,该侧链便可以通过转接桥,以侧链/中继方式对主链的交易(watch_eth)和区块(watch_block)进行实时的监听。After the blockchain members allocate the corresponding side chains to the main chain, they can also configure the main chain contract address to be monitored and the blockchain account to be used for the side chain. In addition, a main chain can correspond to one or more side chains, that is, the scheduled tasks of the main chain can be assigned to at least one side chain for execution. Since the main chain can contain multiple contracts, the main chain contract and the side chain can have a many-to-many relationship, in which a contract in the main chain can correspond to a side chain that performs its scheduled tasks. After that, the side chain can monitor the transactions (watch_eth) and blocks (watch_block) of the main chain in real time in a side chain/relay mode through the transfer bridge.
具体来说,参考图2所示,侧链对主链进行业务监听可以包括以下步骤:Specifically, referring to Figure 2, the side chain's service monitoring on the main chain may include the following steps:
步骤S111,通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希;Step S111, monitoring the transaction of submitting the timing task of the designated address of the main chain through the transfer bridge to obtain its transaction hash;
步骤S112,根据所述交易哈希获取所述提交定时任务的交易在所述主链中所在区块,并根据所述区块的区块头查询对应的哈希值;Step S112, obtaining the block in the main chain where the transaction submitting the timing task is located according to the transaction hash, and querying the corresponding hash value according to the block header of the block;
步骤S113,根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。Step S113: Calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original Merkle tree hash value in the block header in the main chain. The comparison is made to determine whether the transaction submitting the timed task is uploaded in the main chain.
在本公开的示例性实施方式中,侧链可以通过监控主链交易(watch_eth)和区块(watch_block)来确定主链定时器交易的发生以及是否上链。举例而言,侧链可以通过监听主链对应业务合约下的所有交易,来判断定时任务交易是否发生。并且,侧链还可以通过监听主链的所有已经上链的区块头,并将该些区块加入侧链中,以做SPV证明(SimplifiedPayment Verification,简单支付证明)。具体的,侧链在监听到主链在指定地址发起的定时任务的交易后,获取该交易的交易哈希;并通过该交易哈希查询主链以获取该交易所在的区块。以及,侧链通过监听主链的区块头,查询并获取主链区块中构建默克尔树(merkletree)所需的哈希值,并根据该哈希值计算默克尔树哈希(merkle root hash);并将该计算的默克尔树哈希与主链区块头中的原始默克尔树哈希进行对比,判断是否相等。在判断相等时,则证明该定时任务交易在主链中是存在的,且已上链。若不相等,则证明该交易在主链中不存在,或者侧链从主链下载的区块头中数据存在错误等情况。In an exemplary embodiment of the present disclosure, the side chain can determine the occurrence of the main chain timer transaction and whether to go on the chain by monitoring the main chain transaction (watch_eth) and block (watch_block). For example, the side chain can determine whether a scheduled task transaction occurs by monitoring all transactions under the business contract corresponding to the main chain. In addition, the side chain can also monitor all the block headers of the main chain that have been on the chain, and add these blocks to the side chain for SPV proof (Simplified Payment Verification). Specifically, after monitoring the transaction of the scheduled task initiated by the main chain at the specified address, the side chain obtains the transaction hash of the transaction; and queries the main chain through the transaction hash to obtain the block where the transaction is located. And, by monitoring the block header of the main chain, the side chain queries and obtains the hash value required to construct the Merkle tree (merkle tree) in the block of the main chain, and calculates the Merkle tree hash (merkle tree) according to the hash value. root hash); and compare the calculated Merkle tree hash with the original Merkle tree hash in the main chain block header to determine whether they are equal. When it is judged to be equal, it proves that the timed task transaction exists in the main chain and has been on the chain. If they are not equal, it proves that the transaction does not exist in the main chain, or there is an error in the data in the block header downloaded from the main chain by the side chain.
在步骤S12,在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步,并在与所述主链同步完成后执行所述定时任务。In step S12, after monitoring that the timing task is on the main chain, perform original user state synchronization with the main chain, and execute the timing task after the synchronization with the main chain is completed.
在本公开的示例性实施方式中,当侧链在监听到定时任务在主链上链后,便可以将主链的原始用户状态同步至侧链,进而在同步完成后在侧链执行对应的定时任务。In the exemplary embodiment of the present disclosure, when the side chain monitors the timing task on the main chain, it can synchronize the original user state of the main chain to the side chain, and then execute the corresponding operation on the side chain after the synchronization is completed. Scheduled tasks.
具体来说,参考图3所示,上述的在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步可以包括:Specifically, referring to FIG. 3 , after monitoring that the timing task is on the main chain, the synchronization of the original user state with the main chain may include:
步骤S1201,在监听到所述定时任务在所述主链上链后,发起确定所述定时任务在所述主链的状态的交易并上链;Step S1201, after monitoring that the timed task is on the main chain, initiate a transaction to determine the state of the timed task in the main chain and put it on the chain;
步骤S1202,在确定所述定时任务在所述主链的状态后,与所述主链进行原始用户状态同步;Step S1202, after determining the state of the timing task in the main chain, perform original user state synchronization with the main chain;
步骤S1203,在同步操作完成后,发起完成同步的交易并上链。In step S1203, after the synchronization operation is completed, a transaction that has completed the synchronization is initiated and uploaded to the chain.
在本公开的示例性实施方式中,侧链在通过转接桥监听到主链的提交定时任务(sumit Timing)的交易,并确定该交易在主链上链后,在侧链发起确定所述定时任务在所述主链的状态的交易并上链。侧链在确定主链的该定时任务后,便可以执行同步主链原始用户状态的交易,将主链的所有关联用户地址的状态同步至侧链。具体的,侧链通过转接桥调用主链的导出状态(export Status Status)方法,发起对管理用户地址(relateAddress)的状态同步。侧链节点做好每一笔状态同步的上链情况,直到所有原始用户的状态变更都上链成功。In an exemplary embodiment of the present disclosure, after the side chain monitors the transaction of the submission timing task (sumit Timing) of the main chain through the transition bridge, and determines that the transaction is on the main chain, the side chain initiates the determination of the Transactions of timed tasks in the state of the main chain are uploaded to the chain. After the side chain determines the timing task of the main chain, it can execute the transaction of synchronizing the original user state of the main chain, and synchronize the state of all associated user addresses of the main chain to the side chain. Specifically, the side chain invokes the main chain's export status (export Status Status) method through the transition bridge to initiate the status synchronization of the management user address (relateAddress). The side chain nodes do a good job of uploading each state synchronization until all the original users' state changes are successfully uploaded to the chain.
侧链在确定所有用户状态同步完成后,可以发起完成侧链状态同步(finish SyncUser Status)的交易并上链。侧链还可以通过转接桥监听与所述主链同步原始用户状态的交易,以确定同步原始用户状态的操作是否完成。After the side chain determines that all user status synchronization is completed, it can initiate a transaction to complete the side chain status synchronization (finish SyncUser Status) and upload it to the chain. The side chain can also monitor the transaction of synchronizing the original user state with the main chain through the transfer bridge, so as to determine whether the operation of synchronizing the original user state is completed.
此外,合约中还可以包含指定的定时任务执行方法,将定时任务(executeTiming)交给侧链的每个节点的定时合约执行器来管理定时任务。定时合约执行器是侧链的原生模块,在满足合约定时规则下,轮询发起对合约指定定时任务执行方法的交易。例如,定时任务执行方法中可以包括定时任务按照时间执行、按照出块顺序执行交易,每次执行交易的次数。In addition, the contract can also include a specified timed task execution method, and the timed task (executeTiming) is handed over to the timed contract executor of each node of the sidechain to manage the timed task. The timing contract executor is the native module of the side chain. Under the condition that the timing rules of the contract are met, it polls to initiate transactions that specify the timing task execution method for the contract. For example, the timed task execution method may include executing the timed task according to time, executing transactions according to the order of block production, and the number of times each time the transaction is executed.
在将主链的原始用户状态同步至侧链后,侧链由定时合约执行器便可以根据主链中定时任务中的定时规则,不间断的调用合约执行定时任务,并将任务结果共识上链。After synchronizing the original user state of the main chain to the side chain, the timed contract executor of the side chain can continuously call the contract to execute the timed task according to the timed rules in the timed task in the main chain, and upload the task result to the chain by consensus. .
具体来说,参考图4所示,可以包括以下步骤:Specifically, referring to Figure 4, the following steps may be included:
步骤S1211,由出块节点的定时合约执行器根据定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点;Step S1211, the timing contract executor of the block-producing node initiates a timing transaction according to the timing contract, and sends the block to be confirmed including the timing transaction to each voting node;
步骤S1212,所述投票节点的定时合约执行器执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果并返回至所述出块节点;Step S1212, the timing contract executor of the voting node executes the timing transaction, generates a block-producing voting result according to the execution result of the timing transaction, and returns it to the block-producing node;
步骤S1213,所述出块节点根据各所述投票节点返回的所述出块投票结果判断是否对所述定时任务结果出块上链。Step S1213, the block producing node judges whether to produce a block on the chain based on the block producing voting result returned by each of the voting nodes.
在本公开的示例性实施方式中,当侧链轮到某个节点出块后,由该出块节点的定时合约执行器根据定时策略调用合约上对应的定时任务执行方法来执行定时交易。出块节点打包定时交易,并将待确认区块发送给投票节点。投票节点也由自己的定时合约执行器执行定时交易。定时合约执行器可以首先判断定时交易是否满足定时规则,在判断满足规则时,再根据合约中的定时方法执行定时交易。投票节点定时合约执行器执行定时任务结束后,将执行结果对应的哈希值加入到验签参数中,作为出块投票结果返回出块节点。以使出块节点收集投票节点的投票结果,在执行定时任务的投票节点大于一定比例后,便可以将定时任务出块上链,进而完成一轮定时任务。在下一轮定时任务中,其他出块节点也按照这个方式依次轮询执行定时任务并上链。In the exemplary embodiment of the present disclosure, when it is the turn of a node to generate a block on the side chain, the timing contract executor of the block-producing node invokes the corresponding timing task execution method on the contract according to the timing policy to execute the timing transaction. Block-producing nodes package timed transactions and send blocks to be confirmed to voting nodes. Voting nodes also execute timed transactions by their own timed contract executors. The timed contract executor can first judge whether the timed transaction satisfies the timed rules, and then execute the timed transaction according to the timed method in the contract when it is judged that the rules are satisfied. After the voting node timing contract executor finishes executing the timing task, it adds the hash value corresponding to the execution result to the signature verification parameter, and returns it to the block producing node as the block voting result. In order to make the block producing nodes collect the voting results of the voting nodes, when the voting nodes that perform the timed task are larger than a certain proportion, the timed task can be released from the block and uploaded to the chain, and then a round of timed tasks can be completed. In the next round of scheduled tasks, other block-producing nodes will also perform scheduled tasks in turn by polling in this way and upload them to the chain.
在步骤S13中,响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链。In step S13, in response to a task stop instruction, the user state after executing the scheduled task is synchronized to the main chain.
在本公开的示例性实施方式中,上述的任务停止指令可以是根据所述定时任务中的定时规则生成的任务停止指令;例如,根据定时规则在预设的时间点结束定时任务,从而在到达该预设时间点时生成任务停止指令;或者,在定时任务执行预定次数后结束定时任务而生成任务停止指令。例如,预设的执行定时任务的次数为五百次,则在定时任务执行到达五百次时,生成任务停止指令。或者,也可以是在监听到停止定时任务的交易在主链上链时,发起停止定时任务的交易以生成任务停止指令。In an exemplary embodiment of the present disclosure, the above-mentioned task stop instruction may be a task stop instruction generated according to a timing rule in the timing task; The task stop instruction is generated at the preset time point; or, after the scheduled task is executed for a predetermined number of times, the scheduled task is ended and the task stop instruction is generated. For example, if the preset number of times to execute the timed task is 500 times, when the timed task execution reaches 500 times, a task stop instruction is generated. Alternatively, it is also possible to initiate a transaction to stop the scheduled task to generate a task stop instruction when the transaction for stopping the scheduled task is monitored on the main chain.
在获取任务停止指令后,便可以通过转接桥调用主链的同步状态接口以发起将定时任务的执行结果返回至主链的同步交易,从而将执行定时任务后的用户状态同步至主链。After obtaining the task stop instruction, you can call the synchronization status interface of the main chain through the transfer bridge to initiate a synchronization transaction that returns the execution result of the timed task to the main chain, thereby synchronizing the user status after executing the timed task to the main chain.
在步骤S14中,在监听到所述执行定时任务后的用户状态同步至所述主链后,结束所述定时任务。In step S14, after monitoring the synchronization of the user state after the execution of the timing task to the main chain, the timing task is ended.
在本公开的示例性实施方式中,参考图5所示,上述的步骤S14可以包括:In an exemplary embodiment of the present disclosure, referring to FIG. 5 , the above-mentioned step S14 may include:
步骤S141,在监听到所述主链完成所述执行定时任务后的用户状态的同步后,发起主链状态同步完成的交易并上链;Step S141, after monitoring the synchronization of the user state after the main chain completes the execution of the timing task, initiate a transaction completed by the synchronization of the main chain state and upload it to the chain;
步骤S142,发起针对所述主链的结束定时任务的交易,以使所述主链执行结束定时任务的交易。Step S142, initiating a transaction for ending the timing task of the main chain, so that the main chain executes the transaction for ending the timing task.
步骤S143,发起确认结束定时任务的交易,以结束所述定时任务。Step S143, initiating a transaction confirming the termination of the timing task to end the timing task.
在本公开的一些示例性实施例中,侧链定时任务停止后,侧链通过转接桥发起对主链的执行定时任务后的用户状态同步交易,同步所有管理用户的状态,从而变更主链的所有用户状态,设置成与侧链一致的token数量,并对每个完成同步的用户进行标记。侧链通过监控主链交易和区块,在确定主链所有用户状态变更完成后,侧链发起主链状态同步完成(finish Sync Status)的交易,从而使主链结束定时任务。In some exemplary embodiments of the present disclosure, after the side chain timing task is stopped, the side chain initiates a user status synchronization transaction on the main chain after executing the timing task through the transfer bridge, and synchronizes the status of all management users, thereby changing the main chain. The status of all users in , is set to the same number of tokens as the side chain, and each user who has completed synchronization is marked. The side chain monitors the main chain transactions and blocks, and after confirming that all user status changes on the main chain are completed, the side chain initiates a transaction of finishing Sync Status of the main chain, so that the main chain ends the scheduled task.
进一步的,侧链在完成主链状态同步完成的交易后,侧链再次通过转接桥发起针对主链的结束定时任务的交易,使主链执行并彻底结束定时任务。侧链在监控到主链结束定时任务后,侧链发起确认完结定时任务(sure Finish Timing)的交易。上链成功后,在侧链结束定时任务,从而使定时任务彻底结束。其中,上述的交易在主链或侧链中上链是指将交易数据保存至对应的区块链中,以及形成新的区块。Further, after the side chain completes the transaction completed by the synchronization of the state of the main chain, the side chain again initiates a transaction for the end timing task of the main chain through the transfer bridge, so that the main chain executes and completely ends the timing task. After the side chain monitors that the main chain finishes the timing task, the side chain initiates a transaction to confirm the completion of the timing task (sure Finish Timing). After the success of the chain, end the scheduled task on the side chain, so that the scheduled task is completely ended. Among them, the above-mentioned transactions are uploaded in the main chain or side chain, which means that the transaction data is saved in the corresponding blockchain, and a new block is formed.
在本公开的其他示例性实施方例中,对于主链和侧链来说,参考图6所示,上述的基于区块链的定时任务调度方法可以包括以下步骤:In other exemplary embodiments of the present disclosure, for the main chain and the side chain, as shown in FIG. 6 , the above-mentioned blockchain-based timing task scheduling method may include the following steps:
步骤S21,基于对主链的一任务调度指令,为所述主链配置侧链以使所述侧链开启对所述主链的业务监听;Step S21, based on a task scheduling instruction for the main chain, configure a side chain for the main chain to enable the side chain to enable service monitoring on the main chain;
步骤S22,所述侧链在监听到定时任务在所述主链上链后,与所述主链执行原始用户状态同步,并在所述侧链执行所述定时任务;Step S22, after monitoring that the timing task is on the main chain, the side chain synchronizes with the main chain to perform the original user state, and executes the timing task on the side chain;
步骤S23,所述侧链响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链以更新所述主链;Step S23, in response to a task stop instruction, the side chain synchronizes the user state after executing the scheduled task to the main chain to update the main chain;
步骤S24,在所述侧链监听到所述主链将执行定时任务后的用户状态同步完成后,在所述主链和所述侧链结束所述定时任务。Step S24, after the side chain monitors that the main chain will perform the timing task after the user state synchronization is completed, the main chain and the side chain end the timing task.
以下将结合附图和实施例对本发明示例性实施方式的基于区块链的定时任务调度方法中主链与侧链之间的交互进行更详细的描述。The interaction between the main chain and the side chain in the block chain-based timing task scheduling method according to the exemplary embodiment of the present invention will be described in more detail below with reference to the accompanying drawings and examples.
在步骤S21中,基于对主链的一任务调度指令,为所述主链配置侧链以使所述侧链开启对所述主链的业务监听。In step S21, based on a task scheduling instruction for the main chain, configure a side chain for the main chain so that the side chain enables service monitoring on the main chain.
在本公开的示例性实施方式中,用户或区块链成员可以预先根据实际需求生成任务调度指令,该指令中可以包含为主链(主区块链)分配迁移并执行定时任务的指定的侧链,并在分配侧链后使侧链开始对该主链进行交易监听。并且,可以为主链分配一条或多条侧链,即主链与侧链可以是一对多的关系。上述的主链可以包括多个业务合约,即主链合约与侧链可以是多对多的关系,其中,主链中的一个合约对应一条执行其对应的定时任务的侧链。In an exemplary embodiment of the present disclosure, a user or a blockchain member may generate a task scheduling instruction in advance according to actual needs, and the instruction may include a designated side that allocates migration to the main chain (main blockchain) and executes timed tasks After the side chain is allocated, the side chain starts to monitor transactions on the main chain. Moreover, one or more side chains can be assigned to the main chain, that is, the main chain and the side chains can be in a one-to-many relationship. The above-mentioned main chain may include multiple business contracts, that is, the main chain contract and the side chain may have a many-to-many relationship, wherein one contract in the main chain corresponds to a side chain that performs its corresponding scheduled task.
举例而言,上述的主链的业务合约可以包含执行和同步定时任务的方法。例如,业务合约中可以包含提交定时任务、停止定时任务、导出状态、同步状态以及完结定时任务的方法。其中,提交定时任务的方法可以包括以下的一项或多项参数:For example, the above-mentioned business contract of the main chain may include methods for executing and synchronizing timed tasks. For example, a business contract can include methods for submitting timed tasks, stopping timed tasks, exporting states, synchronizing states, and completing timed tasks. The method for submitting timed tasks may include one or more of the following parameters:
1)发起定时任务的合约地址(send Address),该地址必须是合约指定的区块链地址,确保定时任务由该地址发起,以防止其他账号滥用。1) The contract address (send Address) that initiates the scheduled task, which must be the blockchain address specified by the contract, to ensure that the scheduled task is initiated by this address to prevent abuse by other accounts.
2)定时任务执行的方法(execute Method),该定时任务的执行方法必须是合约中存在的方法,用于侧链执行定时任务时对方法进行调用。定时方法是由用户业务所确定的方法;例如价值定时交换方法、数据定时触发方法等。2) The execution method of the timed task. The execution method of the timed task must be a method existing in the contract, which is used to call the method when the sidechain executes the timed task. The timing method is a method determined by the user service; for example, the value timing exchange method, the data timing trigger method, and the like.
3)执行定时方法的参数(method Param),部分定时方法存在执行定时任务所需的配置参数,用于侧链在执行定时任务时将配置参数传入侧链,使侧链根据该配置参数执行定时任务。3) Execute the parameters of the timing method (method Param), some timing methods have configuration parameters required to execute the timing task, which are used for the side chain to transfer the configuration parameters to the side chain when executing the timing task, so that the side chain executes according to the configuration parameters. Scheduled tasks.
4)定时任务关联用户的地址(relate Address),由于定时任务涉及到地址间相互的价值互换,必定涉及到不同的地址;因此需要指定关联用户的地址,便于锁定该指定的关联用户的地址,即不允许该指定地址在主链交易。若不指定关联用户的地址,则可以锁定该合约的所有地址,即所有地址不能在主链交易。通过锁定交易可以防止这些地址同时在侧链和主链变更,锁定的地址在主链不能变更,在侧链允许变更。4) The timed task is associated with the user's address (relate Address). Since the timed task involves mutual value exchange between addresses, different addresses must be involved; therefore, it is necessary to specify the address of the associated user, which is convenient for locking the specified address of the associated user. , that is, the specified address is not allowed to trade on the main chain. If the address of the associated user is not specified, all addresses of the contract can be locked, that is, all addresses cannot be traded on the main chain. By locking transactions, these addresses can be prevented from being changed on the side chain and the main chain at the same time. The locked addresses cannot be changed in the main chain, but are allowed to be changed in the side chain.
5)定时任务标识(time Id),可以用于唯一标记一次定时任务的ID。后续定时任务的其他处理过程也可以以此ID作为标识。5) Time Id, which can be used to uniquely mark the ID of a timed task. Other processing procedures of subsequent timing tasks can also be identified by this ID.
6)定时任务类型(type),例如,定时器类型包括按区块递增轮询,或者按时间轮询区块等。6) Timing task type (type), for example, the timer type includes incremental polling by block, or polling block by time, etc.
7)定时任务策略(type Info),举例来说,若按块递增执行,则设置若干个区块执行预定次数的定时交易,区块的递增则是按照侧链的递增变更,比如每增加一个区块发起十笔交易。若按时间轮询,则设定预定时长后执行预定次数的定时交易,比如每10秒钟发起十笔交易。7) Timed task strategy (type Info), for example, if it is executed incrementally by block, set several blocks to execute a predetermined number of timed transactions, and the increment of the block is changed according to the incremental change of the side chain, such as each additional one. The block initiates ten transactions. If polling is performed by time, a predetermined number of timed transactions are executed after a predetermined duration, for example, ten transactions are initiated every 10 seconds.
8)定时任务停止条件(stop Require),即侧链执行定时任务的停止条件,例如,可以设置共执行预定次数的任务后停止定时任务,或者执行预定总时长的任务后停止定时任务等。若不设置停止条件,则可以通过后续发起停止定时任务的交易来停止侧链定时器。8) Timed task stop condition (stop Require), that is, the stop condition for the sidechain to execute the timed task. For example, it can be set to stop the timed task after executing a predetermined number of tasks, or stop the timed task after executing the task with a predetermined total duration, etc. If the stop condition is not set, the sidechain timer can be stopped by subsequently initiating a transaction to stop the scheduled task.
具体来说,上述的侧链对主链进行业务监听可以包括:Specifically, the above-mentioned side chain's business monitoring on the main chain may include:
步骤S211,所述侧链通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希;Step S211, the side chain monitors the transaction of submitting the timing task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
步骤S212,根据所述交易哈希获取所述提交定时任务的交易在所述主链中的所在区块,并根据所述区块的区块头查询对应的哈希值;Step S212, obtaining the block in the main chain where the transaction submitting the timing task is located according to the transaction hash, and querying the corresponding hash value according to the block header of the block;
步骤S213,根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。Step S213: Calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original Merkle tree hash value in the block header in the main chain. The comparison is made to determine whether the transaction submitting the timed task is uploaded in the main chain.
侧链通过对主链的交易(watch eth)和区块(watch block)监听结果共同确认主链定时任务的交易是否发生和上链。具体来说,侧链通过转接桥监听主链对应业务合约下的所有交易,来判断定时任务相关交易是否发生;侧链通过监听主链的所有已经上链的区块头,并加入到侧链自己的区块链中,以进行SPV证明(Simplified PaymentVerification,简单支付验证)。The side chain jointly confirms whether the transaction of the main chain timing task occurs and is on the chain through the monitoring results of the transaction (watch eth) and block (watch block) of the main chain. Specifically, the side chain monitors all transactions under the business contract corresponding to the main chain through the transfer bridge to determine whether transactions related to timed tasks occur; In its own blockchain, SPV proof (Simplified PaymentVerification, simple payment verification).
在步骤S22中,所述侧链在监听到定时任务在所述主链上链后,与所述主链执行原始用户状态同步,并在所述侧链执行所述定时任务。In step S22, after monitoring that the timing task is on the main chain, the side chain synchronizes with the original user state of the main chain, and executes the timing task on the side chain.
在本公开的示例性实施方式中,用户可以在主链提交定时任务,该定时任务可以指定主链合约的定时规则。并且,在主链提交定时任务时,还可以在主链对管理用户进行锁定,防止在主链做数据变更。In an exemplary embodiment of the present disclosure, a user can submit a timed task on the main chain, and the timed task can specify the timed rules of the main chain contract. In addition, when the main chain submits timed tasks, the management user can also be locked on the main chain to prevent data changes on the main chain.
具体来说,上述的侧链监听到在所述主链提交的定时任务后,与所述主链执行原始用户状态同步,具体可以包括:Specifically, after the above-mentioned side chain monitors the timing tasks submitted by the main chain, it synchronizes with the main chain to perform the original user state, which may specifically include:
步骤S2211,所述侧链在监听到所述定时任务在所述主链上链后,在所述侧链发起确定所述定时任务在所述主链的状态的交易并上链;Step S2211, after monitoring that the timing task is on the main chain, the side chain initiates a transaction to determine the status of the timing task on the main chain and uploads it on the side chain;
步骤S2212,所述侧链在确认所述主链的定时任务后,发起同步主链原始用户状态的交易,以用于与所述主链同步原始用户状态;Step S2212, after confirming the timing task of the main chain, the side chain initiates a transaction for synchronizing the original user state of the main chain, so as to synchronize the original user state with the main chain;
步骤S2213,当所述侧链确认完成原始用户状态同步后,在所述侧链发起侧链状态同步完成的交易并上链。Step S2213, after the side chain confirms that the synchronization of the original user state is completed, the side chain initiates a transaction completed by the side chain state synchronization and uploads it to the chain.
侧链在监听到在主链提交的定时任务上链后,侧链还可以发起确定所述定时任务在所述主链的状态的交易并上链,从而对主链的定时交易进行确认。侧链在确定主链的定时任务后,便可以执行同步主链原始用户状态的交易并上链,从而将主链的原始用户状态同步至侧链。After the side chain monitors the timed task submitted by the main chain to be uploaded, the side chain can also initiate a transaction to determine the state of the timed task in the main chain and upload it to the chain, thereby confirming the timed transaction of the main chain. After the side chain determines the scheduled tasks of the main chain, it can execute transactions that synchronize the original user state of the main chain and upload it to the chain, thereby synchronizing the original user state of the main chain to the side chain.
具体的,侧链可以通过转接桥调用主链同步状态接口,来调用主链合约中的导出状态方法,以发起同步主链原始用户状态的交易,来导出主链所有关联用户地址的原始用户状态,并做好侧链的初始化。Specifically, the side chain can call the main chain synchronization state interface through the transfer bridge to call the export state method in the main chain contract to initiate a transaction that synchronizes the original user state of the main chain to derive the original users of all associated user addresses in the main chain state and initialize the sidechain.
同时,还可以将同步结果返回主链,使主链结束原始用户状态的同步操作。侧链还可以侧链通过转接桥监听主链的同步原始用户状态的交易,来确定同步原始用户状态的操作是否完成。At the same time, the synchronization result can also be returned to the main chain, so that the main chain ends the synchronization operation of the original user state. The side chain can also monitor the transaction of synchronizing the original user state of the main chain through the transfer bridge to determine whether the operation of synchronizing the original user state is completed.
侧链在完成原始用户状态的同步后,侧链节点便可以根据定时任务中的定时规则调用合约执行定时任务,并将任务结果共识上链。具体来说,可以包括:After the sidechain completes the synchronization of the original user state, the sidechain node can call the contract to execute the timed task according to the timed rules in the timed task, and upload the task result to the chain by consensus. Specifically, it can include:
步骤S2221,所述侧链的出块节点的定时合约执行器调用定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点;Step S2221, the timing contract executor of the block-producing node of the side chain invokes the timing contract to initiate a timing transaction, and sends the block to be confirmed including the timing transaction to each voting node;
步骤S2222,所述投票节点的定时合约执行器调用定时合约执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果,并将所述出块投票结果返回至所述出块节点;Step S2222, the timing contract executor of the voting node invokes the timing contract to execute the timing transaction, generates a block voting result according to the execution result of the timing transaction, and returns the block voting result to the block generating node ;
步骤S2223,所述出块节点根据所述投票节点返回的出块投票结果判断是否对所述定时任务结果出块上链。Step S2223, the block producing node judges whether to produce a block on the chain according to the block producing voting result returned by the voting node.
在本公开的示例性实施方式中,侧链节点的定时合约执行器根据合约中定时策略发起对应的定时交易,来执行定时任务。合约内的状态变更必须是上述的指定的关联用户,若合约执行过程中涉及到关联用户的地址范围以外的用户的状态变更,则执行失败。In an exemplary embodiment of the present disclosure, the timing contract executor of the side chain node initiates a corresponding timing transaction according to the timing policy in the contract to execute the timing task. The state change in the contract must be the above-mentioned designated associated user. If the contract execution process involves the state change of the user outside the address range of the associated user, the execution will fail.
在步骤S23中,所述侧链响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链以更新所述主链。In step S23, in response to a task stop instruction, the side chain synchronizes the user state after executing the scheduled task to the main chain to update the main chain.
在本公开的示例性实施方式中,上述的任务停止指令可以是侧链根据定时任务中的定时规则生成的任务停止指令,即根据主链合约中的完结定时任务的方法生成的任务停止指令。或者,在合约中未设置停止定时任务的方法时,也可以通过在主链提交结束定时任务的交易来停止定时任务。当侧链在监听到在所述主链发起的结束定时任务的交易时,便可以在所述侧链发起结束定时任务的交易并上链,从而结束定时任务。In an exemplary embodiment of the present disclosure, the above-mentioned task stop instruction may be a task stop instruction generated by the side chain according to a timing rule in a timed task, that is, a task stop instruction generated according to a method for completing the timed task in the main chain contract. Alternatively, when the method for stopping the scheduled task is not set in the contract, the scheduled task can also be stopped by submitting a transaction to end the scheduled task on the main chain. When the side chain monitors the transaction that ends the timing task initiated on the main chain, the side chain can initiate the transaction to end the timing task and upload it to the chain, thereby ending the timing task.
具体来说,在侧链停止定时任务后,侧链便可以通过转接桥调用所述主链同步状态接口以发起将定时任务的执行结果返回至所述主链的同步交易,以将所述侧链的定时任务执行结果返回所述主链,以实现对所述主链用户状态的更新。即,侧链通过转接桥调用主链同步状态方法发起同步交易,将侧链定时任务的执行结果,即执行定时任务后的用户状态结果返回至主链,使主链变更所有用户状态,设置成与侧链一致的token数量,并对每个同步完成的用户进行标记。Specifically, after the side chain stops the timing task, the side chain can call the main chain synchronization status interface through the transition bridge to initiate a synchronization transaction that returns the execution result of the timing task to the main chain, so as to transfer the The execution result of the scheduled task of the side chain is returned to the main chain, so as to update the user status of the main chain. That is, the side chain invokes the main chain synchronization state method through the transfer bridge to initiate a synchronous transaction, and returns the execution result of the side chain's timed task, that is, the user state result after executing the timed task, to the main chain, so that the main chain changes the state of all users and sets into the same number of tokens as the side chain, and mark each user who has completed synchronization.
上述主链同步状态接口的调用方必须是侧链管理的区块链账号地址,以防止侧链的定时任务执行结果迁移到其他主链或主链账号。传入参数还可以包括地址、token数量等。例如,用户在主链中原有10个token,而在侧链执行定时任务后,为20个token,则在主链设定用户为20个token。同时用户token设置成功后,还可以标记设置成功。并且,转接桥还可以不断监听主链的同步交易,来确定同步是否成功。The caller of the above-mentioned main chain synchronization status interface must be the blockchain account address managed by the side chain, so as to prevent the execution result of the scheduled task of the side chain from being migrated to other main chains or main chain accounts. The incoming parameters can also include address, number of tokens, etc. For example, if the user originally has 10 tokens in the main chain, but after the side chain performs the scheduled task, it is 20 tokens, then the user is set to 20 tokens in the main chain. At the same time, after the user token is successfully set, you can also mark the setting as successful. In addition, the transfer bridge can also continuously monitor the synchronization transactions of the main chain to determine whether the synchronization is successful.
在步骤S24中,在所述侧链监听到所述主链将执行定时任务后的用户状态同步完成后,在所述主链和所述侧链结束所述定时任务。In step S24, after the side chain monitors the synchronization of the user state after the main chain will perform the timing task, the timing task is ended on the main chain and the side chain.
在本公开的示例性实施方式中,上述的步骤S24可以包括:In an exemplary embodiment of the present disclosure, the above-mentioned step S24 may include:
步骤S241,所述侧链在监听到所述主链的同步操作完成后,发起完成主链状态同步的交易并上链;Step S241, after monitoring the completion of the synchronization operation of the main chain, the side chain initiates a transaction to complete the synchronization of the main chain state and uploads it to the chain;
步骤S242,所述侧链发起针对所述主链的结束定时任务的交易,以使所述主链执行所述结束定时任务的交易,并在确认同步操作完成后将所述结束定时任务的交易在所述主链上链以结束所述定时任务。Step S242, the side chain initiates a transaction for the end timing task of the main chain, so that the main chain executes the transaction for ending the timing task, and after confirming that the synchronization operation is completed, the transaction for ending the timing task is completed. On the main chain to end the timing task.
步骤S243,所述侧链发起侧链确认结束定时任务的交易并上链,以用于在所述侧链结束所述定时任务。In step S243, the side chain initiates a transaction for confirming the end of the timing task on the side chain and uploads the transaction, so as to end the timing task on the side chain.
侧链通过监控主链的交易和区块,确认将执行定时任务后的用户状态与主链同步完成后,发起完成主链状态同步的交易并上链。同时,还可以解除主链中各用户的锁定状态。By monitoring the transactions and blocks of the main chain, the side chain confirms that the synchronization of the user state after executing the scheduled task with the main chain is completed, and then initiates a transaction that completes the synchronization of the main chain state and uploads it to the chain. At the same time, the locked state of each user in the main chain can also be released.
侧链还可以通过转接桥调用主链完结定时任务方法,发起对主链的结束定时任务的交易,彻底结束主链的定时任务。侧链监控到定时任务在主链彻底结束后,侧链发起确认结束定时任务的交易,在侧链上链成功后,定时任务在侧链彻底结束。从而在主链和侧链完成了一次定时任务的提交、同步、执行、停止、再同步,完结的过程。The side chain can also call the main chain to complete the timed task method through the transfer bridge, initiate a transaction to the main chain's end timed task, and completely end the main chain's timed task. After the side chain monitors that the scheduled task is completely completed on the main chain, the side chain initiates a transaction to confirm the end of the scheduled task. After the side chain is successfully uploaded, the scheduled task is completely completed on the side chain. As a result, the process of submitting, synchronizing, executing, stopping, resynchronizing, and completing a scheduled task is completed on the main chain and side chain.
综上所述,通过预先为主链分配对应的一个或多个侧链,使得不同合约的定时任务在提交到主链时,可以将定时任务转移到指定的侧链执行。通过利用侧链协作执行主链的定时任务,解决了单区块链定时交易量过多、效率和性能过低的问题;同时减少了主链的交易总量和主链的交易开销;同时侧链可以提供具体的定时任务任务的交易查询。To sum up, by pre-allocating one or more side chains corresponding to the main chain, when the timed tasks of different contracts are submitted to the main chain, the timed tasks can be transferred to the designated side chain for execution. By using the side chain to cooperate to execute the timing tasks of the main chain, the problems of excessive timing transactions, low efficiency and low performance of a single blockchain are solved; at the same time, the total transaction volume of the main chain and the transaction overhead of the main chain are reduced; at the same time, the side chain The chain can provide transaction queries for specific scheduled tasks.
示例性装置Exemplary device
在介绍了本发明示例性实施方式的基于区块链的定时任务调度方法之后,接下来,参考图7对本发明示例性实施方式的基于区块链的定时任务调度装置进行描述。After the blockchain-based timing task scheduling method according to the exemplary embodiment of the present invention is introduced, next, the blockchain-based timing task scheduling apparatus according to the exemplary embodiment of the present invention will be described with reference to FIG. 7 .
参考图7所示,本发明示例性实施方式的一种基于区块链的定时任务调度装置10可以包括:业务监听模块101、第一任务执行模块102、第一任务停止模块103以及任务结束模块104。其中:Referring to FIG. 7 , a blockchain-based timing task scheduling apparatus 10 according to an exemplary embodiment of the present invention may include: a service monitoring module 101 , a first task execution module 102 , a first task stop module 103 and a task end module 104. in:
所述业务监听模块101可以用于响应于对主链的一任务调度指令,以开始对所述主链进行业务监听。The service monitoring module 101 may be configured to respond to a task scheduling instruction on the main chain to start service monitoring on the main chain.
所述第一任务执行模块102可以用于在监听到定时任务在所述主链上链后,与所述主链进行原始用户状态同步,并在与所述主链同步完成后执行所述定时任务。The first task execution module 102 can be configured to perform original user state synchronization with the main chain after monitoring that the timing task is on the main chain, and execute the timing after the synchronization with the main chain is completed. Task.
所述第一任务停止模块103可以用于响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链。The first task stop module 103 may be configured to, in response to a task stop instruction, synchronize the user state after executing the scheduled task to the main chain.
所述任务结束模块104可以用于在监听到所述执行定时任务后的用户状态与所述主链同步完成后,结束所述定时任务。The task ending module 104 may be configured to end the scheduled task after monitoring that the user state after executing the scheduled task is synchronized with the main chain.
根据本公开的示例性实施例,所述业务监听模块101可以包括:交易哈希获取模块、区块头查询模块以及哈希值比对模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the service monitoring module 101 may include: a transaction hash acquisition module, a block header query module, and a hash value comparison module (not shown in the figure). in,
所述交易哈希获取模块可以用于通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希。The transaction hash obtaining module may be configured to monitor, through a transition bridge, a transaction that submits a timed task at a specified address of the main chain to obtain its transaction hash.
所述区块头查询模块可以用于根据所述交易哈希获取所述提交定时任务的交易在所述主链中所在区块,并根据所述区块的区块头查询对应的哈希值。The block header query module may be configured to obtain the block in the main chain where the transaction submitting the timed task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block.
所述哈希值比对模块可以用于根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。The hash value comparison module can be used to calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original value in the block header in the main chain. Merkle tree hash values are compared to determine whether the transaction submitting the scheduled task is on-chain in the main chain.
根据本公开的示例性实施例,所述第一任务执行模块102可以包括:定时任务确认模块、用户状态同步模块和同步完成模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the first task execution module 102 may include: a timing task confirmation module, a user state synchronization module, and a synchronization completion module (not shown in the figure). in,
所述定时任务确认模块可以用于在监听到所述定时任务在所述主链上链后,发起确定所述定时任务在所述主链的状态的交易并上链。The timed task confirmation module may be configured to initiate a transaction to determine the state of the timed task on the main chain after monitoring that the timed task is on the main chain, and upload it to the chain.
所述用户状态同步模块可以用于在确定所述定时任务在所述主链的状态后,与所述主链进行原始用户状态同步。The user state synchronization module may be configured to perform original user state synchronization with the main chain after determining the state of the timing task in the main chain.
所述同步完成模块可以用于在同步操作完成后,发起完成同步的交易并上链。The synchronization completion module may be used to initiate a synchronization completed transaction and upload it to the chain after the synchronization operation is completed.
根据本公开的示例性实施例,所述用户状态同步模块可以包括:主链同步状态接口调用模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the user state synchronization module may include: a main chain synchronization state interface calling module (not shown in the figure).
所述主链同步状态接口调用模块可以用于通过转接桥调用主链同步状态接口,以发起与所述主链同步原始用户状态的交易,并将同步结果返回所述主链。The main chain synchronization state interface calling module can be used to call the main chain synchronization state interface through the transfer bridge to initiate a transaction that synchronizes the original user state with the main chain, and returns the synchronization result to the main chain.
根据本公开的示例性实施例,所述装置还包括:同步结果确认模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the apparatus further includes: a synchronization result confirmation module (not shown in the figure).
所述同步结果确认模块可以用于通过转接桥监听与所述主链同步原始用户状态的交易,以确定同步原始用户状态的操作是否完成。The synchronization result confirmation module can be used to monitor the transaction of synchronizing the original user state with the main chain through the switching bridge, so as to determine whether the operation of synchronizing the original user state is completed.
根据本公开的示例性实施例,所述第一任务执行模块可以包括:定时任务执行模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the first task execution module may include: a timed task execution module (not shown in the figure).
所述定时任务执行模块可以用于根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链。The timed task execution module may be configured to call a contract to execute the timed task according to the timed rules in the timed task, and upload the task result to the chain by consensus.
根据本公开的示例性实施例,所述定时任务执行模块可以包括:交易发起模块、出块投票结果生成模块和定时任务出块模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the timing task execution module may include: a transaction initiation module, a block generation voting result generation module, and a timing task block generation module (not shown in the figure). in,
所述交易发起模块可以用于由出块节点的定时合约执行器根据定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点。The transaction initiation module may be configured to initiate a timed transaction according to the timed contract by the timed contract executor of the block-producing node, and send the block to be confirmed including the timed transaction to each voting node.
所述出块投票结果生成模块可以用于所述投票节点的定时合约执行器执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果并返回至所述出块节点。The block-producing voting result generation module can be used by the timing contract executor of the voting node to execute the timing transaction, generate a block-producing voting result according to the execution result of the timing transaction, and return it to the block-producing node.
所述定时任务出块模块可以用于所述出块节点根据各所述投票节点返回的所述出块投票结果判断是否对所述定时任务结果出块上链。The timing task block generation module can be used by the block generation node to determine whether to generate a block for the timing task result and upload it to the chain according to the block generation voting results returned by each of the voting nodes.
根据本公开的示例性实施例,所述第一任务停止模块103可以包括:停止指令生成模块活和/或停止指令监听模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the first task stop module 103 may include: a stop instruction generating module and/or a stop instruction monitoring module (not shown in the figure). in,
所述停止指令生成模块可以用于根据所述定时任务中的定时规则生成任务停止指令。The stop instruction generating module may be configured to generate a task stop instruction according to a timing rule in the timing task.
所述停止指令监听模块可以用于在监听到停止定时任务的交易在所述主链上链时,发起所述停止定时任务的交易以生成任务停止指令。The stop instruction monitoring module may be configured to initiate the transaction for stopping the timing task to generate a task stop instruction when monitoring that the transaction for stopping the timing task is on the main chain.
根据本公开的示例性实施例,所述第一任务停止模块还包括:任务结果返回模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the first task stopping module further includes: a task result returning module (not shown in the figure).
所述任务结果返回模块可以用于通过转接桥调用所述主链的同步状态接口以发起将所述定时任务的执行结果返回至所述主链的同步交易,以将执行定时任务后的用户状态同步至所述主链。The task result returning module can be used to call the synchronization status interface of the main chain through the switching bridge to initiate a synchronization transaction that returns the execution result of the timed task to the main chain, so that the user after the timed task is executed. The state is synchronized to the main chain.
根据本公开的示例性实施例,所述任务结束模块包括:用户状态监听模块、主链定时任务结束模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the task ending module includes: a user status monitoring module and a main chain timing task ending module (not shown in the figure). in,
所述用户状态监听模块可以用于在监听到所述主链完成所述执行定时任务后的用户状态的同步后,发起主链状态同步完成的交易并上链。The user state monitoring module may be configured to initiate a transaction completed by the synchronization of the state of the main chain and upload it to the chain after monitoring the synchronization of the user state after the main chain completes the execution of the timed task.
所述主链定时任务结束模块可以用于发起针对所述主链的结束定时任务的交易,以使所述主链执行结束定时任务的交易。The main chain timing task ending module may be configured to initiate a transaction for the main chain to end the timing task, so that the main chain executes the transaction for ending the timing task.
根据本公开的示例性实施例,所述装置还包括:定时任务结束模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the apparatus further includes: a timing task ending module (not shown in the figure).
所述定时任务结束模块可以用于发起确认结束定时任务的交易,以结束所述定时任务。The timed task ending module may be configured to initiate a transaction confirming the end of the timed task to end the timed task.
参考图8所示,本发明示例性实施方式的另一种基于区块链的定时任务调度装置20可以包括:侧链分配模块201、第二任务执行模块202、第二任务停止模块203和任务完结模块204。其中,Referring to FIG. 8 , another block chain-based timing task scheduling apparatus 20 according to an exemplary embodiment of the present invention may include: a side chain allocation module 201 , a second task execution module 202 , a second task stop module 203 and a task End block 204 . in,
所述侧链分配模块201可以用于基于对主链的一任务调度指令,为所述主链配置侧链以使所述侧链开启对所述主链的业务监听。The side chain allocation module 201 may be configured to configure a side chain for the main chain based on a task scheduling instruction to the main chain, so that the side chain enables service monitoring of the main chain.
所述第二任务执行模块202可以用于所述侧链在监听到定时任务在所述主链上链后,与所述主链执行用户状态同步,以用于在所述侧链执行所述定时任务。The second task execution module 202 can be used for the side chain to synchronize with the main chain execution user state after monitoring that the timing task is on the main chain, so as to be used for executing the side chain. Scheduled tasks.
所述第二任务停止模块203可以用于所述侧链响应于一任务停止指令,将执行定时任务后的用户状态同步至所述主链以更新所述主链。The second task stop module 203 can be used for the side chain to synchronize the user state after executing the scheduled task to the main chain in response to a task stop instruction to update the main chain.
所述任务完结模块204可以用于在所述侧链监听到所述主链将执行定时任务后的用户状态同步完成后,在所述主链和所述侧链结束所述定时任务。The task completion module 204 may be configured to end the scheduled task on the main chain and the side chain after the side chain monitors the synchronization of the user state after the main chain will perform the scheduled task.
根据本公开的示例性实施例,所述装置还包括:交易哈希获取模块、区块头查询模块和哈希值比对模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the apparatus further includes: a transaction hash acquisition module, a block header query module, and a hash value comparison module (not shown in the figure). in,
所述交易哈希获取模块可以用于所述侧链通过转接桥监听所述主链指定地址的提交定时任务的交易以获取其交易哈希。The transaction hash obtaining module can be used for the side chain to monitor the transaction that submits the timed task at the specified address of the main chain through the transfer bridge to obtain its transaction hash.
所述区块头查询模块可以用于根据所述交易哈希获取所述提交定时任务的交易在所述主链中的所在区块,并根据所述区块的区块头查询对应的哈希值。The block header query module may be configured to obtain the block in the main chain where the transaction submitting the timed task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block.
所述哈希值比对模块可以用于根据所述哈希值计算默克尔树哈希值,并将所述默克尔树哈希值与所述主链中所述区块头中的原始默克尔树哈希值进行比较以判断所述提交定时任务的交易是否在所述主链中上链。The hash value comparison module can be used to calculate the Merkle tree hash value according to the hash value, and compare the Merkle tree hash value with the original value in the block header in the main chain. Merkle tree hash values are compared to determine whether the transaction submitting the scheduled task is on-chain in the main chain.
根据本公开的示例性实施例,所述装置还包括:用户状态锁定模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the apparatus further includes: a user state locking module (not shown in the figure).
所述用户状态锁定模块可以用于在所述主链提交定时任务时,在所述主链锁定管理用户。The user state locking module can be used to lock and manage users on the main chain when the main chain submits a timed task.
根据本公开的示例性实施例,所述第二任务执行模块包括:定时任务侧链确定模块、原始用户状态同步模块和原始用户状态侧链确认模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the second task execution module includes: a timing task side chain determination module, an original user state synchronization module, and an original user state side chain confirmation module (not shown in the figure). in,
所述定时任务侧链确定模块可以用于所述侧链在监听到所述定时任务在所述主链上链后,在所述侧链发起确定所述定时任务在所述主链的状态的交易并上链。The timing task side chain determination module can be used for the side chain to initiate a process to determine the status of the timing task on the main chain after the side chain monitors that the timing task is on the main chain. Transaction and on-chain.
所述原始用户状态同步模块可以用于所述侧链在确认所述主链的定时任务后,发起同步主链原始用户状态的交易,以用于与所述主链同步原始用户状态。The original user state synchronization module can be used for the side chain to initiate a transaction for synchronizing the original user state of the main chain after confirming the scheduled task of the main chain, so as to synchronize the original user state with the main chain.
所述原始用户状态侧链确认模块可以用于当所述侧链确认完成原始用户状态同步后,在所述侧链发起侧链状态同步完成的交易并上链。The original user state side chain confirmation module can be used to initiate a transaction completed by the side chain state synchronization on the side chain after the side chain confirms that the synchronization of the original user state is completed, and upload it to the chain.
根据本公开的示例性实施例,所述原始用户状态同步模块包括:主链同步状态接口调用模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the original user state synchronization module includes: a main chain synchronization state interface calling module (not shown in the figure).
所述主链同步状态接口调用模块可以用于所述侧链通过转接桥调用所述主链同步状态接口,以发起同步主链原始用户状态的交易,并将同步结果返回至所述主链。The main chain synchronization state interface calling module can be used for the side chain to call the main chain synchronization state interface through the transfer bridge to initiate a transaction that synchronizes the original user state of the main chain, and returns the synchronization result to the main chain .
根据本公开的示例性实施例,所述原始用户状态侧链确认模块包括:主链同步交易监听模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the original user state side chain confirmation module includes: a main chain synchronization transaction monitoring module (not shown in the figure).
所述主链同步交易监听模块可以用于所述侧链通过转接桥监听所述主链的同步原始用户状态的交易以确定所述同步原始用户状态的操作是否完成。The main chain synchronization transaction monitoring module can be used for the side chain to monitor the transaction of synchronizing the original user state of the main chain through the transfer bridge to determine whether the operation of synchronizing the original user state is completed.
根据本公开的示例性实施例,所述第二任务执行模块包括:定时任务侧链执行模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the second task execution module includes: a timing task side chain execution module (not shown in the figure).
所述定时任务侧链执行模块可以用于所述侧链节点根据所述定时任务中的定时规则调用合约执行所述定时任务,并将任务结果共识上链。The timed task sidechain execution module can be used by the sidechain node to call a contract to execute the timed task according to the timed rules in the timed task, and to upload the task result to the chain by consensus.
根据本公开的示例性实施例,所述定时任务侧链执行模块可以包括:出块节点执行模块、投票节点执行模块和任务结果出块模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the timing task side chain execution module may include: a block producing node execution module, a voting node execution module, and a task result block producing module (not shown in the figure). in,
所述出块节点执行模块可以用于所述侧链的出块节点的定时合约执行器调用定时合约发起定时交易,并将包含所述定时交易的待确认区块发送至各投票节点。The block-producing node execution module can be used by the timing contract executor of the block-producing node of the side chain to call the timing contract to initiate a timing transaction, and send the block to be confirmed including the timing transaction to each voting node.
所述投票节点执行模块可以用于所述投票节点的定时合约执行器调用定时合约执行所述定时交易,根据所述定时交易的执行结果生成出块投票结果,并将所述出块投票结果返回至所述出块节点。The voting node execution module can be used by the timing contract executor of the voting node to call the timing contract to execute the timing transaction, generate a block voting result according to the execution result of the timing transaction, and return the block generation voting result. to the block producing node.
所述任务结果出块模块可以用于所述出块节点根据所述投票节点返回的出块投票结果判断是否对所述定时任务结果出块上链。The task result block generation module can be used by the block generation node to determine whether to generate a block for the timed task result and upload it to the chain according to the block generation voting result returned by the voting node.
根据本公开的示例性实施例,所述第二任务停止模块包括:停止指令侧链生成模块和/或停止指令侧链生成模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the second task stop module includes: a stop instruction side chain generation module and/or a stop instruction side chain generation module (not shown in the figure). in,
所述停止指令侧链生成模块可以用于所述侧链根据所述定时任务中的定时规则生成任务停止指令。The stop instruction side chain generation module may be used for the side chain to generate a task stop instruction according to a timing rule in the timing task.
所述停止指令侧链监听模块可以用于所述侧链在监听到在所述主链发起的结束定时任务的交易时,在所述侧链发起结束定时任务的交易并上链。The stop command side chain monitoring module can be used for the side chain to initiate a transaction to end the timed task on the side chain and upload the transaction when the side chain monitors the transaction initiated on the main chain to end the timed task.
根据本公开的示例性实施例,所述第二任务停止模块还包括:任务结果返回模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the second task stop module further includes: a task result return module (not shown in the figure).
所述任务结果返回模块可以用于所述侧链通过转接桥调用所述主链同步状态接口以发起将定时任务的执行结果返回至所述主链的同步交易,以将所述侧链的定时任务执行结果返回所述主链,以实现对所述主链用户状态的更新。The task result return module can be used by the side chain to call the main chain synchronization status interface through the transfer bridge to initiate a synchronization transaction that returns the execution result of the timed task to the main chain, so as to return the side chain's synchronization status. The execution result of the scheduled task is returned to the main chain, so as to update the user status of the main chain.
根据本公开的示例性实施例,所述任务完结模块包括:主链同步完成模块和定时任务主链结束模块(图中未示出)。其中,According to an exemplary embodiment of the present disclosure, the task completion module includes: a main chain synchronization completion module and a timing task main chain completion module (not shown in the figure). in,
所述主链同步完成模块可以用于所述侧链在监听到所述主链的同步操作完成后,发起完成主链状态同步的交易并上链。The main chain synchronization completion module can be used for the side chain to initiate a transaction to complete the main chain state synchronization and upload to the chain after monitoring the completion of the synchronization operation of the main chain.
所述定时任务主链结束模块可以用于所述侧链发起针对所述主链的结束定时任务的交易,以使所述主链执行所述结束定时任务的交易,并在确认同步操作完成后将所述结束定时任务的交易在所述主链上链以结束所述定时任务。The timing task main chain end module can be used for the side chain to initiate a transaction for the end timing task of the main chain, so that the main chain executes the transaction for ending the timing task, and after confirming that the synchronization operation is completed The transaction that ends the timing task is chained on the main chain to end the timing task.
根据本公开的示例性实施例,所述任务完结模块还包括:定时任务侧链结束模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the task completion module further includes: a timing task side chain completion module (not shown in the figure).
所述定时任务侧链结束模块可以用于所述侧链发起侧链确认结束定时任务的交易并上链,以用于在所述侧链结束所述定时任务。The timing task side chain termination module may be used by the side chain to initiate a transaction of the side chain to confirm the termination of the timing task and upload it to the chain, so as to end the timing task on the side chain.
根据本公开的示例性实施例,所述装置还包括:用户解锁模块(图中未示出)。According to an exemplary embodiment of the present disclosure, the apparatus further includes: a user unlocking module (not shown in the figure).
所述用户解锁模块可以用于所述主链对管理用户进行解锁。The user unlocking module can be used for the main chain to unlock management users.
由于本发明实施方式的基于区块链的定时任务调度装置装置的各个功能模块与上述基于区块链的定时任务调度装置方法发明实施方式中相同,因此在此不再赘述。Since the functional modules of the block chain-based timing task scheduling apparatus according to the embodiment of the present invention are the same as those in the above-mentioned inventive embodiments of the block chain-based timing task scheduling apparatus method, they will not be repeated here.
示例性存储介质Exemplary Storage Media
在介绍了本发明示例性实施方式的音频播放方法和装置、音频分享方法和装置之后,接下来,参考图9对本发明示例性实施方式的存储介质进行说明。After introducing the audio playing method and apparatus, and the audio sharing method and apparatus according to the exemplary embodiment of the present invention, next, the storage medium of the exemplary embodiment of the present invention will be described with reference to FIG. 9 .
参考图9所示,描述了根据本发明的实施方式的用于实现上述方法的程序产品700,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在设备,例如个人电脑上运行。然而,本发明的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。Referring to FIG. 9, a program product 700 for implementing the above method is described according to an embodiment of the present invention, which may adopt a portable compact disc read only memory (CD-ROM) and include program code, and may be stored in a device such as run on a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
所述程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples (non-exhaustive list) of readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer readable signal medium may include a propagated data signal in baseband or as part of a carrier wave with readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium can also be any readable medium, other than a readable storage medium, that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言的任意组合来编写用于执行本发明操作的程序代码,所述程序设计语言包括面向对象的程序设计语言-诸如Java、C++等,还包括常规的过程式程序设计语言-诸如"C"语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages - such as Java, C++, etc., as well as conventional procedural Programming Language - Such as "C" language or similar programming language. The program code may execute entirely on the user computing device, partly on the user computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (eg, using an Internet service provider business via an Internet connection).
示例性电子设备Exemplary Electronics
在介绍了本发明示例性实施方式的存储介质之后,接下来,参考图10对本发明示例性实施方式的电子设备进行说明。After introducing the storage medium of the exemplary embodiment of the present invention, next, the electronic device of the exemplary embodiment of the present invention will be described with reference to FIG. 10 .
图10显示的电子设备800仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。The electronic device 800 shown in FIG. 10 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present invention.
如图10所示,电子设备800以通用计算设备的形式表现。电子设备800的组件可以包括但不限于:上述至少一个处理单元810、上述至少一个存储单元820、连接不同系统组件(包括存储单元820和处理单元810)的总线830、显示单元840。As shown in FIG. 10, electronic device 800 takes the form of a general-purpose computing device. Components of the electronic device 800 may include, but are not limited to: the above-mentioned at least one processing unit 810 , the above-mentioned at least one storage unit 820 , a bus 830 connecting different system components (including the storage unit 820 and the processing unit 810 ), and a display unit 840 .
其中,所述存储单元存储有程序代码,所述程序代码可以被所述处理单元810执行,使得所述处理单元810执行本说明书上述"示例性方法"部分中描述的根据本发明各种示例性实施方式的步骤。例如,所述处理单元810可以执行如图1中所示的步骤S11至步骤S14,或者所述处理单元810可以执行如图6中所示的步骤S21至步骤S24。Wherein, the storage unit stores program codes, and the program codes can be executed by the processing unit 810, so that the processing unit 810 executes various exemplary methods according to the present invention described in the above-mentioned "Exemplary Methods" section of this specification Implementation steps. For example, the processing unit 810 may perform steps S11 to S14 as shown in FIG. 1 , or the processing unit 810 may perform steps S21 to S24 as shown in FIG. 6 .
存储单元820可以包括易失性存储单元,例如随机存取存储单元(RAM)8201和/或高速缓存存储单元8202,还可以进一步包括只读存储单元(ROM)8203。The storage unit 820 may include a volatile storage unit, such as a random access storage unit (RAM) 8201 and/or a cache storage unit 8202 , and may further include a read only storage unit (ROM) 8203 .
存储单元820还可以包括具有一组(至少一个)程序模块8205的程序/实用工具8204,这样的程序模块8205包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。The storage unit 820 may also include a program/utility 8204 having a set (at least one) of program modules 8205 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, An implementation of a network environment may be included in each or some combination of these examples.
总线830可以包括数据总线、地址总线和控制总线。The bus 830 may include a data bus, an address bus, and a control bus.
电子设备800也可以与一个或多个外部设备900(例如键盘、指向设备、蓝牙设备等)通信,这种通信可以通过输入/输出(I/O)接口850进行。电子设备800还包括显示单元840,其连接到输入/输出(I/O)接口850,用于进行显示。并且,电子设备800还可以通过网络适配器860与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器860通过总线830与电子设备800的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备800使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。Electronic device 800 may also communicate with one or more external devices 900 (eg, keyboards, pointing devices, Bluetooth devices, etc.), such communication may be through input/output (I/O) interface 850 . The electronic device 800 also includes a display unit 840 connected to an input/output (I/O) interface 850 for display. Also, the electronic device 800 may communicate with one or more networks (eg, a local area network (LAN), a wide area network (WAN), and/or a public network such as the Internet) through a network adapter 860 . As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830 . It should be understood that, although not shown, other hardware and/or software modules may be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives and data backup storage systems.
应当注意,尽管在上文详细描述中提及了音频播放装置和音频分享装置的若干模块或子模块,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本发明的实施方式,上文描述的两个或更多单元/模块的特征和功能可以在一个单元/模块中具体化。反之,上文描述的一个单元/模块的特征和功能可以进一步划分为由多个单元/模块来具体化。It should be noted that although several modules or sub-modules of the audio playback device and the audio sharing device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. Indeed, the features and functions of two or more units/modules described above may be embodied in one unit/module according to embodiments of the present invention. Conversely, the features and functions of one unit/module described above may be further subdivided to be embodied by multiple units/modules.
此外,尽管在附图中以特定顺序描述了本发明方法的操作,但是,这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。Furthermore, although the operations of the methods of the present invention are depicted in the figures in a particular order, this does not require or imply that the operations must be performed in the particular order, or that all illustrated operations must be performed to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined to be performed as one step, and/or one step may be decomposed into multiple steps to be performed.
虽然已经参考若干具体实施方式描述了本发明的精神和原理,但是应该理解,本发明并不限于所公开的具体实施方式,对各方面的划分也不意味着这些方面中的特征不能组合以进行受益,这种划分仅是为了表述的方便。本发明旨在涵盖所附权利要求的精神和范围内所包括的各种修改和等同布置。While the spirit and principles of the present invention have been described with reference to a number of specific embodiments, it should be understood that the invention is not limited to the specific embodiments disclosed, nor does the division of aspects imply that features of these aspects cannot be combined to perform Benefit, this division is only for convenience of presentation. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims (10)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110327969.XA CN112988751B (en) | 2019-04-22 | 2019-04-22 | Timing task scheduling method and device based on block chain |
| CN201910322758.XA CN110046166B (en) | 2019-04-22 | 2019-04-22 | Block chain-based timing task scheduling method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910322758.XA CN110046166B (en) | 2019-04-22 | 2019-04-22 | Block chain-based timing task scheduling method and device |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110327969.XA Division CN112988751B (en) | 2019-04-22 | 2019-04-22 | Timing task scheduling method and device based on block chain |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN110046166A true CN110046166A (en) | 2019-07-23 |
| CN110046166B CN110046166B (en) | 2021-06-18 |
Family
ID=67278277
Family Applications (2)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910322758.XA Active CN110046166B (en) | 2019-04-22 | 2019-04-22 | Block chain-based timing task scheduling method and device |
| CN202110327969.XA Active CN112988751B (en) | 2019-04-22 | 2019-04-22 | Timing task scheduling method and device based on block chain |
Family Applications After (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110327969.XA Active CN112988751B (en) | 2019-04-22 | 2019-04-22 | Timing task scheduling method and device based on block chain |
Country Status (1)
| Country | Link |
|---|---|
| CN (2) | CN110046166B (en) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111143053A (en) * | 2019-11-15 | 2020-05-12 | 杭州涂鸦信息技术有限公司 | Scheduling method of timing task, server and storage device |
| CN111369144A (en) * | 2020-03-04 | 2020-07-03 | 浙江大学 | Intelligent energy scheduling system and method based on fog calculation and block chain |
| CN112801795A (en) * | 2021-03-08 | 2021-05-14 | 中国工商银行股份有限公司 | Block chain multi-chain management method and device, electronic equipment and readable storage medium |
| CN113672358A (en) * | 2020-05-15 | 2021-11-19 | 北京沃东天骏信息技术有限公司 | Timing task processing method and device, system, electronic device and storage medium |
| CN115396197A (en) * | 2022-08-25 | 2022-11-25 | 福建中锐网络股份有限公司 | Token system of carbon assets |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114356523A (en) * | 2021-12-31 | 2022-04-15 | 浙江大华技术股份有限公司 | Method, device, storage medium and electronic device for executing blockchain tasks |
Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR101701131B1 (en) * | 2016-04-28 | 2017-02-13 | 주식회사 라피 | Data recording and validation methods and systems using the connecting of blockchain between different type |
| CN106528775A (en) * | 2016-10-28 | 2017-03-22 | 山东明和软件有限公司 | Private block chain operation support system that supports logical multi-chain, and working method thereof |
| CN106874087A (en) * | 2017-01-25 | 2017-06-20 | 上海钜真金融信息服务有限公司 | A kind of block chain intelligence contract timed task dispatching method |
| CN107767267A (en) * | 2017-10-20 | 2018-03-06 | 上海策赢网络科技有限公司 | The transfer method and device of a kind of virtual resource |
| CN107886388A (en) * | 2017-09-22 | 2018-04-06 | 杭州云象网络技术有限公司 | The traffic trip credit and safety service platform and its operation method of multicenter are realized based on alliance's chain |
| CN108139964A (en) * | 2017-12-06 | 2018-06-08 | 深圳达闼科技控股有限公司 | Cloud service configuration method and device, storage medium and cloud service system |
| US20180227131A1 (en) * | 2017-02-06 | 2018-08-09 | ShoCard, Inc. | Electronic identification verification methods and systems with storage of certification records to a side chain |
| CN109189751A (en) * | 2018-09-18 | 2019-01-11 | 平安科技(深圳)有限公司 | Method of data synchronization and terminal device based on block chain |
| CN109271245A (en) * | 2018-09-13 | 2019-01-25 | 腾讯科技(深圳)有限公司 | Method and device for controlling block processing task |
| US20190109707A1 (en) * | 2017-10-10 | 2019-04-11 | Chromata Corporation | System and method for a blockchain network with heterogeneous privacy |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20200327498A1 (en) * | 2016-03-21 | 2020-10-15 | National Ict Australia Limited | Business Process Execution on a Blockchain Platform |
| KR102303427B1 (en) * | 2017-04-05 | 2021-09-23 | 삼성에스디에스 주식회사 | Method for calculating confirmation reliability for blockchain based transaction and Blockchain network monitoring system for performing the method |
| GB201709188D0 (en) * | 2017-06-09 | 2017-07-26 | Nchain Holdings Ltd | Computer-Implemented system and method |
| CN109558411A (en) * | 2017-09-26 | 2019-04-02 | 浙江华信区块链科技服务有限公司 | A kind of lower chain synchronous method and device based on block chain data |
| CN108074081A (en) * | 2017-12-08 | 2018-05-25 | 上海策赢网络科技有限公司 | The transfer method and device of a kind of virtual resource |
| CN109361661B (en) * | 2018-10-08 | 2020-07-10 | 莆田市烛火信息技术有限公司 | A consensus device of a blockchain that relies on the computing power of the relevant chain |
| CN109513207A (en) * | 2018-11-12 | 2019-03-26 | 网易(杭州)网络有限公司 | Processing method, device, storage medium, processor and the server of game asset |
-
2019
- 2019-04-22 CN CN201910322758.XA patent/CN110046166B/en active Active
- 2019-04-22 CN CN202110327969.XA patent/CN112988751B/en active Active
Patent Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR101701131B1 (en) * | 2016-04-28 | 2017-02-13 | 주식회사 라피 | Data recording and validation methods and systems using the connecting of blockchain between different type |
| CN106528775A (en) * | 2016-10-28 | 2017-03-22 | 山东明和软件有限公司 | Private block chain operation support system that supports logical multi-chain, and working method thereof |
| CN106874087A (en) * | 2017-01-25 | 2017-06-20 | 上海钜真金融信息服务有限公司 | A kind of block chain intelligence contract timed task dispatching method |
| US20180227131A1 (en) * | 2017-02-06 | 2018-08-09 | ShoCard, Inc. | Electronic identification verification methods and systems with storage of certification records to a side chain |
| CN107886388A (en) * | 2017-09-22 | 2018-04-06 | 杭州云象网络技术有限公司 | The traffic trip credit and safety service platform and its operation method of multicenter are realized based on alliance's chain |
| US20190109707A1 (en) * | 2017-10-10 | 2019-04-11 | Chromata Corporation | System and method for a blockchain network with heterogeneous privacy |
| CN107767267A (en) * | 2017-10-20 | 2018-03-06 | 上海策赢网络科技有限公司 | The transfer method and device of a kind of virtual resource |
| CN108139964A (en) * | 2017-12-06 | 2018-06-08 | 深圳达闼科技控股有限公司 | Cloud service configuration method and device, storage medium and cloud service system |
| CN109271245A (en) * | 2018-09-13 | 2019-01-25 | 腾讯科技(深圳)有限公司 | Method and device for controlling block processing task |
| CN109189751A (en) * | 2018-09-18 | 2019-01-11 | 平安科技(深圳)有限公司 | Method of data synchronization and terminal device based on block chain |
Non-Patent Citations (4)
| Title |
|---|
| ALBERTO GAROFFOLO等: "Sidechains: Decoupled Consensus Between Chains", 《HTTPS://ARXIV.ORG/ABS/1812.05441》 * |
| LIPING DENG等: "Research on Cross-Chain Technology Based on Sidechain and Hash-Locking", 《INTERNATIONAL CONFERENCE ON EDGE COMPUTING》 * |
| 白杰等: "发布区块链标准应用模型及应用部署技术研究", 《信息技术与网络安全》 * |
| 赵小峰的思想迭代器: "以太坊上的侧链技术Loom(一)", 《HTTPS://WWW.JIANSHU.COM/P/35039DC96BBB?UTM_CAMPAIGN=MALESKINE&UTM_CONTENT=NOTE&UTM_MEDIUM=SEO_NOTES&UTM_SOURCE=RECOMMENDATION》 * |
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111143053A (en) * | 2019-11-15 | 2020-05-12 | 杭州涂鸦信息技术有限公司 | Scheduling method of timing task, server and storage device |
| CN111369144A (en) * | 2020-03-04 | 2020-07-03 | 浙江大学 | Intelligent energy scheduling system and method based on fog calculation and block chain |
| CN111369144B (en) * | 2020-03-04 | 2022-02-18 | 浙江大学 | Intelligent energy scheduling system and method based on fog calculation and block chain |
| CN113672358A (en) * | 2020-05-15 | 2021-11-19 | 北京沃东天骏信息技术有限公司 | Timing task processing method and device, system, electronic device and storage medium |
| CN112801795A (en) * | 2021-03-08 | 2021-05-14 | 中国工商银行股份有限公司 | Block chain multi-chain management method and device, electronic equipment and readable storage medium |
| CN112801795B (en) * | 2021-03-08 | 2024-04-02 | 中国工商银行股份有限公司 | Block chain multi-chain management method, device, electronic equipment and readable storage medium |
| CN115396197A (en) * | 2022-08-25 | 2022-11-25 | 福建中锐网络股份有限公司 | Token system of carbon assets |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112988751A (en) | 2021-06-18 |
| CN110046166B (en) | 2021-06-18 |
| CN112988751B (en) | 2024-08-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110046166B (en) | Block chain-based timing task scheduling method and device | |
| CN105573828B (en) | A kind of operation processing method and device | |
| EP3480686B1 (en) | Data processing method, cluster manager, resource manager and data processing system | |
| CN114282210B (en) | Sandbox automatic construction method, system, computer device and readable storage medium | |
| CN110210845B (en) | Method, apparatus, medium, and computing device for blockchain data migration | |
| CN103038788A (en) | Provisioning multiple network resources | |
| JP2016513305A (en) | Instance host configuration | |
| US11960369B2 (en) | Efficient creation of a secondary database system | |
| CN117850968B (en) | A method, device and system for specifying NUMA nodes to implement virtual machine migration | |
| CN108400898A (en) | The management method and device of resource in cloud data management platform | |
| CN111327447B (en) | Distributed system, arbitration method, node device and storage medium | |
| CN111861481A (en) | Block chain account checking method and system | |
| WO2023045617A1 (en) | Transaction data processing method and apparatus, device and medium | |
| CN114491656B (en) | Methods and devices in blockchain networks | |
| CN112132684A (en) | Account settling method and system based on language prediction machine lock group | |
| CN111782406A (en) | Resource allocation method and device, electronic equipment and computer readable storage medium | |
| CN109586949A (en) | Block generation method and computer storage medium | |
| CN119861925A (en) | Interface access number method based on e-commerce SaaS ERP system | |
| CN113628052B (en) | Blockchain asset and contract processing method, system and device based on oracle | |
| WO2023197259A1 (en) | Devices and methods for providing a federated learning model | |
| CN111159585A (en) | Method, apparatus, device and medium for automatically submitting data | |
| JP7529361B2 (en) | CONTROL METHOD, CONTROL PROGRAM, AND INFORMATION PROCESSING APPARATUS | |
| TWM676825U (en) | Uninterrupted gate service system | |
| CN120234018A (en) | Full-link application update method and electronic device | |
| CN121051096A (en) | HBase data migration method and device among clusters |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |