Scheduled task scheduling method and device based on blockchain
By allocating side chains to the main chain, monitoring and executing scheduled tasks of the main chain, the problem of low transaction performance of the blockchain platform is solved, and efficient scheduling of scheduled tasks and transaction speed improvement are achieved.
Patent Information
- Application Number
- CN202110327969.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-22
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing blockchain platform has low transaction performance and cannot meet users' frequent transaction needs. Moreover, different business contracts are used between blockchains, making it impossible to perform scheduled transaction tasks on one blockchain platform with high frequency.
By allocating side chains to the main chain, the side chain can monitor the main chain transactions in real time, and after the main chain submits the scheduled tasks, synchronizes the user status to the side chain, executes the scheduled tasks, and then synchronizes the execution results back to the main chain, reducing the number of main chain transactions. chain transaction volume and reduce transaction overhead.
It improves the execution efficiency of scheduled tasks on the main chain, reduces the total transaction volume and transaction overhead of the main chain, increases transaction speed, and achieves efficient scheduling of scheduled tasks.
Smart Images

Figure CN112988751B
Abstract
Description
[0001] This invention is a divisional application of a patent application with an application date of April 22, 2019, application number 201910322758.X, and invention name “Timed task scheduling method and device based on blockchain”. Technical Field
[0002] The embodiments of the present invention relate to the field of computer technology. More specifically, the embodiments of the present invention relate to a blockchain-based scheduled task scheduling method and device, a storage medium and an electronic device. Background Art
[0003] This section is intended to provide a background or context to embodiments of the invention recited in the claims, and no description herein is admitted to be prior art by inclusion in this section.
[0004] As an emerging distributed infrastructure, blockchain is essentially a decentralized database. It has now been widely used in many fields such as securities trading, e-commerce, social communications, and file storage. Summary of the invention
[0005] However, in some technologies, on the one hand, due to the relatively low transaction performance and slow transaction processing speed of existing blockchain platforms, they cannot meet users' needs for frequent transactions and transaction timeliness; on the other hand, different business contracts are used between blockchains, making it impossible to execute a large number of high-frequency transactions on one blockchain platform.
[0006] Therefore, in the prior art, there is still a lack of a corresponding systematic and standard data processing method for transferring the scheduled tasks of the main chain to the side chain for execution.
[0007] To this end, there is a great need for an improved blockchain-based scheduled task scheduling method and device, storage medium and electronic device to achieve efficient scheduling of scheduled tasks between the main chain and the side chain.
[0008] In this context, embodiments of the present invention are intended to provide a blockchain-based scheduled task scheduling method and device, a storage medium, and an electronic device.
[0009] According to one aspect of the present disclosure, a blockchain-based scheduled task scheduling method is provided, comprising:
[0010] In response to a task scheduling instruction for the main chain, start monitoring the business of the main chain;
[0011] After monitoring that the scheduled task is on the main chain, synchronizing the original user status with the main chain, and executing the scheduled task after the synchronization with the main chain is completed;
[0012] In response to a task stop instruction, synchronizing the user status after executing the scheduled task to the main chain;
[0013] After monitoring that the user status after executing the scheduled task is synchronized to the main chain, the scheduled task is ended.
[0014] In an exemplary embodiment of the present disclosure, the monitoring of services on the main link includes:
[0015] Monitor the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
[0016] Obtain the block in the main chain where the transaction for submitting the scheduled task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block;
[0017] A Merkle tree hash value is calculated based on the hash value, and the Merkle tree hash value is compared 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 on the main chain.
[0018] In an exemplary embodiment of the present disclosure, after monitoring that the scheduled task is on the main chain, synchronizing the original user state with the main chain includes:
[0019] After monitoring that the scheduled task is on the main chain, a transaction is initiated to determine the status of the scheduled task on the main chain and the transaction is on the main chain;
[0020] After determining the status of the scheduled task on the main chain, synchronizing the original user status with the main chain;
[0021] After the synchronization operation is completed, initiate a transaction to complete the synchronization and upload it to the chain.
[0022] In an exemplary embodiment of the present disclosure, after determining the status of the scheduled task on the main chain, synchronizing the original user status with the main chain includes:
[0023] The main chain synchronization status interface is called through the transfer bridge to initiate a transaction to synchronize the original user status with the main chain, and return the synchronization result to the main chain.
[0024] In an exemplary embodiment of the present disclosure, the method further includes:
[0025] 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.
[0026] In an exemplary embodiment of the present disclosure, executing the scheduled task includes:
[0027] The contract is called according to the timing rules in the scheduled task to execute the scheduled task, and the task result consensus is uploaded to the chain.
[0028] In an exemplary embodiment of the present disclosure, calling a contract to execute the scheduled task according to the timing rule in the scheduled task and uploading the task result consensus to the chain includes:
[0029] 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 containing the timing transaction to each voting node;
[0030] The timing contract executor of the voting node executes the timing transaction, generates a block voting result according to the execution result of the timing transaction, and returns it to the block node;
[0031] The block-producing node determines whether to produce a block for the scheduled task result and chain it according to the block-producing voting result returned by each of the voting nodes.
[0032] In an exemplary embodiment of the present disclosure, the generation of the task stop instruction includes:
[0033] Generate a task stop instruction according to the timing rule in the scheduled task; or
[0034] When a transaction for stopping a scheduled task is monitored on the main chain, the transaction for stopping the scheduled task is initiated to generate a task stop instruction.
[0035] In an exemplary embodiment of the present disclosure, synchronizing the user status after executing the scheduled task to the main chain includes:
[0036] The synchronization status interface of the main chain is called through the switching bridge to initiate a synchronization transaction that returns the execution result of the scheduled task to the main chain, so as to synchronize the user status after executing the scheduled task to the main chain.
[0037] In an exemplary embodiment of the present disclosure, after monitoring that the user status after executing the scheduled task is synchronized to the main chain, ending the scheduled task includes:
[0038] After monitoring that the main chain completes the synchronization of the user status after executing the scheduled task, initiate a transaction to complete the synchronization of the main chain status and upload it to the chain;
[0039] Initiate a transaction for ending the scheduled task on the main chain, so that the main chain executes the transaction for ending the scheduled task.
[0040] In an exemplary embodiment of the present disclosure, after monitoring the transaction of the main chain executing the end of the scheduled task, the method further includes:
[0041] Initiate a transaction to confirm the end of the scheduled task to end the scheduled task.
[0042] According to one aspect of the present disclosure, a blockchain-based scheduled task scheduling method is provided, comprising:
[0043] Based on a task scheduling instruction for the main chain, configure a side chain for the main chain so that the side chain starts monitoring the business of the main chain;
[0044] After monitoring that the scheduled task is on the main chain, the side chain synchronizes the original user state with the main chain and executes the scheduled task on the side chain;
[0045] In response to a task stop instruction, the side chain synchronizes the user status after executing the scheduled task to the main chain to update the main chain;
[0046] After the side chain monitors that the main chain will execute the scheduled task, the scheduled task is terminated on the main chain and the side chain after the user status synchronization is completed.
[0047] In an exemplary embodiment of the present disclosure, the side chain starts monitoring the service of the main chain, including:
[0048] The side chain monitors the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
[0049] Obtain the block where the transaction for submitting the scheduled task is located in the main chain according to the transaction hash, and query the corresponding hash value according to the block header of the block;
[0050] A Merkle tree hash value is calculated based on the hash value, and the Merkle tree hash value is compared 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 on the main chain.
[0051] In an exemplary embodiment of the present disclosure, when the main chain submits a scheduled task, the method further includes:
[0052] Lock management users in the main chain.
[0053] In an exemplary embodiment of the present disclosure, after the side chain monitors the scheduled task submitted by the main chain, performing original user state synchronization with the main chain includes:
[0054] After monitoring that the scheduled task is on the main chain, the side chain initiates a transaction on the side chain to determine the status of the scheduled task on the main chain and uploads it to the chain;
[0055] After confirming the scheduled task of the main chain, the side chain initiates a transaction to synchronize the original user state of the main chain, so as to synchronize the original user state with the main chain;
[0056] When the side chain confirms that the original user state synchronization is completed, a transaction for completing the side chain state synchronization is initiated on the side chain and uploaded to the chain.
[0057] In an exemplary embodiment of the present disclosure, the side chain initiates a transaction for synchronizing the original user state of the main chain for synchronizing the original user state with the main chain, including:
[0058] The side chain calls the main chain synchronization status interface through the transfer bridge to initiate a transaction to synchronize the original user status of the main chain, and returns the synchronization result to the main chain.
[0059] In an exemplary embodiment of the present disclosure, the method for the side chain to confirm the completion of the original user state synchronization includes:
[0060] The side chain monitors 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.
[0061] In an exemplary embodiment of the present disclosure, the executing of the scheduled task by the side chain includes:
[0062] The side chain node calls the contract to execute the scheduled task according to the timing rules in the scheduled task, and uploads the task result consensus to the chain.
[0063] In an exemplary embodiment of the present disclosure, the side chain node calls the contract to execute the scheduled task according to the timing rule in the scheduled task, and uploads the task result consensus to the chain, including:
[0064] The timing contract executor of the block-producing node of the side chain calls the timing contract to initiate a timing transaction, and sends the block to be confirmed containing the timing transaction to each voting node;
[0065] The timing contract executor of the voting node calls 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 node;
[0066] The block producing node determines whether to produce a block for the scheduled task result and chain it according to the block producing voting result returned by the voting node.
[0067] In an exemplary embodiment of the present disclosure, the side chain responds to a task stop instruction including:
[0068] The side chain generates a task stop instruction according to the timing rule in the scheduled task; or
[0069] When the side chain monitors the transaction initiated by the main chain to end the scheduled task, the transaction to end the scheduled task is initiated on the side chain and uploaded to the chain.
[0070] In an exemplary embodiment of the present disclosure, synchronizing the user status with the main chain to update the main chain includes:
[0071] The side chain calls the main chain synchronization status interface through the transfer bridge to initiate a synchronization transaction that returns the execution result of the scheduled task to the main chain, so as to return the execution result of the scheduled task of the side chain to the main chain, so as to update the user status of the main chain.
[0072] In an exemplary embodiment of the present disclosure, after the user status synchronization is completed after the side chain monitors that the main chain will execute the scheduled task, the main chain and the side chain end the scheduled task including:
[0073] After monitoring that the synchronization operation of the main chain is completed, the side chain initiates a transaction to complete the synchronization of the main chain status and uploads it to the chain;
[0074] The side chain initiates a transaction for ending the scheduled task on the main chain, so that the main chain executes the transaction for ending the scheduled task, and after confirming that the synchronization operation is completed, the transaction for ending the scheduled task is chained on the main chain to end the scheduled task.
[0075] In an exemplary embodiment of the present disclosure, after the side chain monitors the transaction of the end of the scheduled task of the main chain and is on-chain on the main chain, the method further includes:
[0076] The side chain initiates a transaction to confirm the end of the scheduled task and uploads it to the chain, so as to end the scheduled task on the side chain.
[0077] In an exemplary embodiment of the present disclosure, the method further includes:
[0078] The main chain unlocks the management user.
[0079] According to one aspect of the present disclosure, a blockchain-based scheduled task scheduling device is provided, comprising:
[0080] A service monitoring module, used to respond to a task scheduling instruction for the main chain to start service monitoring for the main chain;
[0081] A first task execution module is used to synchronize the original user status with the main chain after monitoring that the scheduled task is on the main chain, and execute the scheduled task after the synchronization with the main chain is completed;
[0082] A first task stop module, configured to synchronize the user status after executing the scheduled task to the main chain in response to a task stop instruction;
[0083] The task ending module is used to end the scheduled task after monitoring that the user status after executing the scheduled task is synchronized with the main chain.
[0084] In an exemplary embodiment of the present disclosure, the service monitoring module includes:
[0085] A transaction hash acquisition module is used to monitor the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
[0086] A block header query module, used to obtain the block in the main chain where the transaction for submitting the scheduled task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block;
[0087] A hash value comparison module is used to calculate a Merkle tree hash value based on 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 on the main chain.
[0088] In an exemplary embodiment of the present disclosure, the first task execution module includes:
[0089] A scheduled task confirmation module is used to initiate a transaction to determine the status of the scheduled task on the main chain and upload it to the chain after monitoring that the scheduled task is on the main chain;
[0090] A user status synchronization module, used to synchronize the original user status with the main chain after determining the status of the scheduled task on the main chain;
[0091] The synchronization completion module is used to initiate and upload the synchronization transaction to the chain after the synchronization operation is completed.
[0092] In an exemplary embodiment of the present disclosure, the user status synchronization module includes:
[0093] The main chain synchronization status interface calling module is used to call the main chain synchronization status interface through the transfer bridge to initiate a transaction to synchronize the original user status with the main chain, and return the synchronization result to the main chain.
[0094] In an exemplary embodiment of the present disclosure, the device further includes:
[0095] 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 to determine whether the operation of synchronizing the original user state is completed.
[0096] In an exemplary embodiment of the present disclosure, the first task execution module includes:
[0097] The scheduled task execution module is used to call the contract to execute the scheduled task according to the timing rules in the scheduled task, and upload the task result consensus to the chain.
[0098] In an exemplary embodiment of the present disclosure, the scheduled task execution module includes:
[0099] A transaction initiation module, which is used for the time contract executor of the block-producing node to initiate a timed transaction according to the timed contract, and send the block to be confirmed containing the timed transaction to each voting node;
[0100] A block voting result generation module, which is used for the timing contract executor of the voting node to execute the timing transaction, and generates a block voting result according to the execution result of the timing transaction and returns it to the block node;
[0101] The scheduled task block generation module is used for the block generation node to determine whether to generate a block for the scheduled task result and chain it according to the block generation voting result returned by each voting node.
[0102] In an exemplary embodiment of the present disclosure, the first task stopping module includes:
[0103] a stop instruction generating module, used to generate a task stop instruction according to the timing rule in the scheduled task; and / or
[0104] The stop instruction monitoring module is used to initiate the transaction of stopping the scheduled task to generate a task stop instruction when monitoring the transaction of stopping the scheduled task on the main chain.
[0105] In an exemplary embodiment of the present disclosure, the first task stopping module further includes:
[0106] The task result return module is 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 scheduled task to the main chain, so as to synchronize the user status after executing the scheduled task to the main chain.
[0107] In an exemplary embodiment of the present disclosure, the task ending module includes:
[0108] A user status monitoring module is used to initiate a transaction of completing the synchronization of the main chain status and upload it to the chain after monitoring that the main chain completes the synchronization of the user status after executing the scheduled task;
[0109] The main chain scheduled task ending module is used to initiate a transaction for ending the scheduled task on the main chain so that the main chain executes the transaction for ending the scheduled task.
[0110] In an exemplary embodiment of the present disclosure, the device further includes:
[0111] The scheduled task ending module is used to initiate a transaction to confirm the end of the scheduled task, so as to end the scheduled task.
[0112] According to one aspect of the present disclosure, a blockchain-based scheduled task scheduling device is provided, comprising:
[0113] A side chain allocation module, configured to configure a side chain for the main chain based on a task scheduling instruction for the main chain so that the side chain starts monitoring the business of the main chain;
[0114] A second task execution module is used for the side chain to synchronize the user status with the main chain after monitoring that the scheduled task is on the main chain, so as to execute the scheduled task on the side chain;
[0115] A second task stop module, configured for the side chain to synchronize the user status after executing the scheduled task to the main chain in response to a task stop instruction to update the main chain;
[0116] The task completion module is used to complete the scheduled task on the main chain and the side chain after the user status synchronization is completed after the side chain monitors that the main chain will execute the scheduled task.
[0117] In an exemplary embodiment of the present disclosure, the device further includes:
[0118] A transaction hash acquisition module is used for the side chain to monitor the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
[0119] A block header query module, used to obtain the block where the transaction for submitting the scheduled task is located in the main chain according to the transaction hash, and query the corresponding hash value according to the block header of the block;
[0120] A hash value comparison module is used to calculate a Merkle tree hash value based on 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 on the main chain.
[0121] In an exemplary embodiment of the present disclosure, the device further includes:
[0122] The user status locking module is used to lock the management user on the main chain when the main chain submits a scheduled task.
[0123] In an exemplary embodiment of the present disclosure, the second task execution module includes:
[0124] A scheduled task side chain determination module is used for the side chain to initiate a transaction on the side chain to determine the status of the scheduled task on the main chain and upload it to the chain after the side chain monitors that the scheduled task is on the main chain;
[0125] 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 scheduled task of the main chain, so as to synchronize the original user state with the main chain;
[0126] The original user status side chain confirmation module is used to initiate a transaction on the side chain to complete the side chain status synchronization and upload it to the chain after the side chain confirms that the original user status synchronization is completed.
[0127] In an exemplary embodiment of the present disclosure, the original user status synchronization module includes:
[0128] The main chain synchronization status interface calling module is used for the side chain to call the main chain synchronization status interface through the transfer bridge to initiate a transaction to synchronize the original user status of the main chain, and return the synchronization result to the main chain.
[0129] In an exemplary embodiment of the present disclosure, the original user status side chain confirmation module includes:
[0130] 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.
[0131] In an exemplary embodiment of the present disclosure, the second task execution module includes:
[0132] The scheduled task side chain execution module is used for the side chain node to call the contract to execute the scheduled task according to the timing rules in the scheduled task, and to upload the task result consensus to the chain.
[0133] In an exemplary embodiment of the present disclosure, the scheduled task side chain execution module includes:
[0134] A block node execution module, which is used for the timing contract executor of the block 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;
[0135] A voting node execution module, which 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 block node;
[0136] The task result block generation module is used for the block generation node to determine whether to generate a block for the scheduled task result and chain it according to the block generation voting result returned by the voting node.
[0137] In an exemplary embodiment of the present disclosure, the second task stopping module includes:
[0138] A stop instruction side chain generation module, used for the side chain to generate a task stop instruction according to the timing rule in the scheduled task; and / or
[0139] The stop instruction side chain monitoring module is used for the side chain to initiate a transaction to end the scheduled task on the side chain and upload it to the chain when the side chain monitors the transaction to end the scheduled task initiated by the main chain.
[0140] In an exemplary embodiment of the present disclosure, the second task stopping module further includes:
[0141] The task result return module is used for 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 scheduled task to the main chain, so as to return the execution result of the scheduled task of the side chain to the main chain, so as to realize the update of the user status of the main chain.
[0142] In an exemplary embodiment of the present disclosure, the task completion module includes:
[0143] The main chain synchronization completion module is used for the side chain to initiate a transaction to complete the main chain state synchronization and upload it to the chain after monitoring that the synchronization operation of the main chain is completed;
[0144] The scheduled task main chain termination module is used for the side chain to initiate a transaction for ending the scheduled task on the main chain, so that the main chain executes the transaction for ending the scheduled task, and after confirming that the synchronization operation is completed, the transaction for ending the scheduled task is chained on the main chain to end the scheduled task.
[0145] In an exemplary embodiment of the present disclosure, the task completion module further includes:
[0146] The scheduled task side chain termination module is used for the side chain to initiate a transaction to confirm the termination of the scheduled task and upload it to the chain, so as to terminate the scheduled task on the side chain.
[0147] In an exemplary embodiment of the present disclosure, the device further includes:
[0148] The user unlocking module is used for the main chain to unlock the management user.
[0149] According to one aspect of the present disclosure, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the blockchain-based scheduled task scheduling method described in any of the above embodiments is implemented.
[0150] According to one aspect of the present disclosure, there is provided an electronic device, including:
[0151] Processor; and
[0152] A memory, configured to store executable instructions of the processor;
[0153] Wherein, the processor is configured to execute any one of the above-mentioned blockchain-based scheduled task scheduling methods by executing the executable instructions.
[0154] According to the method for scheduling scheduled tasks in the embodiment of the present invention, by pre-allocating the corresponding side chain to the main chain, the side chain can monitor the transactions submitted on the main chain in real time; and after monitoring the submission of the scheduled task by the main chain, the original user state of the main chain is synchronized to the side chain, so that the side chain can execute the corresponding scheduled task, thereby realizing the automatic transfer of the scheduled task of the main chain to the designated side chain for execution, effectively solving the problem of low efficiency of the scheduled task execution of the main chain. And after the scheduled task is completed by the side chain, the user state after the scheduled task is executed is synchronized to the main chain, thereby reducing the total transaction volume of the main chain and reducing the transaction overhead of the main chain. BRIEF DESCRIPTION OF THE DRAWINGS
[0155] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, in which:
[0156] Figure 1 The flowchart of a scheduled task scheduling method based on blockchain according to an embodiment of the present invention is schematically shown;
[0157] Figure 2 A flow chart schematically shows a method for a side chain to monitor services on a main chain according to an embodiment of the present invention;
[0158] Figure 3 A flow chart schematically shows a method for synchronizing the original user state between the side chain and the main chain according to an embodiment of the present invention;
[0159] Figure 4 A flowchart of a method for uploading a consensus on the execution result of a scheduled task to a chain by a side chain according to an embodiment of the present invention is schematically shown;
[0160] Figure 5 A flowchart of a method for ending a scheduled task according to an embodiment of the present invention is schematically shown;
[0161] Figure 6 The flowchart of another blockchain-based scheduled task scheduling method according to an embodiment of the present invention is schematically shown;
[0162] Figure 7 A block diagram of a scheduled task scheduling device based on blockchain according to an embodiment of the present invention is schematically shown;
[0163] Figure 8 A block diagram of another blockchain-based scheduled task scheduling device according to an embodiment of the present invention is schematically shown;
[0164] Fig. 9 A schematic diagram showing a storage medium according to an embodiment of the present invention; and
[0165] Fig.10 A block diagram of an electronic device according to an embodiment of the invention is schematically shown.
[0166] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0167] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0168] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0169] According to an embodiment of the present invention, a blockchain-based scheduled task scheduling method, a blockchain-based scheduled task scheduling device, a storage medium and an electronic device are provided.
[0170] In this document, any number of elements in the drawings is used for illustration rather than limitation, and any naming is used only for distinction and does not have any limiting meaning.
[0171] The principle 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
[0173] The inventors have found that in the prior art, the existing blockchain platforms are subject to the single-machine execution of transactions, single-machine storage, and consensus efficiency of a single blockchain, resulting in relatively low transaction performance of the blockchain platforms and being unable to meet the needs of users for frequent transactions. In addition, in the existing technical solutions, different business contracts are used between blockchain platforms, so that scheduled transaction tasks in each blockchain can only be executed in the respective blockchain platforms, resulting in the inability to execute scheduled transaction tasks at a high frequency on a single blockchain platform.
[0174] In view of the above, the basic idea of the present invention is: by pre-allocating the corresponding side chain to the main chain, on the one hand, the side chain can monitor the transactions submitted and on the chain in real time on the main chain; and after monitoring the main chain submitting the scheduled task, the original user state of the main chain is synchronized to the side chain, so that the side chain can execute the corresponding scheduled task, thereby realizing the automatic transfer of the scheduled task of the main chain to the designated side chain for execution, effectively solving the problem of low efficiency of the scheduled task execution of the main chain. On the other hand, by synchronizing the user state after executing the scheduled task to the main chain after the side chain completes the scheduled 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.
[0175] After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention are described in detail below.
[0176] Exemplary Methods
[0177] Combine the following Figure 1 To describe a blockchain-based scheduled task scheduling method according to an exemplary embodiment of the present invention.
[0178] refer to Figure 1 , the scheduled task scheduling method based on blockchain may include the following steps:
[0179] S11, responding to a task scheduling instruction for the main chain to start business monitoring for the main chain;
[0180] S12. After monitoring that the scheduled task is on the main chain, synchronize the original user status with the main chain, and execute the scheduled task after the synchronization with the main chain is completed;
[0181] S13, in response to a task stop instruction, synchronizing the user status after executing the scheduled task to the main chain;
[0182] S14: After monitoring that the user status after executing the scheduled task is synchronized to the main chain, end the scheduled task.
[0183] In the blockchain-based scheduled task scheduling method of the embodiment of the present invention, by pre-allocating the corresponding side chain to the main chain, the side chain can monitor the transactions submitted on the main chain in real time; and after monitoring the submission of the scheduled task by the main chain, the original user state of the main chain is synchronized to the side chain, so that the side chain can execute the corresponding scheduled task, thereby realizing the automatic transfer of the scheduled task of the main chain to the designated side chain for execution, effectively solving the problem of low efficiency of the scheduled task execution of the main chain. And after the side chain completes the scheduled task, the user state after executing the scheduled task is synchronized to the main chain, thereby reducing the total transaction volume of the main chain and reducing the transaction overhead of the main chain. .
[0184] In step S11, in response to a task scheduling instruction for the main link, service monitoring of the main link is started.
[0185] In an exemplary embodiment of the present disclosure, for the side chain, the user can assign a corresponding side chain to the main chain, so that the side chain can monitor the transactions submitted and on the main chain. Among them, the side chain can be a blockchain based on consensus such as POS (Proof of Stake) and BFT (Byzantine Fault Tolerance). Specifically, the side chain may include a transfer bridge, a side chain contract, and a side chain timed contract executor. Among them, the transfer bridge, as part of the side chain, enables each node of the side chain to monitor the main chain blocks and transactions through the transfer bridge. The side chain contract is a contract corresponding to the main chain business contract. The side chain timed contract executor can be used to round-robin and execute timed transactions according to the timed contract.
[0186] Among them, the transfer bridge can have the functions of querying user status (quey status), executing synchronous transaction function (execute status status) and executing completion timer function (execute finish timing). Specifically, the above-mentioned query user status function 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 status of all related user addresses (relate Address) and initialize the user status of the side chain contract. The above-mentioned execution synchronous transaction function, that is, calling the main chain synchronization status (sync Status Status) method in the main chain contract to initiate a synchronous transaction, and returning 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. At the same time, the transfer bridge can also continuously monitor the synchronization transaction of the main chain to determine whether the synchronization is successful. The above-mentioned execution completion timer function can call the finish timing task (finish Timing) method in the main chain contract. After the status synchronization of all users in the side chain is completed, the side chain initiates the completion timing task transaction to the main chain, thereby completely completing the timing task of the main chain.
[0187] The above-mentioned side chain contract is a contract corresponding to the main chain business contract, which can include confirming the submission of scheduled tasks (sure Sumit Timing). After the transfer bridge monitors the submission of scheduled tasks (sure Sumit Timing) transactions on the main chain and confirms the chain, the side chain is initiated by the block node to execute the transaction to confirm the submission of scheduled tasks, and brings the parameters of the scheduled tasks (time Params) of the main chain and submits them to the side chain.
[0188] After the blockchain members assign the corresponding sidechain 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 sidechain. 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 be a many-to-many relationship, in which a contract in the main chain can correspond to a side chain that executes 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 through the transfer bridge in a side chain / relay manner.
[0189] Specifically, refer to Figure 2 As shown, the side chain monitoring the main chain's business may include the following steps:
[0190] Step S111, monitoring the transaction of submitting the scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash;
[0191] Step S112, obtaining the block where the transaction for submitting the scheduled task is located in the main chain according to the transaction hash, and querying the corresponding hash value according to the block header of the block;
[0192] Step S113, calculating a Merkle tree hash value according to the hash value, and comparing 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 on the main chain.
[0193] In an exemplary embodiment of the present disclosure, the side chain can determine the occurrence of the main chain timer transaction and whether it is on the chain by monitoring the main chain transaction (watch_eth) and block (watch_block). For example, the side chain can determine whether the timed task transaction occurs by monitoring all transactions under the corresponding business contract of 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 to make SPV proof (Simplified Payment Verification). Specifically, after the side chain monitors the transaction of the timed task initiated by the main chain at the specified address, it 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, the side chain queries and obtains the hash value required to build the Merkle tree in the main chain block by monitoring the block header of the main chain, and calculates the Merkle tree hash (merkle root hash) according to the hash value; and compares the calculated Merkle tree hash with the original Merkle tree hash in the main chain block header to determine whether they are equal. If they are equal, it proves that the scheduled task transaction exists in the main chain and has been uploaded. 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.
[0194] In step S12, after monitoring that the scheduled task is on the main chain, the original user state is synchronized with the main chain, and the scheduled task is executed after the synchronization with the main chain is completed.
[0195] In an exemplary embodiment of the present disclosure, when the side chain monitors that a scheduled task is on the main chain, the original user state of the main chain can be synchronized to the side chain, and then the corresponding scheduled task can be executed on the side chain after the synchronization is completed.
[0196] Specifically, refer to Figure 3 As shown, after monitoring that the scheduled task is on the main chain, synchronizing the original user status with the main chain may include:
[0197] Step S1201, after monitoring that the scheduled task is on the main chain, initiating a transaction to determine the status of the scheduled task on the main chain and on-chain;
[0198] Step S1202, after determining the status of the scheduled task on the main chain, synchronizing the original user status with the main chain;
[0199] Step S1203, after the synchronization operation is completed, initiate a transaction to complete the synchronization and upload it to the chain.
[0200] In an exemplary embodiment of the present disclosure, after the side chain monitors the transaction of submitting a timed task (sumit Timing) of the main chain through the transfer bridge and determines that the transaction is on the main chain, the side chain initiates a transaction to determine the status of the timed task on the main chain and uploads it to the chain. After the side chain determines the timed task of the main chain, it can execute the transaction of synchronizing the original user status of the main chain, and synchronize the status of all associated user addresses of the main chain to the side chain. Specifically, the side chain calls the export status (export Status Status) method of the main chain through the transfer bridge to initiate the status synchronization of the management user address (relateAddress). The side chain node makes every state synchronization on the chain until all the status changes of the original users are successfully uploaded to the chain.
[0201] After the side chain determines that all user status synchronization is complete, 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 status with the main chain through the transfer bridge to determine whether the operation of synchronizing the original user status is completed.
[0202] In addition, the contract can also include a specified scheduled task execution method, and hand over the scheduled task (executeTiming) to the scheduled contract executor of each node of the side chain to manage the scheduled task. The scheduled contract executor is a native module of the side chain. Under the condition of meeting the contract timing rules, it polls and initiates transactions for the contract to specify the scheduled task execution method. For example, the scheduled task execution method can include the execution of the scheduled task according to time, the execution of the transaction according to the block order, and the number of times the transaction is executed each time.
[0203] 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 tasks according to the timing rules in the timed tasks in the main chain, and upload the task results to the consensus chain.
[0204] Specifically, refer to Figure 4 As shown, the following steps may be included:
[0205] 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 containing the timing transaction to each voting node;
[0206] Step S1212, the timing contract executor of the voting node executes the timing transaction, generates a block voting result according to the execution result of the timing transaction, and returns it to the block node;
[0207] Step S1213, the block-producing node determines whether to produce a block for the scheduled task result and chain it according to the block-producing voting results returned by each of the voting nodes.
[0208] In an exemplary embodiment of the present disclosure, when it is the turn of a node in the side chain to produce a block, the timing contract executor of the block-producing node calls the corresponding timing task execution method on the contract according to the timing strategy to execute the timing transaction. The block-producing node packages the timing transaction and sends the block to be confirmed to the voting node. The voting node also executes the timing transaction by its own timing contract executor. The timing contract executor can first determine whether the timing transaction meets the timing rules. When it is determined that the rules are met, the timing transaction is executed according to the timing method in the contract. After the voting node timing contract executor completes the execution of the timing task, the hash value corresponding to the execution result is added to the signature verification parameter and returned to the block-producing node as the block-producing voting result. In order to enable the block-producing node to collect the voting results of the voting nodes, after the voting nodes that execute the timing task are greater than a certain proportion, the timing task can be put on the chain, thereby completing a round of timing tasks. In the next round of timing tasks, other block-producing nodes also poll in turn to execute the timing tasks and put them on the chain in this way.
[0209] In step S13, in response to a task stop instruction, the user state after executing the scheduled task is synchronized to the main chain.
[0210] In an exemplary embodiment of the present disclosure, the above-mentioned task stop instruction may be a task stop instruction generated according to the timing rules in the scheduled task; for example, the scheduled task is ended at a preset time point according to the timing rules, so that a task stop instruction is generated when the preset time point is reached; or, the scheduled task is ended after the scheduled task is executed a predetermined number of times and a task stop instruction is generated. For example, if the preset number of executions of the scheduled task is five hundred times, then a task stop instruction is generated when the scheduled task is executed five hundred times. Alternatively, when a transaction to stop the scheduled task is monitored on the main chain, a transaction to stop the scheduled task is initiated to generate a task stop instruction.
[0211] After obtaining the task stop instruction, the synchronization status interface of the main chain can be called through the transfer bridge to initiate a synchronization transaction that returns the execution result of the scheduled task to the main chain, thereby synchronizing the user status after executing the scheduled task to the main chain.
[0212] In step S14, after monitoring that the user status after executing the scheduled task is synchronized to the main chain, the scheduled task is ended.
[0213] In the exemplary embodiment of the present disclosure, referring to Figure 5 As shown, the above step S14 may include:
[0214] Step S141, after monitoring that the main chain completes the synchronization of the user status after executing the scheduled task, initiate a transaction for completing the synchronization of the main chain status and upload it to the chain;
[0215] Step S142, initiating a transaction for ending the scheduled task on the main chain, so that the main chain executes the transaction for ending the scheduled task.
[0216] Step S143, initiating a transaction to confirm the end of the scheduled task to end the scheduled task.
[0217] In some exemplary embodiments of the present disclosure, after the side chain scheduled task stops, the side chain initiates a user status synchronization transaction after executing the scheduled task on the main chain through the transfer bridge, synchronizes the status of all management users, thereby changing the status of all users on the main chain, setting the number of tokens consistent with the side chain, and marking each user who has completed synchronization. The side chain monitors the main chain transactions and blocks, and after determining that the status changes of all users on the main chain are completed, the side chain initiates a transaction to complete the main chain status synchronization (finish Sync Status), thereby completing the scheduled task on the main chain.
[0218] Furthermore, after the side chain completes the transaction of synchronizing the status of the main chain, the side chain again initiates a transaction to end the scheduled task for the main chain through the transfer bridge, so that the main chain executes and completely ends the scheduled task. After the side chain monitors that the main chain has ended the scheduled task, the side chain initiates a transaction to confirm the completion of the scheduled task (sure Finish Timing). After the chain is successfully uploaded, the scheduled task is ended on the side chain, so that the scheduled task is completely terminated. Among them, the above-mentioned transaction on the main chain or side chain refers to saving the transaction data in the corresponding blockchain and forming a new block.
[0219] In other exemplary embodiments of the present disclosure, for the main chain and the side chain, refer to Figure 6 As shown, the above-mentioned blockchain-based scheduled task scheduling method may include the following steps:
[0220] Step S21, based on a task scheduling instruction for the main chain, configuring a side chain for the main chain so that the side chain starts monitoring the business of the main chain;
[0221] Step S22, after monitoring that the scheduled task is on the main chain, the side chain performs original user state synchronization with the main chain and executes the scheduled task on the side chain;
[0222] Step S23, in response to a task stop instruction, the side chain synchronizes the user status after executing the scheduled task to the main chain to update the main chain;
[0223] Step S24, after the side chain monitors that the main chain will execute the scheduled task and the user status synchronization is completed, the scheduled task is ended on the main chain and the side chain.
[0224] The following will describe in more detail the interaction between the main chain and the side chain in the blockchain-based scheduled task scheduling method of an exemplary embodiment of the present invention in combination with the accompanying drawings and examples.
[0225] In step S21, based on a task scheduling instruction for the main chain, a side chain is configured for the main chain so that the side chain starts monitoring the business of the main chain.
[0226] 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, which may include allocating a designated side chain for migration and executing a scheduled task to the main chain (main blockchain), and after allocating the side chain, the side chain starts to monitor transactions on the main chain. In addition, one or more side chains may be allocated to the main chain, that is, the main chain and the side chain may have 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 executes its corresponding scheduled task.
[0227] For example, the business contract of the main chain mentioned above may include methods for executing and synchronizing scheduled tasks. For example, the business contract may include methods for submitting scheduled tasks, stopping scheduled tasks, exporting status, synchronizing status, and completing scheduled tasks. Among them, the method for submitting scheduled tasks may include one or more of the following parameters:
[0228] 1) The contract address (send Address) that initiates the scheduled task. This address must be the blockchain address specified by the contract to ensure that the scheduled task is initiated from this address to prevent abuse by other accounts.
[0229] 2) The execution method of the scheduled task (execute Method), which must exist in the contract and is used to call the method when the side chain executes the scheduled task. The scheduled method is determined by the user's business; for example, the value scheduled exchange method, the data scheduled trigger method, etc.
[0230] 3) Parameters for executing the timing method (method Param). Some timing methods have configuration parameters required to execute the timing task. The side chain is used to pass the configuration parameters to the side chain when executing the timing task, so that the side chain executes the timing task according to the configuration parameters.
[0231] 4) The address of the user associated with the scheduled task (relate Address). Since the scheduled task involves the mutual exchange of value between addresses, it must involve different addresses; therefore, the address of the associated user needs to be specified to facilitate locking the address of the specified 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 address cannot be changed on the main chain, but can be changed on the side chain.
[0232] 5) Timed task identification (time Id), which can be used to uniquely mark the ID of a timed task. Other processing processes of subsequent timed tasks can also use this ID as an identification.
[0233] 6) Scheduled task type (type), for example, the timer type includes polling by block increments, or polling blocks by time, etc.
[0234] 7) Scheduled task strategy (type Info), for example, if it is executed by block increment, a number of blocks are set to execute a predetermined number of scheduled transactions, and the increment of blocks is based on the incremental change of the side chain, such as initiating ten transactions for each additional block. If it is polled by time, a predetermined number of scheduled transactions are executed after a predetermined length of time, such as initiating ten transactions every 10 seconds.
[0235] 8) Stop Requirement for scheduled tasks, i.e., the stop condition for the side chain to execute scheduled tasks. For example, you can set the scheduled task to stop after executing a predetermined number of tasks, or after executing a predetermined total duration of tasks. If the stop condition is not set, the side chain timer can be stopped by initiating a subsequent transaction to stop the scheduled task.
[0236] Specifically, the business monitoring of the main chain by the above-mentioned side chain may include:
[0237] Step S211, the side chain monitors the transaction of submitting the scheduled task at the designated address of the main chain through the transfer bridge to obtain its transaction hash;
[0238] Step S212, obtaining the block in the main chain where the transaction for submitting the scheduled task is located according to the transaction hash, and querying the corresponding hash value according to the block header of the block;
[0239] 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 to determine whether the transaction submitting the scheduled task is on the main chain.
[0240] The side chain confirms whether the transaction of the main chain's scheduled task has occurred and is on the chain by monitoring the transaction (watch eth) and block (watch block) of the main chain. Specifically, the side chain monitors all transactions under the corresponding business contract of the main chain through the transfer bridge to determine whether the transaction related to the scheduled task has occurred; the side chain monitors all the block headers of the main chain that have been on the chain and adds them to the side chain's own blockchain to perform SPV proof (Simplified Payment Verification).
[0241] In step S22, after monitoring that the scheduled task is on the main chain, the side chain performs original user state synchronization with the main chain and executes the scheduled task on the side chain.
[0242] In an exemplary embodiment of the present disclosure, a user can submit a scheduled task on the main chain, and the scheduled task can specify the timing rules of the main chain contract. In addition, when submitting a scheduled task on the main chain, the management user can also be locked on the main chain to prevent data changes on the main chain.
[0243] Specifically, after the above-mentioned side chain monitors the scheduled task submitted by the main chain, it performs the original user state synchronization with the main chain, which may specifically include:
[0244] Step S2211, after monitoring that the scheduled task is on the main chain, the side chain initiates a transaction on the side chain to determine the status of the scheduled task on the main chain and uploads it to the chain;
[0245] Step S2212, after confirming the scheduled task of the main chain, the side chain initiates a transaction to synchronize the original user state of the main chain, so as to synchronize the original user state with the main chain;
[0246] Step S2213, when the side chain confirms that the original user state synchronization is completed, a transaction for completing the side chain state synchronization is initiated on the side chain and uploaded to the chain.
[0247] After the side chain monitors the scheduled task submitted on the main chain, it can also initiate a transaction to determine the status of the scheduled task on the main chain and upload it to the chain, thereby confirming the scheduled transaction of the main chain. After the side chain determines the scheduled task of the main chain, it can execute a transaction to synchronize the original user status of the main chain and upload it to the chain, thereby synchronizing the original user status of the main chain to the side chain.
[0248] Specifically, the side chain can call the main chain synchronization status interface through the transfer bridge to call the export status method in the main chain contract to initiate a transaction to synchronize the original user status of the main chain, to export the original user status of all associated user addresses of the main chain, and to initialize the side chain.
[0249] At the same time, the synchronization result can also be returned to the main chain, so that the main chain can end 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.
[0250] After the side chain completes the synchronization of the original user status, the side chain node can call the contract to execute the scheduled task according to the timing rules in the scheduled task, and upload the task result consensus to the chain. Specifically, it can include:
[0251] Step S2221, the timing contract executor of the block-producing node of the side chain calls the timing contract to initiate a timing transaction, and sends the block to be confirmed containing the timing transaction to each voting node;
[0252] Step S2222, the timing contract executor of the voting node calls 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 node;
[0253] Step S2223: The block-producing node determines whether to produce a block for the scheduled task result and chain it based on the block-producing voting result returned by the voting node.
[0254] In the exemplary embodiment of the present disclosure, the timing contract executor of the side chain node initiates the corresponding timing transaction according to the timing strategy in the contract to execute the timing task. The state change in the contract must be the above-mentioned specified associated user. If the state change of the user outside the address range of the associated user is involved in the contract execution process, the execution fails.
[0255] In step S23, the side chain responds to a task stop instruction and synchronizes the user status after executing the scheduled task to the main chain to update the main chain.
[0256] 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 the timing rules in the scheduled task, that is, a task stop instruction generated according to the method of completing the scheduled task in the main chain contract. Alternatively, when the method of 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 initiated on the main chain to end the scheduled task, it can initiate a transaction to end the scheduled task on the side chain and upload it to the chain, thereby ending the scheduled task.
[0257] Specifically, after the side chain stops the scheduled task, the side chain can call the main chain synchronization status interface through the transfer bridge to initiate a synchronization transaction that returns the execution result of the scheduled task to the main chain, so as to return the execution result of the scheduled task of the side chain to the main chain, so as to update the user status of the main chain. That is, the side chain calls the main chain synchronization status method through the transfer bridge to initiate a synchronization transaction, and returns the execution result of the side chain scheduled task, that is, the user status result after executing the scheduled task, to the main chain, so that the main chain changes all user statuses, sets it to the same token number as the side chain, and marks each user who has completed synchronization.
[0258] The caller of the main chain synchronization status interface must be the blockchain account address managed by the side chain to prevent the side chain's scheduled task execution results from being migrated to other main chains or main chain accounts. The input parameters can also include addresses, token numbers, etc. For example, if a user originally has 10 tokens in the main chain, and after the side chain executes the scheduled task, it has 20 tokens, then the user is set to 20 tokens in the main chain. At the same time, after the user token is set successfully, it can also be marked as set successfully. In addition, the transfer bridge can also continuously monitor the synchronization transactions of the main chain to determine whether the synchronization is successful.
[0259] In step S24, after the side chain monitors that the main chain will execute the scheduled task and the user status synchronization is completed, the scheduled task is ended on the main chain and the side chain.
[0260] In an exemplary embodiment of the present disclosure, the above step S24 may include:
[0261] Step S241, after monitoring that the synchronization operation of the main chain is completed, the side chain initiates a transaction to complete the main chain state synchronization and uploads it to the chain;
[0262] In step S242, the side chain initiates a transaction for ending the scheduled task on the main chain so that the main chain executes the transaction for ending the scheduled task, and after confirming that the synchronization operation is completed, the transaction for ending the scheduled task is chained on the main chain to end the scheduled task.
[0263] Step S243, the side chain initiates a transaction to confirm the end of the scheduled task and uploads it to the chain, so as to end the scheduled task on the side chain.
[0264] The side chain monitors the transactions and blocks of the main chain, confirms that the user status after executing the scheduled task is synchronized with the main chain, and then initiates the transaction to complete the main chain status synchronization and uploads it to the chain. At the same time, it can also unlock the lock status of each user in the main chain.
[0265] The side chain can also call the main chain's scheduled task completion method through the transfer bridge, initiate a transaction to end the scheduled task on the main chain, and completely end the scheduled task on the main chain. After the side chain monitors that the scheduled task has been 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 to the chain, the scheduled task is completely completed on the side chain. In this way, the submission, synchronization, execution, stop, resynchronization, and completion of a scheduled task are completed on the main chain and the side chain.
[0266] In summary, by pre-assigning one or more corresponding side chains to the main chain, the scheduled tasks of different contracts can be transferred to the designated side chain for execution when submitted to the main chain. By utilizing the side chain to collaboratively execute the scheduled tasks of the main chain, the problem of excessive scheduled transactions, low efficiency and performance of a single blockchain is solved; at the same time, the total transaction volume and transaction overhead of the main chain are reduced; at the same time, the side chain can provide transaction queries for specific scheduled tasks.
[0267] Exemplary Devices
[0268] After introducing the blockchain-based scheduled task scheduling method according to an exemplary embodiment of the present invention, Figure 7 A blockchain-based scheduled task scheduling device according to an exemplary embodiment of the present invention is described.
[0269] refer to Figure 7 As shown, a blockchain-based scheduled task scheduling device 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. Among them:
[0270] The service monitoring module 101 may be used to respond to a task scheduling instruction for the main link to start service monitoring for the main link.
[0271] The first task execution module 102 can be used to synchronize the original user status with the main chain after monitoring that the scheduled task is on the main chain, and execute the scheduled task after the synchronization with the main chain is completed.
[0272] The first task stopping module 103 may be configured to synchronize the user status after executing the scheduled task to the main chain in response to a task stopping instruction.
[0273] The task ending module 104 can be used to end the scheduled task after monitoring that the user status after executing the scheduled task is synchronized with the main chain.
[0274] According to an exemplary embodiment of the present disclosure, the business 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).
[0275] The transaction hash acquisition module can be used to monitor the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash.
[0276] The block header query module can be used to obtain the block in the main chain where the transaction for submitting the scheduled task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block.
[0277] The hash value comparison module can be used to calculate a Merkle tree hash value based on 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 on the main chain.
[0278] According to an exemplary embodiment of the present disclosure, the first task execution module 102 may include: a scheduled task confirmation module, a user status synchronization module and a synchronization completion module (not shown in the figure).
[0279] The scheduled task confirmation module can be used to initiate a transaction to determine the status of the scheduled task on the main chain and upload it to the chain after monitoring that the scheduled task is on the main chain.
[0280] The user status synchronization module can be used to synchronize the original user status with the main chain after determining the status of the scheduled task on the main chain.
[0281] The synchronization completion module can be used to initiate a transaction to complete the synchronization and upload it to the chain after the synchronization operation is completed.
[0282] According to an exemplary embodiment of the present disclosure, the user status synchronization module may include: a main chain synchronization status interface calling module (not shown in the figure).
[0283] The main chain synchronization status interface calling module can be used to call the main chain synchronization status interface through the transfer bridge to initiate a transaction to synchronize the original user status with the main chain, and return the synchronization result to the main chain.
[0284] According to an exemplary embodiment of the present disclosure, the device further includes: a synchronization result confirmation module (not shown in the figure).
[0285] 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 to determine whether the operation of synchronizing the original user state is completed.
[0286] According to an exemplary embodiment of the present disclosure, the first task execution module may include: a scheduled task execution module (not shown in the figure).
[0287] The scheduled task execution module can be used to call the contract to execute the scheduled task according to the timing rules in the scheduled task, and upload the task result consensus to the chain.
[0288] According to an exemplary embodiment of the present disclosure, the scheduled task execution module may include: a transaction initiation module, a block voting result generation module and a scheduled task block module (not shown in the figure).
[0289] The transaction initiation module can be used for the timing contract executor of the block-producing node to initiate a timing transaction according to the timing contract, and send the block to be confirmed containing the timing transaction to each voting node.
[0290] The block voting result generation module can be used for the timing contract executor of the voting node to execute the timing transaction, generate the block voting result according to the execution result of the timing transaction and return it to the block node.
[0291] The scheduled task block generation module can be used by the block generation node to determine whether to generate a block for the scheduled task result and chain it according to the block generation voting result returned by each voting node.
[0292] According to an exemplary embodiment of the present disclosure, the first task stopping module 103 may include: a stop instruction generating module and / or a stop instruction monitoring module (not shown in the figure).
[0293] The stop instruction generating module may be used to generate a task stop instruction according to a timing rule in the scheduled task.
[0294] The stop instruction monitoring module can be used to initiate the transaction of stopping the scheduled task to generate a task stop instruction when monitoring the transaction of stopping the scheduled task on the main chain.
[0295] 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).
[0296] The task result return 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 scheduled task to the main chain, so as to synchronize the user status after executing the scheduled task to the main chain.
[0297] According to an exemplary embodiment of the present disclosure, the task ending module includes: a user status monitoring module and a main chain timed task ending module (not shown in the figure).
[0298] The user status monitoring module can be used to initiate a transaction for completing the synchronization of the main chain status and upload it to the chain after monitoring that the main chain has completed the synchronization of the user status after executing the scheduled task.
[0299] The main chain scheduled task ending module can be used to initiate a transaction for ending the scheduled task of the main chain, so that the main chain executes the transaction for ending the scheduled task.
[0300] According to an exemplary embodiment of the present disclosure, the device further includes: a scheduled task termination module (not shown in the figure).
[0301] The scheduled task ending module may be used to initiate a transaction to confirm the ending of the scheduled task, so as to end the scheduled task.
[0302] refer to Figure 8 As shown, another blockchain-based scheduled task scheduling device 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 completion module 204. Among them,
[0303] The side chain allocation module 201 can be used to configure a side chain for the main chain based on a task scheduling instruction for the main chain so that the side chain starts monitoring the business of the main chain.
[0304] The second task execution module 202 can be used for the side chain to synchronize the user status with the main chain after monitoring that the scheduled task is on the main chain, so as to execute the scheduled task on the side chain.
[0305] The second task stop module 203 can be used for the side chain to respond to a task stop instruction and synchronize the user status after executing the scheduled task to the main chain to update the main chain.
[0306] The task completion module 204 can be used to complete the scheduled task on the main chain and the side chain after the user status synchronization is completed after the side chain monitors that the main chain will execute the scheduled task.
[0307] According to an exemplary embodiment of the present disclosure, the device further includes: a transaction hash acquisition module, a block header query module and a hash value comparison module (not shown in the figure).
[0308] The transaction hash acquisition module can be used by the side chain to monitor the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash.
[0309] The block header query module can be used to obtain the block in the main chain where the transaction for submitting the scheduled task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block.
[0310] The hash value comparison module can be used to calculate a Merkle tree hash value based on 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 on the main chain.
[0311] According to an exemplary embodiment of the present disclosure, the device further includes: a user status locking module (not shown in the figure).
[0312] The user status locking module can be used to lock the management user on the main chain when the main chain submits a scheduled task.
[0313] According to an exemplary embodiment of the present disclosure, the second task execution module includes: a timed 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).
[0314] The scheduled task side chain determination module can be used for the side chain to initiate a transaction on the side chain to determine the status of the scheduled task on the main chain and upload it to the chain after the side chain monitors that the scheduled task is on the main chain.
[0315] The original user state synchronization module can be used for the side chain to initiate a transaction to synchronize 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.
[0316] The original user state side chain confirmation module can be used to initiate a transaction on the side chain to complete the side chain state synchronization and upload it to the chain after the side chain confirms that the original user state synchronization is completed.
[0317] According to an exemplary embodiment of the present disclosure, the original user status synchronization module includes: a main chain synchronization status interface calling module (not shown in the figure).
[0318] The main chain synchronization status interface calling module can be used by the side chain to call the main chain synchronization status interface through the transfer bridge to initiate a transaction to synchronize the original user status of the main chain, and return the synchronization result to the main chain.
[0319] According to an exemplary embodiment of the present disclosure, the original user status side chain confirmation module includes: a main chain synchronous transaction monitoring module (not shown in the figure).
[0320] 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.
[0321] According to an exemplary embodiment of the present disclosure, the second task execution module includes: a scheduled task side chain execution module (not shown in the figure).
[0322] The scheduled task side chain execution module can be used by the side chain node to call the contract to execute the scheduled task according to the timing rules in the scheduled task, and to upload the task result consensus to the chain.
[0323] According to an exemplary embodiment of the present disclosure, the scheduled task side chain execution module may include: a block node execution module, a voting node execution module and a task result block module (not shown in the figure).
[0324] The block node execution module can be used for the timing contract executor of the block 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.
[0325] The voting node execution module can be used for the timing contract executor of the voting node to call the timing contract to execute the timing transaction, generate the block voting result according to the execution result of the timing transaction, and return the block voting result to the block node.
[0326] The task result block generation module can be used by the block generation node to determine whether to generate a block for the scheduled task result and chain it according to the block generation voting result returned by the voting node.
[0327] 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).
[0328] The stop instruction side chain generation module can be used for the side chain to generate a task stop instruction according to the timing rule in the scheduled task.
[0329] The stop instruction side chain monitoring module can be used for the side chain to initiate a transaction to end the scheduled task on the side chain and upload it to the chain when the side chain monitors a transaction to end the scheduled task initiated on the main chain.
[0330] According to an exemplary embodiment of the present disclosure, the second task stopping module further includes: a task result returning module (not shown in the figure).
[0331] 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 scheduled task to the main chain, so as to return the execution result of the scheduled task of the side chain to the main chain, so as to realize the update of the user status of the main chain.
[0332] According to an exemplary embodiment of the present disclosure, the task completion module includes: a main chain synchronization completion module and a scheduled task main chain termination module (not shown in the figure).
[0333] The main chain synchronization completion module can be used for the side chain to initiate a transaction to complete the main chain status synchronization and upload it to the chain after monitoring that the synchronization operation of the main chain is completed.
[0334] The scheduled task main chain end module can be used by the side chain to initiate a transaction for ending the scheduled task on the main chain, so that the main chain executes the transaction for ending the scheduled task, and after confirming that the synchronization operation is completed, the transaction for ending the scheduled task is chained on the main chain to end the scheduled task.
[0335] According to an exemplary embodiment of the present disclosure, the task completion module further includes: a scheduled task side chain termination module (not shown in the figure).
[0336] The scheduled task side chain termination module can be used for the side chain to initiate a transaction for side chain confirmation of the termination of the scheduled task and upload it to the chain, so as to terminate the scheduled task on the side chain.
[0337] According to an exemplary embodiment of the present disclosure, the device further includes: a user unlocking module (not shown in the figure).
[0338] The user unlocking module can be used by the main chain to unlock the management user.
[0339] Since the various functional modules of the blockchain-based scheduled task scheduling device in the implementation mode of the present invention are the same as those in the above-mentioned blockchain-based scheduled task scheduling device method invention implementation mode, they will not be repeated here.
[0340] Exemplary Storage Media
[0341] After introducing the audio playing method and device, and the audio sharing method and device according to the exemplary embodiments of the present invention, Fig. 9 A storage medium according to an exemplary embodiment of the present invention is described.
[0342] refer to Fig. 9 As shown, a program product 700 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0343] The program product may use 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, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0344] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. 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 above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0345] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0346] Program code for performing the 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., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user computing device, partially on a remote computing device, or entirely on a 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 type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0347] Exemplary Electronic Devices
[0348] After introducing the storage medium of the exemplary embodiment of the present invention, next, reference is made to Fig.10 An electronic device according to an exemplary embodiment of the present invention is described.
[0349] Fig.10The electronic device 800 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0350] like Fig.10 As shown, the electronic device 800 is in the form of a general computing device. The components of the electronic device 800 may include, but are not limited to: the at least one processing unit 810, the 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.
[0351] The storage unit stores program codes, which can be executed by the processing unit 810, so that the processing unit 810 performs the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification. For example, the processing unit 810 can perform the following steps: Figure 1 Steps S11 to S14 shown in FIG. 8 , or the processing unit 810 may perform the following steps: Figure 6 Steps S21 to S24 shown in FIG.
[0352] 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 .
[0353] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0354] The bus 830 may include a data bus, an address bus, and a control bus.
[0355] The electronic device 800 can also communicate with one or more external devices 900 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), and this communication can be performed through an input / output (I / O) interface 850. The electronic device 800 also includes a display unit 840, which is connected to the input / output (I / O) interface 850 for display. In addition, the electronic device 800 can also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs) and / or public networks, such as the Internet) through a network adapter 860. As shown in the figure, the network adapter 860 communicates with other modules of the electronic device 800 through a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the 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, etc.
[0356] It should be noted that although several modules or submodules 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. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules for embodiment.
[0357] In addition, although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, certain steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps. Although the spirit and principles of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined for benefit. This division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the appended claims.
Claims
1. A scheduled task scheduling method based on blockchain, characterized in that: Applied to sidechains, including: In response to a task scheduling instruction for the main chain, the service monitoring of the main chain is started; the task scheduling instruction includes allocating migration to the main chain and executing the side chain of the scheduled task; After monitoring that the scheduled task is on-chain on the main chain, synchronizing the original user status with the main chain, and executing the scheduled task after the synchronization with the main chain is completed; In response to a task stop instruction, synchronizing the user status after executing the scheduled task to the main chain; After monitoring that the user status after executing the scheduled task is synchronized to the main chain, the scheduled task is terminated; Wherein, after monitoring that the scheduled task is on the main chain, synchronizing the original user status with the main chain includes: After monitoring that the scheduled task is on the main chain, a transaction is initiated to determine the status of the scheduled task on the main chain and the transaction is on the main chain; After determining the status of the scheduled task on the main chain, synchronizing the original user status with the main chain; After the synchronization operation is completed, initiate a transaction to complete the synchronization and upload it to the chain.
2. The method according to claim 1, characterized in that The business monitoring of the main chain includes: Monitor the transaction of submitting a 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 for submitting the scheduled task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block; A Merkle tree hash value is calculated based on the hash value, and the Merkle tree hash value is compared 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 on the main chain.
3. The method according to claim 1, characterized in that: After determining the status of the scheduled task on the main chain, synchronizing the original user status with the main chain includes: The main chain synchronization status interface is called through the transfer bridge to initiate a transaction to synchronize the original user status with the main chain, and return the synchronization result to the main chain.
4. The method according to claim 3, characterized in that The method further comprises: 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.
5. The method according to claim 1, characterized in that The executing of the scheduled task comprises: The contract is called according to the timing rules in the scheduled task to execute the scheduled task, and the task result consensus is uploaded to the chain.
6. The method according to claim 5, characterized in that The calling of the contract to execute the scheduled task according to the timing rules in the scheduled task and uploading the task result consensus to the chain 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 containing the timing transaction to each voting node; The timing contract executor of the voting node executes the timing transaction, generates a block voting result according to the execution result of the timing transaction, and returns it to the block node; The block-producing node determines whether to produce a block for the scheduled task result and chain it according to the block-producing voting result returned by each of the voting nodes.
7. The method according to claim 1, characterized in that The generation of the task stop instruction includes: Generate a task stop instruction according to the timing rule in the scheduled task; or When a transaction for stopping a scheduled task is monitored on the main chain, the transaction for stopping the scheduled task is initiated to generate a task stop instruction.
8. The method according to claim 1, characterized in that The step of synchronizing the user status after executing the scheduled task to the main chain includes: The synchronization status interface of the main chain is called through the switching bridge to initiate a synchronization transaction that returns the execution result of the scheduled task to the main chain, so as to synchronize the user status after executing the scheduled task to the main chain.
9. The method according to claim 1, characterized in that: After monitoring that the user status after executing the scheduled task is synchronized to the main chain, ending the scheduled task includes: After monitoring that the main chain completes the synchronization of the user status after executing the scheduled task, initiate a transaction to complete the synchronization of the main chain status and upload it to the chain; Initiate a transaction for ending the scheduled task on the main chain, so that the main chain executes the transaction for ending the scheduled task.
10. The method according to claim 9, characterized in that After monitoring the transaction of the main chain executing the end of the scheduled task, the method further includes: Initiate a transaction to confirm the end of the scheduled task to end the scheduled task.
11. A scheduled task scheduling device based on blockchain, characterized in that: Executed by sidechains, including: A business monitoring module, used to respond to a task scheduling instruction for the main chain to start business monitoring for the main chain; the task scheduling instruction includes allocating migration to the main chain and executing the side chain of the scheduled task; A first task execution module is used to synchronize the original user status with the main chain after monitoring that the scheduled task is on the main chain, and execute the scheduled task after the synchronization with the main chain is completed; A first task stop module, configured to synchronize the user status after executing the scheduled task to the main chain in response to a task stop instruction; A task ending module, used to end the scheduled task after monitoring that the user status after executing the scheduled task is synchronized with the main chain; Wherein, the first task execution module includes: A scheduled task confirmation module is used to initiate a transaction to determine the status of the scheduled task on the main chain and upload it to the chain after monitoring that the scheduled task is on the main chain; A user status synchronization module, used to synchronize the original user status with the main chain after determining the status of the scheduled task on the main chain; The synchronization completion module is used to initiate and upload the synchronization transaction to the chain after the synchronization operation is completed.
12. The device according to claim 11, characterized in that The service monitoring module includes: A transaction hash acquisition module is used to monitor the transaction of submitting a scheduled task at the specified address of the main chain through the transfer bridge to obtain its transaction hash; A block header query module, used to obtain the block in the main chain where the transaction for submitting the scheduled task is located according to the transaction hash, and query the corresponding hash value according to the block header of the block; A hash value comparison module is used to calculate a Merkle tree hash value based on 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 on the main chain.
13. The device according to claim 11, characterized in that The user status synchronization module includes: The main chain synchronization status interface calling module is used to call the main chain synchronization status interface through the transfer bridge to initiate a transaction to synchronize the original user status with the main chain, and return the synchronization result to the main chain.
14. The device according to claim 13, characterized in that The device also 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 to determine whether the operation of synchronizing the original user state is completed.
15. The device according to claim 11, characterized in that The first task execution module includes: The scheduled task execution module is used to call the contract to execute the scheduled task according to the timing rules in the scheduled task, and upload the task result consensus to the chain.
16. The device according to claim 15, characterized in that The scheduled task execution module includes: A transaction initiation module, which is used for the time contract executor of the block-producing node to initiate a timed transaction according to the timed contract, and send the block to be confirmed containing the timed transaction to each voting node; A block voting result generation module, which is used for the timing contract executor of the voting node to execute the timing transaction, and generates a block voting result according to the execution result of the timing transaction and returns it to the block node; The scheduled task block generation module is used for the block generation node to determine whether to generate a block for the scheduled task result and chain it according to the block generation voting result returned by each voting node.
17. The device according to claim 11, characterized in that The first task stopping module includes: a stop instruction generating module, used to generate a task stop instruction according to the timing rule in the scheduled task; and / or The stop instruction monitoring module is used to initiate the transaction of stopping the scheduled task to generate a task stop instruction when monitoring the transaction of stopping the scheduled task on the main chain.
18. The device according to claim 11, characterized in that The first task stopping module also includes: The task result return module is 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 scheduled task to the main chain, so as to synchronize the user status after executing the scheduled task to the main chain.
19. The device according to claim 11, characterized in that The task end module includes: A user status monitoring module is used to initiate a transaction of completing the synchronization of the main chain status and upload it to the chain after monitoring that the main chain completes the synchronization of the user status after executing the scheduled task; The main chain scheduled task ending module is used to initiate a transaction for ending the scheduled task on the main chain so that the main chain executes the transaction for ending the scheduled task.
20. The device according to claim 19, characterized in that The device also includes: The scheduled task ending module is used to initiate a transaction to confirm the end of the scheduled task, so as to end the scheduled task.
21. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the blockchain-based scheduled task scheduling method described in any one of claims 1 to 10 is implemented.
22. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the blockchain-based scheduled task scheduling method described in any one of claims 1 to 10 by executing the executable instructions.
