Transaction fee payment method, device and storage medium based on block chain

文档序号:1817383 发布日期:2021-11-09 浏览:6次 中文

阅读说明:本技术 一种基于区块链的交易费支付方法、设备及储存介质 (Transaction fee payment method, device and storage medium based on block chain ) 是由 应秋敏 王志文 吴思进 于 2021-09-03 设计创作,主要内容包括:本发明属于计算机技术领域,尤其涉及一种基于区块链的交易费支付方法、设备及储存介质。本发明提供的方法通过发布可兑换代币组,在交易执行时,若交易费扣除账户内没有足够的原生代币而存在别的类型的代币资产,则可以实现自动兑换足额的原生代币作为交易费,交易可以继续执行,此过程自动兑换,发起链上任何交易,都不再需要关心原生币种余额是否够用,只需要持有资产,都可以自动兑换成相应的手续费交易,减少交易次数,降低了多次交易的手续费消耗。原来要先换手续费,再交易。现在交易的时候自动兑换,减少了一次交易,节省了手续费。(The invention belongs to the technical field of computers, and particularly relates to a transaction fee payment method based on a block chain, equipment and a storage medium. The method provided by the invention can realize automatic exchange of the full-amount original token as the transaction fee if the transaction fee deduction account does not have enough original token and other types of token assets exist during the transaction execution by issuing the exchangeable token group, the transaction can be continuously executed, the process is automatically exchanged, any transaction on a chain is initiated, whether the balance of the original currency is enough or not is not needed to be concerned, and the corresponding commission transaction can be automatically exchanged only by holding the asset, so that the transaction frequency is reduced, and the commission consumption of multiple transactions is reduced. Originally, the transaction is carried out after the charge is replaced. The automatic exchange is carried out when the transaction is carried out, so that one transaction is reduced, and the commission charge is saved.)

1. A blockchain based transaction fee payment method for a decentralized exchange, for issuing a set of redeemable tokens in a blockchain network of the decentralized exchange, the set of redeemable tokens including token types for which a blockchain system of the decentralized exchange supports redemption with native tokens, the method comprising:

when transaction execution needs to be deducted, whether enough original tokens exist in a transaction fee deduction account or not is judged, if not, the transaction fee deduction account is traversed to judge whether token types contained in an exchangeable token group exist or not, if so, the token types are recorded to obtain a first token type group, real-time prices of transaction pairs consisting of the token types in the first token type group and the original tokens are obtained, the amount of the tokens belonging to the token types in the first token type group in the transaction fee deduction account is calculated to be converted into the amount of the original tokens, whether the amount of the tokens is larger than the transaction fee or not is judged, if so, the type of the tokens to be exchanged is determined, the amount of the tokens of the type to be exchanged required by the transaction fee is calculated according to the prices of the transaction pairs consisting of the types to be exchanged and the original tokens, the original tokens are exchanged by using the tokens of the tokens to be exchanged, and the transaction fee is deducted, the transaction continues to be executed.

2. The blockchain-based transaction fee payment method of claim 1, wherein when there are a plurality of token types to be exchanged satisfying a requirement, the priority is ranked according to liquidity of the token types.

3. A computer device, characterized by one or more processors;

a memory for storing one or more programs,

the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in claim 1 or 2.

4. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to claim 1 or 2.

Technical Field

The invention belongs to the technical field of computers, and particularly relates to a transaction fee payment method based on a block chain, equipment and a storage medium.

Background

The block chain technology is a distributed book technology, and can store transaction data in a non-falsifiable block and connect the blocks in series according to a time sequence to form a block chain. In a narrow sense, the block chain is a chain data structure formed by combining data blocks in a sequential connection mode according to a time sequence, and is a distributed account book which is guaranteed in a cryptology mode and cannot be tampered and forged; broadly, the blockchain technique is a completely new distributed infrastructure and computing approach that utilizes blockchain data structures to verify and store data, utilizes distributed node consensus algorithms to generate and update data, utilizes cryptography to secure data transmission and access, and utilizes intelligent contracts composed of automated script code to program and manipulate data.

At present, a plurality of decentralized trading exchanges constructed based on intelligent contracts exist, in the existing decentralized trading exchanges, the original currency is needed to be used as a commission charge to initiate the trading, the trading needs to be exchanged in advance, but the trading fails to be executed when the trading fee is insufficient, so that a user needs to exchange before the trading to ensure the smooth execution of the trading.

Therefore, a transaction fee payment method supporting multiple currencies, simplifying transaction process and reducing operation difficulty is needed.

Disclosure of Invention

In order to achieve the purpose, the invention provides a transaction fee payment method, equipment and a storage medium based on a block chain, which can support multi-currency handling fee payment interfaces, simplify the transaction process and reduce the operation difficulty.

The invention adopts the following technical scheme.

In a first aspect, a blockchain-based transaction fee payment method is provided, which is suitable for a decentralized exchange and issues a exchangeable token group in a blockchain network of the decentralized exchange, where the exchangeable token group includes token types that a plurality of decentralized exchange blockchain systems support exchange with native tokens, and the method includes:

when transaction execution needs to be deducted, whether enough original tokens exist in a transaction fee deduction account or not is judged, if not, the transaction fee deduction account is traversed to judge whether token types contained in an exchangeable token group exist or not, if so, the token types are recorded to obtain a first token type group, real-time prices of transaction pairs consisting of the token types in the first token type group and the original tokens are obtained, the amount of the tokens belonging to the token types in the first token type group in the transaction fee deduction account is calculated to be converted into the amount of the original tokens, whether the amount of the tokens is larger than the transaction fee or not is judged, if so, the type of the tokens to be exchanged is determined, the amount of the tokens of the type to be exchanged required by the transaction fee is calculated according to the prices of the transaction pairs consisting of the types to be exchanged and the original tokens, the original tokens are exchanged by using the tokens of the tokens to be exchanged, and the transaction fee is deducted, the transaction continues to be executed.

Preferably, when there are a plurality of types of tokens to be exchanged that satisfy the requirement, the priority ranking is performed according to liquidity of the types of tokens.

In a second aspect, a computer device is provided, comprising one or more processors;

a memory for storing one or more programs,

the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method as described in the first aspect above.

In a third aspect, there is provided a storage medium storing a computer program which, when executed by a processor, implements the method as described in the first aspect above.

The invention has the advantages that by issuing the exchangeable token group, when the transaction is executed, if the transaction fee deduction account does not have enough original tokens and other types of token assets exist, the original tokens with full exchange amount can be automatically used as the transaction fee, the transaction can be continuously executed, the process is automatically exchanged, any transaction on the chain is initiated, whether the balance of the original currency is enough or not is not needed to be concerned, the corresponding commission transaction can be automatically exchanged only by holding the tokens, the transaction frequency is reduced, and the commission consumption of multiple transactions is reduced. Originally, the transaction is carried out after the charge is replaced. The automatic exchange is carried out when the transaction is carried out, so that one transaction is reduced, and the commission charge is saved.

Drawings

Fig. 1 is a schematic structural diagram of a computer device according to embodiment 2 of the present invention.

Detailed Description

The invention is described in further detail below with reference to specific embodiments and the attached drawing figures. Those skilled in the art will be able to implement the invention based on these teachings. Moreover, the embodiments of the present invention described in the following description are generally only some embodiments of the present invention, and not all embodiments. Therefore, all other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative effort shall fall within the protection scope of the present invention. Unless otherwise specified, the methods described in the examples of the present invention are all those known to those skilled in the art.

Example 1

The embodiment provides a transaction fee payment method based on a blockchain, which is suitable for a decentralized exchange and issues a convertible token group in a blockchain network of the decentralized exchange, wherein the convertible token group comprises token types which are supported by a plurality of decentralized exchange blockchain systems to be converted with original tokens, and the method comprises the following steps:

when transaction execution needs to be deducted, whether enough original tokens exist in a transaction fee deduction account or not is judged, if not, the transaction fee deduction account is traversed to judge whether token types contained in an exchangeable token group exist or not, if so, the token types are recorded to obtain a first token type group, real-time prices of transaction pairs consisting of the token types in the first token type group and the original tokens are obtained, the amount of the tokens belonging to the token types in the first token type group in the transaction fee deduction account is calculated to be converted into the amount of the original tokens, whether the amount of the tokens is larger than the transaction fee or not is judged, if so, the type of the tokens to be exchanged is determined, the amount of the tokens of the type to be exchanged required by the transaction fee is calculated according to the prices of the transaction pairs consisting of the types to be exchanged and the original tokens, the original tokens are exchanged by using the tokens of the tokens to be exchanged, and the transaction fee is deducted, the transaction continues to be executed.

Further, when there are a plurality of types of tokens to be exchanged that satisfy the requirement, the priority ranking is performed according to liquidity of the types of tokens.

The principle of the embodiment is that the exchangeable token type is defined by issuing the exchangeable token group, whether sufficient original tokens are available as transaction fees is judged when the transaction is executed until the transaction is required, if not, the original tokens are exchanged through other exchangeable token types in the account, and the transaction fees are paid by exchanging the original tokens according to the real-time exchange price. The method has the advantages that the automatic exchange is carried out in the process, any transaction on the chain is initiated, whether the balance of the original currency is sufficient or not is not needed to be concerned, and the transaction can be automatically exchanged into corresponding commission transaction only by holding the asset, so that the transaction frequency is reduced, and the commission consumption of multiple transactions is reduced. Originally, the transaction is carried out after the charge is replaced. The automatic exchange is carried out when the transaction is carried out, so that one transaction is reduced, and the commission charge is saved.

Example 2

A computer device, the device comprising: one or more processors; memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to perform the method of embodiment 1.

A storage medium storing a computer program which, when executed by a processor, implements the method as described in embodiment 1 above.

Fig. 1 is a schematic structural diagram of an apparatus provided in this embodiment.

As shown in fig. 1, as another aspect, the present application also provides a computer apparatus 500 including one or more Central Processing Units (CPUs) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the apparatus 500 are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.

The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication via a network such as the internet, and the processing driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.

In particular, according to the embodiments disclosed in the present application, the method described in the above embodiment 1 may be implemented as a computer software program. For example, embodiments disclosed herein include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method described in any of the embodiments above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511.

As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described herein.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.

The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种区块链匿名红包发送方法、设备及储存介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!