Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation. In addition, although the division of the functional blocks is made in the device diagram, in some cases, it may be divided in blocks different from those in the device diagram.
The embodiment of the application provides a transaction payment method, a transaction payment device, transaction payment equipment and a storage medium based on a block chain. The transaction payment method based on the block chain can be applied to terminal equipment or a server, and the terminal equipment can be electronic equipment such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and wearable equipment; the server may be a single server or a server cluster including a plurality of servers. The following explanation takes the application of the transaction payment method based on the blockchain to the server as an example.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a step of a transaction payment method based on a blockchain according to an embodiment of the present disclosure.
As shown in fig. 1, the block chain-based transaction payment method includes steps S101 to S105.
And step S101, acquiring a transaction request sent by a client, and verifying the transaction request.
The server is accessed into the blockchain network as a blockchain node, for example, the server is a distribution management node in the blockchain network. The blockchain network further comprises a plurality of service nodes, the distribution management node is used for performing distribution management on the transaction request sent by the client to distribute the transaction request to a target service node in the blockchain network, and the target service node is used for responding to the transaction request distributed by the distribution management node to complete a complete reimbursement process of the transaction request and complete a transaction.
It should be noted that the transaction request may include, but is not limited to, the requested information of the user's interest in moving funds, such as recharging, buying and selling, transferring, etc. For example, the transaction request may be request information for a user to recharge a certain amount of digital assets in a digital wallet; alternatively, the transaction request may be a request for information from the user to apply for a transfer to an outbound account. The transaction request of the embodiment of the application is not limited to the request of transaction circulation of legal currency, and also comprises the request of transaction circulation among non-real digital assets, such as virtual currency of Tadaemon USDT, TUSD and the like.
In one embodiment, the user generates the interest in the fund flow and causes the client to generate the transaction request through a triggering operation on the client. The client is, for example, a mobile phone or a PC computer, and the triggering operation is, for example, a click operation, a slide operation, a voice control operation, a verification operation, and the like, which is not limited in this embodiment. The transaction request generated by the client can be transmitted to the distribution management node through a preset Application Programming Interface (API), and the distribution management node can conveniently perform data interaction with the client through the API.
In one embodiment, the transaction request generated by the client is an encrypted transaction request. The transaction request carries a secret key and a merchant number, which may include a client identifier or a user identifier, and is one of the credentials for verifying the transaction request. The client encrypts the transaction request through a preset format, for example, concatenates the transaction requests in the form of key + vue, and encrypts the transaction request using an asymmetric algorithm, for example, an MD5 encryption algorithm and a key. It should be noted that the secret key is an independently set unique identification code, and the process of encrypting by the MD5 encryption algorithm is irreversible, so that the encrypted transaction request is difficult to crack, and the security of transaction payment is improved.
It can be understood that, after the distribution management node receives the encrypted transaction request, the encrypted transaction request needs to be decrypted and checked, for example, the encrypted transaction request is decrypted through a preset public key corresponding to the client, so as to obtain a plaintext of the transaction request. The transaction request may further include a plurality of items, such as the name of the transaction to be transacted, the category of the transaction, the number of the transaction, and the like. In the subsequent data interaction process of the transaction request and the related information thereof, for example, in the data interaction process of the distribution management node and the service node, the encrypted transaction request needs to be decrypted and checked, which is not described herein again.
In one embodiment, the distribution management node verifies the transaction request, including: and sending the transaction request to a plurality of service nodes in the block chain network so that the plurality of service nodes can verify the secret key and the merchant number in the transaction request. Specifically, each service node verifies the key and the merchant number in the transaction request, determines whether the key and the merchant number are correct, and obtains verification information; and the distribution management node determines the verification result of the transaction request according to the verification information sent by the plurality of service nodes. For example, when the number of the check information sent by the service nodes is greater than the preset number or the ratio is greater than the preset ratio, it is determined that the check result of the transaction request is passed, that is, the transaction request passes the check. The transaction request is verified through the service nodes in the block chain network, the transaction request is not needed to be verified through the distribution management node, the verification safety and fairness are improved, when the transaction request is not verified through the distribution management node, verification can be conducted through the service nodes near the distribution management node, and the feasibility is high.
And step S102, when the transaction request passes the verification, distributing the transaction request to a target service node in the block chain network according to a preset distribution rule.
After the transaction request is confirmed to pass the verification, the distribution management node records the transaction request, and distributes the transaction request to the target service node in the blockchain network according to the preset distribution rule so that the target service node can generate related collection information based on the transaction request, the cross-border transaction cost can be reduced, and the capital flow speed is increased. The transaction request is distributed according to the preset distribution rule, so that the response to the transaction request is quicker and the efficiency is higher.
In one embodiment, when the transaction request is verified, as shown in fig. 2, step S102 includes: substeps 1021 to substep S1022.
And a substep S1021, obtaining congestion information, reputation information and/or response speed of a plurality of service nodes in the block chain network.
The block chain network further comprises a plurality of service nodes, and the service nodes are used for receiving services corresponding to the transaction requests, such as receiving recharging services and transferring services. The congestion information is used for representing the access quantity of the transaction request, the credit information is used for representing the contract record of the service node responding to the transaction request, and the response speed is used for representing the duration of the service node responding to the transaction request.
It should be noted that the transaction requests that each service node can process within a period of time are limited, and when the access number of the transaction requests to be processed corresponding to one service node is larger, the number of queued transaction requests is larger, which indicates that the service node is more congested, and the congestion information of the service node is larger; when the business node processes the transaction request, disputes may be generated between the business node and a user who sends the transaction request, or complaints of the user are suffered, and when events which may violate the disputes, the complaints and the like occur on the business node, the credit information of the business node is influenced, and the higher the credit information of the business node is, the better the contract record of the business node responding to the transaction request is; the response speed of the service node is the time length required by the service node from the period of receiving the transaction request to the period of finishing the response (confirming collection) of the transaction request, namely the time length of the service node responding to the transaction request, and the faster the response speed of the service node is, the shorter the time length of the service node responding to the transaction request is, the better the effect is. After each service node completes a complete transaction service, the congestion information, the reputation information and/or the response speed and other related information are stored, so that the searching of the distribution management node and the intelligent distribution of the transaction request are facilitated.
And a substep S1022, selecting a target service node from the plurality of service nodes according to the congestion information, reputation information and/or response speed of the plurality of service nodes, and distributing the transaction request to the target service node.
The distribution management node can distribute the transaction request according to the congestion information of the service nodes, the service nodes with smaller congestion information have higher transaction request processing speed, the service nodes with higher credit information have better transaction request processing effect, and the service nodes with higher response speed have shorter transaction request processing time, so that the payment can be completed quickly.
In an embodiment, the service node corresponding to the minimum congestion information, the maximum reputation information and/or the minimum response speed in the plurality of service nodes is determined as the target service node, which is beneficial to ensuring the security of payment and quickly completing payment.
In another embodiment, priorities corresponding to the congestion information, the reputation information and the response speed are determined; selecting congestion information, credit information or response speed with higher priority as an influence factor; and selecting a target service node from the plurality of service nodes according to the influence factors. For example, if the priority corresponding to the response speed is the highest, the service node corresponding to the minimum response speed is selected to be determined as the target service node, so as to improve the timeliness of payment.
In one embodiment, a first preset coefficient corresponding to congestion information is determined, and a first score of each service node is calculated according to the first preset coefficient and the congestion information of a plurality of service nodes; determining a second preset coefficient corresponding to the credit information, and calculating a second score of each service node according to the second preset coefficient and the credit information of the plurality of service nodes; determining a third preset coefficient corresponding to the response speed, and calculating a third score of each service node according to the third preset coefficient and the response speeds of the plurality of service nodes; and selecting a target service node from the plurality of service nodes according to the first score, the second score and the third score of each service node. The first preset coefficient, the second preset coefficient and the third preset coefficient can be set according to actual conditions and can be positive numbers or negative numbers. And adding the first score, the second score and the third score of each service node, and selecting the service node with the lowest total score or the highest total score as a target service node, so that the distribution management node distributes the transaction request to the service node with high stability and efficiency, and payment transaction between the user and the service payment chain is facilitated.
Illustratively, the first preset coefficient is 0.5, the second preset coefficient is-0.3, and the third preset coefficient is 0.4, so that the traffic node with smaller congestion information has a higher speed of processing the transaction request, and the first score of each traffic node is less dominant; the higher the credit information is, the better the effect of the business node on processing the transaction request is, and the second preset coefficient is a negative number, so that the second score of each business node is small; the service node with higher response speed has shorter duration for processing the transaction request, and the third fraction of each service node is smaller; the total score of each service node is the sum of the first score, the second score and the third score, so that the service node with the lowest total score is selected as the target service node, and the payment transaction effect is good.
In an embodiment, when the performance parameter of the target service node is less than or equal to the preset performance parameter and the current duration of the target service node responding to the transaction request is greater than or equal to the preset duration, a new target service node is selected from the plurality of service nodes, and the transaction request is distributed to the new target service node. The performance parameter at least includes one of the operating speed of the CPU, the memory size, the disk write performance, the disk read performance, and the like, and the preset performance parameter and the preset duration may be flexibly set by the user, which is not specifically limited in this embodiment.
It should be noted that the set allocation rule includes that the distribution management node can switch any service node, which is beneficial to distributing and controlling the service to be traded. If the distribution management node dispatches the transaction request to the service system A, the service system A is found not to reach the preset performance parameters or the server is down, the processing of the service can be temporarily interrupted, and the service system B can be quickly switched to at the moment, so that the whole service of the distribution management node is not influenced and can be normally used.
In one embodiment, after the distribution management node distributes the transaction request to the target service node in the blockchain network, the target service node generates relevant collection information based on the transaction request. The collection information comprises a collection mode, a collection amount, a receiver, a collection account number, a collection address link and the like supported by the target service node, the collection mode comprises payment modes such as union pay, WeChat and Paibao, and the target service node also needs to return the generated collection information to the distribution management node.
And step S103, acquiring collection information returned by the target service node based on the transaction request, and generating a payment page according to the collection information.
And the distribution management node acquires the collection information returned by the target service node based on the transaction request, records the collection information, and then generates a payment page by utilizing the information such as collection mode, collection amount, a receiver, a collection account number, a collection address link and the like in the collection information. The data interaction between the distribution management node and the target service node is carried out based on the appointed application program interface API.
Step S104, sending the payment page to the client for the client to display the payment page, and responding to the payment operation of the user on the payment page to generate payment information.
The distribution management node returns the payment page to the client through a preset application program interface API, the client displays the payment page on the display interface, and generates payment information in response to payment operation of the user on the payment page. The payment information comprises a payment mode, a collection amount, a payer, payment time, a payment account number and the like, and the payment mode is the same as the collection mode supported by the target service node and comprises payment modes such as Unionpay, WeChat, Paibao and the like. The payment operation of the user on the payment page comprises a code scanning operation, a password input operation, a fingerprint code input operation, a face feature input operation and other payment operations.
Step S105, the payment information sent by the client is verified, when the payment information passes the verification, the balance information of the transaction request is generated, and the balance information is broadcasted in the block chain network.
The payment information comprises a transaction request, collection information and payment information, the transaction pool of the target service node records the payment information, the target service node can quickly know the complete payment process of the payment transaction through the payment information recorded in the transaction pool, effective recording is carried out when cross-border payment or recharging conversion between legal currency and digital assets is carried out, and the reasonability and the safety of asset circulation are guaranteed.
In one embodiment, the verifying the payment information sent by the client comprises: the distribution management node sends the payment information sent by the client to a plurality of service nodes in the block chain network, so that the plurality of service nodes can check the payment information. When the plurality of service nodes in the block chain network receive the payment information issued by the distribution management node, the payment information can be verified. Illustratively, each business node enters a bank transfer system through a network interface to verify a payment account contained in payment information, whether a collection account and a payment amount are correct, whether the payment account has enough payment amount, whether a target business node confirms collection and the like, and a verification result about the payment information is sent to a distribution management node, the distribution management node generates receipt and payment information of a transaction request when confirming that the payment information passes verification, and issues the receipt and payment information to a block chain network, so that the phenomena of fake payment information and fake payment information can be effectively avoided, and the security of transaction payment is improved.
Referring to fig. 3, fig. 3 is a schematic view of a scenario for implementing the transaction payment method based on the blockchain according to the embodiment.
As shown in fig. 3, a user sends a transaction request through a client 10, for example, the transaction request is transmitted to a distribution management node 20 through a preset application program interface API, the distribution management node 20 verifies the transaction request sent by the client 10, and when the transaction request passes the verification, the transaction request is distributed to a target service node 30 in a blockchain network according to a preset distribution rule, then the distribution management node 20 obtains collection information returned by the target service node 30 based on the transaction request, generates a payment page according to the collection information, and sends the payment page to the client 10, the client 10 displays the payment page, and generates payment information in response to a payment operation of the user on the payment page, then the client 10 sends the payment information to the distribution management node 20, and the distribution management node 20 verifies the payment information sent by the client 10, and when the payment information passes the verification, generating the balance information of the transaction request, and then broadcasting the balance information in the blockchain network.
The block chain-based transaction payment method provided in the above embodiment checks the transaction request sent by the client, and when the transaction request passes the check, distributes the transaction request to the target service node in the block chain network according to the preset distribution rule, then obtains the collection information returned by the target service node based on the transaction request, and generates the payment page according to the collection information, sends the payment page to the client for the client to display the payment page, and generates the payment information in response to the payment operation of the user on the payment page, then checks the payment information sent by the client, and when the payment information passes the check, generates the balance information of the transaction request, and then broadcasts the balance information in the block chain network, so that each node in the block chain network records the balance information of the transaction request, and the payment of the money can be completed quickly through the related technology of the block chain, the method avoids a plurality of limitations of a transit bank, simultaneously stores the receipt and payment information on the block chain, is decentralized, can track whether the money is in place in real time, has extremely high safety, and can not be tampered with.
Referring to fig. 4, fig. 4 is a schematic block diagram of a transaction payment device based on a blockchain according to an embodiment of the present disclosure.
As shown in fig. 4, the blockchain-based transaction payment apparatus 200 is applied to a distribution management node in a blockchain network, and the blockchain-based transaction payment apparatus 200 includes:
an obtaining module 201, configured to obtain a transaction request sent by a client;
a verification module 202, configured to verify the transaction request;
the distribution module 203 is configured to distribute the transaction request to a target service node in the blockchain network according to a preset distribution rule when the transaction request passes the verification;
the obtaining module 201 is further configured to obtain collection information returned by the target service node based on the transaction request;
the generating module 204 is configured to generate a payment page according to the payment information;
a sending module 205, configured to send the payment page to the client, so that the client displays the payment page, and generates payment information in response to a payment operation performed on the payment page by a user;
the verification module 202 is further configured to verify the payment information sent by the client;
the generating module 204 is further configured to generate the balance information of the transaction request when the payment information passes the verification;
a broadcasting module 206, configured to broadcast and publish the balance information in the blockchain network.
In one embodiment, as shown in FIG. 5, the distribution module 203 comprises:
the obtaining sub-module 2031 is configured to obtain congestion information, reputation information, and/or response speed of a plurality of service nodes in the block chain network;
a distributing submodule 2032, configured to select a target service node from the multiple service nodes according to congestion information, reputation information, and/or response speed of the multiple service nodes, and distribute the transaction request to the target service node;
the congestion information is used for representing the access quantity of the transaction request, the reputation information is used for representing the contract record of the service node responding to the transaction request, and the response speed is used for representing the duration of the service node responding to the transaction request.
In one embodiment, the distribution submodule 2032 is further configured to:
and determining the service node corresponding to the minimum congestion information, the maximum reputation information and/or the minimum response speed in the plurality of service nodes as a target service node.
In one embodiment, the distribution submodule 2032 is further configured to:
determining a first preset coefficient corresponding to the congestion information, and calculating a first score of each service node according to the first preset coefficient and the congestion information of a plurality of service nodes;
determining a second preset coefficient corresponding to the credit information, and calculating a second score of each service node according to the second preset coefficient and the credit information of a plurality of service nodes;
determining a third preset coefficient corresponding to the response speed, and calculating a third score of each service node according to the third preset coefficient and the response speeds of a plurality of service nodes;
and selecting a target service node from the plurality of service nodes according to the first score, the second score and the third score of each service node.
In one embodiment, the distribution module 203 is further configured to:
and when the performance parameter of the target service node is less than or equal to a preset performance parameter and the current duration of the target service node responding to the transaction request is greater than or equal to a preset duration, selecting a new target service node from the plurality of service nodes and distributing the transaction request to the new target service node.
In one embodiment, the balance information includes the transaction request, receipt information and payment information, and the balance information is recorded in a transaction pool of the target service node.
In one embodiment, the verification module 202 is further configured to:
and sending the transaction request to a plurality of service nodes in the block chain network so that the service nodes can verify the secret key and the merchant number in the transaction request.
It should be noted that, as will be clearly understood by those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus and the modules and units described above may refer to the corresponding processes in the embodiment of the transaction payment method based on the block chain, and are not described herein again.
The apparatus provided by the above embodiments may be implemented in the form of a computer program, which can be run on a computer device as shown in fig. 6.
Referring to fig. 6, fig. 6 is a schematic block diagram illustrating a structure of a computer device according to an embodiment of the present disclosure. The computer device may be a server or a terminal device.
As shown in fig. 6, the computer device includes a processor, a memory, and a network interface connected by a system bus, wherein the memory may include a nonvolatile storage medium and an internal memory.
The non-volatile storage medium may store an operating system and a computer program. The computer program includes program instructions that, when executed, cause a processor to perform any one of blockchain based transaction payment methods.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for the execution of a computer program on a non-volatile storage medium, which when executed by the processor, causes the processor to perform any one of the blockchain based transaction payment methods.
The network interface is used for network communication, such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring a transaction request sent by a client, and verifying the transaction request;
when the transaction request passes the verification, distributing the transaction request to a target service node in the block chain network according to a preset distribution rule;
acquiring collection information returned by the target service node based on the transaction request, and generating a payment page according to the collection information;
sending the payment page to the client for the client to display the payment page, and responding to the payment operation of the user on the payment page to generate payment information;
and verifying the payment information sent by the client, generating the balance information of the transaction request when the payment information passes the verification, and broadcasting the balance information in the block chain network.
In one embodiment, the processor, when implementing the distributing the transaction request to the target service node in the blockchain network according to the preset distribution rule, is configured to implement:
acquiring congestion information, reputation information and/or response speed of a plurality of service nodes in the block chain network;
selecting a target service node from the plurality of service nodes according to the congestion information, the reputation information and/or the response speed of the plurality of service nodes, and distributing the transaction request to the target service node;
the congestion information is used for representing the access quantity of the transaction request, the reputation information is used for representing the contract record of the service node responding to the transaction request, and the response speed is used for representing the duration of the service node responding to the transaction request.
In one embodiment, the processor, when implementing the selecting the target service node from the plurality of service nodes according to the congestion information, the reputation information and/or the response speed of the plurality of service nodes, is configured to implement:
and determining the service node corresponding to the minimum congestion information, the maximum reputation information and/or the minimum response speed in the plurality of service nodes as a target service node.
In one embodiment, the processor, when implementing the selecting the target service node from the plurality of service nodes according to the congestion information, the reputation information and/or the response speed of the plurality of service nodes, is configured to implement:
determining a first preset coefficient corresponding to the congestion information, and calculating a first score of each service node according to the first preset coefficient and the congestion information of a plurality of service nodes;
determining a second preset coefficient corresponding to the credit information, and calculating a second score of each service node according to the second preset coefficient and the credit information of a plurality of service nodes;
determining a third preset coefficient corresponding to the response speed, and calculating a third score of each service node according to the third preset coefficient and the response speeds of a plurality of service nodes;
and selecting a target service node from the plurality of service nodes according to the first score, the second score and the third score of each service node.
In one embodiment, the processor is further configured to implement:
and when the performance parameter of the target service node is less than or equal to a preset performance parameter and the current duration of the target service node responding to the transaction request is greater than or equal to a preset duration, selecting a new target service node from the plurality of service nodes and distributing the transaction request to the new target service node.
In one embodiment, the balance information includes the transaction request, receipt information and payment information, and the balance information is recorded in a transaction pool of the target service node.
In one embodiment, the processor, in performing the verifying the transaction request, is configured to perform:
and sending the transaction request to a plurality of service nodes in the block chain network so that the service nodes can verify the secret key and the merchant number in the transaction request.
It should be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the computer device described above may refer to the corresponding process in the foregoing embodiment of the transaction payment method based on the blockchain, and details are not described herein again.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed, a method implemented by the computer-readable storage medium may refer to various embodiments of the block chain based transaction payment method of the present application.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, 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 memory Card (Flash Card), and the like provided on the computer device.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.