CN-121981818-A - Dynamic execution method and device for on-chain resource transaction, electronic equipment and product
Abstract
The embodiment of the application is suitable for the field of blockchains and provides a dynamic execution method, a device, electronic equipment and a product of on-chain resource transaction, wherein the method comprises the steps of obtaining a resource transaction request submitted by a user on a chain; the resource transaction request comprises a first object to be transacted, a transaction resource and a second object expected to transact, on-chain transaction information is acquired, the on-chain transaction information is used for describing on-chain dynamic working conditions when the first object and the second object transact, a time weighting curve is dynamically generated according to the on-chain transaction information, the time weighting curve comprises a time window, a plurality of transaction time points in the time window and resource transaction amounts respectively corresponding to the transaction time points, and the on-chain transaction of the transaction resource is completed by executing the resource transaction request based on the time weighting curve. By adopting the method, the unpredictability of transaction execution can be improved to inhibit external arbitrage behavior, and the resource allocation efficiency and the transaction success rate on the chain are optimized.
Inventors
- ZHANG SHUAI
- XIA LIWEI
- WANG XIAOYI
- LIU YIHENG
Assignees
- 杭州高新区(滨江)区块链与数据安全研究院
Dates
- Publication Date
- 20260505
- Application Date
- 20251203
Claims (10)
- 1. A method for dynamically executing a resource transaction on a chain, comprising the steps of: the method comprises the steps of acquiring a resource transaction request submitted by a user on a chain, wherein the resource transaction request comprises a first object to be transacted, a transaction resource and a second object expected to be transacted; The method comprises the steps of acquiring on-chain transaction information, wherein the on-chain transaction information is used for describing on-chain dynamic working conditions when the first object and the second object conduct transaction; dynamically generating a time weighting curve according to the transaction information on the chain, wherein the time weighting curve comprises a time window, a plurality of transaction time points in the time window and resource transaction amounts respectively corresponding to the transaction time points; And executing the resource transaction request based on the time weighting curve to complete the chain transaction of the transaction resource.
- 2. The method according to claim 1, characterized in that the method further comprises: Calculating the proportion of the transaction resources to the available resources in a liquidity pool, wherein the liquidity pool is a transaction pool supporting the transaction of the first object and the second object; If the proportion is smaller than a first preset proportion, executing the resource transaction request by adopting an instant transaction execution mode, and completing the transaction of all the transaction resources; And if the ratio is greater than or equal to the first preset ratio, executing transaction resources with a second preset ratio by adopting the instant transaction execution mode, and executing the step of acquiring the transaction information on the chain and the subsequent step aiming at the rest transaction resources.
- 3. The method of claim 1, wherein the on-chain transaction information includes at least one of price volatility, available resources in a liquidity pool, a ratio of the transaction resources to the available resources, and on-chain transaction fees, wherein dynamically generating a time-weighted curve from the on-chain transaction information comprises: Determining a threshold interval corresponding to any on-chain transaction information according to any on-chain transaction information; If the threshold interval corresponding to the price fluctuation rate is a preset low fluctuation rate interval and the available resource is located in a preset resource sufficient interval, a first time weighting curve is generated, wherein the time window in the first time weighting curve is divided into a first continuous stage and a second continuous stage, the single transaction amount duty ratio of the first continuous stage is larger than that of the second continuous stage, and the execution frequency of the single transaction in the first continuous stage is larger than that of the single transaction in the second continuous stage; generating a second time weighting curve if the threshold interval corresponding to the price fluctuation rate is a preset high fluctuation rate interval, wherein in the second time weighting curve, the single transaction amount duty ratio of the first stage is smaller than that of the second stage, and the execution frequency of the single transaction in the first stage is smaller than that of the single transaction in the second stage; If the threshold value interval corresponding to the transaction cost on the chain is a preset high cost interval, a third time weighting curve is generated, wherein the total time length of a time window in the third time weighting curve is longer than the preset reference total time length, and the resource transaction amounts corresponding to a plurality of transaction time points are uniformly distributed; If the threshold interval corresponding to the available resources is a preset insufficient resource interval or the threshold interval corresponding to the proportion is a preset high proportion interval, generating a fourth time weighting curve, wherein the number of transaction time points in the time window in the fourth time weighting curve is larger than the preset reference number; and determining one of the first time weighting curve, the second time weighting curve, the third time weighting curve and the fourth time weighting curve as the time weighting curve.
- 4. The method of claim 1, wherein dynamically generating a time-weighted curve from the on-chain transaction information comprises: if the first object to the second object are direct transaction paths, dynamically generating a time weighting curve corresponding to the direct transaction paths according to the on-chain transaction information; If the first object to the second object are indirect transaction paths, sub-time weighting curves corresponding to each sub-transaction path are dynamically generated according to the on-chain transaction information, a plurality of sub-time weighting curves are determined to be the time weighting curves, the indirect transaction path is composed of a plurality of sub-transaction paths, and the starting point and the ending point of each sub-transaction path are adjacent transaction objects.
- 5. The method of claim 4, wherein the executing the resource transaction request based on the time-weighted curve to complete the on-chain transaction for the transaction resource comprises: aiming at a target sub-transaction path for executing transaction currently in the sub-transaction paths, acquiring the transaction progress of the target sub-transaction path; and if the transaction progress of the target sub-transaction path reaches the preset progress, starting the sub-time weighting curve corresponding to the next sub-transaction path to execute the on-chain transaction until the transaction of the last sub-transaction path is completed.
- 6. The method of claim 5, wherein if the transaction progress of the target sub-transaction path reaches a preset progress, then starting to execute the on-chain transaction based on the sub-time weighting curve corresponding to the next sub-transaction path until the transaction of the last sub-transaction path is completed, further comprising: if the transaction progress of the target sub-transaction path is equal to the preset progress, starting the sub-time weighting curve corresponding to the next sub-transaction path to execute the on-chain transaction; In the transaction process of the target sub-transaction path, calculating actual transaction prices of two transaction objects in the target sub-transaction path, and comparing the actual transaction prices with the price offset of the preset reference price of the target sub-transaction path; if the price offset is greater than a preset offset threshold, stopping executing the next on-chain transaction corresponding to the sub-transaction path; And if the price offset is not greater than the preset offset threshold, continuing to execute the on-chain transaction corresponding to the next sub-transaction path until the transaction of the last sub-transaction path is completed.
- 7. The method of any of claims 1-6, wherein the performing the resource transaction request based on the time-weighted curve to complete the on-chain transaction of the transaction resource comprises: superposing random disturbance on the time weighting curve, and adjusting at least one of the transaction time points or corresponding resource transaction amounts to obtain a target time weighting curve; and executing the resource transaction request based on the target time weighting curve to complete the on-chain transaction of the transaction resource.
- 8. A dynamic execution device for on-chain resource transactions, the device comprising: the system comprises a first acquisition module, a second acquisition module and a first processing module, wherein the first acquisition module is used for acquiring a resource transaction request submitted by a user on a chain, and the resource transaction request comprises a first object to be transacted, a transaction resource and a second object expected to be transacted; The system comprises a first acquisition module, a second acquisition module and a processing module, wherein the first acquisition module is used for acquiring on-chain transaction information, and the on-chain transaction information is used for describing on-chain dynamic working conditions when the first object and the second object are transacted; the generation module is used for dynamically generating a time weighting curve according to the transaction information on the chain, wherein the time weighting curve comprises a time window, a plurality of transaction time points in the time window and resource transaction amounts respectively corresponding to the transaction time points; And the first execution module is used for executing the resource transaction request based on the time weighting curve and completing the on-chain transaction of the transaction resource.
- 9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when the computer program is executed.
- 10. A computer program product, characterized in that the computer program product, when run on an electronic device, causes the electronic device to perform the method of any one of claims 1 to 7.
Description
Dynamic execution method and device for on-chain resource transaction, electronic equipment and product Technical Field The application belongs to the technical field of blockchain, and particularly relates to a dynamic execution method, a device, electronic equipment and a product for on-chain resource transaction. Background In the technical field of blockchain, a matching mechanism of resource transaction on a chain mainly relies on a liquidity pool to realize automatic exchange and circulation of resources, and a time weighted execution strategy is widely applied as a core means for reducing impact of the transaction on the value of the resources. In the prior art, a time weighting curve with fixed parameters is generally adopted for time weighting execution of the transactions on a chain, namely, core parameters such as a time window for splitting the transactions, a transaction amount distribution proportion of each time point and the like are preset, and the curve form and the execution rhythm are kept unchanged in the whole execution process. However, the execution of the fixed time weighting curve is highly predictable, and is easy to be controlled by an external program. Specifically, the parameter transparency of the fixed time weighting curve is high, and an external program (such as an MEV robot and a sleeve Li Jiaoben) can accurately predict key information such as the execution time point of the transaction, the transaction amount distribution rule and the like through analyzing the preset rule of the curve. Furthermore, the method realizes directional arbitrage by controlling the transaction submitting sequence, utilizing the difference of block packing time and the like and performing association operation before and after the target transaction is executed. That is, the transaction execution method in the prior art has a problem that predictable arbitrage behavior cannot be suppressed. Disclosure of Invention The embodiment of the application provides a dynamic execution method, a dynamic execution device, electronic equipment and a dynamic execution product for on-chain resource transaction, which can solve the problem that the transaction execution method in the prior art cannot restrain foreseeable arbitrage behavior. In a first aspect, an embodiment of the present application provides a method for dynamically executing a link resource transaction, where the method includes: the method comprises the steps of acquiring a resource transaction request submitted by a user on a chain, wherein the resource transaction request comprises a first object to be transacted, a transaction resource and a second object expected to be transacted; the method comprises the steps of acquiring on-chain transaction information, wherein the on-chain transaction information is used for describing on-chain dynamic working conditions when a first object and a second object conduct transaction; dynamically generating a time weighting curve according to the transaction information on the chain, wherein the time weighting curve comprises a time window, a plurality of transaction time points in the time window and resource transaction amounts respectively corresponding to the transaction time points; and executing the resource transaction request based on the time weighting curve to complete the chain transaction of the transaction resource. In a second aspect, an embodiment of the present application provides a dynamic execution apparatus for on-chain resource transaction, where the apparatus includes: the system comprises a first acquisition module, a second acquisition module and a first processing module, wherein the first acquisition module is used for acquiring a resource transaction request submitted by a user on a chain, and the resource transaction request comprises a first object to be transacted, a transaction resource and a second object expected to be transacted; the system comprises a first acquisition module, a second acquisition module and a processing module, wherein the first acquisition module is used for acquiring on-chain transaction information, and the on-chain transaction information is used for describing on-chain dynamic working conditions when a first object and a second object conduct transaction; the generation module is used for dynamically generating a time weighting curve according to the on-chain transaction information, wherein the time weighting curve comprises a time window, a plurality of transaction time points in the time window and resource transaction amounts respectively corresponding to the transaction time points; and the first execution module is used for executing the resource transaction request based on the time weighting curve and completing the on-chain transaction of the transaction resource. In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and exe