CN117391854A - Data processing method and device based on block chain and related equipment - Google Patents

Data processing method and device based on block chain and related equipment Download PDF

Info

Publication number
CN117391854A
CN117391854A CN202311324136.3A CN202311324136A CN117391854A CN 117391854 A CN117391854 A CN 117391854A CN 202311324136 A CN202311324136 A CN 202311324136A CN 117391854 A CN117391854 A CN 117391854A
Authority
CN
China
Prior art keywords
resource
conversion
path
service
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311324136.3A
Other languages
Chinese (zh)
Inventor
刘区城
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311324136.3A priority Critical patent/CN117391854A/en
Publication of CN117391854A publication Critical patent/CN117391854A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/06Asset management; Financial planning or analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Economics (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Software Systems (AREA)
  • Operations Research (AREA)
  • Human Resources & Organizations (AREA)
  • Game Theory and Decision Science (AREA)
  • Computing Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application discloses a data processing method, a device and related equipment based on a blockchain, which can be applied to the technical field of data processing. The method comprises the following steps: receiving a resource conversion request; determining the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request; acquiring a service resource directed graph associated with a request timestamp; in the service resource directed graph, taking a resource node matched with a source service resource as a path index starting point, taking a resource node matched with a target service resource as a path index end point, determining a service conversion path from the path index starting point to the path index end point, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; and returning the resource conversion proportion, the service conversion path and the target consumed resource to the resource management client. By adopting the embodiment of the application, the resource conversion efficiency is improved.

Description

Data processing method and device based on block chain and related equipment
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a data processing method and apparatus based on a blockchain, and related devices.
Background
Currently, in a blockchain scenario, a business object (e.g., user 1) may submit a conversion transaction for performing resource conversion to a blockchain link point, so that when the blockchain node receives the conversion transaction, the blockchain node may invoke a corresponding business contract to perform the conversion transaction, and further may directly convert a resource a into a resource B according to a conversion exchange rate currently acquired from a business conversion platform for converting the resource a into another digital resource (e.g., resource B).
However, the inventor finds that once the resource A and the resource B cannot be directly converted, the phenomenon of transaction execution failure easily occurs. Based on this, if the service object (e.g. user 1) needs to exchange the resource a for the resource B, the resource conversion needs to be indirectly implemented in a manner of initiating multiple conversion transactions, that is, at this time, user 1 needs to submit multiple conversion transactions to the blockchain node successively. For ease of understanding, taking the example that the blockchain node receives multiple conversion transactions sequentially as two conversion transactions, the two conversion transactions may specifically include: a transaction TX1 initiated by user 1 at a first time stamp for converting resource a to resource C, and a transaction TX2 initiated by user 1 at a second time stamp (i.e., a time stamp subsequent to the first time stamp) for converting the converted resource C to resource B. However, due to the consensus characteristic of the blockchain node, a certain consensus duration is required to be consumed to perform transaction consensus on the transaction TX1, so that after the transaction consensus is successful, the transaction TX1 is allowed to be uplink to the blockchain, and the resource C converted by the resource a is returned to the user 1, so that the user 1 can initiate the transaction TX2 to the blockchain node again based on the received resource C. Then, the blockchain node needs to consume a certain consensus duration to perform transaction consensus on the transaction TX2, so that after the transaction consensus is successful, the transaction TX2 successfully converted from the resource C into the resource B is allowed to be uplink to the blockchain, which means that in the prior art, in the process of indirectly converting the resource a into the resource B by submitting multiple conversion transactions in sequence, a longer resource conversion duration is consumed, so that the efficiency of resource conversion is reduced.
Disclosure of Invention
The embodiment of the application provides a data processing method, a device and related equipment based on a block chain, which can calculate a service conversion path for resource conversion under the block chain, and is beneficial to improving the efficiency of resource conversion.
In one aspect, an embodiment of the present application provides a data processing method based on a blockchain, where the method is performed by a resource conversion device, and the method includes:
receiving a resource conversion request sent by a resource management client; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
determining the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request;
acquiring a service resource directed graph associated with a request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
In the service resource directed graph, taking a resource node matched with a source service resource as a path index starting point, taking a resource node matched with a target service resource as a path index end point, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the service conversion path, the resource expenditure quantity and the resource conversion quantity;
returning the resource conversion proportion, the service conversion path and the target consumed resources to the resource management client so that the resource management client constructs and obtains service conversion transaction for being sent to the blockchain node equipment associated with the blockchain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
In one aspect, an embodiment of the present application provides a data processing method based on a blockchain, where the method is performed by a resource management client, and the method includes:
determining a resource conversion request based on the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource, and sending the resource conversion request to the resource conversion equipment; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
acquiring a resource conversion proportion, a service conversion path and a target consumption resource returned by the resource conversion equipment; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
Based on K resource nodes in the service conversion path, constructing and obtaining service conversion transaction for sending to the block chain node equipment associated with the block chain; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
In one aspect, a method for processing data based on a blockchain is provided, where the method is executed by a blockchain node device, and the method includes:
acquiring business conversion transaction sent by a resource management client; the business conversion transaction is constructed based on K resource nodes in a business conversion path returned by the resource conversion equipment on the basis of the resource management client side; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
When a resource conversion contract deployed on a blockchain is called based on a target consumed resource, a business conversion path and a resource conversion proportion are input into the resource conversion contract, and a source business resource is converted into a target business resource through the resource conversion contract.
In one aspect, an embodiment of the present application provides a data processing apparatus based on a blockchain, where the apparatus is operated by a resource conversion device, and the apparatus includes:
the request receiving module is used for receiving a resource conversion request sent by the resource management client; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
the request analysis module is used for determining the resource expenditure quantity of the source service resources and the resource conversion quantity of the target service resources based on the resource conversion request;
the directed graph acquisition module is used for acquiring a service resource directed graph associated with the request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
The path calculation module is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the service conversion path, the resource expenditure quantity and the resource conversion quantity;
the data transmission module is used for returning the resource conversion proportion, the service conversion path and the target consumption resource to the resource management client so that the resource management client constructs and obtains service conversion transaction for being transmitted to the block chain node equipment associated with the block chain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
In one aspect, an embodiment of the present application provides a data processing apparatus based on a blockchain, where the apparatus is executed by a resource management client, and the apparatus includes:
the request determining module is used for determining a resource conversion request based on the resource expenditure quantity of the source service resources and the resource conversion quantity of the target service resources, and sending the resource conversion request to the resource conversion equipment; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
the data acquisition module is used for acquiring the resource conversion proportion, the service conversion path and the consumed resource with the target returned by the resource conversion equipment; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
The transaction construction module is used for constructing and obtaining business conversion transactions for being sent to the block chain node equipment associated with the block chain based on K resource nodes in the business conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
In one aspect, an embodiment of the present application provides a blockchain-based data processing apparatus, the apparatus being executed by a blockchain node device, the apparatus including:
the transaction acquisition module is used for acquiring business conversion transactions sent by the resource management client; the business conversion transaction is constructed based on K resource nodes in a business conversion path returned by the resource conversion equipment on the basis of the resource management client side; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
And the resource conversion module is used for inputting the business conversion path and the resource conversion proportion into the resource conversion contract when the resource conversion contract deployed on the block chain is called based on the target consumed resource, and converting the source business resource into the target business resource through the resource conversion contract.
In one aspect, the present application provides a computer readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having the processor performs the method provided in the embodiments of the present application.
In one aspect, the present application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method provided in the embodiments of the present application.
In the embodiment of the application, in the resource conversion equipment under the blockchain, the service conversion path can be calculated based on the service resource directed graph, and the resource conversion proportion and the target consumption resource of the service conversion path are determined. According to the method and the device for processing the business conversion, before the business conversion transaction is formally initiated, the business conversion path is calculated through the resource conversion equipment under the block chain, the phenomenon that the transaction execution fails due to the fact that the resource conversion cannot be directly carried out between the source business resource and the target business resource can be avoided, and therefore the success rate of the business conversion transaction for carrying out the resource conversion sent to the block chain node is improved, the time waste caused by the transaction failure is avoided, and the resource conversion efficiency is improved. And the service conversion path comprises more than 2 resource nodes, namely the service conversion path relates to the resource conversion of more than 2 service resources, further service conversion transaction is constructed based on the service conversion path, the blockchain node can realize the resource conversion of more than 2 service resources through the service conversion transaction, the consumed resource conversion time is shorter, and the resource conversion efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a block chain based data processing system according to an embodiment of the present application;
FIG. 2 is an interactive schematic diagram of a blockchain-based data processing system provided in an embodiment of the present application;
FIG. 3 is a schematic view of a scenario of data interaction provided in an embodiment of the present application;
FIG. 4 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present disclosure;
fig. 5 is an effect schematic diagram of a service resource directed graph provided in an embodiment of the present application;
FIG. 6 is a flowchart of a method for determining a resource transformation path according to an embodiment of the present application;
FIG. 7 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present disclosure;
FIG. 8 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present disclosure;
FIG. 9 is a schematic diagram of an effect of a resource conversion path set according to an embodiment of the present application;
FIG. 10 is a flowchart illustrating a resource transformation calculation procedure according to an embodiment of the present application;
FIG. 11 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present disclosure;
FIG. 12 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application;
FIG. 13 is an interactive timing diagram of a blockchain-based data processing method provided in an embodiment of the present application;
FIG. 14 is a block chain based data processing apparatus according to an embodiment of the present application;
FIG. 15 is a block chain based data processing apparatus according to an embodiment of the present application;
FIG. 16 is a block chain based data processing apparatus according to an embodiment of the present application;
fig. 17 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Referring to FIG. 1, FIG. 1 is a block chain based data processing system according to one embodiment of the present application. The data processing system may include a cluster of end devices, a cluster of resource conversion devices, and a blockchain network. As shown in fig. 1, the terminal device cluster may be the terminal device cluster 100a shown in fig. 1, the resource conversion device cluster may be the resource conversion device cluster 200a shown in fig. 1, and the blockchain network may be the blockchain network 300a shown in fig. 1.
It will be appreciated that one or more terminal devices may be included in the terminal device cluster 100a shown in fig. 1. The number of terminal devices in the cluster of terminal devices 100a will not be limited here. As shown in fig. 1, the terminal devices in the terminal device cluster 100a may include terminal device 110a, terminal devices 110b, …, terminal device 110n, and so on. The application client running in any one of the terminal devices may specifically be a resource client, also referred to as a resource management client. The resource management client may be a tool for managing digital resources, and may be used to store a private key of a service object in an encrypted file, and further sign a transaction to be signed (such as a transaction for transferring digital resources to other accounts) based on the private key stored in the resource management client, and send the signed transaction and the transaction signature to the blockchain to realize transfer of digital resources on the blockchain. The resource management client may be a hardware device or a software program. It will be appreciated that there may be one or more resource management clients running in one terminal device, and there will be no limitation on the number of resource management clients running in one terminal device. It may be understood that the same service object may correspond to one or more resource management clients, and that multiple resource management clients corresponding to the same service object may operate on the same terminal device, or may operate on different terminal devices, where no limitation is placed. The resource management client provides a client page, and a user performs resource conversion transaction operation through the client page, wherein the operation comprises the steps of inputting information such as source service resources (and corresponding quantity) required to be paid out, target service resources required to be obtained, expected resource conversion proportion (or the quantity of target service resources expected to be obtained) and the like.
It can be appreciated that the embodiments of the present application may be applied to financial scenarios, and that the digital resource corresponding to the resource management client may be a legal digital asset. The embodiment of the application can also be applied to a game scene, and the digital resource corresponding to the resource management client can be a game prop or the like which can be used for transaction or exchange in a game, and the application is not limited herein.
Wherein the resource conversion device cluster 200a (also referred to as a resource management server cluster) may include one or more service conversion paths (also referred to as a resource management server, a resource management background server) for determining to convert the source service resource into the target service resource, the number of resource conversion devices in the resource conversion device cluster 200a will not be limited herein. As shown in fig. 1, the plurality of resource converting devices in the resource converting device cluster 200a may include a resource converting device 120a, resource converting devices 120b, …, resource converting device 120n, and the like. As shown in fig. 1, the resource conversion devices in the resource conversion device cluster 200a may be in network connection with some or all of the terminal devices in the terminal device cluster 100a shown in fig. 1, so as to perform data interaction with some or all of the terminal devices in the terminal device cluster 100a through the network connection. The resource conversion device may be used for processing user requests (such as resource conversion requests), obtaining transaction resource pair information, calculating service conversion paths, converting resource proportions, and the like. The resource conversion device and the resource management client can perform data interaction through an API (interface). For example, the terminal device 110a may serve as a service terminal, and further, the service object may send a resource conversion request to the resource conversion device 120a by using the resource management client in the terminal device 110a, so that the resource conversion device 120a may determine a service conversion path based on the resource conversion request, and further return the determined service conversion path to the resource management client.
It is to be appreciated that the blockchain network 300a as shown in fig. 1 can include a plurality of blockchain nodes (also referred to as blockchain node devices), the number of blockchain nodes in the blockchain network 300a will not be limited herein. As shown in FIG. 1, the plurality of blockchain links in the blockchain network 300a may specifically include blockchain node 11a, blockchain node 11b, blockchain node 11c, blockchain node 11d, and so forth. The blockchain nodes in the blockchain network may be used to collectively maintain blockchains, e.g., the blockchain stored on each node in the blockchain network 300a (e.g., blockchain nodes 11a, 11b, 11c, and 11 d) is blockchain 11e.
As shown in fig. 1, the terminal devices (e.g., terminal device 110 a) in the terminal device cluster 100a may be in network connection with the blockchain nodes such as blockchain node 11a, blockchain node 11b, blockchain node 11c, blockchain node 11d, etc. to interact with the blockchain nodes in the blockchain network 300a when the terminal devices in the terminal device cluster 100a access the blockchain network 300 a. For example, the terminal device 110a may be used as a service terminal, and thus the service object may send a service transaction to the blockchain network through the service terminal, and thus the blockchain node in the blockchain network may perform corresponding transaction processing based on the service transaction.
It should be understood that the blockchain according to the embodiments of the present application is a novel application mode of computer technologies such as distributed data storage, peer-to-peer transmission, a consensus mechanism, and an encryption algorithm, and is mainly used for sorting data according to a time sequence, encrypting an account book, so that the account book cannot be tampered and forged, and meanwhile, performing verification, storage, and update of data. The blockchain is essentially a decentralised database, which is a series of data blocks generated by cryptographic methods, each data block containing a batch of information of network transactions for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer. The Block chain comprises a series of blocks (blocks) which are mutually connected according to the sequence of the generated time, and the blocks record Block data packed and submitted by Block chain nodes in the Block chain system. The blockchain underlying platform may include processing modules for object management, basic services, smart contracts, and operations management. The object management module is responsible for identity information management of all blockchain participants, including maintenance of public and private key generation (account management), key management, maintenance of corresponding relation between real identities of users and blockchain addresses (authority management), etc., and under the condition of authorization, supervision and audit of transaction conditions of certain real identities, and provision of rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node devices, is used for verifying the validity of a service request, recording the service request on a storage after the effective request is identified, for a new service request, the basic service firstly analyzes interface adaptation and authenticates the interface adaptation, encrypts service information (identification management) through an identification algorithm, and transmits the encrypted service information to a shared account book (network communication) in a complete and consistent manner, and records and stores the service information; the intelligent contract module is responsible for registering and issuing contracts, triggering contracts and executing contracts, a developer can define contract logic through a certain programming language, issue the contract logic to a blockchain (contract registering), invoke keys or other event triggering execution according to the logic of contract clauses to complete the contract logic, and simultaneously provide a function of registering contract upgrading; the operation management module is mainly responsible for deployment in the product release process, modification of configuration, contract setting, cloud adaptation and visual output of real-time states in product operation, for example: alarms, managing network conditions, managing node device health status, etc. The platform product service layer provides basic capabilities and implementation frameworks of typical applications, and developers can complete the blockchain implementation of business logic based on the basic capabilities and the characteristics of the superposition business. The application service layer provides the application service based on the block chain scheme to the business participants for use.
It will be appreciated that a blockchain (e.g., blockchain 11 e) may be composed of a plurality of blocks, wherein an originating block (also referred to as an originating block, i.e., a first block in the blockchain) includes a block header and a block body, wherein the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the father block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured. It is understood that each block in the blockchain may correspond to a block height, which refers to the number of blocks between the block and the created block in the blockchain. It should be noted that the block height of the created block is 0 and the block height of the next block of the created block is 1.
It should be appreciated that one or more smart contracts may be deployed on a blockchain (e.g., the blockchain 11 e) of the blockchain network (e.g., the blockchain network 300 a) that may be distinguished by contract identifications that may include one or more of: the contract calling address, contract identification number (Identity document, ID) or contract name can also be carried in the business transaction initiated by the user client, so as to specify the intelligent contract to be operated. In embodiments of the present application, the intelligent contracts deployed on the blockchain may include resource transformation contracts. The resource conversion contract can be an intelligent contract for converting resources based on the service conversion path obtained by calculation under the chain, and the resource conversion can be completed one by one according to the service conversion path and the resource conversion proportion which are calculated in advance. The intelligent contracts are deployed on a blockchain, which can interact with the resource transformation device through web3.js (an interface) or other library. It is appreciated that the resource management client may interact with the intelligent contract via a corresponding interface, including signing business transformation transactions, sending business transformation transactions, receiving transformed resources, and so forth. The block chain can be further provided with a transaction resource pair conversion contract corresponding to the transaction resource pair, the transaction resource pair conversion contract can be used for converting a reference resource in the transaction resource pair into a target resource, the target resource is a business resource which is required to be converted when the resource in the transaction resource pair is converted, and the reference resource is a business resource which is required to be paid when the resource in the transaction resource pair is converted. For example, where trading resource pair T1 is resource A→resource B, then trading resource pair T1 may correspond to a trading resource pair conversion contract that may be used to convert resource A to resource B.
For ease of understanding, further referring to FIG. 2, FIG. 2 is an interactive schematic diagram of a blockchain-based data processing system provided in an embodiment of the present application. The resource management client executes S21a: and initiating a resource conversion request to the resource conversion device. The resource conversion device executes S22a: and acquiring a service resource directed graph based on the resource conversion request, determining a service conversion path based on the service resource directed graph, and determining a resource conversion proportion and a target consumption resource. Further, the resource conversion device executes S23a: returning to the service conversion path, the resource conversion proportion and the target consumed resource. The resource management client then performs S24a, constructs a traffic conversion transaction based on the traffic conversion path. The resource management client performs S25a, the business transformation transaction is sent to the blockchain network. The blockchain network may include a plurality of blockchain nodes, such as blockchain node 1, blockchain node 2, blockchain node 3, and so forth. Each blockchain node is provided with a resource conversion contract, and then the blockchain nodes (such as the blockchain node 1, the blockchain node 2 and the blockchain node 3) can call the resource conversion contracts to execute business conversion transaction so as to perform resource conversion based on a business conversion path. It can be understood that the whole system architecture realizes front-end and back-end separation, and is convenient for expansion and maintenance. Through integration of the resource conversion platform, the data source and the intelligent contract, conversion among various business resources can be realized through one business conversion transaction, and the transaction efficiency and convenience are improved.
For ease of understanding, further, please refer to fig. 3, fig. 3 is a schematic view of a scenario of data interaction provided in an embodiment of the present application. As shown in fig. 3, the terminal device 20a may be any terminal device (e.g., the terminal device 110a, the terminal device 110b, etc.) in the terminal device cluster in fig. 1, where the resource management client is running on the terminal device 20. The resource conversion device 21a may be any one of the resource conversion devices in the resource conversion device cluster in fig. 1 described above (e.g., the resource conversion device 120a, the resource conversion device 120b, etc.).
The business object a may initiate a resource conversion request to the resource conversion device 21a through a resource management client running on the terminal device 20a (step S21). It will be appreciated that the resource conversion request is used to determine a traffic conversion path when converting a source traffic resource to a target traffic resource. It will be appreciated that the business object a may configure source business resources and target business resources on a client page of a resource management client. For example, as shown in client page 210a in FIG. 3, a business object may configure a source business resource and a resource payout amount, a target business resource and a resource conversion amount on client page 210a, e.g., a region shown as 2101a in FIG. 3, a source business resource may be configured as 100 resources A and 50 resources B, a region shown as 2102a in FIG. 3, and a target business resource may be configured as 70 resources C and 80 resources D. Alternatively, the resource expense number of the source service resource and the number proportion of the target service resource to the source service resource may be determined by the service object, and then the resource conversion number of the target service resource may be determined based on the number proportion and the resource expense number. It is understood that the source service resource refers to a service resource that is paid for when the resource conversion is performed, and the target service resource refers to a service resource that is converted when the resource conversion is performed. And, the business object can also configure the resource expenditure quantity of the source business resource and the resource conversion quantity of the target business resource. The resource expenditure quantity refers to the quantity of source service resources indicated by the resource conversion request, which is equivalent to the quantity of willing expenditure source service resources when the service object performs resource conversion. The resource conversion number refers to the number of target service resources indicated by the resource conversion request, and is equivalent to the number of target service resources expected to be converted when the service object performs resource conversion. It may be understood that in the embodiment of the present application, the source service resources may include service resources of M resource types (i.e., including M source service resources), the target service resources may include target service resources of N resource types (i.e., including N target service resources), and M and N are integers.
Further, when the resource conversion device 21a obtains the resource conversion request, the resource expense number 201a corresponding to the source service resource and the resource conversion number 202a corresponding to the target service resource can be obtained from the resource conversion request.
And, the resource conversion device 21a may acquire a traffic resource directed graph corresponding to the resource conversion request time from the resource conversion platform (as shown by 203a in fig. 3). The service resource directed graph is determined by resource nodes (also simply called nodes), node connection edges (also simply called connecting edges) and edge connection influence values (also simply called influence values); the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to convert the transaction resource pair at the time of the request timestamp. It will be appreciated that the resource conversion platform may be an information platform for providing resource conversion services that provide transactional resource pairs for performing resource conversion, as well as conversion rates and resource conversion fees between each transactional resource pair. The conversion rate may be a ratio of conversion between two resources in the transaction resource pair, for example, the conversion rate may be a price of a destination resource in the transaction resource pair/a price of a reference resource, so that the number of destination resources that may be converted by 1 reference resource may be described by the conversion rate. Further, business transformation paths, resource transformation proportions, and target consumed resources (i.e., indicated at 204 a) may be determined based on the resource expense amount 201a, the resource transformation amount 202a, and the business resource digraph. The traffic conversion path, the resource conversion ratio, and the target consumed resource are then returned to the resource management client in the terminal device 20a (step S22).
Further, the resource management client in the terminal device 20a may construct the service conversion resource when acquiring the service conversion path, the resource conversion ratio and the target consumption resource. It will be appreciated that the business object a may view the business transformation path, the resource transformation ratio, and the target consumed resources returned by the resource transformation device in the resource management client. If the service object considers that the service conversion path meets the expectations, the service conversion path may be confirmed, and the resource management client in the terminal device 20a may construct a service conversion transaction based on the service conversion path (and the resource conversion ratio and the target consumed resource) in response to the confirmation operation of the service object.
Further, the resource management client may transmit a service switching transaction to the blockchain network 300a (step S23). It is appreciated that a plurality of blockchain link point devices may be included in blockchain network 300a, each of which may have a resource conversion contract deployed thereon. Here, taking the blockchain node 11d as an example, the blockchain node 11d is deployed with a resource conversion contract 205a, and when the blockchain node 11d obtains a service conversion transaction, the blockchain node enters a service conversion path and a resource conversion proportion into the resource conversion contract 205a, and converts a source service resource into a target service resource through the resource conversion contract, thereby realizing conversion of the source service transaction into the target service transaction.
It may be understood that the number of resource nodes in the service conversion path determined by the resource conversion device is K, where K is a positive integer greater than 2, and the service conversion path may include a path index start point corresponding to the source service resource and a path index end point corresponding to the target service resource. It may be understood that, the number of node connection edges in the service conversion path determined by the resource conversion device is W, where W is a positive integer greater than 2, and the W node connection edges are node connection edges between K resource nodes on the service conversion path, in other words, the service conversion path may include K sub-paths, and one node connection edge and a resource node connected by the node connection edge form a sub-path, and then the service conversion path is a path including multiple sub-paths.
It can be understood that, by adopting the embodiment of the application, in the resource conversion device under the blockchain, the calculation of the service conversion path can be performed based on the service resource directed graph, and the resource conversion proportion and the target consumption resource of the service conversion path can be determined. According to the method and the device for processing the business conversion, before the business conversion transaction is formally initiated, the business conversion path is calculated through the resource conversion equipment under the block chain, the phenomenon that the transaction execution fails due to the fact that the resource conversion cannot be directly carried out between the source business resource and the target business resource can be avoided, and therefore the success rate of the business conversion transaction for carrying out the resource conversion sent to the block chain node is improved, the time waste caused by the transaction failure is avoided, and the resource conversion efficiency is improved. And the service conversion path comprises more than 2 resource nodes, namely the service conversion path relates to the resource conversion of more than 2 service resources, further service conversion transaction is constructed based on the service conversion path, the blockchain node can realize the resource conversion of more than 2 service resources through the service conversion transaction, the consumed resource conversion time is shorter, and the resource conversion efficiency is improved.
In addition, when the service conversion path is calculated based on the service resource directed graph, the edge connection influence weight in the service resource directed graph is determined based on the consumption resources of the transaction resource pair, so that the cost of resource conversion is considered in the process of determining the service conversion path, the service conversion path which needs to consume lower consumption resources can be determined, and the cost of resource conversion is reduced. In addition, the service conversion path determined by the resource conversion device may include resource nodes greater than 2, that is, the service conversion path may not be directly converted from the source service resource to the target service resource, which is helpful for improving flexibility of resource conversion.
It can be understood that, by the embodiment of the application, the transaction efficiency of the business object (such as a user) can be improved, and the operation flow is simplified. For example, a user may complete the redemption of multiple business resources by initiating only one business transformation transaction, without waiting for multiple transaction acknowledgements, faster, and without undergoing a complex operational flow. This will make the user more convenient, labour saving and time saving is with low costs, has improved transaction efficiency and convenience. At the same time, security and accuracy of transactions are ensured by the ability of smart contracts (i.e., resource conversion contracts) to be automatically calculated and executed. In addition, by adopting the embodiment of the application, the transaction cost of the user can be reduced, and the transaction cost is reduced. By implementing the scheme, the service conversion path with lower transaction cost can be calculated in the resource conversion equipment, so that a user can enjoy the lower transaction cost to increase the satisfaction degree of the user, and the user is stimulated to conduct transactions on the blockchain more actively. In addition, through the embodiment of the application, the asset diversification and risk management are facilitated for users. Through the scheme, the user can more conveniently conduct transaction and investment combination adjustment among different types of resources, so that asset diversification is realized. In addition, users can better manage their risk because users can better understand market trends and asset performance by acquiring business transformation paths. In summary, the present approach will provide a number of benefits, including higher transaction efficiency, lower transaction costs, and better asset diversification and risk management. For the transaction platform, the embodiment of the application can enable the transaction success rate of the user on the transaction platform to be higher, increase the satisfaction degree of the business object on the transaction platform, and bring more benefits and success to the transaction platform.
In one embodiment, the embodiments of the present application may be applied in a game scenario. For example, in a game scenario, the service resource related to the embodiments of the present application may be a virtual resource that may be used for exchange in a game, such as an integration in the game, a prop, and so on, which are not limited herein. In the game scenario, the resource conversion platform may be a game provider or a third party platform, which is not limited herein. The embodiment of the application can be applied to a financial scene. For example, in a financial scenario, the business resources involved in embodiments of the present application may be legal digital resources.
It will be appreciated that the blockchain nodes (e.g., any blockchain node in the blockchain network 300 a) and the resource conversion devices (e.g., any resource conversion device in the resource conversion device cluster 200 a) according to the embodiments of the present application may be computer devices, which may be servers, terminals, or other devices that perform data processing, and are not limited herein. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms, and the like, which is not limited herein.
The terminal devices (e.g., any one of the terminal device clusters 100 a) according to the embodiments of the present application may include, but are not limited to, a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, an aircraft, an intelligent sound box, an intelligent home appliance, and the like.
It should be noted that, before and during the process of collecting the relevant data of the user, the present application may display a prompt interface, a popup window or output a voice prompt message, where the prompt interface, popup window or voice prompt message is used to prompt the user to collect the relevant data currently, so that the present application only starts to execute the relevant step of obtaining the relevant data of the user after obtaining the confirmation operation of the user to the prompt interface or popup window, otherwise (i.e. when the confirmation operation of the user to the prompt interface or popup window is not obtained), the relevant step of obtaining the relevant data of the user is finished, i.e. the relevant data of the user is not obtained. In other words, all user data collected in the present application is collected with the consent and authorization of the user, and the collection, use and processing of relevant user data requires compliance with relevant laws and regulations and standards of the relevant country and region.
It can be understood that the cloud server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms, and the like. The terminal equipment comprises, but is not limited to, a mobile phone, a computer, an intelligent voice interaction device, an intelligent household appliance, a vehicle-mounted terminal, an aircraft, an intelligent sound box, an intelligent household appliance and the like.
It can be understood that the above scenario is merely an example, and does not constitute a limitation on the application scenario of the technical solution provided in the embodiments of the present application, and the technical solution of the present application may also be applied to other scenarios. For example, as one of ordinary skill in the art can know, with the evolution of the system architecture and the appearance of new service scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.
Further, referring to fig. 4, fig. 4 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. The method is performed by a resource conversion device. The method may comprise at least the following steps S101-S105.
S101, receiving a resource conversion request sent by a resource management client; the resource conversion request is used to determine a traffic conversion path when converting the source traffic resource to the target traffic resource.
Wherein the resource conversion request may determine a traffic path for the requesting resource conversion device when converting the source traffic resource into the target traffic resource. The source service resource refers to a service resource which is paid out when the resource conversion is performed, and the target service resource refers to a service resource which is converted when the resource conversion is performed. Traffic resources may also be referred to simply as resources. It is understood that in the present application, the source service resource includes service resources of M resource types, and the target service resource includes service resources of N resource types, where M and N are both positive integers. In other words, in the embodiment of the present application, it may be realized that one resource is converted into another resource (i.e., the values of M and N are both 1), one resource is converted into multiple resources (i.e., M is 1 and N is greater than 1), multiple resources are converted into one resource (i.e., M is greater than 1 and N is 1), and multiple resources are converted into multiple resources (i.e., M is greater than 1 and N is greater than 1). For example, when converting resource a into resource B, resource a is a source traffic resource and resource B is a target traffic resource. As another example, when converting resource a and resource B into resource C and resource D, resource a and resource B are source traffic resources and resource C and resource D are target traffic resources.
The service conversion path refers to a conversion path required for converting the source service resource into the target service resource. The service conversion path may include K resource nodes, that is, may include K service resources. For example, when converting the resource a into the resource B, the resource a may be converted into the resource D, and then the resource D is converted into the resource B, and the service conversion path may be: resource a→resource d→resource B.
S102, determining the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request.
The resource expenditure amount refers to the amount of source service resources indicated by the resource conversion request, which is equivalent to the amount of willing expenditure of source service resources when the service object performs resource conversion. The resource conversion number refers to the number of target service resources indicated by the resource conversion request, and is equivalent to the number of target service resources expected to be converted when the service object performs resource conversion.
It is to be appreciated that the number of resource transformations may refer to a value that may represent a minimum of the number of target business resources that a business object is expected to transform. For example, the target service resources are resource a and resource B, and the resource conversion number includes the resource conversion number corresponding to the resource a and the resource conversion number corresponding to the resource B. The number of resource conversions corresponding to the resource a is 10, and the number of resource conversions corresponding to the resource B is 50, which indicates that the service object wishes to obtain 10 or more resources a and 50 or more resources B through source service resource conversion. Alternatively, the number of resource conversions may be the minimum of a range of values, which may then represent a range of numbers of target business resources that the business object is expected to convert to. For example, the target service resource is resource C, the number of resource conversions corresponding to resource C is 10-15, which means that the service object wishes to obtain 10-15 resource cs through source service resource conversion, and the minimum value (e.g., 10 resource cs) in the target service resource may be determined, so as to facilitate the subsequent calculation of the service conversion path, the resource conversion ratio and the consumed resource.
S103, acquiring a service resource directed graph associated with a request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to convert the transaction resource pair at the time of the request timestamp.
The request time stamp refers to a time stamp corresponding to the resource conversion request. The request timestamp may be a timestamp carried by the resource conversion request, i.e. a timestamp when the resource conversion request was generated by the resource management client. The request timestamp may also be a timestamp determined by the resource conversion server for the resource conversion request when the resource conversion request is acquired, which is not limited herein, and may be determined according to actual requirements.
The service resource directed graph may be a directed graph for determining a service transition path. The directional diagram refers to a diagram having directivity. The traffic resource directed graph is determined based on the transaction resource pairs at the time of the request time stamp acquired from the resource conversion platform and conversion information of the transaction resource pairs. A transaction resource pair refers to a resource pair formed by business resources of two resource types participating in resource conversion. The transaction resource pair has a resource conversion direction, and the resource conversion direction refers to the direction of transaction of two kinds of resources included in the transaction resource pair when the transaction resource pair performs resource conversion. When the resource conversion directions are different, two different transaction resource pairs can be formed, for example, the resource A is converted into the resource B (namely, the resource conversion direction is that the resource A is the resource A.fwdarw.the resource B) to form one transaction resource pair, and the resource B is converted into the resource A (namely, the resource conversion direction is that the resource B.fwdarw.the resource A) to form another transaction resource pair.
It will be appreciated that the traffic resource graph is determined by the resource nodes, node connection edges and edge connection impact values. In the traffic resource directed graph, one resource node corresponds to a traffic resource of one resource type, in other words, the resource node is determined by the transaction resource pair provided by the resource conversion platform for performing resource conversion. For example, the transaction resource pairs provided by the resource conversion platform include: the service resource directed graph may include a resource node corresponding to the resource a, a resource node corresponding to the resource B, a resource node corresponding to the resource C, and so on.
And one node connecting edge is used for connecting resource nodes corresponding to the business resources of the two resource types forming the transaction resource pair. It will be appreciated that the connection edge direction of the node connection edge is determined based on the resource conversion direction of the connected transaction resource pair, the connection edge direction being used to describe the node connection edge from one resource node to another in the traffic resource graph. In other words, the node connection edge is determined by a resource relationship corresponding to a transaction resource pair that participates in resource conversion when a timestamp is requested, the resource relationship being used to indicate a resource transfer direction between the transaction resource pair. For example, the transaction resource pairs provided by the resource conversion platform include: in the service resource directed graph, a node connection edge is arranged between a resource node corresponding to the resource A and a resource node corresponding to the resource B, the connection edge direction of the node connection edge is from the resource A to the resource B, a node connection edge is arranged between a resource node corresponding to the resource B and a resource node corresponding to the resource C, and the connection edge direction of the node connection edge is from the resource B to the resource C. If the resource A and the resource C do not form a transaction resource pair, no resource node connecting edge exists between the resource node corresponding to the resource A and the resource node corresponding to the resource B. It can be understood that if there is a transaction resource pair of converting the resource a into the resource B and a transaction resource pair of converting the resource B into the resource a, there is a node connection edge of the resource node of the resource a pointing to the resource node of the resource B and a node connection edge of the resource node of the resource B pointing to the resource node of the resource a between the resource node corresponding to the resource a and the resource node corresponding to the resource B.
The edge connection influence value refers to an influence value of a node connection edge, which is equivalent to the weight of the node connection edge in the service resource directed graph, and one node connection edge corresponds to one edge connection influence value. It is to be appreciated that the edge connection impact value can be determined based on the corresponding transaction resource versus the consumed resources consumed in making the resource conversion. The consumed resources refer to transaction fees, also referred to as transaction costs, that are expended in making resource conversions. It will be appreciated that a transaction resource pair is formed of two parts, one part being the procedure fee charged by the transaction platform (i.e., the resource conversion platform) and the other part being the fee charged by the execution of the intelligent contracts (e.g., the contracts called for resource conversion) on the blockchain. It should be understood that the consumed resources herein may be expressed as a percentage of resource consumption, for example, the consumption of 0.6% when the resource a is converted to the resource B, and the consumed resources are 0.6%, and the edge connection impact value corresponding to the node connection edge of the resource node corresponding to the resource B is 0.6%.
For example, referring to fig. 5, fig. 5 is an effect schematic diagram of a service resource directed graph provided in an embodiment of the present application. As shown in fig. 5, a traffic resource directed graph (as shown in 501a in fig. 5) may include resource nodes, such as node a, node b, node e, and the like, and may include node connection edges, and edge connection impact weights corresponding to the node connection edges. The construction process of the service resource directed graph is described herein by taking node a and node b as examples. If the transaction resource pair provided by the resource conversion platform comprises a transaction resource pair converted from the service resource A to the service resource B when the timestamp is requested, a node a corresponding to the service resource A and a node B corresponding to the service resource B are constructed in the service resource directed graph, a node connection edge pointing to the node B from the node a is arranged between the node a and the node B, and if the consumption resource required for resource conversion of the transaction resource pair is w1, the edge connection weight of the node connection edge pointing to the node B from the node a is w1. Similarly, a business resource targeting graph (shown as 501a in FIG. 5) may be determined based on the respective transaction resource pairs provided by the resource conversion platform.
S104, in the service resource directed graph, taking a resource node matched with the source service resource as a path index starting point, taking a resource node matched with the target service resource as a path index end point, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the service conversion path, the resource expenditure quantity and the resource conversion quantity.
It may be understood that the starting point of the path index may refer to a starting point of the path index in the traffic resource directed graph, and the ending point of the path index may refer to an ending point of the path index in the traffic resource directed graph, where the path index is used to indicate a path from the starting point of the path index to the ending point of the path index.
It may be understood that, if the source service resource includes service resources of M resource types, resource nodes that are matched with the service resources of M resource types (i.e., resource nodes corresponding to the service resources of M resource types) may be determined as path index start points, i.e., determining M path index start points. The target service resource includes N service resources of resource types, and then the resource nodes matched with the service resources of the N resource types (i.e., the resource nodes corresponding to the service resources of the N resource types) may be determined as path index end points, i.e., N path index end points are determined.
It is understood that the traffic conversion path may be determined based on a resource conversion path from each of the M path index start points to the N path index end points, respectively. For example, if the M path index starts include: the traffic conversion path may be determined based on the resource conversion path of each of the path index end points from the path index start point 1 to the N path index end points from the M path index start points, the resource conversion path of each of the path index end points from the path index start point 2 to the N path index end points, and the path index start point M.
It is understood that a path index start point to a path index end point have one resource conversion path, in other words, one resource conversion path refers to an index path from a path index start point to a path index end point for determining a traffic conversion path. The resource conversion path may be an index path with the smallest sum of edge connection influence values in at least one index path from the path index start point to the path index end point, or may be an index path with the smallest number of node connection edges in at least one index path from the path index start point to the path index end point, which may be specifically determined according to actual requirements, and is not limited herein. The index path may refer to a path indexed from a path index start point to a path index end point.
For example, referring to fig. 6, fig. 6 is a flowchart of a method for determining a resource conversion path according to an embodiment of the present application. As shown in fig. 6, the process of determining a resource conversion path from a path index start point to a path index end point will be described herein by taking a node a in a traffic resource directed graph (as shown by 601a in fig. 6) as a path index start point and a node d as a path index end point. The resource conversion node may determine the index paths from node a to node b (step S61) by taking node a as the path index start point and node b as the path index end point, wherein the index paths from node a to node b may be shown by reference to 602a in fig. 6, and may specifically include index path 61a, index path 62a, and index path 63a. Further, a resource conversion path is determined from among the index paths 61a, 62a, 63a (step S62), thereby determining the resource conversion path 603a from node a to node b. Specifically, an index path having the smallest sum of edge connection influence values may be determined as a resource conversion path, or an index path having the smallest number of node connection edges may be determined as a resource conversion path.
Further, when M and N are different values, the logic for determining the service switching path is different. When M and N are both 1, if the source service resource is a resource a (the corresponding resource node is a node a 1) and the target service resource is a resource B (the corresponding resource node is a node B1), an index path with the number of resource nodes greater than 1 except for the resource index start point and the resource index end point on the index path from the node a1 to the node B1 may be determined as a resource conversion path, and the service conversion path may be determined based on the determined resource conversion path. For another example, when M and N are different from each other and are 1, if the source service resource includes a resource a (corresponding resource node is node a 1) and a resource B (corresponding resource node is node B1), and the target service resource is a resource C (corresponding resource node is node C1) and a resource D (corresponding resource node is node D1), the service conversion path may be determined based on the resource conversion path from node a1 to node C1, the resource conversion path from node a1 to node D1, the resource conversion path from node B1 to node C1, and the resource conversion path from node B1 to node D1.
It will be appreciated that K resource nodes may be included in the traffic conversion path, K being a positive integer greater than 2. The traffic conversion path may include a path index start point and a path index end point. It will be understood that if M and N are both 1, the number of path index start points is 1 and the number of path index end points is 1, and the service conversion path needs to further include other resource nodes except the path index start points and the path index end points, so that K is a positive integer greater than 2. For example, if the resource a needs to be converted into the resource B, the determined service conversion path may be the resource node a corresponding to the resource a→the resource node C corresponding to the resource c→the resource node B corresponding to the resource B. If M and N are different from each other and are 1, the number of path index start points is M and the number of path index end points is N, and the service conversion path may include only the M path index start points and the N path index end points, or may further include other resource nodes except the path index start points and the path index end points, so that K is a positive integer greater than 2. For example, if the resource a needs to be converted into the resource B and the resource C, the determined service conversion path may include the resource node a corresponding to the resource a→the resource node B corresponding to the resource B, and the resource node a corresponding to the resource a→the resource node C corresponding to the resource C.
It should be understood that the service conversion path may include W node connection sides, where W is a positive integer greater than 2. The W node connection edges are node connection edges between K resource nodes on the service conversion path. Correspondingly, in the W node connection sides, the service resources corresponding to the two resource nodes connected by each node connection side form a transaction resource pair, and the resource conversion direction of the formed transaction resource pair is determined based on the connection side direction of the node connection side, in other words, M transaction resource pairs may be corresponding to the service conversion path, and the M transaction resource pairs may also be referred to as transaction resource pairs corresponding to the resource nodes on the service conversion path.
It will be appreciated that in a traffic resource directed graph, there may be a path index start point to a path index end point without a resource switch path. In other words, a path index start point cannot pass through any path index to a path index end point. For example, in some scenarios, the service resource directed graph includes a resource node a, a resource node b, and a resource node c, where only a node connection edge from the resource node a to the resource node b is provided between the resource node a and the resource node b, only a node connection edge from the resource node c to the resource node b is provided between the resource node c and the resource node b, and no node connection edge is provided between the resource node a and the resource node b, if the resource node a is a path index start point, and the resource node b is a path index end point, then there is no resource conversion path between the path index start point of the resource node a and the path index end point of the resource node b. It can be understood that in this case, if M and N are both 1, that is, the resource conversion request is used to convert the service resource corresponding to the resource node a into the service resource corresponding to the resource node b, the resource conversion request cannot determine the service conversion path, and further, prompt information for indicating that determining the service conversion path fails may be returned to the resource management client. It will be appreciated that in this case, if M and N are not 1 at the same time, it may be determined whether a sufficient number of target service resources can be converted based on other resource conversion paths.
The resource conversion ratio associated with the service conversion path may be used to indicate a ratio of a number of target service resources determined based on the service conversion path and predicted to be converted to a number of resource expenditures. The number of predicted converted target traffic resources determined based on the traffic conversion path may be referred to herein as a target predicted resource conversion number. It may be understood that, if M and N are both 1, the resource conversion ratio may be a ratio of the number of target service resources corresponding to 1 resource type obtained by the expected conversion determined based on the service conversion path to the number of resource expenditures of the source service resources of 1 resource type. For example, when the resource conversion request is used to indicate that 10 resources a are converted into 20 resources B, if it is determined that the number of resources B expected to be converted is 22 based on the traffic conversion path, the resource conversion ratio may be 22/10=2.2. If M and N are different from each other and are 1, the resource conversion ratio may include a resource conversion ratio corresponding to a target service resource of each of the N resource types, and the resource conversion ratio corresponding to a target service resource of any one resource type may be a ratio of the number of service resources of the any one resource type and the sum of the number of resource expenditures of source service resources of the M resource types, which are expected to be converted based on the service conversion path. For example, when the resource conversion request is used to indicate that 10 resources a and 15 resources B are converted into 20 resources C and 30 resources D, if the number of resources C expected to be converted is 22 and the number of resources D expected to be converted is 30 based on the service conversion path, the resource conversion ratio corresponding to the resources C included in the resource conversion ratio is 22/(10+15), and the resource conversion ratio corresponding to the resources D is 30/(10+15).
The target consumed resource refers to a resource required to be consumed for converting the service resource corresponding to the resource expenditure amount into the target service resource, which is determined based on the service conversion path. It will be appreciated that the target consumed resource may be determined based on the edge connection impact value in the traffic conversion path and the number of resource expenditures. For example, the service conversion path is node a→node b→node c, where the edge connection influence value between node a→node b is 0.6%, the edge connection influence value between node b→node c is 0.2%, and if the resource payout amount is P, the target consumed resource determined based on the service resource may be P0.6% + P0.2%.
S105, returning the resource conversion proportion, the service conversion path and the target consumed resources to the resource management client so that the resource management client constructs and obtains service conversion transaction for being sent to the block chain node equipment associated with the block chain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
It can be understood that, the resource conversion proportion, the service conversion path and the target consumption resource are returned to the resource management client, so that the service object can check the resource conversion proportion, the service conversion path and the target consumption resource determined by the resource conversion device in the terminal device, so that the service object can determine whether to initiate the formal service conversion transaction based on the service conversion path.
The business conversion transaction refers to a transaction of resource conversion based on a business conversion path. It will be appreciated that the traffic conversion transaction may carry traffic conversion paths and resource conversion proportions. It can be appreciated that the processing procedure of the block link point device for performing the service transaction may refer to the related description of the subsequent embodiments, which is not described herein.
It is understood that the resource conversion device may determine at least one service conversion path, and the resource conversion ratio and the target consumption resource associated with the at least one service conversion path, and further return the at least one service conversion path, and the resource conversion ratio and the target consumption resource associated with the at least one service conversion path, to the resource management device. It is to be appreciated that the at least one traffic conversion path may include, but is not limited to, a traffic conversion path determined based on a resource conversion path determined based on an index path having a smallest sum of edge connection influence values, a traffic conversion path determined based on a resource conversion path determined based on an index path having a small number of node edges, and the like. For convenience of description, a service conversion path, and a resource conversion ratio and a target consumption resource associated with the service conversion path may be referred to as a resource conversion policy, and then the resource conversion device may return at least one resource conversion policy to the resource management client, so that the service object may select a resource conversion policy meeting the requirement from the at least one resource conversion policy through the resource management client. Further, when the service object selects the resource conversion policy, the resource management client may construct a service conversion transaction based on the resource conversion policy selected by the service object, that is, may determine the service conversion transaction based on the service conversion path, the resource conversion proportion and the target consumption resource selected by the service object, and then the resource management client may send the service conversion transaction to the block link point device, so that the block link point device may convert the source service resource into the target service resource based on the service conversion transaction in the service conversion transaction.
Optionally, when M and N are both 1, the resource conversion device may further determine a direct conversion path when the source service transaction of 1 resource type is converted into the target service resource of 1 resource type, where the direct conversion path may refer to a path determined by a transaction resource pair formed by converting the source service resource into the target service resource, where the transaction resource pair corresponds to the resource node. For example, if the source service resource is a resource a and the target service resource is a resource B, the direct conversion path is a node a corresponding to the resource a→a node B corresponding to the resource B.
Further, when the direct conversion path is determined, the corresponding resource conversion proportion and the target consumed resource are determined based on the direct conversion path and the resource expenditure quantity, and then the direct conversion path, the corresponding resource conversion proportion and the target consumed resource are returned to the resource management client. It will be appreciated that for ease of description, the direct conversion path, the corresponding resource conversion ratio, and the target consumed resource may be referred to as a resource conversion strategy. The resource conversion device may return the resource conversion policy corresponding to the direct conversion path and the resource conversion policy corresponding to the service conversion path to the resource management client, and the service object may select a resource conversion policy meeting the requirement from the plurality of resource conversion policies through the resource management client. Further, when the service object selects the resource conversion policy, the resource management client may construct a service conversion transaction based on the resource conversion policy selected by the service object, that is, may determine the service conversion transaction based on the conversion path (such as the service conversion path or the direct conversion path) selected by the service object, the corresponding resource conversion proportion and the target consumption resource, and further, the resource management client may send the service conversion transaction to the block link point device, so that the block link point device may convert the source service resource into the target service resource based on the service conversion transaction, and in particular, may convert the source service resource into the target service resource based on the service conversion path and the resource conversion proportion in the service conversion transaction.
Further, referring to fig. 7, fig. 7 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. The method is performed by a resource conversion device. The method may include at least the following step S201 to step S207.
S201, receiving a resource conversion request sent by a resource management client; the resource conversion request is used to determine a traffic conversion path when converting the source traffic resource to the target traffic resource.
S202, determining the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request.
S203, acquiring a service resource directed graph associated with a request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to convert the transaction resource pair at the time of the request timestamp.
The processing in steps S201 to S203 may refer to the descriptions related to steps S101 to S103, and will not be described herein.
And S204, when the values of M and N are 1, in the service resource directed graph, taking 1 resource node matched with the source service resource as a path index starting point and taking 1 resource node matched with the target service resource as a path index ending point.
For example, if the source service resource is a resource a and the target service resource is a resource B, the resource node corresponding to the resource a may be used as a path index start point and the resource node corresponding to the resource B may be used as a path index end point.
S205, when it is determined that at least one resource node is included in the node index path from the path index starting point corresponding to the source service resource to the path index ending point corresponding to the target service resource, the resource conversion path determined by the path index starting point, at least one resource node in the node index path and the path index starting point is used as the service conversion path.
It is understood that the node index path refers to a path formed by the resource nodes determined in the process of indexing from the path index start point to the path index end point, and the node index path does not include the path index start point and the path index end point. It will be appreciated that the index herein is meant to refer to a path that looks up one node to another. For example, the path index starting point is node a, the path index end point is node b, when the path index is from node a to node b, the path index path from the path index starting point corresponding to the source service resource (i.e. node a) to the path index end point corresponding to the target service resource (i.e. node b) includes node c, i.e. the node index path includes at least one resource node. It is understood that the node index path from the path index start point to the path index end point includes at least one resource node, and the number of node connection edges on the index path (i.e. the path formed by the path index start point, the resource node on the node index path, and the path index end point) from the path index start point to the path index end point is a positive integer greater than 2.
It is understood that an indexed path may be formed by a path index starting point, at least one resource node in a node indexed path, and a path index starting point. The resource conversion path determined by the path index starting point, at least one resource node in the node index path and the path index starting point is used as a service conversion path, namely, the resource conversion path is determined based on the index path comprising at least one resource node in the node index path, and the determined resource conversion path is used as the service conversion path. It is appreciated that in some scenarios, the number of index paths including at least one resource node in the node index paths may be one or more, and then determining the resource conversion path based on the index paths including at least one resource node in the node index paths may include: among index paths including at least one resource node among the node index paths, an index path having the smallest associated path index value is determined as a resource conversion path.
It can be understood that if there is an index path that does not include a resource node in the node index path from the path index start point corresponding to the source service resource to the path index end point corresponding to the target service resource, the index path may be determined to be a direct conversion path, so as to determine the resource conversion ratio and the target consumption resource of the direct conversion path.
S206, determining the resource conversion proportion and the target consumption resource associated with the business conversion path based on the business conversion path, the resource expenditure quantity and the resource conversion quantity.
When M and N are both 1, the resource conversion ratio may be a ratio of the number of target service resources corresponding to 1 resource type obtained by the expected conversion determined based on the service conversion path to the number of resource expenditures of the source service resources of 1 resource type. The target consumed resource may be a resource required to be consumed for converting the service resource corresponding to the resource payout amount into the target service resource, which is determined based on the service conversion path.
Specifically, determining the resource conversion ratio and the target consumption resource associated with the traffic conversion path based on the traffic conversion path, the resource expense amount, and the resource conversion amount may include the steps of: acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from a resource conversion platform; determining a first target resource conversion number of target service resources converted from the source service resources based on a reference conversion exchange rate of the transaction resource pairs corresponding to the resource nodes on the service conversion path and the resource expenditure number; when the first target resource conversion number is greater than or equal to the resource conversion number, determining a resource conversion ratio associated with the service conversion path based on a ratio of the first target resource conversion number to the resource expenditure number; and determining the target consumption resource based on the edge connection influence value on the service conversion path and the resource expenditure quantity.
The reference conversion rate may be a conversion rate of a transaction resource pair obtained from the resource conversion platform when the timestamp is requested. One transaction resource pair corresponds to one reference conversion rate. It will be appreciated that the conversion rate (e.g., reference conversion rate) may be a ratio of conversion of two resources in a trading resource pair, and in particular may be a price of a destination resource/a price of a reference resource in the trading resource pair. The target resource refers to a business resource which is required to be converted when the resources in the transaction resource pair are converted, and the reference resource refers to a business resource which is required to be paid when the resources in the transaction resource pair are converted. For example, when a transaction resource pair is converted into a resource B, the resource a is a reference resource, the resource B is a destination resource, and the reference conversion exchange rate of the transaction resource pair is the price of the resource B divided by the resource a, for example, when 1 resource a can be converted into 2 resources B at the time of requesting the timestamp, the reference conversion exchange rate of the transaction resource pair, which is converted into the resource B, is 2/1=2.
It may be understood that the transaction resource pair corresponding to the resource node on the service conversion path may refer to the above description, that is, the service resources corresponding to the two resource nodes connected by each node connection edge on the service conversion path form a transaction resource pair.
It is understood that the first target resource conversion number refers to the number of target service resources into which the source service resource is converted based on the service conversion path when M and N are both 1.
It can be understood that, taking the service conversion path as the resource a→the resource b→the resource C, the process of determining the first target resource conversion number of the target service resource converted by the source service resource based on the reference conversion exchange rate and the resource expenditure number of the transaction resource pair corresponding to the resource node on the service conversion is described. In this case, the transaction conversion path includes a transaction resource pair T1 and a transaction resource pair T2, where the transaction resource pair T1 is a resource a→a resource B, and the transaction resource pair T2 is a resource b→a resource C, and the amount of the resource B converted from the resource expenditure amount may be determined based on the resource expenditure amount and the reference conversion exchange rate of the transaction resource pair T1 (for example, the resource expenditure amount is multiplied by the reference conversion exchange rate of the transaction resource pair T1), and then the amount of the resource B converted from the resource expenditure amount is determined based on the amount of the resource B converted and the reference conversion exchange rate of the transaction resource T2 (for example, the amount of the resource B converted from the transaction resource pair T2 is multiplied by the reference conversion exchange rate of the transaction resource pair T2), and then the amount of the resource C converted from the resource a (i.e. the source service resource) is the first target resource conversion amount of the resource C converted from the resource a (i.e. the target service resource).
It can be appreciated that if the first target resource conversion number is greater than or equal to the resource conversion number, it indicates that the number of target service resources obtained by the expected conversion determined by the service conversion path can meet the expectation of the service object, and then the service conversion path can be sent to the resource management client.
It will be appreciated that determining the target consumption resource based on the edge connection impact value on the traffic conversion path, and the number of resource expenditures, may include: and determining the sum of the edge connection influence values on the service conversion path, and multiplying the sum of the edge connection influence values on the service conversion path by the resource expenditure quantity to obtain the target consumption resource. For example, if the traffic conversion path is resource a→resource b→resource C, the edge connection influence value between resource a→resource B is 0.6%, the edge connection influence value between resource b→resource C is 0.2%, and the resource expenditure number is 100, the target consumed resources may be 100× (0.6% +0.2%) resources a.
It can be appreciated that if the first target resource conversion number is smaller than the resource conversion number, a prompt message may be returned to the resource management node to prompt that the service object does not find a service conversion path that meets the requirement. Optionally, if the number of the first target resources converted is smaller than the number of the resources converted, the resource conversion ratio and the target consumption resources of the service conversion path may still be calculated, and when the service conversion path, the resource conversion ratio and the target consumption resources are returned to the resource management client, a prompt message is output to prompt that the number of the target service resources converted by the service conversion path does not meet the requirement, so that whether the service object selects to initiate the service conversion transaction based on the service conversion path or not is convenient.
S207, returning the resource conversion proportion, the service conversion path and the target consumed resources to the resource management client so that the resource management client constructs and obtains service conversion transaction for being sent to the block chain node equipment associated with the block chain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to input a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the resource conversion contract is used for carrying out resource conversion on the source business resource corresponding to the resource expenditure quantity.
It is to be understood that the step S207 may refer to the related description of the step S105, which is not described herein.
Further, referring to fig. 8, fig. 8 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. The method is performed by a resource conversion device. The method may comprise at least the following step S301-step S309.
S301, receiving a resource conversion request sent by a resource management client; the resource conversion request is used to determine a traffic conversion path when converting the source traffic resource to the target traffic resource.
S302, determining the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request.
S303, acquiring a service resource directed graph associated with a request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to convert the transaction resource pair at the time of the request timestamp.
The processing in steps S301 to S303 may refer to the descriptions related to steps S101 to S103, and will not be described herein.
And S304, when the values of M and N are different and are 1, in the service resource directed graph, taking M resource nodes matched with the source service resource as a path index starting point and N resource nodes matched with the target service resource as a path index ending point.
It is understood that the values of M and N are not 1 at the same time, and may include: m is 1 and N is greater than 1, alternatively, M is greater than 1 and N is 1, or both M and N are greater than 1.
For example, when M is 1 and N is greater than 1, if the source service resource is resource a and the target service resource includes resource B and resource C, the resource node corresponding to resource a may be used as a path index start point, and the resource node corresponding to resource B and the resource node corresponding to resource C may be used as path index end points.
For another example, when M is greater than 1 and N is 1, if the source service resource is a resource a and a resource B, and the target service resource is a resource C, both the resource node corresponding to the resource a and the resource node corresponding to the resource B may be used as the path index start point, and both the resource node corresponding to the resource C may be used as the path index end point.
For another example, when M and N are both greater than 1, if the source service resource is a resource a and a resource B, and the target service resource is a resource C and a resource D, then both the resource node corresponding to the resource a and the resource node corresponding to the resource B may be used as the path index start point, and both the resource node corresponding to the resource C and the resource node corresponding to the resource D may be used as the path index end point.
S305, selecting a resource node i from M resource nodes included in the path index starting point as a target index starting point, and selecting a resource node j from N resource nodes included in the path index ending point as a target index ending point; i is a positive integer less than or equal to M, and j is a positive integer less than or equal to N.
The resource node i may be any one of M resource nodes. It can be understood that if M is 1, the resource node i is the resource node corresponding to the source service resource of the 1 transaction type, and if M is greater than 1, the resource node i is the resource node corresponding to any service resource of the service resources of the M transaction types. Similarly, the resource node j may be any one of the N resource nodes. It can be understood that if N is 1, the resource node j is a resource node corresponding to the target service resource of the 1 transaction type, and if N is greater than 1, the resource node j is a resource node corresponding to any service resource of the service resources of the M transaction types.
It will be understood that the target index start point is the resource node i, in other words, the target index start point refers to any one of M resource nodes included in the path index start point. The target index destination is the resource node j, in other words, the target index destination is any one of the N resource nodes included in the path index destination.
S306, determining a resource conversion path from the target index starting point to the target index end point in the service resource directed graph.
It will be understood that, as described above, a resource conversion path refers to an index path from a path index start point to a path index end point for determining a traffic conversion path. The resource conversion path of the resource conversion path from the target index start point to the target index end point refers to an index path from the target index start point to the target index end point for determining the service conversion path.
The determining a resource conversion path from the target index start point to the target index end point in the traffic resource directed graph may be determining an index path with the smallest sum of edge connection influence values as the resource conversion path from at least one index path from the target index start point to the target index end point. Alternatively, the index path having the smallest number of node connection edges among at least one index path from the target index start point to the target index end point may be determined as the resource conversion path. It will be appreciated that if the resource conversion path selects the index path with the smallest sum of edge connection influence values, the target consumption of resources is less when the finally determined service conversion path is used for resource conversion, which is helpful for reducing the transaction cost of resource conversion. It can be appreciated that if the resource conversion path selects the index path with the minimum number of node connection edges, the number of conversions of the transaction resource pairs required when the finally determined service conversion path is used for resource conversion is reduced, which is helpful for reducing the complexity of resource conversion.
Optionally, determining a resource conversion path from the target index start point to the target index end point in the traffic resource digraph may include the following steps: determining at least one index path from a target index start point to a target index end point in the traffic resource directed graph; determining an index path having the smallest path influence value among the at least one index path as a resource conversion path; the path impact value refers to the sum of edge connection impact values on the index path.
It may be appreciated that, in the traffic resource directed graph, the determining at least one index path from the target index start point to the target index end point may be based on a breadth-first search method or a depth-first search method, or the like, to determine at least one index path from the target index start point to the target index end point.
It will be appreciated that if the resource conversion path is an index path having a minimum path impact value from the target index start point to the target index end point, the determination of the resource conversion path may be performed based on some shortest path algorithm, for example, dijkstra (a shortest path algorithm), floyd (a shortest path algorithm), bellman-Ford (a shortest path algorithm), and the like, which are not limited herein. Taking Dijkstra (a shortest path algorithm) as an example, a method of converting a resource into an index path having a minimum path influence value between a target index start point and a target index end point will be described. Specifically, when determining an index path with a minimum path impact value between a target index start point and a target index end point based on Dijkstra (a shortest path algorithm), a shortest path from the target index start point to other resource nodes in the service resource directed graph (the shortest path herein refers to the index path with the minimum path impact value) may be determined, so as to determine a shortest path from the target index start point to the target index end point. Specifically, when determining the shortest path between the path index starting point D and other resource nodes in the traffic resource directed graph G, two arrays S and U are introduced. The function of S is to record the resource node that has found the shortest path and the corresponding shortest path length (i.e., the sum of the edge connection impact values on the shortest path), while U is to record the resource node that has not found the shortest path and the distance of that resource node from the path index starting point D (i.e., the sum of the edge connection impact values). (1) Initially, only the path index starting point D is in the array S; the array U is a resource node except the path index starting point D, and the distance from each resource node to the path index starting point D is recorded in the array U. If the resource node is not adjacent to the path index starting point D, the distance is infinity. (2) Further, the resource node K with the shortest path (i.e., the sum of the edge connection influence values is the smallest) is found out from the array U and added to the array S, and at the same time, the resource node K is removed from the array U, and the distance from each resource node in the array U to the path index start point D is updated. And (2) repeating the operation in the step (2) until all the resource nodes are traversed, wherein the shortest path length from the path index starting point D to each resource node in the service resource directed graph is recorded in the array S at the moment, and the shortest path from the path index starting point D to the path index ending point (namely, the index path with the minimum path influence value) can be determined from the S.
It can be understood that the resource node corresponding to each service resource in the service resources corresponding to the M resource types can be determined as a target index starting point, the resource node corresponding to each service resource in the service resources corresponding to the N resource types is determined as a target index end point, and a plurality of resource conversion paths corresponding to the process of converting the service resources of the M resource types into the service resources of the N resource types are determined through permutation and combination, where the number of the resource conversion paths is greater than or equal to 2.
S307, a service conversion path is determined based on the determined resource conversion path.
It can be understood that when M is greater than 1 and N is 1, or M is 1 and N is greater than 1, the combination processing may be performed on the resource nodes and the node connection edges on the determined multiple resource conversion paths, so as to obtain the service conversion path. For example, the resource conversion paths from the path index starting point a to the path index ending point b are node a→node d→node b, and the resource conversion paths from the path index starting point a to the path index ending point c are node a→node d→node c, and then the traffic conversion paths may be node a→node d→node b and node c.
When both M and N are greater than 1, a resource conversion path set may be determined based on the determined resource conversion path, and further a traffic conversion path may be determined based on the resource conversion path set.
S308, determining a resource conversion ratio and a target consumption resource associated with the traffic conversion path based on the traffic conversion path, the resource payout amount, and the resource conversion amount.
Wherein, it can be understood that the values of M and N are not 1 at the same time, and the method can comprise the following steps: m is 1 and N is greater than 1, alternatively, M is greater than 1 and N is 1, or both M and N are greater than 1. The manner in which the resource conversion ratio and the target consumed resources are determined may be different for different situations. When M is 1 and N is greater than 1, the target estimated resource conversion number corresponding to each of the N resource types of service resources included in the target service resource may be determined based on the resource expense number and the service conversion path of the source service resource, and the resource conversion ratio associated with the service conversion path may be determined based on the target estimated resource conversion number and the resource expense number corresponding to each of the service resources (may also be referred to as each of the target service resources) in the target service resource. When M is greater than 1 and N is 1, the target estimated resource conversion number corresponding to the target service resource may be determined based on the resource expenditure number of the service resources of the M resource types included in the source service resource and the service conversion path, and the resource conversion ratio associated with the service conversion path may be determined based on the target estimated resource conversion number corresponding to the target service resource and the resource expenditure number of the service resources of the M resource types included in the source service resource. When M and N are both greater than 1, the target estimated resource conversion number corresponding to each of the N resource types of service resources included in the target service resource may be determined based on the resource payout number of the M resource types of service resources included in the source service resource and the service conversion path, and the resource conversion ratio associated with the service conversion path may be determined based on the target estimated resource conversion number corresponding to the target service resource and the resource payout number of the M resource types of service resources included in the source service resource.
Specifically, the fact that the values of M and N are different and are 1 includes: m has a value of 1, and N has a value of more than 1; the service resources of the N resource types included in the target service resource comprise first type resources and second type resources; the path index starting point is 1 resource node matched with the source service resource; the path index endpoint comprises a first resource node matched with the first type resource and a second resource node matched with the second type resource; the traffic conversion path is determined based on the first resource conversion path and the second resource conversion path; the first resource conversion path is a resource conversion path from a path index starting point to a first resource node; the second resource conversion path is a resource conversion path from the path index starting point to the second resource node; the resource conversion number comprises a first resource conversion number corresponding to the first type of resources and a second resource conversion number corresponding to the second type of resources; then, determining the resource conversion ratio and the target consumption resource associated with the traffic conversion path based on the traffic conversion path, the resource expense amount, and the resource conversion amount may include the steps of: acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from a resource conversion platform; determining a transaction resource pair corresponding to a resource node on a first resource conversion path as a first path transaction resource pair, and determining a first expected resource expenditure quantity required for converting to obtain a first type of resource corresponding to the first resource conversion quantity based on a reference conversion exchange rate and the first resource conversion quantity of the first path transaction resource pair; determining a transaction resource pair corresponding to the resource node on the first resource conversion path as a second path transaction resource pair, and determining a second estimated resource expenditure quantity required for converting to obtain a second type resource corresponding to the second resource conversion quantity based on a reference conversion exchange rate and the second resource conversion quantity of the second path transaction resource pair; a resource conversion ratio and a target consumed resource associated with the traffic conversion path are determined based on the first projected amount of resource expenditure, the second projected amount of resource expenditure, and the amount of resource expenditure.
The first resource type may be a service resource included in the target service resource, and the second resource type may be a service resource included in the target service resource and different from the first resource type. The first type of resource is different from the second type of resource, e.g., the first type of resource is a first type of resource and the second type of resource is a second type of resource that is different from the first type of resource. It should be appreciated that the resource types of the first type of resource and the second type of resource are each different from the resource types of the source traffic resources.
It is understood that the first resource node is a resource node in the traffic resource directed graph that matches a first type of resource, and the second resource node is a resource node in the traffic resource directed graph that matches a second type of resource. The first resource conversion path refers to a resource conversion path from the path index starting point to the first resource node, and the second resource conversion path refers to a resource conversion path from the path index starting point to the first resource node. The process of determining the first resource conversion path and the second resource conversion path may refer to the above related description, and will not be described herein.
The first resource conversion number refers to the resource conversion number corresponding to the first type of resources, and the second resource conversion number refers to the resource conversion number corresponding to the second type of resources. For example, the resource conversion request is used to indicate that 100 resources a are converted into 10 resources B and 20 resources C, and if the first type of resources are resources B, the first number of resource conversions is 10, and if the second type of resources are resources C, the second number of resource conversions is 20.
It should be understood that the description of the conversion exchange rate may refer to the description of step S206, which is not described herein.
It may be understood that the first path transaction resource pair refers to a transaction resource pair corresponding to a resource node on the first resource conversion path. That is, the first path transaction resource pair refers to a transaction resource pair formed by service resources corresponding to resource nodes connected by node connection edges on the first resource conversion path. The second path transaction resource pair refers to a transaction resource pair corresponding to a resource node on the second resource conversion path. That is, the second path transaction resource pair refers to a transaction resource pair formed by service resources corresponding to resource nodes connected by node connection edges on the second resource conversion path.
It is understood that the first estimated resource payout amount refers to the amount of source service resources estimated to be paid out when the first type of resources converted to the first resource conversion amount are determined based on the first resource conversion path. The second estimated resource payout amount refers to the amount of the source service resource estimated to be paid out when the second type resource converted to the second resource conversion amount is determined based on the second resource conversion path. For example, for any resource conversion path, if one resource conversion path is resource a→resource b→resource C, the reference conversion exchange rate of the resource transaction pair formed by resource a→resource B is P1, the reference conversion exchange rate of the resource transaction pair formed by resource a→resource B is P2, and the resource conversion number of resource C is E1, the number E2 of the resource B expected to be paid out can be obtained based on E1/P2, and the number of the resource a expected to be paid out can be obtained based on E2/P1, that is, the expected resource payout number corresponding to resource a can be obtained.
It may be understood that the first type of resource and the second type of resource included in the target service resource are only an example, the target service resource may include more types of service resources, and a specific processing procedure may refer to a description related to when the target service resource includes the first type of resource and the second type of resource, so that a corresponding estimated resource expense amount may be determined based on a resource conversion path from a path index start point to each path index end point, so that a resource conversion proportion and a target consumption resource are determined based on an estimated resource expense amount corresponding to a resource conversion path from the path index start point to each path index end point, which are not described herein.
Specifically, the first type of resource and the second type of resource are both associated with a resource conversion priority; then, determining the resource conversion ratio and the target consumed resource associated with the traffic conversion path based on the first estimated resource expense amount, the second estimated resource expense amount, and the resource expense amount may include the steps of: determining a sum of the first estimated resource payout amount and the second estimated resource payout amount as an estimated payout amount sum, and determining a resource conversion remaining amount based on a difference between the estimated payout amount and the estimated payout amount sum when the estimated payout amount sum is less than or equal to the resource payout amount; determining a first allowance conversion path from the first resource conversion path and the second resource conversion path based on the resource conversion priority of the first type resource and the resource conversion priority of the second type resource, and determining a first allowance resource conversion quantity obtained by converting the source service resource corresponding to the resource conversion residual quantity based on the resource conversion residual quantity and the first allowance conversion path; determining a resource conversion ratio associated with the traffic conversion path based on the first balance resource conversion number, the first resource conversion number, the second resource conversion number, and the resource payout number; the target consumption resource is determined based on the edge connection impact value on the first resource conversion path, the edge connection impact value on the second resource conversion path, the first projected resource payout amount, the resource conversion remaining amount, and the second projected resource payout amount.
It is understood that the resource conversion priority refers to the priority of the target service resource for conversion when the conversion obtains enough target service resources (i.e. the target predicted resource conversion number reaches the resource conversion number) and the remaining source service resources remain. It will be appreciated that the remaining source traffic resources may be prioritized to target traffic resources with higher resource transformation priorities.
It is understood that the sum of the estimated resource expense amounts may refer to the sum of the first estimated resource expense amount and the second estimated resource expense amount. If the target service resource may include service resources of more resource types, the sum of the estimated expense amounts may be a sum of the estimated resource expense amounts corresponding to the resource conversion paths from the path index start point to each path index end point.
It can be appreciated that if the sum of the estimated cost amounts is less than or equal to the resource cost amount, it indicates that the source service resource corresponding to the resource cost amount can be converted into a sufficient target service resource. Otherwise, if the sum of the estimated expenditure amounts is greater than the resource expenditure amount, it indicates that the source service resource corresponding to the resource expenditure amount cannot be converted into enough target service resource.
It is understood that the remaining number of resource conversions refers to the number of source traffic resources that remain when a sufficient target traffic resource is obtained (i.e., the target predicted number of resource conversions reaches the number of resource conversions). The resource conversion remaining amount may be a difference between the resource payout amount and the sum of the estimated payout amounts.
It can be understood that the first margin conversion path may refer to a resource conversion path for performing resource conversion on the source service resources corresponding to the residual number of resource conversion when M is 1 and N is greater than 1. It may be appreciated that the first margin transition path may be a resource transition path with a highest resource transition priority among a plurality of resource transition paths associated with the traffic transition path. For example, when the resource conversion priority of the first type resource is higher than the resource conversion priority of the second type resource, the first resource conversion path is determined as a first margin conversion path. And determining the second resource conversion path as a first allowance conversion path when the resource conversion priority of the second type resource is higher than that of the first type resource.
It can be understood that the first surplus resource conversion number is the number of service resources corresponding to the path index end point of the first surplus conversion path into which the source service resources corresponding to the residual resource conversion number are converted. The process of determining the first surplus resource conversion number obtained by converting the source service resource corresponding to the resource conversion surplus number may refer to the above, and the description related to the first target resource conversion number is determined based on the service conversion path and the resource expenditure number when M and N are both 1, which is not described herein. It can be understood that, if the first surplus resource conversion path is the first resource conversion path, the determined first surplus resource conversion number is the number of the first type of resources converted from the source service resources corresponding to the residual resource conversion number; and if the first allowance conversion path is the second resource conversion path, the first allowance resource conversion quantity is the quantity of the second type resource converted from the source service resource corresponding to the resource conversion surplus quantity.
It may be appreciated that determining the resource conversion ratio associated with the traffic conversion path based on the first balance resource conversion number, the first resource conversion number, the second resource conversion number, and the resource payout number may include: if the first surplus resource conversion number is the number of the first type of resources, determining a resource conversion ratio corresponding to the first type of resources based on a ratio of a sum of the first surplus resource conversion number and the first resource conversion number to the resource expenditure number, determining a resource conversion ratio corresponding to the second type of resources based on a ratio of the second resource conversion number to the resource expenditure number, and determining a resource conversion ratio associated with the service conversion path based on the resource conversion ratio corresponding to the first type of resources and the resource conversion ratio corresponding to the second type of resources. If the first surplus resource conversion number is the number of the second type of resources, determining a resource conversion ratio corresponding to the first type of resources based on a ratio of the first surplus resource conversion number to the resource expenditure number, determining a resource conversion ratio corresponding to the second type of resources based on a ratio of a sum of the first surplus resource conversion number and the second resource conversion number to the resource expenditure number, and determining a resource conversion ratio associated with the service conversion path based on the resource conversion ratio corresponding to the first type of resources and the resource conversion ratio corresponding to the second type of resources.
It is understood that determining the target consumption resource based on the edge connection impact value on the first resource conversion path, the edge connection impact value on the second resource conversion path, the first projected resource payout amount, the resource conversion remaining amount, and the second projected resource payout amount may include: if the first allowance conversion path is a first resource conversion path, determining a consumption resource corresponding to the first type resource based on the edge connection influence value, the first expected resource expenditure quantity and the resource conversion surplus quantity on the first resource conversion path, determining a consumption resource corresponding to the second type resource based on the edge connection influence value and the second expected resource expenditure quantity on the second resource conversion path, and determining a target consumption resource based on the consumption resource corresponding to the first type resource and the consumption resource corresponding to the second type resource. The consumed resources corresponding to the first type of resources refer to consumed resources required by converting the source business resources into the first type of resources through a first resource conversion path. The consumed resources corresponding to the second type of resources refer to consumed resources required by converting the source service resources to obtain the second type of resources through a second resource conversion path.
Similarly, if the first allowance conversion path is the second resource conversion path, determining a consumption resource corresponding to the second type resource based on the edge connection influence value, the second predicted resource expenditure quantity and the resource conversion surplus quantity on the second resource conversion path, determining a consumption resource corresponding to the first type resource based on the edge connection influence value and the first predicted resource expenditure quantity on the first resource conversion path, and determining a target consumption resource based on the consumption resource corresponding to the first type resource and the consumption resource corresponding to the second type resource.
It can be appreciated that the target service resource may not be associated with a resource conversion priority, and thus the remaining number of source service resources for resource conversion may not be converted. Then, determining the resource conversion ratio and the target consumed resource associated with the traffic conversion path based on the first estimated resource expense amount, the second estimated resource expense amount, and the resource expense amount may include the steps of: and determining a sum of the first estimated resource expense amount and the second estimated resource expense amount as an estimated expense amount sum, and determining a resource conversion ratio associated with the service conversion path based on the first resource conversion amount, the second resource conversion amount and the resource expense amount when the estimated expense amount sum is less than or equal to the resource expense amount. The method specifically may determine a resource conversion ratio corresponding to the first type of resource based on a ratio of the first resource conversion number to the sum of the estimated payout amounts, determine a resource conversion ratio corresponding to the second type of resource based on a ratio of the second resource conversion number to the sum of the estimated payout amounts, and determine a resource conversion ratio associated with the traffic conversion path based on the resource conversion ratio corresponding to the first type of resource and the resource conversion ratio corresponding to the second type of resource. Further, the determining the target consumption resource based on the edge connection impact value on the first resource conversion path, the edge connection impact value on the second resource conversion path, the first predicted resource payout amount, and the second predicted resource payout amount may specifically include: and determining the consumed resources corresponding to the first type of resources based on the edge connection influence value and the first expected resource expenditure quantity on the first resource conversion path, determining the consumed resources corresponding to the second type of resources based on the edge connection influence value and the second expected resource expenditure quantity on the second resource conversion path, and determining the target consumed resources based on the consumed resources corresponding to the first type of resources and the consumed resources corresponding to the second type of resources. It may be appreciated that, when the service conversion path is returned to the resource management client, the expected total sum of the costs may be returned, so that the service object carries the expected total sum of the costs in the service conversion transaction constructed based on the service conversion path when performing the confirmation operation for the service conversion path, so that the blockchain node may convert the source service resource of the expected total sum of the costs into the target service resource, so that the resource conversion device calculates the resource under the chain to convert into sufficient target service resource by paying out fewer source service resources.
Specifically, the fact that the values of M and N are different and are 1 includes: m is more than 1, and N has a value of 1; the M resource types of service resources included in the source service resources comprise third type resources and fourth type resources; the path index end point is 1 resource node matched with the target service resource; the path index starting point comprises a third resource node matched with the third type resource and a fourth resource node matched with the fourth type resource; the traffic conversion path is determined based on the third resource conversion path and the fourth resource conversion path; the third resource conversion path is a resource conversion path from the third resource node to the path index end point; the fourth resource conversion path is a resource conversion path from the fourth resource node to the path index end point; the resource expenditure quantity comprises a first resource expenditure quantity corresponding to the third type of resource and a second resource expenditure quantity corresponding to the fourth type of resource; then, determining the resource conversion ratio and the target consumption resource associated with the traffic conversion path based on the traffic conversion path, the resource expense amount, and the resource conversion amount may include the steps of: acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from a resource conversion platform; determining a transaction resource pair corresponding to a resource node on a third resource conversion path as a third path transaction resource pair, and determining a first predicted resource conversion number corresponding to a target service resource for converting a third type resource corresponding to the first resource expense number based on a reference conversion exchange rate and the first resource expense number of the third path transaction resource pair; determining a transaction resource pair corresponding to a resource node on a fourth resource conversion path as a fourth path transaction resource pair, and determining a second predicted resource conversion number corresponding to a target service resource for converting a fourth type resource corresponding to a second resource expense number based on a reference conversion exchange rate and the second resource expense number of the fourth path transaction resource pair; a resource conversion ratio and a target consumed resource associated with the traffic conversion path are determined based on the first projected resource conversion number, the second projected resource conversion number, the first resource payout number, and the second resource payout number.
The third resource type may be a service resource included in the source service resource, and the fourth resource type may be a service resource included in the source service resource and different from the third resource type. The third type of resource is different from the fourth type of resource, e.g., the third type of resource is a third type of resource and the fourth type of resource is a fourth type of resource that is different from the third type of resource. It should be appreciated that the resource types of the third type of resource and the fourth type of resource are each different from the resource types of the target traffic resource.
It can be understood that the third resource node is a resource node in the service resource directed graph that matches a third type of resource, and the fourth resource node is a resource node in the service resource directed graph that matches a fourth type of resource. The third resource conversion path refers to a resource conversion path from the third resource node to the path index end point, and the fourth resource conversion path refers to a resource conversion path from the third resource node to the path index end point. The process of determining the third resource conversion path and the fourth resource conversion path may refer to the above related description, and will not be described herein.
The first resource expense amount refers to the resource expense amount corresponding to the third type of resource, and the second resource expense amount refers to the resource expense amount corresponding to the fourth type of resource. For example, the resource conversion request is used to instruct to convert 10 resources a and 20 resources B into 50 resources C, where the first resource payout amount is 10 if the third type of resources is the resource a, and the second resource payout amount is 20 if the fourth type of resources is the resource B.
It should be understood that the description of the conversion exchange rate may refer to the description of step S206, which is not described herein.
It may be understood that the third path transaction resource pair refers to a transaction resource pair corresponding to a resource node on the third resource conversion path. That is, the third path transaction resource pair refers to a transaction resource pair formed by service resources corresponding to resource nodes connected by node connection edges on the third resource conversion path. The fourth path transaction resource pair refers to a transaction resource pair corresponding to a resource node on the fourth resource conversion path. That is, the fourth path transaction resource pair refers to a transaction resource pair formed by service resources corresponding to resource nodes connected by node connection edges on the fourth resource conversion path.
It may be understood that the first expected conversion number refers to a number of target service resources obtained by converting a third type of resource corresponding to the first resource payout amount based on the third resource conversion path. The second estimated conversion number refers to the number of target service resources obtained by converting the fourth type of resources corresponding to the second resource expenditure number based on the fourth resource conversion path. For example, for any resource conversion path, if the resource conversion path is a resource a→a resource b→a resource C, the reference conversion exchange rate of the resource transaction pair formed by the resource a→the resource B is P1, the reference conversion exchange rate of the resource transaction pair formed by the resource a→the resource B is P2, and the resource expenditure amount of the resource a is F1, the number F2 of the resource B expected to be converted can be obtained based on F1×p1, and the number of the resource C expected to be converted can be obtained based on F2×p2, that is, the expected conversion number corresponding to the resource C can be obtained.
It may be understood that the third type of resource and the fourth type of resource included in the source service resource are only an example, the source service resource may include more types of service resources, and a specific processing procedure may refer to a description related to the case where the source service resource includes the third type of resource and the fourth type of resource, and then a corresponding estimated resource conversion number may be determined based on a resource conversion path from a start point of each path index to an end point of the path index, so that a resource conversion ratio and a target consumption resource are determined based on a corresponding estimated resource conversion number of a resource conversion path from the start point of each path index to the end point of the path index.
Specifically, determining the resource conversion ratio and the target consumption resource associated with the traffic conversion path based on the first predicted resource conversion number, the second predicted resource conversion number, the first resource payout number, and the second resource payout number may include the steps of: determining a sum of the first predicted resource conversion number and the second predicted resource conversion number as a predicted conversion number sum; when the sum of the estimated conversion numbers is greater than or equal to the resource conversion number, determining a resource conversion ratio associated with the service conversion path based on the sum of the estimated conversion numbers, the first resource expenditure number and the second resource expenditure number; and determining the target consumed resource based on the edge connection impact value, the first resource expenditure amount and the second resource expenditure amount on the third resource conversion path.
Wherein the sum of the number of predicted conversions may refer to the sum of the first number of predicted resource conversions and the second number of predicted resource conversions. If the source traffic resource may include traffic resources of more resource types, the sum of the estimated conversion numbers may be a sum of estimated resource conversion numbers corresponding to the resource conversion paths from the start point of each path index to the end point of the path index.
It can be understood that if the sum of the expected conversion numbers is greater than or equal to the resource conversion number, it indicates that the source service resource corresponding to the resource expenditure number can be converted into a sufficient target service resource. Otherwise, if the sum of the expected conversion numbers is smaller than the resource conversion number, the source service resources corresponding to the resource expenditure number cannot be converted to obtain enough target service resources.
It is to be appreciated that determining the resource conversion ratio associated with the traffic conversion path based on the sum of the projected conversion number, the first resource payout amount, and the second resource payout amount may include: a resource conversion ratio associated with the traffic conversion path is determined based on a ratio of the sum of the projected conversion amounts to the sum of the first and second resource payout amounts.
It is understood that determining the target consumption resource based on the edge connection impact value, the first resource payout amount, and the second resource payout amount on the third resource conversion path may include: determining a consumption resource required for converting the third type of resource into the target service resource based on the edge connection influence value and the first resource expense amount on the third resource conversion path, determining a consumption resource required for converting the fourth type of resource into the target service resource based on the edge connection influence value and the second resource expense amount on the fourth resource conversion path, and determining a target consumption resource based on the consumption resource required for converting the third type of resource into the target service resource and the consumption resource required for converting the fourth type of resource into the target service resource.
It will be appreciated that where M and N are both greater than 1, the traffic conversion path is determined based on the set of resource conversion paths. The set of resource conversion paths may include resource conversion paths from each of the M path index starts to N path index ends, respectively.
Specifically, determining service resources to be indexed from service resources of M resource types; the path index starting point comprises a resource node to be indexed corresponding to the service resource to be indexed; the path index end point comprises N resource nodes corresponding to the service resources of the N resource types; determining a resource conversion path subset corresponding to the service resources to be indexed based on the resource conversion paths from the resource nodes to be indexed to each of the N resource nodes; when each service resource in the source service resources is used as a service resource to be indexed, determining a resource conversion path subset corresponding to each service resource included in the source service resources; and determining a resource conversion path set associated with the service conversion path based on the resource conversion path subset corresponding to each service resource included in the source service resource.
The service resource to be indexed may be any one of the service resources of the M resource types. The resource node to be indexed can be the resource node corresponding to the service resource to be indexed. It is to be appreciated that each service resource included in the source service resource can be referred to as a source service resource, and each target service resource included in the target service resource can be referred to as a target service resource. The subset of resource conversion paths may include resource conversion paths of traffic resources to be indexed to each target traffic resource. And then each source service resource can be determined as the service resource to be indexed, so as to determine a resource conversion path subset corresponding to each source service resource, and the resource conversion path subset corresponding to each source service resource forms a resource conversion path set.
For example, referring to fig. 9, fig. 9 is a schematic diagram illustrating an effect of a resource conversion path set according to an embodiment of the present application. Here, the description will be given taking, as an example, that the path index starting point includes a node a corresponding to the service resource a and a node B corresponding to the service resource B, and the path index ending point includes a node C corresponding to the service resource C and a node D corresponding to the service resource D. Specifically, the node a may be used as a resource node to be indexed, so as to determine resource conversion paths from the node a to the node c and the node d, and obtain a resource conversion path subset corresponding to the service resource a (e.g. 901a in fig. 9). And taking the node B as a resource node to be indexed, so as to determine resource conversion paths from the node B to the node c and the node d, and obtaining a resource conversion path subset corresponding to the service resource B (as 902a in fig. 9). Further, a resource conversion path set 903a is determined based on the resource conversion path subset indicated by 901a and the resource conversion path subset indicated by 902a, where the resource conversion paths may include a to c and d, and b to c and d.
Wherein, the values of M and N are different and are 1 at the same time comprises: m and N are both greater than 1; the traffic conversion path is determined based on the set of resource conversion paths; the resource conversion path set comprises a plurality of resource conversion paths; then, determining the resource conversion ratio and the target consumption resource associated with the traffic conversion path based on the traffic conversion path, the resource expense amount, and the resource conversion amount may include the steps of: sequencing a plurality of resource conversion paths in a resource conversion path set to obtain a resource conversion path sequence; determining an r-th resource conversion path in the resource conversion path sequence as a to-be-processed resource conversion path, determining a path index starting point in the to-be-processed resource conversion path as a to-be-processed index starting point, and determining a path index end point in the to-be-processed resource conversion path as a to-be-processed index end point; r is a positive integer; determining M resource conversion surplus numbers corresponding to the business resources of M resource types and N resource conversion difference value numbers corresponding to the business resources of N resource types based on the resource expenditure numbers corresponding to the starting points of the to-be-processed path indexes and the resource conversion numbers corresponding to the ending points of the to-be-processed path indexes; one resource conversion residual quantity corresponding to one resource type in the K resource types; business resources of one resource type in the N resource types correspond to the quantity of resource conversion difference values; updating the resource conversion path to be processed based on the (r+1) th resource conversion path in the resource conversion path sequence, and updating the M resource conversion surplus quantity and the N resource conversion difference quantity based on the updated resource conversion path to be processed; the (r+1) th resource conversion path is the next resource conversion path of the (r) th resource conversion path in the resource conversion path sequence; and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the updated M resource conversion residual quantities and the updated N resource conversion difference value quantities.
The resource conversion path sequence may be a sequence obtained by sequencing a plurality of resource conversion paths in the resource conversion path set. The resource conversion path sequence may be a sequence obtained by sorting the resource conversion paths in order from smaller to larger based on the sum of edge connection influence values on the resource conversion paths.
It is understood that the resource conversion path to be processed may be the r-th resource conversion path in the sequence of resource conversion paths. r is a positive integer, and the value of r should be smaller than or equal to the number of resource conversion paths in the resource conversion path set. It is understood that the index start point to be processed refers to a path index start point in the resource conversion path to be processed. The index endpoint to be processed refers to a path index endpoint in the conversion path of the resource to be processed. For convenience of description, the service resource corresponding to the start point of the index to be processed may be referred to as a source service resource to be processed, the service resource corresponding to the end point of the index to be processed may be referred to as a target service resource to be processed,
specifically, when determining the M resource conversion residual numbers corresponding to the service resources of the M resource types and the N resource conversion difference numbers corresponding to the service resources of the N resource types, the resource conversion residual numbers of the service resources of the source to be processed and the resource conversion difference numbers of the service resources of the target to be processed may be determined based on the resource conversion paths to be processed. Specifically, the initial resource conversion residual quantity of the source service resources of the M resource types and the initial resource conversion difference quantity of the target service resources of the N resource types are obtained. Wherein the initial resource conversion remaining number and the initial resource conversion difference number are determined based on the resource payout number and the resource conversion number.
Determining the quantity of the to-be-processed target service resources (recorded as the to-be-processed estimated conversion quantity) converted from the residual quantity of the initial resource conversion based on the to-be-processed resource conversion path, and determining the quantity of the to-be-processed source service resources (recorded as the to-be-processed estimated expense quantity) required by converting the to-be-processed target service resources corresponding to the initial resource conversion difference quantity based on the to-be-processed resource conversion path; if the estimated conversion number to be processed is greater than the resource conversion number of the target service resource to be processed (when the estimated expenditure number to be processed is smaller than the resource conversion number of the source service resource to be processed), determining a difference value between the estimated expenditure number to be processed and the initial resource conversion residual number of the source service resource to be processed as the resource conversion residual number of the source service resource to be processed, and determining the resource conversion difference value number of the target service resource to be processed as 0; if the predicted conversion number to be processed is smaller than the resource conversion number of the target service resource to be processed (when the predicted expenditure number to be processed is larger than the resource conversion number of the source service resource to be processed), determining the difference value between the predicted conversion number to be processed and the initial resource conversion difference value number of the target service resource to be processed as the resource conversion difference value number of the target service resource to be processed, and determining the resource conversion allowance number of the target service resource to be processed as 0; if the number of the expected conversion to be processed is equal to the number of the initial resource conversion difference values of the target service resources to be processed (the number of the expected expenditure to be processed is equal to the number of the initial resource conversion residuals of the source service resources to be processed at the moment), the number of the resource conversion residuals of the source service resources to be processed is determined to be 0, and the number of the resource conversion residuals of the target service resources to be processed is determined to be 0. And updating the initial resource conversion residual quantity of the source service resources of the M resource types and the initial resource conversion difference quantity of the target service resources of the N resource types based on the resource conversion residual quantity of the source service resources to be processed and the resource conversion difference quantity of the target service resources to be processed, which are determined by the resource conversion path to be processed, so as to obtain the M resource conversion residual quantities and the N resource conversion difference quantities. In short, the resource conversion path is used to convert as many source service resources in the resource conversion path as possible into target service resources in the resource conversion path, so as to determine the residual resource conversion number and the differential resource conversion number obtained after conversion based on the resource conversion path.
It is understood that the (r+1) th resource conversion path may be a next resource conversion path of the (r) th resource conversion path in the sequence of resource conversion paths. And updating the resource conversion path to be processed based on the (r+1) th resource conversion path in the resource conversion path sequence, namely taking the (r+1) th resource conversion path as the resource conversion path to be processed. When the M resource conversion surplus numbers and the N resource conversion difference numbers are updated based on the updated to-be-processed resource conversion path, the M resource conversion surplus numbers determined based on the r-th resource conversion path may be used as the initial resource conversion surplus numbers, and the N resource conversion difference numbers may be used as the initial resource conversion difference numbers, so that the description about the resource conversion surplus numbers of the to-be-processed source service resources determined based on the to-be-processed resource conversion path and the resource conversion difference numbers of the to-be-processed target service resources may be referred to above, which will not be repeated herein.
It can be understood that in the embodiment of the present application, the M number of resource conversion residuals and the N number of resource conversion differences may be updated continuously according to the order in the sequence of the resource conversion paths until a preset condition is reached. The preset condition may be: the updated M resource conversion residual numbers have a resource conversion number greater than 0 and the N resource conversion difference numbers have a resource conversion difference number greater than 0.
It can be appreciated that, when determining the updated M resource conversion residual numbers and N resource conversion difference numbers, the number of source service resources that are paid for performing resource conversion based on each resource conversion path may be recorded, so as to facilitate subsequent calculation of consumed resources.
For example, referring to fig. 10, fig. 10 is a flowchart of a resource conversion calculation process according to an embodiment of the present application. As shown in fig. 10, the resource conversion paths in the resource conversion path set may be ordered to obtain a resource conversion path sequence (step S1001). Further, a resource conversion path to be processed is determined from the resource conversion path sequence, and the initial resource conversion surplus number and the initial resource conversion difference number are acquired (step S1002). Here, the resource conversion path to be processed is determined from the resource conversion path sequence, and the resource conversion path ordered first may be determined as the resource conversion path to be processed. The initial resource conversion remaining number and the initial resource conversion difference number may be determined based on the resource expenditure number of the M source service resources and the resource conversion number of the N target service resources. Further, based on the initial resource conversion residual number of the source service resource and the initial resource conversion difference number of the target service resource in the to-be-processed resource conversion path, the initial resource conversion residual number and the initial resource conversion difference number are updated to obtain the resource conversion number and the resource conversion difference number (step S1003). The specific implementation of this step may refer to the above description, and will not be described here in detail.
Further, it may be detected whether there is a resource conversion difference number greater than 0 (step S1004), and if there is no resource conversion difference number greater than 0, the conversion target is achieved successfully (step S1005), in other words, the conversion can be performed to a sufficient number (i.e., the resource expenditure number) of target service resources based on the source service resources. If the number of resource conversion differences is greater than 0, it is detected whether there is a remaining number of resource conversion greater than 0 (step S1006), and if there is no remaining number of resource conversion greater than 0, it indicates failure to achieve the conversion objective (step S1007), in other words, it is possible to convert the objective service resources of a sufficient number (i.e., the number of resource expenditures) based on the source service resources. At this time, the arrangement order of the resource conversion path sequence may be adjusted, and the above-described step S1001 is repeatedly performed based on the new resource conversion path sequence.
If the remaining number of resource conversions is greater than 0, the next resource conversion path of the to-be-processed resource conversion paths in the sequence of resource conversion paths may be determined as a new to-be-processed resource conversion path, and the remaining number of resource conversions at this time is used as the initial remaining number of resource conversions, and the remaining number of resource conversions at this time is used as the initial differential number of resource conversions (step S1008).
Further, each of the N resource types is associated with a resource conversion priority; then, determining the resource conversion ratio and the target consumed resource associated with the traffic conversion path based on the updated M resource conversion surplus numbers and the updated N resource conversion difference number may include the steps of: when the updated M resource conversion residual quantities have the resource conversion residual quantity which is more than or equal to 0 and the updated N resource conversion difference value quantities are all 0, determining the resource conversion residual quantity with the value which is more than 0 in the updated M resource conversion residual quantities as a target resource conversion residual quantity; determining a second allowance conversion path from the resource conversion path set based on the resource conversion priority associated with each of the N resource types and the resource type corresponding to the target resource conversion residual quantity; determining a second surplus resource conversion quantity of the target service resource obtained by converting the source service resource of the resource type corresponding to the target resource conversion surplus quantity based on the second surplus conversion path and the target resource conversion surplus quantity; determining a resource conversion ratio associated with the service conversion path based on the second surplus resource conversion number, the resource expenditure number of the service resources of the M resource types, and the resource conversion number of the service resources of the N resource types; and determining target consumption resources based on the edge connection influence value, the second surplus resource conversion quantity and the resource expenditure quantity of the business resources of M resource types on each resource conversion path in the resource conversion path set.
And if the updated M resource conversion residual numbers are greater than or equal to 0 and the updated N resource conversion difference values are all 0, the success of achieving the conversion target is indicated. And thus the resource conversion ratio and the target consumption amount can be determined.
The target resource conversion remaining number may be a resource conversion remaining number having a value greater than 0 among the updated M resource conversion remaining numbers. The second margin conversion path refers to a resource conversion path used for converting the remaining number of service resources when M and N are both greater than 1. The second surplus resource conversion number refers to the number of target service resources converted from the source service resources of the resource type corresponding to the target resource conversion surplus number, which is determined based on the second surplus resource conversion path.
It may be understood that, based on the second residual conversion path and the target resource conversion residual quantity, the step of determining the second residual resource conversion quantity of the target service resource converted by the source service resource of the resource type corresponding to the target resource conversion residual quantity may refer to the above description related to determining the first residual resource conversion quantity, which is not described herein.
The determining the resource conversion ratio associated with the service conversion path based on the second surplus resource conversion number, the resource expenditure number of the service resources of the M resource types, and the resource conversion number of the service resources of the N resource types may be: determining a resource conversion ratio of the target traffic resource corresponding to the path index end point of the second surplus conversion path based on a ratio of a sum of the resource conversion numbers of the target traffic resource corresponding to the path index end point of the first surplus conversion path and a sum of the resource expenditure numbers of the traffic resources of the M resource types, determining a corresponding resource conversion ratio of the sum of the resource expenditure numbers of the traffic resources of the M resource types based on the corresponding resource conversion numbers for other traffic resources of the N resource types except the target traffic resource corresponding to the path index end point of the second surplus conversion path,
the determining the target consumption resource based on the edge connection influence value, the second surplus resource conversion number and the resource expenditure number of the service resources of the M resource types in each resource conversion path in the resource conversion path set may be that, when the updated M resource conversion surplus numbers and the N resource conversion difference numbers are determined, the recorded number of source service resources expended based on conversion of each resource conversion path is obtained, and further, the number of source service resources expended based on conversion of each resource conversion path is determined based on the number of source service resources expended based on conversion of each resource conversion path, and the edge connection influence value on the corresponding resource conversion path, the consumption resource corresponding to each resource conversion path is determined, and the target consumption resource is determined based on the consumption resource corresponding to each resource conversion path.
It can be appreciated that the target service resource may not be associated with a resource conversion priority, and thus the remaining number of source service resources for resource conversion may not be converted. Then, the resource conversion ratio associated with the service conversion path may be determined by determining the resource conversion ratio corresponding to each target service resource based on the ratio of the resource conversion number corresponding to each target service resource to the sum of the resource expenditure numbers of the service resources of the M resource types. Furthermore, the target consumption resource may be determined according to the edge connection impact value on each resource conversion path, and the specific determination of the target consumption resource may be: and when the updated M resource conversion surplus quantity and N resource conversion difference quantity are determined, the recorded quantity of the source business resources which are consumed by conversion based on each resource conversion path is obtained, and then the consumed resources corresponding to each resource conversion path are determined based on the quantity of the source business resources which are consumed by conversion of each resource conversion path and the edge connection influence value on the corresponding resource conversion path.
S309, returning the resource conversion proportion, the service conversion path and the target consumed resources to the resource management client so that the resource management client constructs and obtains service conversion transaction for being sent to the block chain node equipment associated with the block chain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to input a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the resource conversion contract is used for carrying out resource conversion on the source business resource corresponding to the resource expenditure quantity.
It can be understood that if the remaining amount of the resource conversion of the source service resource does not need to be converted into the target service resource, when the resource conversion proportion, the service conversion path and the target consumed resource are returned to the resource management client, the amount of the source service resource required to be paid out by the target service resource converted into the resource conversion amount, that is, the sum of the calculated estimated resource expenditure amounts can also be returned. When the resource management client performs service conversion transaction based on the service conversion path, the sum of the expected resource expenditure amounts is recorded in the service conversion transaction, and then the blockchain node can convert the source service resource corresponding to the sum of the expected resource expenditure amounts into the target service resource.
It can be appreciated that when the resource conversion goal can be achieved based on the service conversion path (i.e., the source service resource corresponding to the resource expenditure amount can be converted to a sufficient target service resource based on the service conversion path), the service conversion path, the resource conversion ratio, and the target consumed resource can be returned to the resource management client. When the resource conversion target cannot be achieved based on the service conversion path, a prompt message can be returned to the resource management client to prompt that the service conversion path cannot achieve the conversion target. Or, a service conversion path, a resource conversion proportion and a target consumption resource can be returned to the resource management client, and a prompt message is returned at the same time, so that the service conversion path can not reach the conversion target, and further, whether the service object selects whether to initiate the resource conversion transaction based on the currently determined service conversion path under the condition that the conversion target can not be reached by the current service conversion path.
Further, referring to fig. 11, fig. 11 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. The method is performed by a resource management client. The method may comprise at least the following steps S401-S403.
S401, determining a resource conversion request based on the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource, and sending the resource conversion request to resource conversion equipment; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource; the description of the resource conversion request may refer to the description of step S101, which is not described herein.
S402, acquiring a resource conversion proportion, a service conversion path and a target consumption resource returned by the resource conversion equipment; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to convert the transaction resource pair at the time of the request timestamp.
It can be understood that the process of determining the resource conversion ratio, the service conversion path and the target resource consumption returned by the resource conversion device may refer to the descriptions related to steps S101-S104, which are not described herein.
S403, constructing and obtaining business conversion transaction for sending to the block chain node equipment associated with the block chain based on K resource nodes in the business conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
Among other things, it can be appreciated that constructing a business transformation transaction can include: and constructing a business transaction to be signed based on the business conversion path, carrying out transaction signature on the business transaction to be signed based on a private key held by the business object to obtain signature information, and determining the business conversion transaction based on the signature information and the business transaction to be signed. The business transaction to be signed may be a resource conversion transaction to be signed. It can be understood that the private key held by the service object may correspond to an account on the chain on the blockchain, and then the account on the chain corresponding to the private key is the initiation address of the service conversion transaction. Furthermore, when the blockchain node obtains the target service resource based on the service conversion transaction, the obtained target service resource can be sent to the initiating address to complete the service conversion transaction.
It will be appreciated that upon detection of a validation operation of a business object for a business transformation path, a business transformation transaction is constructed in response to the validation operation. The validation operation may be an operation for indicating that the business object allows construction of a business transformation transaction based on the business transformation path. It can be appreciated that if multiple service conversion paths (and corresponding resource conversion ratios and target consumed resources) are obtained, the service conversion path indicated by the validation operation of the service object is determined as the service conversion path for constructing the service conversion transaction.
It can be understood that, when the business transformation transaction is constructed, if the number of the resource transformation paths corresponding to the business transformation paths is a plurality of, the resource transformation paths may be ordered according to a certain order. For example, the resource conversion paths may be recorded in the traffic conversion paths based on an order of the sequence of resource conversion paths determined by the resource conversion device, so that the blockchain node may calculate the number of expenditures per source traffic resource and the number of converted target traffic resources determined by each resource conversion path based on the order to perform resource conversion based on the number of expenditures per source traffic resource and the number of converted target traffic resources determined by each resource conversion path.
Further, referring to fig. 12, fig. 12 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. The method is performed by a block link point device. The method may comprise at least the following step S501-step S502.
S501, acquiring service conversion transaction sent by a resource management client; the business conversion transaction is constructed based on K resource nodes in a business conversion path returned by the resource conversion equipment on the basis of the resource management client side; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp; the resource conversion request is used to determine a traffic conversion path when converting the source traffic resource to the target traffic resource.
The process of determining the business transformation transaction may refer to the above related description, which is not described herein.
S502, when a resource conversion contract deployed on a blockchain is called based on a target consumed resource, a service conversion path and a resource conversion proportion are input into the resource conversion contract, and a source service resource is converted into a target service resource through the resource conversion contract.
It will be appreciated that invoking a resource conversion contract deployed on the blockchain based on the target consumable resource indicates that the blockchain node can automatically deduct transaction fees based on the target consumable resource when invoking the resource conversion contract.
Specifically, transaction resource pairs provided by the resource conversion platform correspond to a transaction resource pair conversion contract on the blockchain; then converting the source business resource to the target business resource by the resource conversion contract may comprise the steps of: based on the transaction time stamp of the business conversion transaction, acquiring a target conversion exchange rate of a transaction resource pair for resource conversion, which is provided by a resource conversion platform, based on the transaction time stamp; determining transaction resource pair conversion contracts corresponding to transaction resource pairs corresponding to the K resource nodes through the resource conversion contracts, and determining the determined transaction resource pair conversion contracts as target transaction resource pair conversion contracts associated with the business conversion paths; determining a target resource expense amount of the source business resource from the business transformation transaction; and when the target transaction resource is called to perform resource conversion on the conversion contract based on the service conversion path and the target conversion exchange rate of the transaction resource pair corresponding to the K resource nodes, converting the source service resource corresponding to the target resource expenditure quantity into the target service resource.
It is understood that the transaction time stamp of the business transformation transaction may refer to the time at which the business transformation transaction was generated. The target conversion rate may refer to a conversion rate of a transaction resource pair for resource conversion acquired at a transaction time stamp. The target conversion rate may be the same as the reference conversion rate or may be different from the reference conversion rate.
It will be appreciated that the description of the conversion contract by the transaction resource may refer to the related description, and will not be repeated here. The target transaction resource pair conversion contract refers to a transaction resource pair conversion contract corresponding to a transaction resource pair corresponding to K resource nodes.
It is to be appreciated that the target resource payout amount can be the amount of source business resources in the business transformation transaction. It is understood that the target resource payout amount may be the same as or different from the resource payout amount in the resource conversion request. Specifically, when determining the resource conversion ratio and the target consumed resource, if the resource conversion remaining amount of the source service resource is converted into the target service resource, the target resource payout amount may be the same as the resource payout amount in the resource conversion request. If the remaining number of resource conversions for the source traffic resource is not converted to the target traffic resource, the target resource payout amount may be different from the resource payout amount in the resource conversion request, i.e., may be converted to a sufficient target traffic resource by a source traffic resource having a smaller resource payout amount than in the resource conversion request.
It may be understood that when the target transaction resource pair conversion contract is called to perform resource conversion based on the service conversion path and the target conversion exchange rate of the transaction resource pair corresponding to the K resource nodes, converting the source service resource corresponding to the target resource expenditure amount into the target service resource may include: determining the number of the reference resources and the number of the target resources corresponding to each transaction resource pair in the transaction resource pairs corresponding to the K resource nodes based on the target conversion exchange rate of the transaction resource pairs corresponding to the K resource nodes, the resource conversion path corresponding to the service conversion path, and the target expenditure number and the resource conversion proportion of each source service resource, calling the target transaction resource pair conversion contract corresponding to each transaction resource pair according to the service conversion path, and converting the number of the reference resources into the number of the target resources, thereby obtaining the target resource number of the target service resources.
It can be appreciated that the resource conversion contract can be invoked to determine the reference resource conversion number for the target business resource based on the target payout amount and the resource conversion ratio for the source business resource. The reference resource conversion number may be a number of target service resources desired to be converted by the service conversion transaction, and the reference resource conversion number may be obtained based on the target payout number multiplied by the resource conversion ratio. And further, the number of source service resources required to be paid for resource conversion based on each resource conversion path, the number of reference resources and the number of destination resources corresponding to the transaction resources on each resource conversion path can be calculated based on the target payout number, the resource conversion ratio and each resource conversion path included in the service conversion path. Wherein, the number of source service resources required to be paid for resource conversion based on each resource conversion path can be referred to the related description in step S308 described above. Further, the number of the service resources on each resource conversion path can be combined and counted, so that the number of the corresponding reference resources and the number of the target resources of each transaction resource pair in the service conversion path can be determined. The merging statistics means that the number of the same service resources belonging to each resource conversion path is added. And further, invoking corresponding transaction resources to perform resource conversion on the conversion contract according to the occurrence sequence of the transaction resources on the service conversion path.
For example, if the traffic conversion paths for converting 150 resources a into resources B and resources C are determined based on the resource conversion path L1 (resource a→resource d→resource B) and the resource conversion path L2 (resource a→resource d→resource C), the number of each resource in the resource conversion path L1 and the number of each resource in the resource conversion path L2 can be determined, for example, when the conversion is performed based on the resource conversion path L1, the following are: 100 resources A-50 resources D-10 resources B) are converted based on a resource conversion path L2, and the conversion is as follows: 50 resources A-40 resources D-20 resources C), and further, the number of corresponding reference resources and the number of target resources can be combined and counted for the transaction resources on each resource conversion path, so that the number of each transaction resource on the resource conversion path L1 and the resource conversion path L2 can be combined and counted into (100+50) resources A-50+40 resources D-10 resources B and 20 resources C. Then, the trade resource pair conversion contract Y1 for converting resource a into resource D may be called to convert 150 resources a into 90 (i.e., 50+40) resources D, then the trade resource pair conversion contract Y2 for converting resource D into resource B may be called to convert 50 resources D into 10 resources B, and the trade resource pair conversion contract Y3 for converting resource D into resource C may be called to convert 40 resources D into 20 resources C. The transaction resource is called first to convert the conversion contract Y1 to 90 resources D, so that the resources B and C can be obtained based on the transaction resource to convert the conversion contracts Y2 and Y3, and the order of calling the transaction resource to convert the conversion contracts Y2 and Y3 is not limited.
It can be understood that, the conversion exchange rate adopted when calculating the target service resource obtained by conversion and invoking the transaction resource to perform resource conversion on the conversion contract is the exchange rate corresponding to the transaction timestamp, and after the execution of one transaction resource on the contract is completed, the conversion exchange rate is not required to be acquired to perform the invocation of the next transaction resource on the contract, so that the resource conversion can be performed on the corresponding transaction resource pair corresponding to the transaction resource pair on the service conversion path synchronously, and the resource conversion efficiency is improved.
Specifically, the business transformation transaction is initiated based on the target account address; then embodiments of the present application may further include the steps of: determining a target resource quantity of the target service resource converted from the source service resource corresponding to the target resource expenditure quantity based on the target resource expenditure quantity and the resource conversion proportion; if the target resource quantity meets the transaction success condition, determining that the business conversion transaction is successfully executed, and sending the target business resource corresponding to the target resource quantity to the target account address through the resource conversion contract.
The target account address refers to an account address for initiating a business conversion transaction, namely signature information in the business conversion transaction is signed based on a private key corresponding to the target account address.
The target resource number refers to the number of the target service resources converted from the source service resources corresponding to the target resource payout number, and the method for determining the target resource number may refer to the above description, that is, the number of the source service resources required to be paid out by each resource conversion path and the number of the target service resources obtained by conversion may be determined based on each resource conversion path corresponding to the service conversion path, so that the target resource number of the target service resources is obtained, which is not described herein.
The transaction success condition may refer to a condition that the business transformation transaction is successfully executed. For example, the transaction success condition may be that a target resource conversion ratio determined based on a ratio of a target resource amount to a target payout amount is greater than or equal to the resource conversion ratio. It can be understood that the reason why the target resource conversion ratio is different from the resource conversion ratio may be that the exchange rate provided by the resource conversion platform is different due to time variation (i.e., the target conversion exchange rate is different from the reference conversion exchange rate), and the service conversion transaction execution failure may be caused due to the decrease of the reference conversion exchange rate of the transaction resource pair on the service conversion path, which results in that the target resource conversion ratio is smaller than the resource conversion ratio, i.e., the result obtained by performing resource conversion by the blockchain cannot meet the requirement of the service conversion transaction. It can be appreciated that, to avoid this, when determining the resource conversion ratio based on the service conversion path, the resource conversion device may reduce the resource conversion ratio by a certain value as the finally returned resource conversion ratio, so as to leave a certain margin, and further determine the service conversion transaction based on the resource conversion ratio reduced by the certain value, so as to avoid failure of executing the service conversion transaction by the block link point.
It will be appreciated that the blockchain node may uplink the business transformation transaction into the blockchain. It will be appreciated that the business alignment may query the transaction record through the resource management client, and the user may view detailed information of the business conversion transaction in the transaction history, such as the business conversion path, the actual resource conversion ratio (i.e., the target resource conversion ratio) performed, the transaction fee (i.e., the target consumed resource), and the like.
Further, referring to fig. 13, fig. 13 is an interaction timing chart of a data processing method based on a blockchain according to an embodiment of the present application. The data processing method involves a resource conversion node, a resource management client and a blockchain node. As shown in fig. 13, the method may include at least steps S1301 to S1310.
S1301, a resource management client determines a resource conversion request based on the resource expenditure quantity of source service resources and the resource conversion quantity of target service resources, and sends the resource conversion request to resource conversion equipment; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
step S1301 may refer to the related description of S401 in fig. 11, which is not described herein.
S1302, a resource conversion device receives a resource conversion request sent by a resource management client;
s1303, a resource conversion device determines the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request;
s1304, the resource conversion equipment acquires a service resource directed graph associated with the request timestamp based on the request timestamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
s1305, a resource conversion device, in a service resource directed graph, taking a resource node matched with a source service resource as a path index starting point, taking a resource node matched with a target service resource as a path index end point, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the service conversion path, the resource expenditure quantity and the resource conversion quantity;
S1306, the resource conversion equipment returns the resource conversion proportion, the service conversion path and the target consumed resource to the resource management client;
steps S1302-S1305 may refer to the relevant descriptions of S101-S105 in fig. 1, and are not described herein.
S1307, the resource management client acquires the resource conversion proportion, the service conversion path and the consumed resource with the target returned by the resource conversion equipment;
s1308, the resource management client builds and obtains service conversion transaction for being sent to the block chain node equipment associated with the block chain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points;
steps S1307-S1308 can refer to the relevant descriptions of S402-S403 in fig. 11, and are not described here.
S1309, the block chain node acquires a service conversion transaction sent by a resource management client;
s1310, when the resource conversion contract deployed on the block chain is called based on the target consumed resource, the block chain node enters a service conversion path and a resource conversion proportion into the resource conversion contract, and the source service resource is converted into the target service resource through the resource conversion contract.
Steps S1309-S1310 may refer to the description related to S501-S502 in fig. 12, and are not described herein.
Referring to fig. 14, fig. 14 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an embodiment of the present application. As shown in fig. 14, the blockchain-based data processing device 1 may be a computer program (including program code) running on a resource conversion device (e.g., resource conversion device 120a in fig. 1), for example, the data processing device 1 is an application software; it will be appreciated that the blockchain-based data processing device 1 may be used to perform the corresponding steps in the data processing method provided by the embodiments of the present application. As shown in fig. 14, the blockchain-based data processing device 1 may include: a request receiving module 11, a request analyzing module 12, a directed graph obtaining module 13 and a path calculating module 14;
a request receiving module 11, configured to receive a resource conversion request sent by a resource management client; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
a request parsing module 12, configured to determine a resource expenditure number of the source service resource and a resource conversion number of the target service resource based on the resource conversion request;
The directed graph obtaining module 13 is configured to obtain a service resource directed graph associated with a request timestamp based on the request timestamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
a path calculation module 14, configured to determine, in the traffic resource directed graph, a traffic conversion path from a path index start point to a path index end point, with a resource node that matches a source traffic resource as a path index start point, and with a resource node that matches a target traffic resource as a path index end point, and determine, based on the traffic conversion path, the resource expense amount, and the resource conversion amount, a resource conversion ratio and a target consumption resource that are associated with the traffic conversion path;
the data sending module 15 is configured to return the resource conversion ratio, the service conversion path and the target consumption resource to the resource management client, so that the resource management client constructs a service conversion transaction for sending to the blockchain node device associated with the blockchain based on the K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
The source business resources comprise business resources of M resource types, and the target business resources comprise business resources of N resource types; the M resource types and the N resource types are different from each other;
the path calculation module 14 includes: a first path calculation unit 141; the first path calculation unit 141 includes: a first index point determination unit 1411, a first path determination unit 1412;
a first index point determining unit 1411, configured to, when the values of M and N are both 1, take, in the traffic resource directed graph, 1 resource node that matches the source traffic resource as a path index start point, and take, as a path index end point, 1 resource node that matches the target traffic resource;
the first path determining unit 1412 is configured to, when determining that at least one resource node is included in a node index path from a path index start point corresponding to the source service resource to a path index end point corresponding to the target service resource, take, as the service conversion path, a resource conversion path determined by the path index start point, at least one resource node in the node index path, and the path index start point.
Wherein the path computation module 14 includes: a first proportion determination unit 142;
The first proportion determining unit 142 is specifically configured to:
acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from a resource conversion platform;
determining a first target resource conversion number of target service resources converted from the source service resources based on a reference conversion exchange rate of the transaction resource pairs corresponding to the resource nodes on the service conversion path and the resource expenditure number;
when the first target resource conversion number is greater than or equal to the resource conversion number, determining a resource conversion ratio associated with the service conversion path based on a ratio of the first target resource conversion number to the resource expenditure number;
and determining the target consumption resource based on the edge connection influence value on the service conversion path and the resource expenditure quantity.
The source business resources comprise business resources of M resource types, and the target business resources comprise business resources of N resource types; the M resource types and the N resource types are different from each other;
wherein the path computation module 14 includes: a second path calculation unit 143; the second path calculation unit 143 includes: a second index point determination unit 1431, a resource conversion path determination unit 1432, and a second path determination unit 1433;
A second index point determining unit 1431, configured to, when the values of M and N are both different and are 1, take M resource nodes matched with the source service resource as a path index start point and N resource nodes matched with the target service resource as a path index end point in the service resource directed graph;
a second index point determining unit 1431, configured to select a resource node i from M resource nodes included in the path index start point as a target index start point, and select a resource node j from N resource nodes included in the path index end point as a target index end point; i is a positive integer less than or equal to M, j is a positive integer less than or equal to N;
a resource conversion path determining unit 1432, configured to determine a resource conversion path from the target index start point to the target index end point in the traffic resource directed graph;
a second path determining unit 1433 for determining a traffic conversion path based on the determined resource conversion path.
The resource conversion path determining unit 1432 is specifically configured to:
determining at least one index path from a target index start point to a target index end point in the traffic resource directed graph;
determining an index path having the smallest path influence value among the at least one index path as a resource conversion path; the path impact value refers to the sum of edge connection impact values on the index path.
Wherein, the values of M and N are different and are 1 at the same time comprises: m has a value of 1, and N has a value of more than 1; the service resources of the N resource types included in the target service resource comprise first type resources and second type resources; the path index starting point is 1 resource node matched with the source service resource; the path index endpoint comprises a first resource node matched with the first type resource and a second resource node matched with the second type resource; the traffic conversion path is determined based on the first resource conversion path and the second resource conversion path; the first resource conversion path is a resource conversion path from a path index starting point to a first resource node; the second resource conversion path is a resource conversion path from the path index starting point to the second resource node; the resource conversion number comprises a first resource conversion number corresponding to the first type of resources and a second resource conversion number corresponding to the second type of resources;
wherein the path computation module 14 includes: a second proportion determination unit 144;
the second proportion determining unit 144 is specifically configured to:
acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from a resource conversion platform;
determining a transaction resource pair corresponding to a resource node on a first resource conversion path as a first path transaction resource pair, and determining a first expected resource expenditure quantity required for converting to obtain a first type of resource corresponding to the first resource conversion quantity based on a reference conversion exchange rate and the first resource conversion quantity of the first path transaction resource pair;
Determining a transaction resource pair corresponding to the resource node on the first resource conversion path as a second path transaction resource pair, and determining a second estimated resource expenditure quantity required for converting to obtain a second type resource corresponding to the second resource conversion quantity based on a reference conversion exchange rate and the second resource conversion quantity of the second path transaction resource pair;
a resource conversion ratio and a target consumed resource associated with the traffic conversion path are determined based on the first projected amount of resource expenditure, the second projected amount of resource expenditure, and the amount of resource expenditure.
Wherein, the first type resource and the second type resource are both associated with a resource conversion priority;
the second proportion determining unit 144 is specifically configured to:
determining a sum of the first estimated resource payout amount and the second estimated resource payout amount as an estimated payout amount sum, and determining a resource conversion remaining amount based on a difference between the estimated payout amount and the estimated payout amount sum when the estimated payout amount sum is less than or equal to the resource payout amount;
determining a first allowance conversion path from the first resource conversion path and the second resource conversion path based on the resource conversion priority of the first type resource and the resource conversion priority of the second type resource, and determining a first allowance resource conversion quantity obtained by converting the source service resource corresponding to the resource conversion residual quantity based on the resource conversion residual quantity and the first allowance conversion path;
Determining a resource conversion ratio associated with the traffic conversion path based on the first balance resource conversion number, the first resource conversion number, the second resource conversion number, and the resource payout number;
the target consumption resource is determined based on the edge connection impact value on the first resource conversion path, the edge connection impact value on the second resource conversion path, the first projected resource payout amount, the resource conversion remaining amount, and the second projected resource payout amount.
Wherein, the values of M and N are different and are 1 at the same time comprises: m is more than 1, and N has a value of 1; the M resource types of service resources included in the source service resources comprise third type resources and fourth type resources; the path index end point is 1 resource node matched with the target service resource; the path index starting point comprises a third resource node matched with the third type resource and a fourth resource node matched with the fourth type resource; the traffic conversion path is determined based on the third resource conversion path and the fourth resource conversion path; the third resource conversion path is a resource conversion path from the third resource node to the path index end point; the fourth resource conversion path is a resource conversion path from the fourth resource node to the path index end point; the resource expenditure quantity comprises a first resource expenditure quantity corresponding to the third type of resource and a second resource expenditure quantity corresponding to the fourth type of resource;
The path calculation module 14 includes: a third proportion determination unit 145;
the third proportion determining unit 145 specifically is configured to:
acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from a resource conversion platform;
determining a transaction resource pair corresponding to a resource node on a third resource conversion path as a third path transaction resource pair, and determining a first predicted resource conversion number corresponding to a target service resource for converting a third type resource corresponding to the first resource expense number based on a reference conversion exchange rate and the first resource expense number of the third path transaction resource pair;
determining a transaction resource pair corresponding to a resource node on a fourth resource conversion path as a fourth path transaction resource pair, and determining a second predicted resource conversion number corresponding to a target service resource for converting a fourth type resource corresponding to a second resource expense number based on a reference conversion exchange rate and the second resource expense number of the fourth path transaction resource pair;
a resource conversion ratio and a target consumed resource associated with the traffic conversion path are determined based on the first projected resource conversion number, the second projected resource conversion number, the first resource payout number, and the second resource payout number.
The third proportion determining unit 145 specifically is configured to:
determining a sum of the first predicted resource conversion number and the second predicted resource conversion number as a predicted conversion number sum;
when the sum of the estimated conversion numbers is greater than or equal to the resource conversion number, determining a resource conversion ratio associated with the service conversion path based on the sum of the estimated conversion numbers, the first resource expenditure number and the second resource expenditure number;
and determining the target consumed resource based on the edge connection impact value, the first resource expenditure amount and the second resource expenditure amount on the third resource conversion path.
Wherein, the values of M and N are different and are 1 at the same time comprises: m and N are both greater than 1; the traffic conversion path is determined based on the set of resource conversion paths; the resource conversion path set comprises a plurality of resource conversion paths;
the path calculation module 14 includes: a fourth proportion determination unit 146;
the fourth proportion determining unit 146 is specifically configured to:
sequencing a plurality of resource conversion paths in a resource conversion path set to obtain a resource conversion path sequence;
determining an r-th resource conversion path in the resource conversion path sequence as a to-be-processed resource conversion path, determining a path index starting point in the to-be-processed resource conversion path as a to-be-processed index starting point, and determining a path index end point in the to-be-processed resource conversion path as a to-be-processed index end point; r is a positive integer;
Determining M resource conversion surplus numbers corresponding to the business resources of M resource types and N resource conversion difference value numbers corresponding to the business resources of N resource types based on the resource expenditure numbers corresponding to the starting points of the to-be-processed path indexes and the resource conversion numbers corresponding to the ending points of the to-be-processed path indexes; one resource conversion residual quantity corresponding to one resource type in the K resource types; one resource conversion difference value number corresponding to the business resource of one resource type in the N resource types;
updating the resource conversion path to be processed based on the (r+1) th resource conversion path in the resource conversion path sequence, and updating the M resource conversion surplus quantity and the N resource conversion difference quantity based on the updated resource conversion path to be processed; the (r+1) th resource conversion path is the next resource conversion path of the (r) th resource conversion path in the resource conversion path sequence;
and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the updated M resource conversion residual quantities and the updated N resource conversion difference value quantities.
Wherein, each of the N resource types is associated with a resource conversion priority;
The fourth proportion determining unit 146 is specifically configured to:
when the updated M resource conversion residual quantities have the resource conversion residual quantity which is more than or equal to 0 and the updated N resource conversion difference value quantities are all 0, determining the resource conversion residual quantity with the value which is more than 0 in the updated M resource conversion residual quantities as a target resource conversion residual quantity;
determining a second allowance conversion path from the resource conversion path set based on the resource conversion priority associated with each of the N resource types and the resource type corresponding to the target resource conversion residual quantity;
determining a second surplus resource conversion quantity of the target service resource obtained by converting the source service resource of the resource type corresponding to the target resource conversion surplus quantity based on the second surplus conversion path and the target resource conversion surplus quantity;
determining a resource conversion ratio associated with the service conversion path based on the second surplus resource conversion number, the resource expenditure number of the service resources of the M resource types, and the resource conversion number of the service resources of the N resource types;
and determining target consumption resources based on the edge connection influence value, the second surplus resource conversion quantity and the resource expenditure quantity of the business resources of M resource types on each resource conversion path in the resource conversion path set.
Wherein the path computation module 14 includes: a path set determination unit 147; the path set determination unit 147 includes: a resource to be indexed determination unit 1471, a subset determination unit 1472, and a set determination unit 1473;
a to-be-indexed resource determining unit 1471, configured to determine to-be-indexed service resources from service resources of M resource types; the path index starting point comprises a resource node to be indexed corresponding to the service resource to be indexed; the path index end point comprises N resource nodes corresponding to the service resources of the N resource types;
a subset determining unit 1472, configured to determine a subset of resource conversion paths corresponding to the service resources to be indexed based on the resource conversion paths from the resource node to be indexed to each of the N resource nodes;
a subset determining unit 1472, configured to determine, when each service resource in the source service resources is to be used as a service resource to be indexed, a resource conversion path subset corresponding to each service resource included in the source service resources;
and a set determining unit 1473, configured to determine a set of resource conversion paths associated with the service conversion paths based on the subset of resource conversion paths corresponding to each service resource included in the source service resource.
Referring to fig. 15, fig. 15 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an embodiment of the present application. As shown in fig. 15, the blockchain-based data processing device 2 may be a computer program (including program code) running on a resource management client, for example, the data processing device 2 is an application software; it will be appreciated that the blockchain-based data processing device 2 may be used to perform the corresponding steps in the data processing methods provided by embodiments of the present application. As shown in fig. 15, the blockchain-based data processing device 2 may include: a request determination module 21, a data acquisition module 22, a transaction construction module 23;
a request determining module 21, configured to determine a resource conversion request based on the resource expenditure number of the source service resource and the resource conversion number of the target service resource, and send the resource conversion request to the resource conversion device; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
a data obtaining module 22, configured to obtain a resource conversion ratio, a service conversion path and a target consumption resource returned by the resource conversion device; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp;
A transaction construction module 23, configured to construct a service conversion transaction for sending to a blockchain node device associated with a blockchain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the business conversion transaction is used for indicating the blockchain node equipment to enter a business conversion path and a resource conversion proportion into a resource conversion contract when the resource conversion contract is called based on the target consumed resource, and the source business resource is converted into the target business resource through the resource conversion contract.
Referring to fig. 16, fig. 16 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an embodiment of the present application. As shown in fig. 16, the blockchain-based data processing device 3 may be a computer program (including program code) running on a blockchain node device, for example, the data processing device 3 is an application software; it will be appreciated that the blockchain-based data processing device 3 may be used to perform the corresponding steps in the data processing method provided by the embodiments of the present application. As shown in fig. 16, the blockchain-based data processing device 3 may include: a transaction acquisition module 31, a resource conversion module 32;
A transaction acquisition module 31, configured to acquire a service conversion transaction sent by the resource management client; the business conversion transaction is constructed based on K resource nodes in a business conversion path returned by the resource conversion equipment on the basis of the resource management client side; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the resource conversion equipment is used for taking a resource node matched with the source service resource as a path index starting point and a resource node matched with the target service resource as a path index end point in the service resource directed graph, determining a service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource based on the service conversion path, the resource expenditure quantity and the resource conversion quantity; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; node connection edges are determined by pairs of transaction resources that participate in resource conversion when a timestamp is requested; the edge connection impact value is determined by the consumption resources consumed to perform the resource conversion on the transaction resource pair at the time of the request time stamp; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
The resource conversion module 32 is configured to, when a resource conversion contract deployed on the blockchain is invoked based on the target consumed resource, enter a service conversion path and a resource conversion ratio into the resource conversion contract, and convert the source service resource into the target service resource through the resource conversion contract.
The transaction resource pairs provided by the resource conversion platform correspond to a transaction resource pair conversion contract on the blockchain;
wherein the resource conversion module 32 includes: exchange rate acquisition unit 321, conversion contract determination unit 322, payout amount determination unit 323, conversion unit 324;
a exchange rate obtaining unit 321, configured to obtain, based on a transaction timestamp of the business conversion transaction, a target conversion exchange rate of a transaction resource pair provided by the resource conversion platform for performing resource conversion based on the transaction timestamp;
a conversion contract determining unit 322, configured to determine, by using the resource conversion contracts, a transaction resource pair conversion contract corresponding to transaction resource pairs corresponding to the K resource nodes, and determine the determined transaction resource pair conversion contract as a target transaction resource pair conversion contract associated with the service conversion path;
a payout amount determining unit 323 for determining a target resource payout amount of the source service resource from the service conversion transaction;
The conversion unit 324 is configured to convert the source service resource corresponding to the target resource expense amount into the target service resource when the target transaction resource pair conversion contract is invoked to perform resource conversion based on the service conversion path and the target conversion exchange rate of the transaction resource pair corresponding to the K resource nodes.
Wherein the business transformation transaction is initiated based on the target account address;
the resource conversion module 32 further includes: a conversion number calculation unit 325, a resource transfer unit 326;
a conversion number calculating unit 325, configured to determine, based on the target resource payout number and the resource conversion ratio, a target resource number of the target service resource into which the source service resource corresponding to the target resource payout number is converted;
and the resource transfer unit 326 is configured to determine that the business transformation transaction is successfully executed if the target resource number meets the transaction success condition, and send the target business resource corresponding to the target resource number to the target account address through the resource transformation contract.
Referring to fig. 17, fig. 17 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 17, the computer device 1000 may include: processor 1001, network interface 1004, and memory 1005, and in addition, the above-described computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 17, an operating system, a network communication module, a user interface module, and a device control application program may be included in a memory 1005, which is one type of computer-readable storage medium.
In the computer device 1000 shown in FIG. 17, the network interface 1004 may provide network communication functions; while user interface 1003 is primarily used as an interface for providing input to a user; the processor 1001 may be configured to invoke the device control application stored in the memory 1005 to execute the description of the data processing method in any of the foregoing embodiments, which is not described herein. In addition, the description of the beneficial effects of the same method is omitted.
Furthermore, it should be noted here that: the embodiments of the present application further provide a computer readable storage medium, in which the aforementioned computer programs executed by the data processing apparatus 1, the data processing apparatus 2, and the data processing apparatus 3 are stored, and the computer programs include program instructions, when executed by a processor, capable of executing the descriptions of the data processing methods in the foregoing embodiments, and therefore will not be described herein in detail. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application.
The computer readable storage medium may be the data processing apparatus provided in any one of the foregoing embodiments or an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Furthermore, it should be noted here that: embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform the method provided by any of the corresponding embodiments described above. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the computer program product or the computer program embodiments related to the present application, please refer to the description of the method embodiments of the present application.
The terms first, second and the like in the description and in the claims and drawings of the embodiments of the present application are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the term "include" and any variations thereof is intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or modules but may, in the alternative, include other steps or modules not listed or inherent to such process, method, apparatus, article, or device.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (22)

1. A blockchain-based data processing method, the method performed by a resource conversion device, the method comprising:
receiving a resource conversion request sent by a resource management client; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
determining the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource based on the resource conversion request;
acquiring a service resource directed graph associated with a request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; the node connection edge is determined by a transaction resource pair which participates in resource conversion when the request time stamp is made; the edge connection impact value is determined by the consumption resources consumed for resource conversion of the transaction resource pair at the time of the request timestamp;
In the service resource directed graph, taking a resource node matched with the source service resource as a path index starting point, taking a resource node matched with the target service resource as a path index end point, determining the service conversion path from the path index starting point to the path index end point in the service resource directed graph, and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the service conversion path, the resource expenditure quantity and the resource conversion quantity;
returning the resource conversion proportion, the service conversion path and the target consumption resource to the resource management client so that the resource management client constructs a service conversion transaction for being sent to the block chain node equipment associated with the block chain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise the path index starting point and the path index ending point; the business conversion transaction is used for indicating the blockchain node equipment to input the business conversion path and the resource conversion proportion into the resource conversion contract when the resource conversion contract is called based on the target consumption resource, and the source business resource is converted into the target business resource through the resource conversion contract.
2. The method of claim 1, wherein the source traffic resources comprise traffic resources of M resource types and the target traffic resources comprise traffic resources of N resource types; the M resource types and the N resource types are different from each other;
in the service resource directed graph, taking a resource node matched with the source service resource as a path index starting point, and taking a resource node matched with the target service resource as a path index end point, determining the service conversion path from the path index starting point to the path index end point in the service resource directed graph, including:
when the values of M and N are 1, in the service resource directed graph, taking 1 resource node matched with the source service resource as a path index starting point and taking 1 resource node matched with the target service resource as a path index ending point;
when it is determined that at least one resource node is included in a node index path from a path index start point corresponding to the source service resource to a path index end point corresponding to the target service resource, a resource conversion path determined by the path index start point, the at least one resource node in the node index path, and the path index start point is used as the service conversion path.
3. The method of claim 2, wherein the determining a resource conversion ratio and a target consumption resource associated with the traffic conversion path based on the traffic conversion path, the resource payout amount, and the resource conversion amount comprises:
acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from the resource conversion platform;
determining a first target resource conversion number of the target service resource converted from the source service resource based on a reference conversion exchange rate of a transaction resource pair corresponding to a resource node on a service conversion path and the resource expenditure number;
when the first target resource conversion number is greater than or equal to the resource conversion number, determining a resource conversion ratio associated with the service conversion path based on a ratio of the first target resource conversion number to the resource payout number;
and determining the target consumed resource based on the edge connection influence value on the service conversion path and the resource expenditure quantity.
4. The method of claim 1, wherein the source traffic resources comprise traffic resources of M resource types and the target traffic resources comprise traffic resources of N resource types; the M resource types and the N resource types are different from each other;
In the service resource directed graph, taking a resource node matched with the source service resource as a path index starting point, and taking a resource node matched with the target service resource as a path index end point, determining the service conversion path from the path index starting point to the path index end point in the service resource directed graph, including:
when the values of M and N are different and are 1, in the service resource directed graph, M resource nodes matched with the source service resource are used as path index starting points, and N resource nodes matched with the target service resource are used as path index ending points;
selecting a resource node i from M resource nodes included in the path index starting point as a target index starting point, and selecting a resource node j from N resource nodes included in the path index ending point as a target index ending point; i is a positive integer less than or equal to M, j is a positive integer less than or equal to N;
determining a resource conversion path from the target index starting point to the target index ending point in the service resource directed graph;
and determining the service conversion path based on the determined resource conversion path.
5. The method of claim 4, wherein determining a resource conversion path from the target index start point to the target index end point in the traffic resource directed graph comprises:
determining at least one index path from the target index start point to the target index end point in the service resource directed graph;
determining an index path with the smallest path influence value among the at least one index path as a resource conversion path; the path impact value refers to the sum of edge connection impact values on the index path.
6. The method of claim 4, wherein the values of M and N are not 1 at the same time, comprising: m has a value of 1, and N has a value of more than 1; the service resources of N resource types included in the target service resource comprise first type resources and second type resources; the path index starting point is 1 resource node matched with the source service resource; the path index endpoint comprises a first resource node matched with the first type resource and a second resource node matched with the second type resource; the service switching path is determined based on a first resource switching path and a second resource switching path; the first resource conversion path is a resource conversion path from the path index starting point to the first resource node; the second resource conversion path is a resource conversion path from the path index starting point to the second resource node; the resource conversion number comprises a first resource conversion number corresponding to the first type of resources and a second resource conversion number corresponding to the second type of resources;
The determining a resource conversion ratio and a target consumed resource associated with the traffic conversion path based on the traffic conversion path, the resource payout amount, and the resource conversion amount includes:
acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from the resource conversion platform;
determining a transaction resource pair corresponding to a resource node on the first resource conversion path as a first path transaction resource pair, and determining a first expected resource expenditure quantity required for converting to obtain a first type resource corresponding to the first resource conversion quantity based on a reference conversion exchange rate of the first path transaction resource pair and the first resource conversion quantity;
determining a transaction resource pair corresponding to a resource node on the first resource conversion path as a second path transaction resource pair, and determining a second expected resource expenditure quantity required for converting to obtain a second type resource corresponding to the second resource conversion quantity based on a reference conversion exchange rate of the second path transaction resource pair and the second resource conversion quantity;
a resource conversion ratio and a target consumed resource associated with the traffic conversion path are determined based on the first projected amount of resource expenditure, the second projected amount of resource expenditure, and the amount of resource expenditure.
7. The method of claim 6, wherein the first type of resource and the second type of resource are each associated with a resource conversion priority;
the determining a resource conversion ratio and a target consumed resource associated with the traffic conversion path based on the first estimated resource expense amount, the second estimated resource expense amount, and the resource expense amount includes:
determining a sum of the first estimated resource payout amount and the second estimated resource payout amount as an estimated payout amount sum, and determining a resource conversion remaining amount based on a difference between the resource payout amount and the estimated payout amount sum when the estimated payout amount sum is less than or equal to the resource payout amount;
determining a first surplus conversion path from the first resource conversion path and the second resource conversion path based on the resource conversion priority of the first type resource and the resource conversion priority of the second type resource, and determining a first surplus resource conversion number converted by the source service resource corresponding to the resource conversion surplus based on the resource conversion surplus and the first surplus conversion path;
Determining a resource conversion ratio associated with the traffic conversion path based on the first balance resource conversion number, the first resource conversion number, the second resource conversion number, and the resource payout number;
the target consumed resource is determined based on the edge connection impact value on the first resource conversion path, the edge connection impact value on the second resource conversion path, the first projected resource payout amount, the resource conversion remaining amount, and the second projected resource payout amount.
8. The method of claim 4, wherein the values of M and N are not 1 at the same time, comprising: m is more than 1, and N has a value of 1; the M resource types of service resources included in the source service resource comprise a third type of resource and a fourth type of resource; the path index end point is 1 resource node matched with the target service resource; the path index starting point comprises a third resource node matched with the third type resource and a fourth resource node matched with the fourth type resource; the service switching path is determined based on a third resource switching path and a fourth resource switching path; the third resource conversion path is a resource conversion path from the third resource node to the path index end point; the fourth resource conversion path is a resource conversion path from the fourth resource node to the path index end point; the resource expenditure quantity comprises a first resource expenditure quantity corresponding to the third type of resource and a second resource expenditure quantity corresponding to the fourth type of resource;
The determining a resource conversion ratio and a target consumed resource associated with the traffic conversion path based on the traffic conversion path, the resource payout amount, and the resource conversion amount includes:
acquiring a reference conversion exchange rate of a transaction resource pair for resource conversion from the resource conversion platform;
determining a transaction resource pair corresponding to a resource node on the third resource conversion path as a third path transaction resource pair, and determining a first estimated resource conversion number corresponding to the target service resource for converting a third type resource corresponding to the first resource expense number based on a reference conversion exchange rate of the third path transaction resource pair and the first resource expense number;
determining a transaction resource pair corresponding to a resource node on the fourth resource conversion path as a fourth path transaction resource pair, and determining a second predicted resource conversion number corresponding to the target service resource converted from a fourth type resource corresponding to the second resource expense number based on a reference conversion exchange rate of the fourth path transaction resource pair and the second resource expense number;
determining a resource conversion ratio and a target consumption resource associated with the traffic conversion path based on the first projected resource conversion number, the second projected resource conversion number, the first resource payout number, and the second resource payout number.
9. The method of claim 8, wherein the determining the resource conversion ratio and the target consumption resource associated with the traffic conversion path based on the first projected resource conversion number, the second projected resource conversion number, the first resource payout number, and the second resource payout number comprises:
determining a sum of the first predicted resource conversion number and the second predicted resource conversion number as a predicted conversion number sum;
determining a resource conversion ratio associated with the traffic conversion path based on the estimated conversion number sum, the first resource payout amount, and the second resource payout amount when the estimated conversion number sum is greater than or equal to the resource conversion number;
and determining the target consumed resource based on the edge connection impact value, the first resource expenditure amount and the second resource expenditure amount on the third resource conversion path.
10. The method of claim 4, wherein the values of M and N are not 1 at the same time, comprising: m and N are both greater than 1; the service conversion path is determined based on a resource conversion path set; the resource conversion path set comprises a plurality of resource conversion paths;
The determining a resource conversion ratio and a target consumed resource associated with the traffic conversion path based on the traffic conversion path, the resource payout amount, and the resource conversion amount includes:
sequencing a plurality of resource conversion paths in the resource conversion path set to obtain a resource conversion path sequence;
determining an r-th resource conversion path in the resource conversion path sequence as a to-be-processed resource conversion path, determining a path index starting point in the to-be-processed resource conversion path as a to-be-processed index starting point, and determining a path index end point in the to-be-processed resource conversion path as a to-be-processed index end point; r is a positive integer;
determining M resource conversion surplus numbers corresponding to the service resources of the M resource types and N resource conversion difference value numbers corresponding to the service resources of the N resource types based on the resource expenditure numbers corresponding to the to-be-processed path index starting points and the resource conversion numbers corresponding to the to-be-processed path index ending points; one resource conversion surplus number corresponding to one resource type in the K resource types; the number of resource conversion difference values corresponding to the service resources of one of the N resource types;
Updating the resource conversion paths to be processed based on the (r+1) th resource conversion path in the resource conversion path sequence, and updating the M resource conversion surplus quantity and the N resource conversion difference value quantity based on the updated resource conversion paths to be processed; the (r+1) th resource conversion path is the next resource conversion path of the (r) th resource conversion path in the resource conversion path sequence;
and determining a resource conversion proportion and a target consumption resource associated with the service conversion path based on the updated M resource conversion residual quantities and the updated N resource conversion difference value quantities.
11. The method of claim 10, wherein each of the N resource types is associated with a resource switch priority;
the determining the resource conversion ratio and the target consumption resource associated with the service conversion path based on the updated M resource conversion residual numbers and the updated N resource conversion difference value numbers includes:
when the updated M resource conversion residual quantities have the resource conversion residual quantity which is more than or equal to 0 and the updated N resource conversion difference value quantities are all 0, determining the resource conversion residual quantity with the value which is more than 0 in the updated M resource conversion residual quantities as a target resource conversion residual quantity;
Determining a second allowance conversion path from the resource conversion path set based on the resource conversion priority associated with each of the N resource types and the resource type corresponding to the target resource conversion residual quantity;
determining a second surplus resource conversion quantity of the target service resource obtained by converting the source service resource of the resource type corresponding to the target resource conversion surplus quantity based on the second surplus conversion path and the target resource conversion surplus quantity;
determining a resource conversion ratio associated with the service conversion path based on the second surplus resource conversion number, the resource expenditure number of the service resources of the M resource types, and the resource conversion number of the service resources of the N resource types;
and determining the target consumed resource based on the edge connection influence value, the second allowance resource conversion quantity and the resource expenditure quantity of the business resources of the M resource types on each resource conversion path in the resource conversion path set.
12. The method according to claim 10, wherein the method further comprises:
determining service resources to be indexed from the service resources of the M resource types; the path index starting point comprises a resource node to be indexed corresponding to the service resource to be indexed; the path index end point comprises N resource nodes corresponding to the service resources of the N resource types;
Determining a resource conversion path subset corresponding to the service resource to be indexed based on the resource conversion path from the resource node to be indexed to each of the N resource nodes;
when each service resource in the source service resources is used as the service resource to be indexed, determining a resource conversion path subset corresponding to each service resource included in the source service resources;
and determining the resource conversion path set associated with the service conversion path based on the resource conversion path subset corresponding to each service resource included by the source service resource.
13. A blockchain-based data processing method, the method performed by a resource management client, the method comprising:
determining a resource conversion request based on the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource, and sending the resource conversion request to resource conversion equipment; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
acquiring the resource conversion proportion, the service conversion path and the target consumed resource returned by the resource conversion equipment; the resource conversion device is configured to determine, in a service resource directed graph, a service conversion path from a path index start point to a path index end point by using a resource node that matches a source service resource as a path index start point and using a resource node that matches a target service resource as a path index end point, and determine, based on the service conversion path, the resource expenditure number, and the resource conversion number, a resource conversion ratio to the resource and the target consumption resource; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; the node connection edge is determined by a transaction resource pair which participates in resource conversion when the request time stamp is made; the edge connection impact value is determined by the consumption resources consumed for resource conversion of the transaction resource pair at the time of the request timestamp;
Based on K resource nodes in the service conversion path, constructing and obtaining service conversion transaction for sending to the block chain node equipment associated with the block chain; k is a positive integer greater than 2; the K resource nodes comprise the path index starting point and the path index ending point; the business conversion transaction is used for indicating the blockchain node equipment to input the business conversion path and the resource conversion proportion into the resource conversion contract when the resource conversion contract is called based on the target consumption resource, and the source business resource is converted into the target business resource through the resource conversion contract.
14. A blockchain-based data processing method, the method performed by a blockchain node device, the method comprising:
acquiring business conversion transaction sent by a resource management client; the business conversion transaction is constructed based on K resource nodes in a business conversion path returned by a resource conversion device by a resource management client; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the resource conversion device is configured to determine, in a service resource directed graph, a service conversion path from a path index start point to a path index end point by using a resource node that matches a source service resource as a path index start point and using a resource node that matches a target service resource as a path index end point, and determine, based on the service conversion path, the resource expenditure number, and the resource conversion number, a resource conversion ratio to the resource and the target consumption resource; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; the node connection edge is determined by a transaction resource pair which participates in resource conversion when the request time stamp is made; the edge connection impact value is determined by the consumption resources consumed for resource conversion of the transaction resource pair at the time of the request timestamp; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
When a resource conversion contract deployed on a blockchain is called based on the target consumed resource, the business conversion path and the resource conversion proportion are input into the resource conversion contract, and the source business resource is converted into the target business resource through the resource conversion contract.
15. The method of claim 14, wherein the transaction resource pairs provided by the resource conversion platform each correspond to a transaction resource pair conversion contract on the blockchain;
the converting the source business resource into the target business resource through the resource conversion contract comprises:
based on the transaction time stamp of the business conversion transaction, acquiring a target conversion exchange rate of a transaction resource pair provided by the resource conversion platform and used for resource conversion based on the transaction time stamp;
determining transaction resource pair conversion contracts corresponding to transaction resource pairs corresponding to the K resource nodes through the resource conversion contracts, and determining the determined transaction resource pair conversion contracts as target transaction resource pair conversion contracts associated with the business conversion paths;
determining a target resource payout amount of the source business resource from the business transformation transaction;
And when the resource conversion is carried out on the conversion contract by calling the target transaction resource based on the service conversion path and the target conversion exchange rate of the transaction resource pair corresponding to the K resource nodes, converting the source service resource corresponding to the target resource expenditure quantity into the target service resource.
16. The method of claim 15, wherein the business transformation transaction is initiated based on a target account address; the method further comprises the steps of:
determining a target resource quantity of the target service resource converted from the source service resource corresponding to the target resource expenditure quantity based on the target resource expenditure quantity and the resource conversion proportion;
and if the target resource quantity meets the transaction success condition, determining that the business conversion transaction is successfully executed, and sending the target business resource corresponding to the target resource quantity to the target account address through the resource conversion contract.
17. A blockchain-based data processing apparatus, the apparatus being operated by a resource conversion device, the apparatus comprising:
the request receiving module is used for receiving a resource conversion request sent by the resource management client; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
A request analysis module, configured to determine, based on the resource conversion request, a resource expenditure number of the source service resource and a resource conversion number of the target service resource;
the directed graph acquisition module is used for acquiring a service resource directed graph associated with the request time stamp based on the request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; the node connection edge is determined by a transaction resource pair which participates in resource conversion when the request time stamp is made; the edge connection impact value is determined by the consumption resources consumed for resource conversion of the transaction resource pair at the time of the request timestamp;
a path calculation module, configured to determine, in the service resource directed graph, the service conversion path from the path index start point to the path index end point by using, as a path index start point, a resource node that matches the source service resource, and using, as a path index end point, a resource node that matches the target service resource, and determine, based on the service conversion path, the resource payout amount, and the resource conversion amount, a resource conversion ratio and a target consumption resource that are associated with the service conversion path;
The data sending module is used for returning the resource conversion proportion, the service conversion path and the target consumption resource to the resource management client so that the resource management client can construct service conversion transaction for sending to the blockchain node equipment associated with the blockchain based on K resource nodes in the service conversion path; k is a positive integer greater than 2; the K resource nodes comprise the path index starting point and the path index ending point; the business conversion transaction is used for indicating the blockchain node equipment to input the business conversion path and the resource conversion proportion into the resource conversion contract when the resource conversion contract is called based on the target consumption resource, and the source business resource is converted into the target business resource through the resource conversion contract.
18. A blockchain-based data processing device, the device being operated by a resource management client, the device comprising:
the request determining module is used for determining a resource conversion request based on the resource expenditure quantity of the source service resource and the resource conversion quantity of the target service resource, and sending the resource conversion request to the resource conversion equipment; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
The data acquisition module is used for acquiring the resource conversion proportion, the service conversion path and the target consumption resource returned by the resource conversion equipment; the resource conversion device is configured to determine, in a service resource directed graph, a service conversion path from a path index start point to a path index end point by using a resource node that matches a source service resource as a path index start point and using a resource node that matches a target service resource as a path index end point, and determine, based on the service conversion path, the resource expenditure number, and the resource conversion number, a resource conversion ratio to the resource and the target consumption resource; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; the node connection edge is determined by a transaction resource pair which participates in resource conversion when the request time stamp is made; the edge connection impact value is determined by the consumption resources consumed for resource conversion of the transaction resource pair at the time of the request timestamp;
The transaction construction module is used for constructing and obtaining the business conversion transaction for being sent to the blockchain node equipment associated with the blockchain based on the K resource nodes in the business conversion path; k is a positive integer greater than 2; the K resource nodes comprise the path index starting point and the path index ending point; the business conversion transaction is used for indicating the blockchain node equipment to input the business conversion path and the resource conversion proportion into the resource conversion contract when the resource conversion contract is called based on the target consumption resource, and the source business resource is converted into the target business resource through the resource conversion contract.
19. A blockchain-based data processing apparatus, the apparatus being executable by a blockchain node device, the apparatus comprising:
the transaction acquisition module is used for acquiring business conversion transactions sent by the resource management client; the business conversion transaction is constructed based on K resource nodes in a business conversion path returned by a resource conversion device by a resource management client; k is a positive integer greater than 2; the K resource nodes comprise path index starting points and path index ending points; the resource conversion device is configured to determine, in a service resource directed graph, a service conversion path from a path index start point to a path index end point by using a resource node that matches a source service resource as a path index start point and using a resource node that matches a target service resource as a path index end point, and determine, based on the service conversion path, the resource expenditure number, and the resource conversion number, a resource conversion ratio to the resource and the target consumption resource; the service resource directed graph is determined based on a request time stamp corresponding to the resource conversion request; the service resource directed graph is determined by resource nodes, node connection edges and edge connection influence values; the resource node is determined by a transaction resource pair provided by a resource conversion platform for carrying out resource conversion; the node connection edge is determined by a transaction resource pair which participates in resource conversion when the request time stamp is made; the edge connection impact value is determined by the consumption resources consumed for resource conversion of the transaction resource pair at the time of the request timestamp; the resource conversion request is used for determining a service conversion path when the source service resource is converted into the target service resource;
And the resource conversion module is used for inputting the business conversion path and the resource conversion proportion into the resource conversion contract when the resource conversion contract deployed on the blockchain is called based on the target consumed resource, and converting the source business resource into the target business resource through the resource conversion contract.
20. A computer device comprising a memory and a processor;
the memory is connected to the processor, the memory is used for storing a computer program, and the processor is used for calling the computer program to enable the computer device to execute the method of any one of claims 1-16.
21. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program adapted to be loaded and executed by a processor to cause a computer device having the processor to perform the method of any of claims 1-16.
22. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the method of any of claims 1-16.
CN202311324136.3A 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment Pending CN117391854A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311324136.3A CN117391854A (en) 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311324136.3A CN117391854A (en) 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment

Publications (1)

Publication Number Publication Date
CN117391854A true CN117391854A (en) 2024-01-12

Family

ID=89436884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311324136.3A Pending CN117391854A (en) 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment

Country Status (1)

Country Link
CN (1) CN117391854A (en)

Similar Documents

Publication Publication Date Title
CN110443704B (en) Method and device for sending resources in cross-link mode
CN110175913B (en) Data processing system, method, computing device and storage medium based on block chain
CN109064146B (en) Digital currency transaction method, equipment, system, terminal and client wallet
EP4318362A1 (en) Blockchain-based data processing method, apparatus and device, and storage medium
CN109146484A (en) Common recognition verification method, digging mine machine and block catenary system based on block chain
CN109300038B (en) Resource flow transaction system
Dorsala et al. Fair payments for verifiable cloud services using smart contracts
CN110928951A (en) Data sharing and arbitration method based on block chain
CN108898440A (en) Flow exchanging method and device
CN108768672B (en) Data processing method, device and storage medium
CN109087105A (en) For digging the Hash Search method of mine, digging mine machine and block catenary system
CN113364831A (en) Multi-domain heterogeneous computing network resource credible cooperation method based on block chain
CN111311395B (en) Management system, method, equipment and storage medium for public accumulation fund-charging and repayment service
Xiao et al. Edgetoll: A blockchain-based toll collection system for public sharing of heterogeneous edges
JP6946066B2 (en) Gateway device, usage management system, usage control method and usage control program
CN112995167B (en) Kafka mechanism-based electricity consumption information acquisition method, blockchain network and user terminal
CN113362067B (en) Asynchronous consensus-based electric power transaction matching method and system
CN116055052A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN112699136B (en) Cross-link certificate storage method and related device
Kang et al. Stochastic modeling approaches for analyzing blockchain: A survey
CN109255614A (en) Digging mine method and device, digging mine machine and block catenary system based on block chain
CN111222885B (en) Data processing request endorsement method and device, computer equipment and storage medium
CN117391854A (en) Data processing method and device based on block chain and related equipment
CN113643011A (en) New energy automobile charging sharing system based on block chain
KR102159550B1 (en) Method for Providing Neutral Host Network Service using Block Chain, System And Apparatus Therefor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication