WO2022148199A1 - 一种硬件钱包数字货币选取方法及硬件钱包 - Google Patents
一种硬件钱包数字货币选取方法及硬件钱包 Download PDFInfo
- Publication number
- WO2022148199A1 WO2022148199A1 PCT/CN2021/136241 CN2021136241W WO2022148199A1 WO 2022148199 A1 WO2022148199 A1 WO 2022148199A1 CN 2021136241 W CN2021136241 W CN 2021136241W WO 2022148199 A1 WO2022148199 A1 WO 2022148199A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- digital currency
- digital
- amount
- module
- currency
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 230000001960 triggered effect Effects 0.000 claims description 12
- 238000012795 verification Methods 0.000 claims description 2
- 230000005540 biological transmission Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000010187 selection method Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/30—Payment architectures, schemes or protocols characterised by the use of specific devices or networks
- G06Q20/36—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
- G06Q20/367—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Definitions
- the invention relates to the field of electronic technology, in particular to a method for selecting digital currency in a hardware wallet and a hardware wallet.
- the present invention aims to solve the above-mentioned problems.
- One aspect of the present invention provides a method for selecting digital currency in a hardware wallet, including: S1, obtaining a payment amount; S2, arranging the stored digital currency according to the available amount in descending order, wherein the digital currency includes: an initial digital currency; and /or, the digital currency includes: an initial digital currency and at least one payment data chain; S3, determine whether there is at least one digital currency with an available amount greater than or equal to the payment amount, if it exists, execute step S4, if not, execute step S9; S4 , obtain all digital currencies greater than or equal to the payment amount, and determine whether each digital currency in all digital currencies contains a payment data chain. If there is a digital currency that does not include a payment data chain, execute S5.
- For digital currency execute S6S5, obtain the digital currency that does not include the payment data chain, execute S7; S6, obtain the digital currency with the least payment data chain, execute S7; S7, the number of selected digital currencies is determined to be one, and an available amount is determined For the digital currency closest to the payment amount, calculate the transaction time of the digital currency with the available amount closest to the payment amount.
- the present invention provides a hardware wallet, comprising: an input module, a first judgment module, a second judgment module, a first acquisition module, a second acquisition module, a first transaction time calculation module, a digital currency selection module, and an increase in the number of digital currencies module, digital currency combination selection module, remaining currency judgment module, digital currency removal module, second transaction time calculation module, third transaction time calculation module, second to-be-output digital currency determination module, first to-be-output digital currency determination module, The output module and the process end module, wherein the input module is used to obtain the payment amount and trigger the first judgment module to perform operations; the first judgment module is used to arrange the stored digital currencies according to the available amount from large to small, wherein, The digital currency includes: initial digital currency; and/or, the digital currency includes: initial digital currency and at least one payment data chain; determine whether there is at least one digital currency with an available amount greater than or equal to the payment amount, and if there is, trigger the second judgment module to execute operation, if it does not exist, trigger the digital currency selection module to
- the second acquisition module is triggered to perform the operation; the first acquisition module is used to acquire the payment data chain not included.
- the digital currency of the first transaction time calculation module is triggered to perform operations; the second acquisition module is used to acquire the digital currency that contains the least payment data chain, and triggers the first transaction time calculation module to perform operations; the first transaction time calculation module is used for
- the number of selected digital currencies is determined to be one, determine a digital currency whose available amount is closest to the payment amount, and calculate the transaction time of the digital currency whose available amount is closest to the payment amount, where the transaction time includes: transmitting the digital currency whose available amount is closest to the payment amount.
- the selection module executes the operation; the digital currency combination selection module selects the digital currency combination with the smallest available amount, and judges whether the digital currency combination with the smallest available amount is greater than or equal to the payment amount. If the digital currency combination with the smallest available amount is less than the payment amount, the remaining currency judgment is triggered. The module performs an action if the digital currency combination with the smallest available amount is greater than If it is equal to the payment amount, the second transaction time calculation module is triggered to perform the operation; the remaining currency judgment module is used to determine whether there is any remaining currency. If there is any remaining currency, the digital currency removal module is triggered to perform the operation.
- the trigger process end module executes the operation; digital The currency removal module is used to remove the digital currency with the smallest available amount, triggering the digital currency combination selection module to perform operations; the second transaction time calculation module is used to obtain the digital currency that contains the most payment data chains; Calculate the number that contains the most payment data chains Currency transaction time; determine whether the transaction time of the digital currency with the most payment data chain is greater than the preset time, if the transaction time of the digital currency with the most payment data chain is greater than the preset time, trigger the digital currency quantity increase module to execute the operation, If the transaction time of the digital currency with the most payment data chain is less than or equal to the preset time, the third transaction time calculation module is triggered to execute the operation; the third transaction time calculation module determines
- the transaction time of the currency combination is not greater than the transaction time of the digital currency with the available amount closest to the payment amount, triggering the second to-be-output digital currency determination module to execute the operation; if there is no digital currency with the available amount closest to the payment amount, triggering the second to-be-output digital currency
- the digital currency determination module executes the operation; the second to-be-output digital currency determination module is configured to use the optimal digital currency combination with the smallest available amount as the to-be-output digital currency, and trigger the output module to perform the operation; the first to-be-output digital currency determination module, It is used to use the digital currency with the available amount closest to the payment amount as the digital currency to be output, and trigger the output module to perform operations; the output module is used to output the digital currency to be output; the process end module is used to end the process.
- the hardware wallet digital currency selection method and hardware wallet provided in this embodiment, when the hardware wallet completes the process of selecting digital currency to participate in the transaction, the digital currency closest to the payment amount is selected, the transaction time of the digital currency is calculated, and the optimal digital currency is selected.
- the digital currency combination with the smallest available amount is calculated, and the transaction time of the digital currency combination is calculated, and the digital currency to be output is further determined and output according to the transaction time.
- the problem of low efficiency improves the user experience of using hardware wallets in an offline state.
- FIG. 1 is a schematic structural diagram of a hardware wallet provided by an embodiment of the present invention.
- This embodiment provides a hardware wallet 100, and the hardware wallet 100 can complete the transaction process of using digital currency with other hardware wallets or collection devices in an offline state.
- FIG. 1 is a schematic structural diagram of a hardware wallet 100 provided in this embodiment. As shown in FIG. 1 , the hardware wallet 100 mainly includes:
- Input module 101 first judgment module 102, second judgment module 103, first acquisition module 104, second acquisition module 105, first transaction time calculation module 106, digital currency selection module 107, digital currency quantity increase module 108, digital currency Currency combination selection module 109, remaining currency determination module 110, digital currency removal module 111, second transaction time calculation module 112, third transaction time calculation module 113, second to-be-output digital currency determination module 114, first to-be-output digital currency
- the determination module 115, the output module 116 and the process end module 117 wherein,
- the input module 101 is used to obtain the payment amount and trigger the first judgment module 102 to perform operations;
- the first judging module 102 is used for arranging the stored digital currency according to the available amount in descending order, wherein the digital currency includes: the initial digital currency; and/or, the digital currency includes: the initial digital currency and at least one payment data chain; Determine whether there is at least one digital currency with an available amount greater than or equal to the payment amount, if there is, trigger the second judgment module to perform the operation 103, if not, trigger the digital currency selection module 107 to perform the operation;
- the second judging module 103 is used to obtain all digital currencies greater than or equal to the payment amount, and determine whether each digital currency in all the digital currencies includes a payment data chain, and if there is a digital currency that does not include a payment data chain, trigger the first acquisition
- the module 104 performs the operation, and if there is no digital currency that does not contain the payment data chain, the second acquisition module 105 is triggered to perform the operation;
- the first acquisition module 104 is used to acquire digital currency that does not include the payment data chain, and triggers the first transaction time calculation module 106 to perform operations;
- the second acquisition module 105 is used to acquire the digital currency that contains the least payment data chain, and trigger the first transaction time calculation module 106 to perform operations;
- the first transaction time calculation module 106 is used to determine the number of selected digital currencies as one, determine a digital currency whose available amount is closest to the payment amount, and calculate the transaction time of the digital currency whose available amount is closest to the payment amount, wherein the transaction time includes: : The time taken to transmit the digital currency with the available amount closest to the payment amount, the time taken to sign the digital currency with the available amount closest to the payment amount, and the time taken by the peer device to verify the signature of the digital currency with the available amount closest to the payment amount.
- the digital currency selection module 107 is used to select the digital currency from the remaining digital currency, and trigger the digital currency quantity increase module 108 to perform the operation;
- the digital currency quantity increasing module 108 is used for adding one to the selected digital currency quantity, arranging the remaining digital currencies from large to small, and triggering the digital currency combination selection module 109 to perform operations;
- the digital currency combination selection module 109 selects the digital currency combination with the smallest available amount, and judges whether the digital currency combination with the smallest available amount is greater than or equal to the payment amount. If the digital currency combination with the smallest available amount is less than the payment amount, trigger the remaining currency judgment module 110 to execute the operation , if the digital currency combination with the smallest available amount is greater than or equal to the payment amount, trigger the second transaction time calculation module 112 to perform the operation;
- the remaining currency judging module 110 is used to determine whether there is any remaining currency. If there is any remaining currency, the digital currency removing module 111 is triggered to perform the operation. If there is no remaining currency, and the selected digital currency quantity is less than the total number of digital currencies in the hardware wallet, Trigger the digital currency quantity increase module 108 to perform the operation, if there is no remaining currency, and the selected digital currency quantity is equal to the total number of digital currencies in the hardware wallet, trigger the process end module 117 to perform the operation;
- the digital currency removal module 111 is used to remove the digital currency with the smallest available amount, triggering the digital currency combination selection module 109 to perform operations;
- the second transaction time calculation module 112 is configured to obtain the digital currency containing the most payment data chains; calculate the transaction time of the digital currency containing the most payment data chains; determine whether the transaction time of the digital currency containing the most payment data chains is greater than the preset time , if the transaction time of the digital currency containing the most payment data chain is greater than the preset time, trigger the digital currency quantity increasing module 108 to perform the operation, if the transaction time of the digital currency containing the most payment data chain is less than or equal to the preset time, then trigger the first 3.
- the transaction time calculation module 113 performs operations;
- the third transaction time calculation module 113 determines the optimal digital currency combination with the smallest available amount, and calculates the transaction time of the optimal digital currency combination with the smallest available amount; if there is a digital currency whose available amount is closest to the payment amount, determine the optimal digital currency combination Whether the transaction time of the digital currency combination with the smallest available amount is greater than the transaction time of the digital currency with the available amount closest to the payment amount, if the transaction time of the optimal digital currency combination with the smallest available amount is greater than the digital currency with the available amount closest to the payment amount If the transaction time of the digital currency combination with the smallest available amount is not greater than the transaction time of the digital currency with the available amount closest to the payment amount, trigger the second digital currency to be outputted.
- the determination module 114 performs the operation; if there is no digital currency with an available amount that is closest to the payment amount, triggering the second to-be-output digital currency determination module 114 to perform the operation;
- the second to-be-output digital currency determination module 114 is configured to use the optimal digital currency combination with the smallest available amount as the to-be-output digital currency, and trigger the output module 116 to perform operations;
- the first to-be-output digital currency determination module 115 is configured to use the digital currency whose available amount is closest to the payment amount as the to-be-output digital currency, and trigger the output module 116 to perform operations;
- the output module 116 is used for outputting the digital currency to be output
- the process end module 117 is used to end the process.
- the digital currency quantity increasing module 108 is also used to determine whether the available amount of all digital currencies is greater than or equal to the payment amount, and in the case of judging that the available amount of all digital currencies is greater than or equal to the payment amount, triggering the digital currency combination selection module 109 to execute the selection of the available amount The operation of the smallest digital currency portfolio.
- the hardware wallet 100 of this embodiment further includes: a basic parameter setting module (not shown in the figure), wherein the basic parameter setting module is used to set basic information parameters, wherein the basic parameter
- the information parameters include: time-consuming mX for transmitting the initial digital currency, time-consuming X for transmitting a payment data chain, time-consuming B for calculating a signature, and time-consuming C for verifying a signature.
- the optional preset time is: mX+X+B+3C ms.
- the digital currency closest to the payment amount is selected, the transaction time of the digital currency is calculated, and the optimal digital currency combination with the smallest available amount is selected, And calculate the transaction time of the digital currency combination, and further determine the digital currency to be output and output according to the transaction time.
- the digital currency or digital currency with the shortest transaction time applicable to the transaction can be selected.
- the combination avoids the problems of long transaction time and low transaction efficiency caused by many payment data chains when using the digital currency in the hardware wallet to complete the transaction in an offline state, which improves the user's ability to use the hardware wallet in an offline state. experience feelings.
- the following provides a method for selecting digital currency in a hardware wallet.
- the method can be implemented by the above-mentioned hardware wallet 100.
- the specific implementation and process of each module in the hardware wallet 100 can be referred to as follows. Specifically, the method includes the following steps (S201-S222):
- the payment amount can be obtained by obtaining the payment amount through a terminal used in cooperation with the hardware wallet, and the terminal sends the payment amount to the hardware wallet through a short-distance communication method or a medium-long-distance communication method and other non-networked methods,
- the hardware wallet can be obtained directly through the user's input on the hardware wallet, which is not specifically limited in this embodiment.
- the method before acquiring the payment amount, further includes: setting basic information parameters, wherein the basic information parameters include: time-consuming mX for transmitting the initial digital currency, time-consuming X for transmitting a payment data chain, Calculate the time-consuming B of a signature and the time-consuming C of verifying a signature.
- the basic information parameters include: time-consuming mX for transmitting the initial digital currency, time-consuming X for transmitting a payment data chain, Calculate the time-consuming B of a signature and the time-consuming C of verifying a signature.
- the calculation process of the transaction time is more convenient.
- the digital currencies include: initial digital currencies; and/or, the digital currencies include: initial digital currencies and at least one payment data chain.
- the digital currency when the digital currency can be settled online, it does not include a payment data chain.
- a payment data chain will be generated, which improves the security of offline transactions of digital currency.
- the digital currency that has not participated in the offline transaction includes the initial digital currency and no payment data chain
- the data currency that has participated in the offline transaction includes the initial currency and at least one payment data chain.
- S204 Obtain all digital currencies greater than or equal to the payment amount, and determine whether each digital currency in all the digital currencies includes a payment data chain. If there is a digital currency that does not include a payment data chain, execute S205. If there is no digital currency that does not include a payment data chain the digital currency, then execute S206.
- S205 obtain digital currency that does not include the payment data chain, and execute S207.
- the digital currency with a small amount of data participate in the transaction. Therefore, the hardware wallet will use as little digital currency as possible to participate in the transaction, preferably no payment. Data chain and digital currency with less payment data chain participate in the transaction.
- the number of selected digital currencies is determined to be one, a digital currency whose available amount is closest to the payment amount is determined, and the transaction time of the digital currency whose available amount is closest to the payment amount is calculated, wherein the transaction time includes: the transmission available amount is the closest to the payment amount The sum of the time-consuming of the digital currency of the available amount, the time-consuming of signing the digital currency with the available amount closest to the payment amount, and the time-consuming of the peer device verifying the signature of the digital currency with the available amount closest to the payment amount.
- the transaction time when the digital currency is used to participate in the transaction is further calculated, so that it can be determined whether to use the digital currency to participate in the transaction.
- the preset time is: mX+X+B+3C ms. That is: the sum of the time-consuming mX of transmitting the initial digital currency, the time-consuming X of transmitting a payment data chain, the time-consuming B of calculating a signature and the time-consuming C of verifying a signature, the sum.
- the preset time is related to the computing power of the hardware wallet. Calculate the preset time according to the above method. Different hardware wallets will calculate different preset times. Compared with the method of directly specifying the preset time by the system, it is more practical.
- the transaction time of the digital currency with the available amount closest to the payment amount is not greater than the preset time, it is determined that the digital currency participates in the transaction process, that is, the digital currency with the available amount closest to the payment amount is used as the to-be-output digital currency and output. If the transaction time of the digital currency with the available amount closest to the payment amount is greater than the preset time, re-select the digital currency to participate in the transaction process, that is, re-select the digital currency from the remaining digital currencies.
- S210 add one to the number of selected digital currencies, and arrange the remaining digital currencies from large to small.
- step S211 select the digital currency combination with the smallest available amount, determine whether the digital currency combination with the smallest available amount is greater than or equal to the payment amount, if the digital currency combination with the smallest available amount is less than the payment amount, execute step S212, if the digital currency combination with the smallest available amount is greater than If it is equal to the payment amount, execute S214.
- the method further includes: judging all digital currencies Whether the available amount is greater than or equal to the payment amount, in the case of judging that the available amount of all digital currencies is greater than or equal to the payment amount, perform the step of selecting the digital currency combination with the smallest available amount.
- the available amount of all digital currencies is less than the payment amount, it means that all digital currencies in the hardware wallet are not enough to complete the transaction, and the process can be further selected to end to improve computing efficiency.
- the digital currency combination completes the transaction. For example, if there is no digital currency with an available amount greater than or equal to the payment amount, or when the transaction time of the digital currency with the available amount closest to the payment amount is greater than the preset time, the number of selected digital currencies is increased by one, that is, a digital currency containing 2 digital currencies is selected. Digital currency combination, to determine whether the digital currency combination can participate in the transaction.
- S212 determine whether there is any remaining currency, if there is any remaining currency, execute S213, if there is no remaining currency, and the number of selected digital currency is less than the total number of digital currencies in the hardware wallet, execute S210, if there is no remaining currency, and the selected number The amount of currency is equal to the amount of digital currency in the hardware wallet, and S222 is executed.
- the digital currency combination with the smallest available amount is less than the payment amount, it is further judged whether there is any remaining currency, and if so, the digital currency with the smallest available amount is removed, and the number of selected digital currencies is increased by one, For example, the number of selected digital currencies becomes 3, and it is determined whether there is a digital currency combination that meets the transaction requirements in each group of digital currency combinations containing 3 digital currencies. If it still does not meet the transaction requirements, the selected digital currency amount becomes 4. Until a digital currency combination that meets the trading needs is found, or there are no remaining digital currency positions. In this embodiment, if there is no remaining currency, it means that the sum of all the digital currency amounts does not meet the transaction requirement, then S222 is executed to end the process.
- S215 Calculate the transaction time of the digital currency that contains the most payment data chains.
- S216 determine whether the transaction time of the digital currency containing the most payment data chains is greater than the preset time, if the transaction time of the digital currency containing the most payment data chains is greater than the preset time, then return to S11, if the digital currency containing the most payment data chains is included. If the transaction time of the currency is less than or equal to the preset time, execute S17.
- the digital currency combination with the smallest available amount is greater than or equal to the payment amount, it is determined whether the transaction time of the digital currency containing the most payment chain is greater than the preset time, and if it is greater than the preset time, the digital currency combination needs to be re-selected. If it is less than or equal to the preset time, the transaction time of the digital currency combination is further judged. Calculating the transaction time of the digital currency that contains the most payment chains can exclude some digital currency combinations whose transaction time is longer than the preset time, improving transaction efficiency.
- S218, determine whether the transaction time of the optimal digital currency combination with the smallest available amount is greater than the transaction time of the digital currency with the available amount closest to the payment amount, if the transaction time of the optimal digital currency combination with the smallest available amount is greater than the transaction time of the digital currency combination with the available amount closest to the payment amount.
- the transaction time of the digital currency with the payment amount is returned to S220, and if the transaction time of the digital currency combination with the smallest available amount is not greater than the transaction time of the digital currency with the available amount closest to the payment amount, S219 is performed.
- the transaction time of the optimal digital currency combination with the smallest available amount is further determined. If it is greater than the transaction time of the digital currency whose available amount is closest to the payment amount, it is considered that in the digital wallet, the available amount is the closest to the payment amount.
- the digital currency with the shortest transaction time is the most suitable digital currency. If it is not greater than the transaction time of the digital currency with the available amount closest to the payment amount, it is considered that in the digital wallet, the optimal digital currency combination with the smallest available amount It is the most suitable digital currency for the shortest transaction time.
- the following is an example of how the hardware wallet selects digital currency or a combination of digital currencies in the case of different payment amounts in the hardware wallet.
- the payment amount is 13;
- the obtained payment amount is 13, and it is judged that there is at least one digital currency with an available amount greater than or equal to the payment amount.
- the digital currencies are 13 and 15. Further, according to the payment data chain and the transaction time, determine the currency to be output.
- the obtained payment amount is 18. It is judged that there is no digital currency with an available amount greater than or equal to the payment amount.
- the number of selected digital currencies is 2, and the digital currency combination with the smallest available amount is selected, 1 and 2, and it is judged that the digital currency combination is less than the payment amount.
- Amount judge that there is remaining currency, remove the digital currency 1 with the smallest available amount, return to select the digital currency combination with the smallest available amount, 2 and 5, and judge that the digital currency combination is less than the payment amount, judge that there is remaining currency, remove the available currency Digital currency 2 with the smallest amount, repeat this cycle until digital currency combinations 10 and 13 are found, determine that the digital currency combination is greater than or equal to the payment amount, and further determine whether the transaction time is greater than the preset time through the payment data chain, etc. If it is greater than, then Re-select, if it is less than, determine the optimal digital currency combination with the smallest available amount, calculate the transaction time, and determine the currency to be output.
- the obtained payment amount is 30, and it is judged that there is no digital currency with an available amount greater than or equal to the payment amount.
- the number of selected digital currencies is 2, and the digital currency combination with the smallest available amount is selected, 1 and 2, and it is judged that the digital currency combination is less than the payment amount.
- Amount judge that there is remaining currency, remove the digital currency 1 with the smallest available amount, return to select the digital currency combination with the smallest available amount, 2 and 5, and judge that the digital currency combination is less than the payment amount, judge that there is remaining currency, remove the available currency Digital currency 2 with the smallest amount, repeat this cycle until there is no remaining currency, add 1 to the number of digital currencies, and select 3 digital currencies until the combination of digital currencies 7, 10, and 13 is selected, and judge that the digital currency combination is greater than or equal to
- the payment amount is further judged by the payment data chain, etc. whether the transaction time is greater than the preset time. If it is greater than the preset time, select it again. If it is less than, determine the optimal digital currency combination with the smallest available amount, and calculate the transaction time to determine the currency to be output. .
- the digital currency closest to the payment amount is selected, the transaction time of the digital currency is calculated, the optimal digital currency combination with the smallest available amount is selected, and the value of the digital currency combination is calculated.
- the transaction time is further determined by the transaction time to determine the digital currency to be output and output.
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
一种硬件钱包数字货币选取方法和硬件钱包,该方法包括:获取支付金额,选取可用金额大于或等于支付金额的数字货币,若没有或交易时间大于预设时间,执行选取数字货币组合的操作,若交易时间小于预设时间,则输出该数字货币;选取数字货币组合的操作包括,选取金额最小的数字货币组合,若小于支付金额,去掉金额最小的数字货币,再选择金额最小的数字货币组成数字货币组合,直至选择到大于或等于支付金额的数字货币,或无剩余数字货币,输出待输出数字货币,若所有数字货币之和小于支付金额,则结束流程。通过上述数字货币选取方法,在硬件钱包离线交易时,数据量小,交易速度快。
Description
相关申请的交叉引用
本申请要求天地融科技股份有限公司于2021年1月5日提交的、发明名称为“一种硬件钱包数字货币选取方法及硬件钱包”的、中国专利申请号“202110008634.1”的优先权。
本发明涉及电子技术领域,尤其涉及一种硬件钱包数字货币选取方法及硬件钱包。
现有的数字货币交易过程中,在脱机交易过程中,由于不能联网实时结算,会产生一条支付数据链,在具有支付数据链的数字货币交易过程中,由于其数据量过大,容易造成交易流程变慢的问题,针对不同的交易金额,付款方硬件钱包需要组合取出对应金额的数字货币,不同的组合方式下,传输、计算、校验对应的时间不尽相同。如何设计一种数字货币支付的组合方式,使得交易流程获得最优性能成为亟待解决的问题。
发明内容
本发明旨在解决上述问题。
本发明一方面提供了一种硬件钱包数字货币选取方法,包括:S1,获取支付金额;S2,将存储的数字货币按照可用金额从大到小排列,其中,数字货币包括:初始数字货币;和/或,数字货币包括:初始数字货币和至少一个支付数据链;S3,判断是否存在至少一个可用金额大于等于支付金额的数字货币,如果存在则执行步骤S4,如果不存在则执行步骤S9;S4,获取大于等于支付金额的全部数字货币,判断全部数字货币中的每个数字货币是否包含支付数据链,如果有不包含支付数据链的数字货币,则执行S5,如果没有不包含支付数据链的数字货币,则执行S6S5,获取不包含支付数据链的数字货币,执行S7;S6,获取包含支付数据链最少的数字货币,执行S7;S7,选取的数字货币数量确定为一,确定一个可用金额最接近支付金额的数字货币,计算可用金额最接近支付金额的数字货币的交易时间,其中,交易时间包括:传输可用金额最接近支付金额的数字货币的耗时、对可用金额最接近支付金额的数字货币进行签名的耗时和对端设备验证可用金额最接近支付金额的数字货币的签名的耗时之和;S8,判断可用金额最接近支付金额的数字货币的交易时间是否 大于预设时间,如果大于预设时间,执行S9,如果不大于预设时间,执行S20;S9,在剩余数字货币中选取数字货币;S10,选取的数字货币数量加一,将剩余数字货币从大到小进行排列;S11,选取可用金额最小的数字货币组合,判断可用金额最小的数字货币组合是否大于等于支付金额,如果可用金额最小的数字货币组合小于支付金额,执行步骤S12,如果可用金额最小的数字货币组合大于等于支付金额,则执行S14;S12,判断是否还有剩余货币,如果还有剩余货币,执行S13,如果没有剩余货币,且选取的数字货币数量小于硬件钱包中数字货币的总数,执行S10,如果没有剩余货币,且选取的数字货币数量等于硬件钱包中数字货币的总数,执行S22;S13,去掉可用金额最小的数字货币,返回执行S11;S14,获取包含支付数据链最多的数字货币;S15,计算包含支付数据链最多的数字货币的交易时间;S16,判断包含支付数据链最多的数字货币的交易时间是否大于预设时间,如果包含支付数据链最多的数字货币的交易时间大于预设时间,则返回执行S10,如果包含支付数据链最多的数字货币的交易时间小于等于预设时间,则执行S17;S17,确定最优的可用金额最小的数字货币组合,计算最优的可用金额最小的数字货币组合的交易时间;S18,如果存在可用金额最接近支付金额的数字货币,判断最优的可用金额最小的数字货币组合的交易时间是否大于可用金额最接近支付金额的数字货币的交易时间,如果最优的可用金额最小的数字货币组合的交易时间大于可用金额最接近支付金额的数字货币的交易时间,返回执行S20,如果可用金额最小的数字货币组合的交易时间不大于可用金额最接近支付金额的数字货币的交易时间,则执行S19;如果不存在可用金额最接近支付金额的数字货币,则执行S19;S19,将最优的可用金额最小的数字货币组合作为待输出数字货币,执行S21;S20,将可用金额最接近支付金额的数字货币作为待输出数字货币,执行S21;S21,输出待输出数字货币;S22,结束流程。
本发明提供了一种硬件钱包,包括:输入模块、第一判断模块、第二判断模块、第一获取模块、第二获取模块、第一交易时间计算模块、数字货币选取模块、数字货币数量增加模块、数字货币组合选取模块、剩余货币判断模块、数字货币去掉模块、第二交易时间计算模块、第三交易时间计算模块、第二待输出数字货币确定模块、第一待输出数字货币确定模块、输出模块和流程结束模块,其中,输入模块,用于获取支付金额,并触发第一判断模块执行操作;第一判断模块,用于将存储的数字货币按照可用金额从大到小排列,其中,数字货币包括:初始数字货币;和/或,数字货币包括:初始数字货币和至少一个支付数据链;判断是否存在至少一个可用金额大于等于支付金额的数字货币,如果存在则触发第二判断模块执行操作,如果不存在则触发数字货币选取模块执行操作;第二判断模块,用于获取大于等于支付金额的全部数字货币,判断全部数字货币中的每个数字货币是否包含支付数据链,如果有不包含支付数据链的数字货币,则触发第一获取模块执行操作,如 果没有不包含支付数据链的数字货币,则触发第二获取模块执行操作;第一获取模块,用于获取不包含支付数据链的数字货币,触发第一交易时间计算模块执行操作;第二获取模块,用于获取包含支付数据链最少的数字货币,触发第一交易时间计算模块执行操作;第一交易时间计算模块,用于选取的数字货币数量确定为一,确定一个可用金额最接近支付金额的数字货币,计算可用金额最接近支付金额的数字货币的交易时间,其中,交易时间包括:传输可用金额最接近支付金额的数字货币的耗时、对可用金额最接近支付金额的数字货币进行签名的耗时和对端设备验证可用金额最接近支付金额的数字货币的签名的耗时之和;判断可用金额最接近支付金额的数字货币的交易时间是否大于预设时间,如果大于预设时间,触发数字货币选取模块执行操作,如果不大于预设时间,触发第一待输出数字货币确定模块执行操作;数字货币选取模块,用于在剩余数字货币中选取数字货币,触发数字货币数量增加模块执行操作;数字货币数量增加模块,用于选取的数字货币数量加一,将剩余数字货币从大到小进行排列,触发数字货币组合选取模块执行操作;数字货币组合选取模块,选取可用金额最小的数字货币组合,判断可用金额最小的数字货币组合是否大于等于支付金额,如果可用金额最小的数字货币组合小于支付金额,触发剩余货币判断模块执行操作,如果可用金额最小的数字货币组合大于等于支付金额,则触发第二交易时间计算模块执行操作;剩余货币判断模块,用于判断是否还有剩余货币,如果还有剩余货币,触发数字货币去掉模块执行操作,如果没有剩余货币,且选取的数字货币数量小于硬件钱包中数字货币的总数,触发数字货币数量增加模块执行操作,如果没有剩余货币,且选取的数字货币数量等于硬件钱包中数字货币的总数,触发流程结束模块执行操作;数字货币去掉模块,用于去掉可用金额最小的数字货币,触发数字货币组合选取模块执行操作;第二交易时间计算模块,用于获取包含支付数据链最多的数字货币;计算包含支付数据链最多的数字货币的交易时间;判断包含支付数据链最多的数字货币的交易时间是否大于预设时间,如果包含支付数据链最多的数字货币的交易时间大于预设时间,则触发数字货币数量增加模块执行操作,如果包含支付数据链最多的数字货币的交易时间小于等于预设时间,则触发第三交易时间计算模块执行操作;第三交易时间计算模块,确定最优的可用金额最小的数字货币组合,计算最优的可用金额最小的数字货币组合的交易时间;如果存在可用金额最接近支付金额的数字货币,判断最优的可用金额最小的数字货币组合的交易时间是否大于可用金额最接近支付金额的数字货币的交易时间,如果最优的可用金额最小的数字货币组合的交易时间大于可用金额最接近支付金额的数字货币的交易时间,触发第一待输出数字货币确定模块执行操作,如果可用金额最小的数字货币组合的交易时间不大于可用金额最接近支付金额的数字货币的交易时间,触发第二待输出数字货币确定模块执行操作;如果不存在可用金额最接近支付金额的数字货币,触发第二待输出数字货币确定模块执行 操作;第二待输出数字货币确定模块,用于将最优的可用金额最小的数字货币组合作为待输出数字货币,触发输出模块执行操作;第一待输出数字货币确定模块,用于将可用金额最接近支付金额的数字货币作为待输出数字货币,触发输出模块执行操作;输出模块,用于输出待输出数字货币;流程结束模块,用于结束流程。
通过本实施例提供的硬件钱包数字货币选取方法和硬件钱包,在硬件钱包完成选取数字货币参与交易的流程中,选取最接近支付金额的数字货币,计算该数字货币的交易时间,以及选取最优的可用金额最小的数字货币组合,并计算该数字货币组合的交易时间,进一步通过交易时间决定待输出数字货币并输出,通过上述数字货币或数字货币组合的选择流程和使用了该流程的硬件钱包,可选取到适用于交易的交易时间最短的数字货币或数字货币组合,避免了在脱机状态下使用硬件钱包中的数字货币完成交易时,由于支付数据链多而导致的交易时间长,交易效率低下的问题,提升了用户在脱机状态下使用硬件钱包的使用感受。
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他附图。
图1为本发明实施例提供的硬件钱包结构示意图。
下面将结合附图对本发明实施例作进一步地详细描述。
实施例
本实施例提供了一种硬件钱包100,该硬件钱包100可以在脱机状态下,与其他硬件钱包或收款设备完成使用数字货币的交易流程。
图1为本实施例提供的硬件钱包100的结构示意图,如图1所示,该硬件钱包100主要包括:
输入模块101、第一判断模块102、第二判断模块103、第一获取模块104、第二获取模块105、第一交易时间计算模块106、数字货币选取模块107、数字货币数量增加模块108、数字货币组合选取模块109、剩余货币判断模块110、数字货币去掉模块111、第二交易时间计算模块112、第三交易时间计算模块113、第二待输出数字货币确定模块114、第一待输出数字货币确定模块115、输出模块116和流程结束模块117,其中,
输入模块101,用于获取支付金额,并触发第一判断模块102执行操作;
第一判断模块102,用于将存储的数字货币按照可用金额从大到小排列,其中,数字货币包括:初始数字货币;和/或,数字货币包括:初始数字货币和至少一个支付数据链;判断是否存在至少一个可用金额大于等于支付金额的数字货币,如果存在则触发第二判断模块执行103操作,如果不存在则触发数字货币选取模块107执行操作;
第二判断模块103,用于获取大于等于支付金额的全部数字货币,判断全部数字货币中的每个数字货币是否包含支付数据链,如果有不包含支付数据链的数字货币,则触发第一获取模块104执行操作,如果没有不包含支付数据链的数字货币,则触发第二获取模块105执行操作;
第一获取模块104,用于获取不包含支付数据链的数字货币,触发第一交易时间计算模块106执行操作;
第二获取模块105,用于获取包含支付数据链最少的数字货币,触发第一交易时间计算模块106执行操作;
第一交易时间计算模块106,用于选取的数字货币数量确定为一,确定一个可用金额最接近支付金额的数字货币,计算可用金额最接近支付金额的数字货币的交易时间,其中,交易时间包括:传输可用金额最接近支付金额的数字货币的耗时、对可用金额最接近支付金额的数字货币进行签名的耗时和对端设备验证可用金额最接近支付金额的数字货币的签名的耗时之和;判断可用金额最接近支付金额的数字货币的交易时间是否大于预设时间,如果大于预设时间,触发数字货币选取模块107执行操作,如果不大于预设时间,触发第一待输出数字货币确定模块115执行操作;
数字货币选取模块107,用于在剩余数字货币中选取数字货币,触发数字货币数量增加模块108执行操作;
数字货币数量增加模块108,用于选取的数字货币数量加一,将剩余数字货币从大到小进行排列,触发数字货币组合选取模块109执行操作;
数字货币组合选取模块109,选取可用金额最小的数字货币组合,判断可用金额最小的数字货币组合是否大于等于支付金额,如果可用金额最小的数字货币组合小于支付金额,触发剩余货币判断模块110执行操作,如果可用金额最小的数字货币组合大于等于支付金额,则触发第二交易时间计算模块112执行操作;
剩余货币判断模块110,用于判断是否还有剩余货币,如果还有剩余货币,触发数字货币去掉模块111执行操作,如果没有剩余货币,且选取的数字货币数量小于硬件钱包中数字货币的总数,触发数字货币数量增加模块108执行操作,如果没有剩余货币,且选取的数字货币数量等于硬件钱包中数字货币的总数,触发流程结束模块117执行操作;
数字货币去掉模块111,用于去掉可用金额最小的数字货币,触发数字货币组合选取模块109执行操作;
第二交易时间计算模块112,用于获取包含支付数据链最多的数字货币;计算包含支付数据链最多的数字货币的交易时间;判断包含支付数据链最多的数字货币的交易时间是否大于预设时间,如果包含支付数据链最多的数字货币的交易时间大于预设时间,则触发数字货币数量增加模块108执行操作,如果包含支付数据链最多的数字货币的交易时间小于等于预设时间,则触发第三交易时间计算模块113执行操作;
第三交易时间计算模块113,确定最优的可用金额最小的数字货币组合,计算最优的可用金额最小的数字货币组合的交易时间;如果存在可用金额最接近支付金额的数字货币,判断最优的可用金额最小的数字货币组合的交易时间是否大于可用金额最接近支付金额的数字货币的交易时间,如果最优的可用金额最小的数字货币组合的交易时间大于可用金额最接近支付金额的数字货币的交易时间,触发第一待输出数字货币确定模块115执行操作,如果可用金额最小的数字货币组合的交易时间不大于可用金额最接近支付金额的数字货币的交易时间,触发第二待输出数字货币确定模块114执行操作;如果不存在可用金额最接近支付金额的数字货币,触发第二待输出数字货币确定模块114执行操作;
第二待输出数字货币确定模块114,用于将最优的可用金额最小的数字货币组合作为待输出数字货币,触发输出模块116执行操作;
第一待输出数字货币确定模块115,用于将可用金额最接近支付金额的数字货币作为待输出数字货币,触发输出模块116执行操作;
输出模块116,用于输出待输出数字货币;
流程结束模块117,用于结束流程。
作为本实施例的一个可选实施方式,在数字货币数量增加模块108选取的数字货币数量加一,将剩余数字货币从大到小进行排列之后,还包括:
数字货币数量增加模块108,还用于判断全部数字货币的可用金额是否大于等于支付金额,在判断全部数字货币的可用金额大于等于支付金额的情况下,触发数字货币组合选取模块109执行选取可用金额最小的数字货币组合的操作。
作为本实施例的一个可选实施方式,本实施例的硬件钱包100,还包括:基本参数设置模块(图未示出),其中,基本参数设置模块,用于设置基本信息参数,其中,基本信息参数包括:传输初始数字货币的耗时mX、传输一条支付数据链的耗时X、计算一次签名的耗时B和验证一条签名的耗时C。在本可选实施方式中,预设时间可选的为:mX+X+B+3C ms。
通过本实施例提供的硬件钱包,在完成选择数字货币参与交易的流程中,选取最接近支付金额的数字货币,计算该数字货币的交易时间,以及选取最优的可用金额最小的数字 货币组合,并计算该数字货币组合的交易时间,进一步通过交易时间决定待输出数字货币并输出,通过上述数字货币或数字货币组合的选择流程,可选取到适用于交易的交易时间最短的数字货币或数字货币组合,避免了在脱机状态下使用硬件钱包中的数字货币完成交易时,由于支付数据链多而导致的交易时间长,交易效率低下的问题,提高了用户在脱机状态下使用硬件钱包的使用感受。
以下提供一种硬件钱包数字货币选取方法,该方法可以通过上述的一种硬件钱包100实施,硬件钱包100中各模块的具体实施方式和流程,可以参照如下内容。具体地,该方法包括以下步骤(S201-S222):
S201,获取支付金额。
在本步骤中,支付金额的获取方式可以是,通过与硬件钱包配合使用的终端获取支付金额,由该终端将支付金额通过短距离通信方式或中远距离通信方式等非联网方式发送至硬件钱包,也可以是,硬件钱包通过用户在硬件钱包上的输入直接获得,本实施例不作具体限制。
作为本实施例的一个可选实施方式,获取支付金额之前,还包括:设置基本信息参数,其中,基本信息参数包括:传输初始数字货币的耗时mX、传输一条支付数据链的耗时X、计算一次签名的耗时B和验证一条签名的耗时C。在本可选实施方式中,设置基本信息参数之后,交易时间的计算过程更为便捷。
S202,将存储的数字货币按照可用金额从大到小排列,其中,数字货币包括:初始数字货币;和/或,数字货币包括:初始数字货币和至少一个支付数据链。
在本实施例中,数字货币在可以联网结算时,不包含支付数据链,在脱机交易过程中,由于不能联网实时结算,会产生一条支付数据链,提高数字货币的脱机交易的安全性。在脱机交易场景中,尚未参与过脱机交易的数字货币包括初始数字货币,无支付数据链,已参与过脱机交易的数据货币包括初始货币和至少一个支付数据链。
S203,判断是否存在至少一个可用金额大于等于支付金额的数字货币,如果存在则执行步骤S204,如果不存在则执行步骤S209。
S204,获取大于等于支付金额的全部数字货币,判断全部数字货币中的每个数字货币是否包含支付数据链,如果有不包含支付数据链的数字货币,则执行S205,如果没有不包含支付数据链的数字货币,则执行S206。
S205,获取不包含支付数据链的数字货币,执行S207。
S206,获取包含支付数据链最少的数字货币,执行S207。
在本实施例中,为了提高脱机交易的数据传输速度,在传输数字货币时,优选数据量 小的数字货币参与交易,因此,硬件钱包会使用尽可能少的数字货币参与交易、优选无支付数据链以及支付数据链少的数字货币参与交易。
S207,选取的数字货币数量确定为一,确定一个可用金额最接近支付金额的数字货币,计算可用金额最接近支付金额的数字货币的交易时间,其中,交易时间包括:传输可用金额最接近支付金额的数字货币的耗时、对可用金额最接近支付金额的数字货币进行签名的耗时和对端设备验证可用金额最接近支付金额的数字货币的签名的耗时之和。
在本实施例中,当存在至少一个可用金额大于或等于支付金额的数字货币时,进一步计算使用该数字货币参与交易时的交易时间,从而可以决定是否使用该数字货币参与交易。
S208,判断可用金额最接近支付金额的数字货币的交易时间是否大于预设时间,如果大于预设时间,执行S209,如果不大于预设时间,执行S220。
在本实施例的一个可选实施方式中,预设时间为:mX+X+B+3C ms。即:传输初始数字货币的耗时mX、传输一条支付数据链的耗时X、计算一次签名的耗时B和验证一条签名的耗时C的三倍,之和。预设时间与硬件钱包的计算能力相关,根据上述方式计算预设时间,不同的硬件钱包会计算出不同的预设时间,与***直接规定预设时间的方式相比,实用性更高。
S209,在剩余数字货币中选取数字货币。
在本实施例中,若可用金额最接近支付金额的数字货币的交易时间不大于预设时间,则确定该数字货币参与交易流程,也即,将可用金额最接近支付金额的数字货币作为待输出数字货币并输出。若可用金额最接近支付金额的数字货币的交易时间大于预设时间,则重新选择数字货币参与交易流程,即在剩余数字货币中重新选取数字货币。
S210,选取的数字货币数量加一,将剩余数字货币从大到小进行排列。
S211,选取可用金额最小的数字货币组合,判断可用金额最小的数字货币组合是否大于等于支付金额,如果可用金额最小的数字货币组合小于支付金额,执行步骤S212,如果可用金额最小的数字货币组合大于等于支付金额,则执行S214。
在本实施例的一个可选实施方式中,在选取的数字货币数量加一,将剩余数字货币从大到小进行排列之后,选取可用金额最小的数字货币组合之前,还包括:判断全部数字货币的可用金额是否大于等于支付金额,在判断全部数字货币的可用金额大于等于支付金额的情况下,执行选取可用金额最小的数字货币组合的步骤。在本可选实施方式中,若全部数字货币的可用金额小于支付金额,则意味着硬件钱包中的全部数字货币不足以完成交易,可进一步选择结束流程,提高计算效率。
在本实施例中,若不存在可用金额大于或等于支付金额的数字货币,或者可用金额最接近支付金额的数字货币的交易时间大于预设时间时,将进一步判断是否选择数字货币组 合或哪组数字货币组合完成交易。例如,不存在可用金额大于或等于支付金额的数字货币,或可用金额最接近支付金额的数字货币的交易时间大于预设时间时,选取的数字货币数量加一,即选取包含2个数字货币的数字货币组合,判断该数字货币组合是否可以参与交易。
S212,判断是否还有剩余货币,如果还有剩余货币,执行S213,如果没有剩余货币,且选取的数字货币数量小于硬件钱包中数字货币的总数,执行S210,如果没有剩余货币,且选取的数字货币数量等于硬件钱包中数字货币数量,执行S222。
S213,去掉可用金额最小的数字货币,返回执行S211;
在本实施例中,若可用金额最小的数字货币组合小于支付金额,则进一步判断是会否还有剩余货币,如有,则去掉该可用金额最小的数字货币,选取的数字货币数量加一,例如,选取的数字货币数量变为3,判断每组包含3个数字货币的数字货币组合中是否有符合交易需求的数字货币组合,若仍不符合交易需求,则选取的数字货币量变为4,直至找到符合交易需求的数字货币组合,或者没有剩余数字货币位置。在本实施例中,若没有剩余货币,则意味着所有的数字货币的金额相加,都不满***易需求,则执行S222,结束流程。
S214,获取包含支付数据链最多的数字货币。
S215,计算包含支付数据链最多的数字货币的交易时间。
S216,判断包含支付数据链最多的数字货币的交易时间是否大于预设时间,如果包含支付数据链最多的数字货币的交易时间大于预设时间,则返回执行S11,如果包含支付数据链最多的数字货币的交易时间小于等于预设时间,则执行S17。
在本实施例中,如果可用金额最小的数字货币组合大于等于支付金额,判断包含支付链最多的数字货币的交易时间是否大于预设时间,若大于预设时间,则需重新选择数字货币组合,若小于或等于预设时间,则进一步判断数字货币组合的交易时间。计算包含支付链最多的数字货币的交易时间,可排除部分交易时间大于预设时间的数字货币组合,提高交易效率。
S217,确定最优的可用金额最小的数字货币组合,计算最优的可用金额最小的数字货币组合的交易时间;
S218,判断最优的可用金额最小的数字货币组合的交易时间是否大于可用金额最接近支付金额的数字货币的交易时间,如果最优的可用金额最小的数字货币组合的交易时间大于可用金额最接近支付金额的数字货币的交易时间,返回执行S220,如果可用金额最小的数字货币组合的交易时间不大于可用金额最接近支付金额的数字货币的交易时间,则执行S219。
在本实施例中,进一步判断最优的可用金额最小的数字货币组合的交易时间,若大于 可用金额最接近支付金额的数字货币的交易时间,则认为在该数字钱包中,可用金额最接近支付金额的数字货币为交易时间最短,最适合的数字货币,若不大于可用金额最接近支付金额的数字货币的交易时间,则认为在该数字钱包中,该最优的可用金额最小的数字货币组合为交易时间最短,最适合的数字货币。通过将最优的可用金额最小的数字货币组合的交易时间与可用金额最接近支付金额的数字货币的交易时间进行比较,即可得到最适合作为待输出数字货币的数字货币或数字货币组合是哪个,可进一步减少交易时间。
S219,将最优的可用金额最小的数字货币组合作为待输出数字货币,执行S221;
S220,将可用金额最接近支付金额的数字货币作为待输出数字货币,执行S221;
S221,输出待输出数字货币;
S222,结束流程。
以下以硬件钱包中有金额为1、2、5、7、10、13、15的数字货币,在不同的支付金额的情况下,硬件钱包如何选择数字货币或数字货币的组合为例,简要说明上述实施例中的硬件钱包数字货币的选取流程。
(1)支付金额为13;
获取到的支付金额为13,判断存在至少一个可用金额大于等于支付金额的数字货币,该数字货币为13和15,进一步根据支付数据链,以及交易时间,确定待输出货币。
(2)支付金额为18;
获取到的支付金额为18,判断不存在可用金额大于等于支付金额的数字货币,选取的数字货币数量为2个,选取可用金额最小的数字货币组合,1和2,判断该数字货币组合小于支付金额,判断还有剩余货币,去掉可用金额最小的数字货币1,返回执行选取可用金额最小的数字货币组合,2和5,并判断该数字货币组合小于支付金额,判断还有剩余货币,去掉可用金额最小的数字货币2,以此循环,直至找到数字货币组合10和13,判断该数字货币组合大于或等于支付金额,进一步通过支付数据链等判断交易时间是否大于预设时间,如果大于,则重新选择,如果小于,则确定最优的可用金额最小的数字货币组合,并计算交易时间,确定待输出货币。
(3)支付金额为30;
获取到的支付金额为30,判断不存在可用金额大于等于支付金额的数字货币,选取的数字货币数量为2个,选取可用金额最小的数字货币组合,1和2,判断该数字货币组合小于支付金额,判断还有剩余货币,去掉可用金额最小的数字货币1,返回执行选取可用金额最小的数字货币组合,2和5,并判断该数字货币组合小于支付金额,判断还有剩余货币,去掉可用金额最小的数字货币2,以此循环,直至没有剩余货币,执行数字货币数量加1,选取3个数字货币,直至选至数字货币7、10和13的组合,判断该数字货币组合大于或等 于支付金额,进一步通过支付数据链等判断交易时间是否大于预设时间,如果大于,则重新选择,如果小于,则确定最优的可用金额最小的数字货币组合,并计算交易时间,确定待输出货币。
通过本实施例提供的硬件钱包数字货币选取方法,选取最接近支付金额的数字货币,计算该数字货币的交易时间,以及选取最优的可用金额最小的数字货币组合,并计算该数字货币组合的交易时间,进一步通过交易时间决定待输出数字货币并输出,通过上述数字货币或数字货币组合的选择流程,可选取到适用于交易的交易时间最短的数字货币或数字货币组合,避免了在脱机状态下使用硬件钱包中的数字货币完成交易时,由于支付数据链多而导致的交易时间长,交易效率低下的问题,提高了用户在脱机状态下使用硬件钱包的使用感受。
尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在不脱离本发明的原理和宗旨的情况下在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。本发明的范围由所附权利要求及其等同限定。
Claims (8)
- 一种硬件钱包数字货币选取方法,其特征在于,包括:S1,获取支付金额;S2,将存储的数字货币按照可用金额从大到小排列,其中,所述数字货币包括:初始数字货币;和/或,所述数字货币包括:初始数字货币和至少一个支付数据链;S3,判断是否存在至少一个可用金额大于等于所述支付金额的数字货币,如果存在则执行步骤S4,如果不存在则执行步骤S9;S4,获取大于等于所述支付金额的全部数字货币,判断全部数字货币中的每个数字货币是否包含支付数据链,如果有不包含支付数据链的数字货币,则执行S5,如果没有不包含支付数据链的数字货币,则执行S6;S5,获取所述不包含支付数据链的数字货币,执行S7;S6,获取包含支付数据链最少的数字货币,执行S7;S7,选取的数字货币数量确定为一,确定一个可用金额最接近所述支付金额的数字货币,计算所述可用金额最接近所述支付金额的数字货币的交易时间,其中,所述交易时间包括:传输所述可用金额最接近所述支付金额的数字货币的耗时、对所述可用金额最接近所述支付金额的数字货币进行签名的耗时和对端设备验证所述可用金额最接近所述支付金额的数字货币的签名的耗时之和;S8,判断所述可用金额最接近所述支付金额的数字货币的交易时间是否大于预设时间,如果大于预设时间,执行S9,如果不大于预设时间,执行S20;S9,在剩余数字货币中选取数字货币;S10,选取的数字货币数量加一,将剩余数字货币从大到小进行排列;S11,选取可用金额最小的数字货币组合,判断所述可用金额最小的数字货币组合是否大于等于所述支付金额,如果所述可用金额最小的数字货币组合小于所述支付金额,执行步骤S12,如果所述可用金额最小的数字货币组合大于等于所述支付金额,则执行S14;S12,判断是否还有剩余货币,如果还有剩余货币,执行S13,如果没有剩余货币,且选取的数字货币数量小于所述硬件钱包中数字货币的总数,执行S10,如果没有剩余货币,且选取的数字货币数量等于所述硬件钱包中数字货币的总数,执行S22;S13,去掉可用金额最小的数字货币,返回执行S11;S14,获取包含支付数据链最多的数字货币;S15,计算所述包含支付数据链最多的数字货币的交易时间;S16,判断所述包含支付数据链最多的数字货币的交易时间是否大于所述预设时间,如果所述包含支付数据链最多的数字货币的交易时间大于所述预设时间,则返回执行S10,如果所述包含支付数据链最多的数字货币的交易时间小于等于所述预设时间,则执行S17;S17,确定最优的可用金额最小的数字货币组合,计算所述最优的可用金额最小的数字货币组合的交易时间;S18,如果存在可用金额最接近所述支付金额的数字货币,判断所述最优的可用金额最小的数字货币组合的交易时间是否大于所述可用金额最接近所述支付金额的数字货币的交易时间,如果所述最优的可用金额最小的数字货币组合的交易时间大于所述可用金额最接近所述支付金额的数字货币的交易时间,返回执行S20,如果所述可用金额最小的数字货币组合的交易时间不大于可用金额最接近所述支付金额的数字货币的交易时间,则执行S19;如果不存在可用金额最接近所述支付金额的数字货币,则执行S19;S19,将所述最优的可用金额最小的数字货币组合作为待输出数字货币,执行S21;S20,将所述可用金额最接近所述支付金额的数字货币作为待输出数字货币,执行S21;S21,输出所述待输出数字货币;S22,结束流程。
- 根据权利要求1所述的方法,其特征在于,在所述选取的数字货币数量加一,将剩余数字货币从大到小进行排列之后,所述选取可用金额最小的数字货币组合之前,还包括:判断全部数字货币的可用金额是否大于等于所述支付金额,在判断全部数字货币的可用金额大于等于所述支付金额的情况下,执行所述选取可用金额最小的数字货币组合的步骤。
- 根据权利要求1所述的方法,其特征在于,还包括:所述获取支付金额之前,还包括:设置基本信息参数,其中,所述基本信息参数包括:传输所述初始数字货币的耗时mX、传输一条支付数据链的耗时X、计算一次签名的耗时B和验证一条签名的耗时C。
- 根据权利要求3所述的方法,其特征在于,所述预设时间为:mX+X+B+3C ms。
- 一种硬件钱包,其特征在于,包括:输入模块、第一判断模块、第二判断模块、第一获取模块、第二获取模块、第一交易时间计算模块、数字货币选取模块、数字货币数量增加模块、数字货币组合选取模块、剩余货币判断模块、数字货币去掉模块、 第二交易时间计算模块、第三交易时间计算模块、第二待输出数字货币确定模块、第一待输出数字货币确定模块、输出模块和流程结束模块,其中,所述输入模块,用于获取支付金额,并触发所述第一判断模块执行操作;所述第一判断模块,用于将存储的数字货币按照可用金额从大到小排列,其中,所述数字货币包括:初始数字货币;和/或,所述数字货币包括:初始数字货币和至少一个支付数据链;判断是否存在至少一个可用金额大于等于所述支付金额的数字货币,如果存在则触发所述第二判断模块执行操作,如果不存在则所述触发数字货币选取模块执行操作;所述第二判断模块,用于获取大于等于所述支付金额的全部数字货币,判断全部数字货币中的每个数字货币是否包含支付数据链,如果有不包含支付数据链的数字货币,则触发所述第一获取模块执行操作,如果没有不包含支付数据链的数字货币,则触发所述第二获取模块执行操作;所述第一获取模块,用于获取所述不包含支付数据链的数字货币,触发所述第一交易时间计算模块执行操作;所述第二获取模块,用于获取包含支付数据链最少的数字货币,触发所述第一交易时间计算模块执行操作;所述第一交易时间计算模块,用于选取的数字货币数量确定为一,确定一个可用金额最接近所述支付金额的数字货币,计算所述可用金额最接近所述支付金额的数字货币的交易时间,其中,所述交易时间包括:传输所述可用金额最接近所述支付金额的数字货币的耗时、对所述可用金额最接近所述支付金额的数字货币进行签名的耗时和对端设备验证所述可用金额最接近所述支付金额的数字货币的签名的耗时之和;判断所述可用金额最接近所述支付金额的数字货币的交易时间是否大于预设时间,如果大于预设时间,触发所述数字货币选取模块执行操作,如果不大于预设时间,触发所述第一待输出数字货币确定模块执行操作;所述数字货币选取模块,用于在剩余数字货币中选取数字货币,触发所述数字货币数量增加模块执行操作;所述数字货币数量增加模块,用于选取的数字货币数量加一,将剩余数字货币从大到小进行排列,触发所述数字货币组合选取模块执行操作;所述数字货币组合选取模块,选取可用金额最小的数字货币组合,判断所述可用金额最小的数字货币组合是否大于等于所述支付金额,如果所述可用金额最小的数字货币组合小于所述支付金额,触发所述剩余货币判断模块执行操作,如果所述可用金额最小的数字货币组合大于等于所述支付金额,则触发所述第二交易时间计算模块执 行操作;所述剩余货币判断模块,用于判断是否还有剩余货币,如果还有剩余货币,触发所述数字货币去掉模块执行操作,如果没有剩余货币,且选取的数字货币数量小于所述硬件钱包中数字货币的总数,触发所述数字货币数量增加模块执行操作,如果没有剩余货币,且选取的数字货币数量等于所述硬件钱包中数字货币的总数,触发流程结束模块执行操作;所述数字货币去掉模块,用于去掉可用金额最小的数字货币,触发所述数字货币组合选取模块执行操作;所述第二交易时间计算模块,用于获取包含支付数据链最多的数字货币;计算所述包含支付数据链最多的数字货币的交易时间;判断所述包含支付数据链最多的数字货币的交易时间是否大于所述预设时间,如果所述包含支付数据链最多的数字货币的交易时间大于所述预设时间,则触发所述数字货币数量增加模块执行操作,如果所述包含支付数据链最多的数字货币的交易时间小于等于所述预设时间,则触发所述第三交易时间计算模块执行操作;所述第三交易时间计算模块,确定最优的可用金额最小的数字货币组合,计算所述最优的可用金额最小的数字货币组合的交易时间;如果存在可用金额最接近所述支付金额的数字货币,判断所述最优的可用金额最小的数字货币组合的交易时间是否大于所述可用金额最接近所述支付金额的数字货币的交易时间,如果所述最优的可用金额最小的数字货币组合的交易时间大于所述可用金额最接近所述支付金额的数字货币的交易时间,触发所述第一待输出数字货币确定模块执行操作,如果所述可用金额最小的数字货币组合的交易时间不大于可用金额最接近所述支付金额的数字货币的交易时间,触发所述第二待输出数字货币确定模块执行操作;如果不存在可用金额最接近所述支付金额的数字货币,触发所述第二待输出数字货币确定模块执行操作;所述第二待输出数字货币确定模块,用于将所述最优的可用金额最小的数字货币组合作为待输出数字货币,触发所述输出模块执行操作;所述第一待输出数字货币确定模块,用于将所述可用金额最接近所述支付金额的数字货币作为待输出数字货币,触发所述输出模块执行操作;所述输出模块,用于输出所述待输出数字货币;所述流程结束模块,用于结束流程。
- 根据权利要求5所述的硬件钱包,其特征在于,在所述数字货币数量增加模块选取的数字货币数量加一,将剩余数字货币从大到小进行排列之后:所述数字货币数量增加模块,还用于判断全部数字货币的可用金额是否大于等于 所述支付金额,在判断全部数字货币的可用金额大于等于所述支付金额的情况下,触发数字货币组合选取模块执行所述选取可用金额最小的数字货币组合的操作。
- 根据权利要求5所述的硬件钱包,其特征在于,还包括:基本参数设置模块,其中,所述基本参数设置模块,用于设置基本信息参数,其中,所述基本信息参数包括:传输所述初始数字货币的耗时mX、传输一条支付数据链的耗时X、计算一次签名的耗时B和验证一条签名的耗时C。
- 根据权利要求7所述的硬件钱包,其特征在于,所述预设时间为:mX+X+B+3C ms。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110008634.1A CN112633876A (zh) | 2021-01-05 | 2021-01-05 | 一种硬件钱包数字货币选取方法及硬件钱包 |
CN202110008634.1 | 2021-01-05 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022148199A1 true WO2022148199A1 (zh) | 2022-07-14 |
Family
ID=75290690
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/136241 WO2022148199A1 (zh) | 2021-01-05 | 2021-12-08 | 一种硬件钱包数字货币选取方法及硬件钱包 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112633876A (zh) |
WO (1) | WO2022148199A1 (zh) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112633876A (zh) * | 2021-01-05 | 2021-04-09 | 天地融科技股份有限公司 | 一种硬件钱包数字货币选取方法及硬件钱包 |
CN113344573A (zh) * | 2021-05-25 | 2021-09-03 | 北京极智数仓科技有限公司 | 数字货币可视化支付方法、***、存储介质、数字货币钱包终端 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20130083075A (ko) * | 2011-12-28 | 2013-07-22 | 주식회사 하나은행 | 전자 지갑 관리 시스템, 이를 위한 사용자 단말, 전자 지갑 관리 방법 및 관리 방법을 컴퓨터에서 실행하기 위한 프로그램을 기록하는 컴퓨터 판독 가능한 기록매체 |
CN106651331A (zh) * | 2016-12-22 | 2017-05-10 | 飞天诚信科技股份有限公司 | 一种基于数字货币的电子交易方法及*** |
CN107330692A (zh) * | 2017-06-26 | 2017-11-07 | 中国人民银行数字货币研究所 | 数字货币的流通方法和装置 |
CN107392600A (zh) * | 2017-06-26 | 2017-11-24 | 中国人民银行数字货币研究所 | 数字货币交易付款登记方法和*** |
CN112633876A (zh) * | 2021-01-05 | 2021-04-09 | 天地融科技股份有限公司 | 一种硬件钱包数字货币选取方法及硬件钱包 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111915283A (zh) * | 2019-05-09 | 2020-11-10 | 天地融科技股份有限公司 | 一种脱机电子货币支付方法及装置 |
CN111144862B (zh) * | 2019-12-31 | 2022-11-18 | 深圳四方精创资讯股份有限公司 | 数字货币双离线支付的实现方法、装置、设备、存储介质 |
-
2021
- 2021-01-05 CN CN202110008634.1A patent/CN112633876A/zh active Pending
- 2021-12-08 WO PCT/CN2021/136241 patent/WO2022148199A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20130083075A (ko) * | 2011-12-28 | 2013-07-22 | 주식회사 하나은행 | 전자 지갑 관리 시스템, 이를 위한 사용자 단말, 전자 지갑 관리 방법 및 관리 방법을 컴퓨터에서 실행하기 위한 프로그램을 기록하는 컴퓨터 판독 가능한 기록매체 |
CN106651331A (zh) * | 2016-12-22 | 2017-05-10 | 飞天诚信科技股份有限公司 | 一种基于数字货币的电子交易方法及*** |
CN107330692A (zh) * | 2017-06-26 | 2017-11-07 | 中国人民银行数字货币研究所 | 数字货币的流通方法和装置 |
CN107392600A (zh) * | 2017-06-26 | 2017-11-24 | 中国人民银行数字货币研究所 | 数字货币交易付款登记方法和*** |
CN112633876A (zh) * | 2021-01-05 | 2021-04-09 | 天地融科技股份有限公司 | 一种硬件钱包数字货币选取方法及硬件钱包 |
Also Published As
Publication number | Publication date |
---|---|
CN112633876A (zh) | 2021-04-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022148199A1 (zh) | 一种硬件钱包数字货币选取方法及硬件钱包 | |
JP6998348B2 (ja) | 複数のノードの分散ネットワークで構成されたブロックチェーン上の複数のノード間の合意をなすための方法 | |
Luu et al. | Demystifying incentives in the consensus computer | |
CN109075964B (zh) | 支持用于区块验证的多个单向函数的区块链 | |
JP7512294B2 (ja) | ブロックチェーンネットワークを介した移転を実施するためのコンピュータで実施されるシステムおよび方法 | |
US20200134578A1 (en) | Blockchain consensus systems and methods involving a time parameter | |
CN110458557B (zh) | 一种付款方法、设备及存储介质 | |
WO2020069411A1 (en) | High throughput blockchain consensus systems and methods with low finalization time | |
Vallois et al. | Bitcoin transaction: From the creation to validation, a protocol overview | |
Ferraro et al. | IOTA-based directed acyclic graphs without orphans | |
Spain et al. | The impact of ethereum throughput and fees on transaction latency during icos | |
CN110751469A (zh) | 一种基于智能合约的加密货币多通道支付方法 | |
TWI805040B (zh) | 支付方法、收款設備、付款設備及存儲介質 | |
WO2022206446A1 (zh) | 交易凭证的生成、验证及存储方法、装置、设备和*** | |
CN112118138B (zh) | 区块链共识机制实现***和方法 | |
WO2023045531A1 (zh) | 基于区块链的交易费用结算 | |
CN114945928A (zh) | 时间锁定的区块链事务和相关区块链技术 | |
GB2572340A (en) | Data processing system using directed acyclic graph and method of use thereof | |
TW202109333A (zh) | 用於工作量證明區塊鏈網路上非並行化挖礦之系統及方法 | |
WO2022148200A1 (zh) | 一种硬件钱包数字货币选取方法及硬件钱包 | |
Mittal et al. | Hyperparameter optimization using sustainable proof of work in blockchain | |
JP2019521442A (ja) | 支払い主体の拡張を促進する方法およびデバイス | |
US12026760B2 (en) | Method and apparatus for transacting resource flow | |
CN111210345B (zh) | 一种基于区块链网络交易的签名方法、装置及终端设备 | |
KR20200032928A (ko) | 가상 화폐를 이용한 환율 고정식 환전 방법, 장치 및 컴퓨터-판독가능 기록매체 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21917240 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21917240 Country of ref document: EP Kind code of ref document: A1 |