Disclosure of Invention
The present invention is directed to solving the above problems.
The invention mainly aims to provide a hardware wallet digital currency selection method.
It is another object of the present invention to provide a hardware wallet.
In order to achieve the purpose, the technical scheme of the invention is realized as follows: a hardware wallet digital currency selection method, comprising: acquiring a payment amount; judging whether all digital currencies stored in the storage device exist digital currencies or digital currency combinations with usable amounts more than or equal to payment amounts, wherein the digital currencies comprise: an initial digital currency; and/or, the digital currency comprises: an initial digital currency and at least one payment data chain; under the condition that all the digital currencies stored in the internal storage are judged to have the digital currency or the digital currency combination with the available amount being more than or equal to the payment amount, all the digital currencies or the digital currency combinations meeting the condition that the available amount is more than or equal to the payment amount are obtained; calculating the transaction time of each digital currency or digital currency combination meeting the condition that the available amount is greater than or equal to the payment amount, wherein the transaction time comprises the following steps: transmitting the sum of the time spent on the digital currency combination, the time spent on signing the digital currency combination and the time spent on verifying the signature of the digital currency combination by the opposite-end device; determining the digital currency or the combination of the digital currencies with the transaction time meeting the preset conditions as the currency to be output; and outputting the money to be output.
Further, the judging whether there is a digital money or a combination of digital money whose usable amount is equal to or greater than the payment amount among all the digital money stored inside includes: determining whether an available amount of a digital currency is greater than or equal to a payment amount; and/or determining whether a combination of the available amounts of the plurality of digital currencies is greater than or equal to the payment amount.
In addition, before obtaining the payment amount, the method further comprises the following steps: setting basic information parameters, wherein the basic information parameters comprise: time spent transmitting the initial digital currency mX, time spent transmitting a payment data chain X, time spent calculating a signature B, and time spent verifying a signature C.
In addition, the step of determining that the transaction time meets the preset condition or the combination of the digital currencies into the currency to be output comprises the following steps: and comparing the transaction time with a threshold time calculated according to the basic information parameters, determining that the transaction time meets a preset condition under the condition that the transaction time is less than the threshold time, and taking the digital currency or the digital currency combination meeting the preset condition as the currency to be output.
In addition, the step of determining that the digital currency or the combination of the digital currencies with the transaction time meeting the preset conditions is the currency to be output comprises the following steps: and determining the digital currency or the combination of the digital currencies which have the shortest transaction time, the minimum payment data chain and the closest available amount to the payment amount to be output as the currency to be output.
In another aspect, the present invention provides a hardware wallet, comprising: the system comprises a transaction amount acquisition module, a judgment module, an acquisition digital currency or digital currency combination module, a calculation module, a determination module and an output module; wherein: the transaction amount acquisition module is used for acquiring payment amount; the judging module is used for judging whether all the internally stored digital currencies have digital currencies or digital currency combinations with usable amounts greater than or equal to payment amounts, wherein the digital currencies comprise: an initial digital currency; and/or, the digital currency comprises: an initial digital currency and at least one payment data chain; the digital currency or digital currency combination module is used for acquiring all digital currencies or digital currency combinations meeting the condition that the available amount is greater than or equal to the payment amount under the condition that all the internally stored digital currencies are judged to have the digital currency or digital currency combination with the available amount greater than or equal to the payment amount; the calculating module is used for calculating the transaction time of each digital currency or digital currency combination meeting the condition that the available amount is greater than or equal to the payment amount, wherein the transaction time comprises the following steps: transmitting the sum of the time spent on the digital currency combination, the time spent on signing the digital currency combination and the time spent on verifying the signature of the digital currency combination by the opposite-end device; the determining module is used for determining that the digital currency or the digital currency combination with the transaction time meeting the preset conditions is the currency to be output; and the output module is used for outputting the money to be output.
In addition, the judging module judges whether all the internally stored digital currencies have the digital currency or the digital currency combination with the available amount greater than or equal to the payment amount by the following method: determining whether an available amount of a digital currency is greater than or equal to a payment amount; and/or determining whether a combination of the available amounts of the plurality of digital currencies is greater than or equal to the payment amount.
In addition, the method further comprises the following steps: setting a module; the setting module is used for setting basic information parameters, wherein the basic information parameters comprise: time spent transmitting the initial digital currency mX, time spent transmitting a payment data chain X, time spent calculating a signature B, and time spent verifying a signature C.
In addition, the determining module determines that the transaction time meets the preset condition that the digital currency or the digital currency combination is the currency to be output by the following means: and comparing the transaction time with a threshold time calculated according to the basic information parameters, determining that the transaction time meets a preset condition under the condition that the transaction time is less than the threshold time, and taking the digital currency or the digital currency combination meeting the preset condition as the currency to be output.
In addition, the determining module determines that the digital currency or the digital currency combination with the transaction time meeting the preset conditions is the currency to be output by the following means: and determining the digital currency or the combination of the digital currencies which have the shortest transaction time, the minimum payment data chain and the closest available amount to the payment amount to be output as the currency to be output.
According to the technical scheme provided by the invention, the invention provides the hardware wallet digital currency selection method and the hardware wallet, and the transaction time is calculated after the digital currency or the digital currency combination with the payment amount larger than or equal to the digital currency or the digital currency combination stored in the hardware wallet is judged, and the digital currency or the digital currency combination with the transaction time meeting the preset condition is determined to be the currency to be output and output. Through the selection process of the digital currency or the digital currency combination, the digital currency or the digital currency combination with the shortest transaction time suitable for transaction can be selected, so that the problems of long transaction time and low transaction efficiency caused by a plurality of payment data chains when the transaction is completed by using the digital currency in the hardware wallet in an offline state are solved, and the use feeling of a user using the hardware wallet in the offline state is improved.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used only for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or quantity or location.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Example 1
The present embodiment provides a hardware wallet 100, and the hardware wallet 100 can complete a transaction process using digital money with other hardware wallets or money receiving devices in an offline state.
The following provides a hardware wallet digital currency selecting method, which can be applied in a scenario that a hardware wallet completes a transaction flow using digital currency with other hardware wallets or money receiving devices in an offline state (i.e. in an non-networking state). Specifically, the method includes the following steps (S101-S):
s101, obtaining payment amount;
in this step, the payment amount may be obtained through a terminal used in cooperation with the hardware wallet, and the terminal sends the payment amount to the hardware wallet through a non-networking manner such as a short-distance communication manner or a medium-distance and long-distance communication manner, or the hardware wallet directly obtains the payment amount through an input of the user on the hardware wallet, which is not limited in this embodiment.
In an optional implementation manner of this embodiment, before acquiring the payment amount, the method further includes: setting basic information parameters, wherein the basic information parameters comprise: time spent transmitting the initial digital currency mX, time spent transmitting a payment data chain X, time spent calculating a signature B, and time spent verifying a signature C. In this alternative embodiment, after setting the basic information parameters, the calculation process of the transaction time is more convenient.
S102, judging whether all the digital currencies stored in the machine have digital currencies or digital currency combinations with usable amounts more than or equal to payment amounts, wherein the digital currencies comprise: an initial digital currency; and/or, the digital currency comprises: an initial digital currency and at least one payment data chain.
In this embodiment, if there is no digital currency or combination of digital currencies with an amount greater than or equal to the payment amount, the sum of all currencies in the hardware wallet is not enough to satisfy the payment amount, and the transaction can be further selected to be ended, thereby improving the transaction efficiency. When the digital currency can be settled in a network, the digital currency does not contain a payment data chain, and in the off-line transaction process, because the online real-time settlement cannot be realized, a payment data chain can be generated, so that the security of the off-line transaction of the digital currency is improved. In an offline transaction scenario, the digital currency that has not participated in the offline transaction includes an initial digital currency, no payment data chain, and the data currency that has participated in the offline transaction includes the initial currency and at least one payment data chain.
S103, when all the digital currencies stored in the machine are judged to have the digital currency or the digital currency combination with the available amount being more than or equal to the payment amount, all the digital currencies or the digital currency combinations meeting the condition that the available amount is more than or equal to the payment amount are acquired.
In an optional implementation manner of this embodiment, the determining whether there is any digital currency or combination of digital currencies of which the usable amount is equal to or greater than the payment amount in all the internally stored digital currencies includes: determining whether an available amount of a digital currency is greater than or equal to a payment amount; and/or determining whether a combination of the available amounts of the plurality of digital currencies is greater than or equal to the payment amount.
In this embodiment, the digital currency or the combination of the digital currencies, of which the available amount is greater than or equal to the payment amount, is selected, and the transaction time when the digital currency is used for participating in the transaction can be further calculated, so that whether the digital currency is used for participating in the transaction can be determined, and the transaction efficiency can be improved.
S104, calculating the transaction time of each digital currency or digital currency combination meeting the condition that the available amount is greater than or equal to the payment amount, wherein the transaction time comprises the following steps: the sum of the time spent transmitting the digital currency combination, the time spent signing the digital currency combination, and the time spent verifying the signature of the digital currency combination by the peer device.
The following briefly describes how the hardware wallet selects digital currency or a combination of digital currencies in the case of different payment amounts, where the hardware wallet has digital currencies with amounts of 1, 2, 5, 7, 10, 13, and 15, and the selection process of the hardware wallet digital currencies in the above embodiments is taken as an example.
(1) The payment amount is 13;
the obtained payment amount is 13, and all digital currencies meeting the payment amount condition are as follows: 13. 15; the digital currency combination is as follows: {1, 2, 5, 7}, {2, 5, 7, 10}, … … {1, 15 }. After all the digital currency or the digital currency combination meeting the available amount and larger than or equal to the payment condition are obtained, the transaction time of each digital currency or digital currency combination meeting the condition is further calculated, and then the currency to be output is determined according to the transaction time and is output.
(2) The payment amount is 100
The obtained payment amount is 100, and the digital currency or the digital currency combination with the available amount larger than or equal to the payment amount does not exist in all the internally stored digital currencies, so that the transaction can be further selected to be ended.
And S105, determining the digital currency or the digital currency combination with the transaction time meeting the preset conditions as the currency to be output.
In an optional implementation manner of this embodiment, determining that the transaction time meets the preset condition includes: and comparing the transaction time with a threshold time calculated according to the basic information parameters, determining that the transaction time meets a preset condition under the condition that the transaction time is less than the threshold time, and taking the digital currency or the digital currency combination meeting the preset condition as the currency to be output. In the optional embodiment, the transaction time is compared with the threshold time to obtain the digital currency or the digital currency combination meeting the preset condition, so that the digital currency or the digital currency combination with overlong transaction time is prevented from participating in the transaction, and the transaction efficiency is improved.
In an optional implementation manner of this embodiment, determining that the digital currency or the combination of digital currencies whose transaction time meets the preset condition is the currency to be output includes: and determining the digital currency or the combination of the digital currencies which have the shortest transaction time, the minimum payment data chain and the closest available amount to the payment amount to be output as the currency to be output. In this optional embodiment, in order to increase the data transmission speed of the off-line transaction, when the digital money is transmitted, the digital money with small data volume is preferably used for the transaction, so the hardware wallet uses as little digital money as possible to participate in the transaction, preferably uses no payment data chain and uses less digital money to participate in the transaction, and improves the transaction efficiency.
And S106, outputting the money to be output.
By the method for selecting the digital currency of the hardware wallet provided by the embodiment, after the digital currency or the combination of the digital currencies stored in the hardware wallet is judged to have the digital currency or the combination of the digital currencies larger than or equal to the payment amount, the transaction time is calculated, and the digital currency or the combination of the digital currencies with the transaction time meeting the preset conditions is determined to be the currency to be output and output. Through the selection process of the digital currency or the digital currency combination, the digital currency or the digital currency combination with the shortest transaction time suitable for transaction can be selected, so that the problems of long transaction time and low transaction efficiency caused by a plurality of payment data chains when the transaction is completed by using the digital currency in the hardware wallet in an offline state are solved, and the use feeling of a user using the hardware wallet in the offline state is improved.
Example 2
The present embodiment provides a hardware wallet 200, and the hardware wallet 200 can implement the hardware wallet digital currency selecting method provided in embodiment 1. The structure of the hardware wallet 200 is only briefly described in this embodiment, and for other matters, reference is made to the description in embodiment 1.
As shown in fig. 2, the hardware wallet 200 includes: a transaction amount acquisition module 201, a judgment module 202, an acquisition digital currency or digital currency combination module 203, a calculation module 204, a determination module 205 and an output module 206; wherein:
a transaction amount obtaining module 201, configured to obtain a payment amount;
a determining module 202, configured to determine whether there is any digital currency or combination of digital currencies with an available amount greater than or equal to a payment amount in all digital currencies stored inside, where the digital currencies include: an initial digital currency; and/or, the digital currency comprises: an initial digital currency and at least one payment data chain;
an acquiring digital currency or digital currency combination module 203, configured to acquire all digital currencies or digital currency combinations satisfying a condition that an available amount is equal to or greater than a payment amount, in a case where it is determined that there are digital currencies or digital currency combinations of which available amounts are equal to or greater than the payment amount in all internally stored digital currencies;
a calculating module 204, configured to calculate a transaction time of each digital currency or digital currency combination satisfying the condition that the available amount is greater than or equal to the payment amount, where the transaction time includes: transmitting the sum of the time spent on the digital currency combination, the time spent on signing the digital currency combination and the time spent on verifying the signature of the digital currency combination by the opposite-end device;
the determining module 205 is configured to determine that the digital currency or the combination of digital currencies with transaction time meeting the preset condition is the currency to be output;
and the output module 206 is used for outputting the money to be output.
As an optional implementation manner in this embodiment, the determining module 202 determines whether there is any digital currency or digital currency combination with an available amount greater than or equal to the payment amount in all the digital currencies stored inside by: determining whether an available amount of a digital currency is greater than or equal to a payment amount; and/or determining whether a combination of the available amounts of the plurality of digital currencies is greater than or equal to the payment amount.
As an optional implementation manner in this embodiment, the hardware wallet of this embodiment further includes: a setup module (not shown); the setting module is used for setting basic information parameters, wherein the basic information parameters comprise: time spent transmitting the initial digital currency mX, time spent transmitting a payment data chain X, time spent calculating a signature B, and time spent verifying a signature C.
As an optional implementation manner in this embodiment, the determining module 205 determines that the transaction time meets the preset condition or the combination of the digital currencies is the currency to be output by: and comparing the transaction time with a threshold time calculated according to the basic information parameters, determining that the transaction time meets a preset condition under the condition that the transaction time is less than the threshold time, and taking the digital currency or the digital currency combination meeting the preset condition as the currency to be output.
As an optional implementation manner in this embodiment, the determining module 205 determines that the digital currency or the combination of digital currencies whose transaction time meets the preset condition is the currency to be output by: and determining the digital currency or the combination of the digital currencies which have the shortest transaction time, the minimum payment data chain and the closest available amount to the payment amount to be output as the currency to be output.
With the hardware wallet 200 provided in this embodiment, when a transaction is performed using digital money stored therein, after it is determined that digital money or a combination of digital money equal to or larger than a payment amount exists in the digital money stored in the hardware wallet, a transaction time is calculated, and it is determined that the digital money or the combination of digital money whose transaction time meets a preset condition is the money to be output, and the money is output. Through the selection process of the digital currency or the digital currency combination, the digital currency or the digital currency combination with the shortest transaction time suitable for transaction can be selected, so that the problems of long transaction time and low transaction efficiency caused by a plurality of payment data chains when the transaction is completed by using the digital currency in the hardware wallet in an offline state are solved, and the use feeling of a user using the hardware wallet in the offline state is improved.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware that is related to instructions of a program, and the program may be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a separate product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made in the above embodiments by those of ordinary skill in the art without departing from the principle and spirit of the present invention. The scope of the invention is defined by the appended claims and equivalents thereof.