HK1248349B - Data processing method and equipment based on blockchain - Google Patents
Data processing method and equipment based on blockchain Download PDFInfo
- Publication number
- HK1248349B HK1248349B HK18107874.6A HK18107874A HK1248349B HK 1248349 B HK1248349 B HK 1248349B HK 18107874 A HK18107874 A HK 18107874A HK 1248349 B HK1248349 B HK 1248349B
- Authority
- HK
- Hong Kong
- Prior art keywords
- time
- processing
- business data
- block
- set time
- Prior art date
Links
Description
技术领域Technical Field
本申请涉及互联网信息处理技术以及计算机技术领域,尤其涉及一种基于区块链的数据处理方法及设备。The present application relates to the fields of Internet information processing technology and computer technology, and in particular to a data processing method and device based on blockchain.
背景技术Background Art
区块链技术也称为分布式账本技术,是一种分布式互联网数据库技术,其特点是去中心化、公开透明、不可篡改、可信任。基于区块链技术,可以组建区块链网络。区块作为区块链网络中的一种逻辑上的数据结构,可用于存储业务数据。然而,区块链网络中的区块是动态生成的。Blockchain technology, also known as distributed ledger technology, is a distributed internet database technology characterized by decentralization, transparency, immutability, and trustworthiness. Blockchain technology can be used to build blockchain networks. Blocks, as a logical data structure within a blockchain network, can be used to store business data. However, blocks in a blockchain network are generated dynamically.
在实际应用中,通常按照设定时间间隔产生区块(例如:每十分钟产生一个区块,或者更长时间产生一个区块)。而该区块中存储在设定时间间隔期间产生的业务数据。In actual applications, blocks are usually generated at set time intervals (for example, one block is generated every ten minutes, or one block is generated at a longer time interval), and the blocks store business data generated during the set time interval.
但是,随着科学技术的发展,业务数据的数据量是发生变化的,数据量可大可小,那么基于现有的区块产生机制,将无法在业务需求与系统资源消耗之间做到平衡。However, with the development of science and technology, the amount of business data is changing, and the amount of data can be large or small. Therefore, based on the existing block generation mechanism, it will be impossible to achieve a balance between business needs and system resource consumption.
发明内容Summary of the Invention
有鉴于此,本申请实施例提供了一种基于区块链的数据处理方法及设备,用于实现业务需求与系统资源消耗之间的平衡。In view of this, the embodiments of the present application provide a blockchain-based data processing method and device for achieving a balance between business needs and system resource consumption.
本申请实施例采用下述技术方案:The embodiments of this application adopt the following technical solutions:
本申请实施例提供一种基于区块链的数据处理方法,包括:The present invention provides a data processing method based on blockchain, including:
监控设定时间周期内共识处理业务数据的处理数量;Monitor the amount of consensus processing business data processed within a set time period;
根据所述处理数量,动态调整区块产生的时间;Dynamically adjust the block generation time according to the processing quantity;
按照调整后的所述时间,产生新的区块。A new block is generated according to the adjusted time.
本申请实施例还提供一种基于区块链的数据处理设备,包括:The present application also provides a blockchain-based data processing device, including:
监控单元,监控设定时间周期内共识处理业务数据的处理数量;A monitoring unit monitors the amount of consensus processing business data processed within a set time period;
调整单元,根据所述处理数量,动态调整区块产生的时间;An adjustment unit, dynamically adjusting the time of block generation according to the processing quantity;
处理单元,按照调整后的所述时间,产生新的区块。The processing unit generates a new block according to the adjusted time.
本申请实施例还提供一种基于区块链的数据处理设备,包括:至少一个存储器和至少一个处理器,所述存储器中存储有程序,并被配置为由所述至少一个处理器执行以下步骤:The present application also provides a blockchain-based data processing device, comprising: at least one memory and at least one processor, wherein the memory stores a program and is configured to execute the following steps by the at least one processor:
监控设定时间周期内共识处理业务数据的处理数量;Monitor the amount of consensus processing business data processed within a set time period;
根据所述处理数量,动态调整区块产生的时间;Dynamically adjust the block generation time according to the processing quantity;
按照调整后的所述时间,产生新的区块。A new block is generated according to the adjusted time.
本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
本申请实施例通过监控设定时间周期内共识处理业务数据的处理数量;并根据所述处理数量,动态调整区块产生的时间;进而按照调整后的所述时间,产生新的区块。这样,能够有效保证区块产生的速度与业务数据的变化量相匹配,一方面满足业务需求的要求,另一方面,在对业务数据进行共识处理时,也能够保证系统资源的利用率,不会出现系统资源的利用率高低起伏变化的情况,有效实现了实现业务需求与系统资源消耗之间的平衡。The embodiment of the present application monitors the amount of consensus-processed business data within a set time period; dynamically adjusts the time for block generation based on the amount of processing; and then generates new blocks according to the adjusted time. In this way, it can effectively ensure that the speed of block generation matches the amount of change in business data, on the one hand meeting the requirements of business needs; on the other hand, when consensus processing is performed on business data, it can also ensure the utilization rate of system resources, and will not cause fluctuations in the utilization rate of system resources, effectively achieving a balance between business needs and system resource consumption.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
图1为本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;FIG1 is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application;
图2为本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;FIG2 is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application;
图3为本申请实施例提供的一种基于区块链的数据处理方法的流程示意图;FIG3 is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application;
图4为本申请实施例提供的一种基于区块链的数据处理设备的结构示意图;FIG4 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application;
图5为本申请实施例提供的一种基于区块链的数据处理设备的结构示意图。FIG5 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
基于现有的区块产生机制,如果业务数据产生的速度远远大于区块产生的速度,那么将使得大量业务数据堆积,使得业务数据的处理效率降低;如果业务数据产生的速度小于区块产生的速度,那么意味着共识处理的业务数据量将比较小,这样将造成系统资源浪费(因为发起一次共识所消耗的系统资源不变)。Based on the existing block generation mechanism, if the speed of business data generation is much faster than the speed of block generation, a large amount of business data will accumulate, reducing the efficiency of business data processing; if the speed of business data generation is slower than the speed of block generation, it means that the amount of business data processed by consensus will be relatively small, which will cause a waste of system resources (because the system resources consumed by initiating a consensus remain unchanged).
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请具体实施例及相应的附图对本申请技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
以下结合附图,详细说明本申请各实施例提供的技术方案。The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.
图1为本申请实施例提供的一种基于区块链的数据处理方法的流程示意图。所述方法可以如下所示。本申请实施例的执行主体可以为区块链网络中的区块链节点,也可以为独立于区块链节点的其他设备,用于控制区块的产生速度。Figure 1 is a flow chart of a blockchain-based data processing method provided in an embodiment of the present application. The method may be as follows. The execution entity of the embodiment of the present application may be a blockchain node in a blockchain network, or other device independent of the blockchain node, used to control the block generation rate.
步骤101:监控设定时间周期内共识处理业务数据的处理数量。Step 101: Monitor the amount of consensus processing business data processed within a set time period.
在本申请实施例中,可以以一个区块链节点为监控对象,对该区块链节点在设定时间周期内共识处理的业务数据的处理数量进行监控;也可以分别以多个区块链节点为监控对象,分别对不同区块链节点在设定时间周期内共识处理的业务数据的处理数量进行监控,这里不做具体限定。In an embodiment of the present application, a blockchain node can be used as the monitoring object to monitor the amount of business data processed by consensus on the blockchain node within a set time period; or multiple blockchain nodes can be used as monitoring objects to monitor the amount of business data processed by consensus on different blockchain nodes within a set time period. No specific limitation is made here.
下面以对一个区块链节点在设定时间周期内共识处理的业务数据的处理数量进行监控为例进行说明。The following example illustrates monitoring the amount of business data processed by a blockchain node within a set time period.
在本申请实施例中,在未对区块的产生进行调整之前,区块可以按照设定的基准时间生成,即在基准时间到达时,产生一个新的区块。那么从上一个基准时间到当前这个基准时间这期间,将产生业务数据。In the embodiment of the present application, before the generation of blocks is adjusted, blocks can be generated according to the set reference time, that is, when the reference time arrives, a new block is generated. Then, business data will be generated from the previous reference time to the current reference time.
这里的基准时间可以是指一个时间长度,也可以是指一个时间点,这里不做具体限定。The reference time here may refer to a length of time or a point in time, and is not specifically limited here.
在新的区块产生后,将对产生的业务数据进行共识处理,进而将共识通过的业务数据存储在该新的区块中。After a new block is generated, consensus processing will be performed on the generated business data, and then the business data that passes the consensus will be stored in the new block.
这里的设定时间周期可以根据区块产生的基准时间确定,还可以根据实际需要确定,这里不做具体限定。The set time period here can be determined based on the base time of block generation, or can be determined based on actual needs, and is not specifically limited here.
那么在本申请实施例中,若产生的业务数据的数据量比较小,那么在设定时间周期内共识处理的业务数据可以理解为产生的业务数据的数据量;若产生的业务数据的数据量比较大(一个区块的存储容量无法满足产生的业务数据的数据量),那么在设定时间周期内共识处理的业务数据可以理解为一次共识实际捞取的业务数据的数据量。Then, in the embodiment of the present application, if the amount of business data generated is relatively small, then the business data processed by consensus within the set time period can be understood as the amount of business data generated; if the amount of business data generated is relatively large (the storage capacity of a block cannot meet the amount of business data generated), then the business data processed by consensus within the set time period can be understood as the amount of business data actually retrieved by a consensus.
在监控设定时间周期内共识处理业务数据的处理数量时,为了保证后续对区块产生的时间进行调整的准确性,还可以监控连续n个设定时间周期内共识处理业务数据的处理数量,n为自然数,所述设定时间周期根据区块产生的时间确定。When monitoring the amount of consensus processing business data processed within a set time period, in order to ensure the accuracy of subsequent adjustments to the time of block generation, the amount of consensus processing business data processed within n consecutive set time periods can also be monitored, where n is a natural number, and the set time period is determined according to the time of block generation.
较优地,在本申请实施例中,还可以确定一个业务数据的基准处理量,该基准处理量可以根据区块的容量确定,也可以根据实际需要确定,这里不做具体限定。Preferably, in the embodiment of the present application, a benchmark processing capacity of business data can also be determined. The benchmark processing capacity can be determined based on the capacity of the block or based on actual needs, and is not specifically limited here.
步骤103:根据所述处理数量,动态调整区块产生的时间。Step 103: Dynamically adjust the block generation time according to the processing quantity.
在本申请实施例中,若所述处理数量小于设定第一阈值,则将区块产生的时间延长设定第一时长;In the embodiment of the present application, if the processing quantity is less than a set first threshold, the time for generating the block is extended by a set first time period;
若所述处理数量大于设定第二阈值,则将区块产生的时间缩短设定第二时长。If the processing quantity is greater than a set second threshold, the time for generating the block is shortened by a set second time period.
这里的第一阈值可以根据基准处理量确定,也可以根据区块链节点业务数据处理的最小能力确定,这里不做具体限定;这里的第一阈值也可以根据基准处理量确定,还可以根据区块链节点业务数据处理的最大能力确定,这里不做具体限定。The first threshold here can be determined based on the benchmark processing volume, or it can be determined based on the minimum capacity of the blockchain node business data processing, and no specific limitation is made here; the first threshold here can also be determined based on the benchmark processing volume, or it can be determined based on the maximum capacity of the blockchain node business data processing, and no specific limitation is made here.
较优地,在本申请实施例中,如果步骤101中监控得到的处理数量为连续n个设定时间周期内共识处理业务数据的处理数量,那么在本申请实施例中,根据各所述设定时间周期对应的所述处理数量,动态调整区块产生的时间。Preferably, in an embodiment of the present application, if the processing quantity monitored in step 101 is the processing quantity of consensus-processed business data within n consecutive set time periods, then in an embodiment of the present application, the time for block generation is dynamically adjusted according to the processing quantity corresponding to each of the set time periods.
具体地,若各所述设定时间周期对应的所述处理数量呈递增趋势,且最大的所述处理数量大于设定第二阈值时,将区块产生的时间缩短设定第二时长。Specifically, if the processing quantity corresponding to each of the set time periods shows an increasing trend, and the maximum processing quantity is greater than a set second threshold, the time for generating a block is shortened by a set second duration.
若各所述设定时间周期对应的所述处理数量呈递减趋势,且最小的所述处理数量小于设定第一阈值时,将区块产生的时间延长设定第一时长。If the processing quantities corresponding to the set time periods show a decreasing trend and the minimum processing quantity is less than a set first threshold, the time for generating a block is extended by a set first time period.
这里的第一时长可以是区块产生的基准时间的整数倍,例如:假设基准时间为一个时长,例如:T时长,那么第一时长可以是指a*T,那么区块产生的时间在延长第一时长之后,将变成T+a*T,这里的a为正数;这里的第二时长可以是区块产生的基准时间的小数倍,假设基准时间为一个时长,例如:T时长,那么第二时长可以是指b*T,那么区块产生的时间在缩短第二时长之后,将变成T-b*T,这里的b为正数,且小于1。The first duration here can be an integer multiple of the base time of block generation. For example, assuming the base time is a duration, such as T, then the first duration can refer to a*T. Then, after the first duration is extended, the time of block generation will become T+a*T, where a is a positive number. The second duration here can be a decimal multiple of the base time of block generation. Assuming the base time is a duration, such as T, then the second duration can refer to b*T. Then, after the second duration is shortened, the time of block generation will become T-b*T, where b is a positive number and less than 1.
步骤105:按照调整后的所述时间,产生新的区块。Step 105: Generate a new block according to the adjusted time.
在本申请实施例中,按照调整后的时间,动态产生新的区块。In the embodiment of the present application, new blocks are dynamically generated according to the adjusted time.
如果调整后的时间相对于基准时间延长,可以增加计算难度,放慢区块产生的速度;如果调整后的时间相对于基准时间缩短,可以减小计算难度,加快区块产生的速度。If the adjusted time is extended relative to the base time, the computational difficulty can be increased, slowing down the speed of block generation; if the adjusted time is shortened relative to the base time, the computational difficulty can be reduced, speeding up the speed of block generation.
通过本申请提供的技术方案,监控设定时间周期内共识处理业务数据的处理数量;并根据所述处理数量,动态调整区块产生的时间;进而按照调整后的所述时间,产生新的区块。这样,能够有效保证区块产生的速度与业务数据的变化量相匹配,一方面满足业务需求的要求,另一方面,在对业务数据进行共识处理时,也能够保证系统资源的利用率,不会出现系统资源的利用率高低起伏变化的情况,有效实现了实现业务需求与系统资源消耗之间的平衡。Through the technical solution provided by this application, the amount of consensus-processed business data processed within a set time period is monitored; and based on the processing amount, the time of block generation is dynamically adjusted; and then new blocks are generated according to the adjusted time. In this way, it is possible to effectively ensure that the speed of block generation matches the amount of change in business data, on the one hand, meeting the requirements of business needs, and on the other hand, when consensus processing is performed on business data, it is also possible to ensure the utilization rate of system resources, and there will be no fluctuations in the utilization rate of system resources, effectively achieving a balance between business needs and system resource consumption.
图2为本申请实施例提供的一种基于区块链的数据处理方法的流程示意图。所述方法可以如下所示。若区块产生的时间不变,在本申请实施例中,还可以动态调整共识处理业务数据的处理数量,这样以提升系统资源的利用率,进而实现业务需要与系统资源消耗之间的平衡。Figure 2 is a flow chart of a blockchain-based data processing method provided in an embodiment of the present application. The method can be as follows. If the block generation time remains unchanged, in this embodiment of the present application, the amount of consensus processing business data can be dynamically adjusted to improve system resource utilization and achieve a balance between business needs and system resource consumption.
步骤202:监控连续m个设定时间周期内产生的业务数据的数量。Step 202: Monitor the amount of business data generated within m consecutive set time periods.
这里的m小于n,且为自然数。Here m is less than n and is a natural number.
步骤204:若确定的区块产生的时间等于基准时间,则判断所述数量是否大于基准处理量,以及判断所述数量是否小于调整后的处理数量,若大于基准处理量,执行步骤206;若小于调整后的处理数量,执行步骤208。Step 204: If the time at which the determined block is generated is equal to the reference time, determine whether the number is greater than the reference processing amount, and determine whether the number is less than the adjusted processing amount. If it is greater than the reference processing amount, execute step 206; if it is less than the adjusted processing amount, execute step 208.
在本申请实施例中,假设区块产生的时间为基准时间,但是业务数据将随着业务执行发生变化,若业务数据的数量较低,即低于基准处理量,那么在新的区块产生时,可以将产生的所有业务数据进行共识处理。In the embodiment of the present application, it is assumed that the time when the block is generated is the benchmark time, but the business data will change as the business is executed. If the amount of business data is low, that is, lower than the benchmark processing capacity, then when a new block is generated, all the generated business data can be processed by consensus.
若业务数量的数量比较大,一旦大于基准处理量,即需要触发执行步骤206,即增加每一次业务数据共识处理的处理数量,以保证系统资源的利用率。If the number of businesses is relatively large, once it exceeds the benchmark processing capacity, it is necessary to trigger the execution of step 206, that is, to increase the processing quantity of each business data consensus processing to ensure the utilization of system resources.
步骤206:若连续m个设定时间周期内产生的业务数据的数量大于基准处理量,那么调整设定时间周期内共识处理业务数据的处理数量,跳转执行步骤210。Step 206: If the amount of business data generated within m consecutive set time periods is greater than the benchmark processing capacity, then adjust the processing amount of consensus-processed business data within the set time period and jump to step 210.
在本申请实施例中,调整设定时间周期内共识处理业务数据的处理数量可以理解为增加处理数量,这里的增加幅度可以根据业务数据的基准处理量确定。In the embodiment of the present application, adjusting the processing quantity of consensus processing business data within a set time period can be understood as increasing the processing quantity, and the increase range here can be determined based on the baseline processing volume of the business data.
步骤208:若连续m个设定时间周期内产生的业务数据的数量小于调整后的处理数量,那么调整设定时间周期内共识处理业务数据的处理数量,m小于n,且为自然数。Step 208: If the amount of business data generated within m consecutive set time periods is less than the adjusted processing quantity, then the processing quantity of consensus-processed business data within the set time period is adjusted, where m is less than n and is a natural number.
在本申请实施例中,连续m个设定时间周期内产生的业务数据的数量小于调整后的处理数量,说明业务数据的速度在下降,此时,需要调低设定时间周期内共识处理业务数据的处理数量。In an embodiment of the present application, the amount of business data generated within m consecutive set time periods is less than the adjusted processing quantity, indicating that the speed of the business data is decreasing. At this time, it is necessary to lower the processing quantity of consensus-processed business data within the set time period.
步骤210:在m+1个设定时间周期内按照调整后的处理数量,对业务数据进行共识处理。Step 210: Perform consensus processing on the business data according to the adjusted processing quantity within m+1 set time periods.
图3为本申请实施例提供的一种基于区块链的数据处理方法的流程示意图。所述方法可以如下所示。FIG3 is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application. The method can be as follows.
步骤301:获取在区块产生的基准时长内产生的业务数据。Step 301: Acquire business data generated within the benchmark time period of block generation.
步骤303:判断业务数据的数据量是否小于业务数据的基准处理量,若小于,则在新的区块产生时,对获取到的业务数据进行共识处理,或者在连续m次共识处理的业务数据的处理量都小于业务数据的基准处理量,延长区块产生的时间;若大于,则执行步骤305。Step 303: Determine whether the amount of business data is less than the benchmark processing capacity of business data. If so, perform consensus processing on the acquired business data when a new block is generated, or if the processing capacity of business data after m consecutive consensus processes is less than the benchmark processing capacity of business data, extend the time for block generation; if so, execute step 305.
步骤305:在新的区块产生时,从获取到的业务数据中获取基准处理量对应的业务数据进行共识处理。Step 305: When a new block is generated, business data corresponding to the benchmark processing volume is obtained from the acquired business data for consensus processing.
步骤307:若监控得到连续m次共识处理的业务数据的处理量为基准处理量,那么增加业务数据的基准处理量,并将增加后的基准处理量作为下一次共识处理的处理数量。Step 307: If the processing volume of the business data obtained from the monitoring of m consecutive consensus processes is the benchmark processing volume, then the benchmark processing volume of the business data is increased, and the increased benchmark processing volume is used as the processing volume for the next consensus process.
步骤309:按照增加后的基准处理量,在m+1次共识处理时获取对应的业务数据,并对获取的业务数据进行共识处理。Step 309: According to the increased benchmark processing volume, corresponding business data is obtained during the m+1 consensus processing, and consensus processing is performed on the obtained business data.
步骤302:当增加后的基准处理量达到设定的最大值时,缩短区块产生的时间。Step 302: When the increased baseline processing capacity reaches a set maximum value, shorten the block generation time.
步骤304:监测共识处理业务数据的处理数量,当处理数量小于设定的最大值时,延长区块产生的时间。Step 304: Monitor the processing quantity of consensus processing business data. When the processing quantity is less than the set maximum value, extend the block generation time.
步骤306:当区块产生的时间达到基准时间时,减少业务处理的处理数量至处理量达到基准量。Step 306: When the block generation time reaches the reference time, reduce the number of business processes until the processing volume reaches the reference volume.
图4为本申请实施例提供的一种基于区块链的数据处理设备的结构示意图。所述数据处理设备包括:监控单元401、调整单元402和处理单元403,其中:Figure 4 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The data processing device includes: a monitoring unit 401, an adjustment unit 402, and a processing unit 403, wherein:
监控单元401,监控设定时间周期内共识处理业务数据的处理数量;Monitoring unit 401 monitors the amount of consensus processing business data processed within a set time period;
调整单元402,根据所述处理数量,动态调整区块产生的时间;An adjusting unit 402 dynamically adjusts the time of block generation according to the processing quantity;
处理单元403,按照调整后的所述时间,产生新的区块。The processing unit 403 generates a new block according to the adjusted time.
在本申请的另一个实施例中,所述调整单元402根据所述处理数量,动态调整区块产生的时间,包括:In another embodiment of the present application, the adjusting unit 402 dynamically adjusts the block generation time according to the processing quantity, including:
若所述处理数量小于设定第一阈值,则将区块产生的时间延长设定第一时长;If the processing quantity is less than the set first threshold, the block generation time is extended by the set first time period;
若所述处理数量大于设定第二阈值,则将区块产生的时间缩短设定第二时长。If the processing quantity is greater than a set second threshold, the time for generating the block is shortened by a set second time period.
在本申请的另一个实施例中,所述监控单元401监控设定时间周期内共识处理业务数据的处理数量,包括:In another embodiment of the present application, the monitoring unit 401 monitors the amount of consensus processing business data processed within a set time period, including:
监控连续n个设定时间周期内共识处理业务数据的处理数量,n为自然数,所述设定时间周期根据区块产生的时间确定;Monitor the amount of consensus-processed business data processed within n consecutive set time periods, where n is a natural number and the set time period is determined by the time when the block is generated;
所述调整单元402根据所述处理数量,动态调整区块产生的时间,包括:The adjusting unit 402 dynamically adjusts the block generation time according to the processing quantity, including:
根据各所述设定时间周期对应的所述处理数量,动态调整区块产生的时间。The time for generating blocks is dynamically adjusted according to the processing quantity corresponding to each set time period.
在本申请的另一个实施例中,所述调整单元402根据各所述设定时间周期对应的所述处理数量,动态调整区块产生的时间,包括:In another embodiment of the present application, the adjusting unit 402 dynamically adjusts the block generation time according to the processing quantity corresponding to each set time period, including:
若各所述设定时间周期对应的所述处理数量呈递增趋势,且最大的所述处理数量大于设定第二阈值时,将区块产生的时间缩短设定第二时长。If the processing quantities corresponding to the set time periods show an increasing trend and the maximum processing quantity is greater than a set second threshold, the time for generating a block is shortened by a set second time period.
在本申请的另一个实施例中,所述调整单元402根据各所述设定时间周期对应的所述处理数量,动态调整区块产生的时间,包括:In another embodiment of the present application, the adjusting unit 402 dynamically adjusts the block generation time according to the processing quantity corresponding to each set time period, including:
若各所述设定时间周期对应的所述处理数量呈递减趋势,且最小的所述处理数量小于设定第一阈值时,将区块产生的时间延长设定第一时长。If the processing quantities corresponding to the set time periods show a decreasing trend and the minimum processing quantity is less than a set first threshold, the time for generating a block is extended by a set first time period.
在本申请的另一个实施例中,所述调整单元402,若确定的区块产生的时间等于基准时间,且连续m个设定时间周期内产生的业务数据的累计数量大于基准处理量,那么调整设定时间周期内共识处理业务数据的处理数量,m小于n,且为自然数。In another embodiment of the present application, the adjustment unit 402 adjusts the processing quantity of the consensus-processed business data within the set time period if the time when the determined block is generated is equal to the reference time and the cumulative amount of business data generated within m consecutive set time periods is greater than the reference processing capacity, where m is less than n and is a natural number.
在本申请的另一个实施例中,所述调整单元402,若确定的区块产生的时间等于基准时间,且连续m个设定时间周期内产生的业务数据的累计数量小于调整后的处理量,那么调整设定时间周期内共识处理业务数据的处理数量,m小于n,且为自然数。In another embodiment of the present application, the adjustment unit 402 adjusts the processing quantity of consensus-processed business data within the set time period if the time when the determined block is generated is equal to the reference time and the cumulative amount of business data generated within m consecutive set time periods is less than the adjusted processing volume, where m is less than n and is a natural number.
在本申请的另一个实施例中,所述处理单元403,在m+1个设定时间周期内按照调整后的处理数量,对业务数据进行共识处理。In another embodiment of the present application, the processing unit 403 performs consensus processing on the business data according to the adjusted processing quantity within m+1 set time periods.
需要说明的是,本申请实施例提供的数据处理设备可以通过硬件方式实现,也可以通过软件方式实现,这里不做具体限定。数据处理设备监控设定时间周期内共识处理业务数据的处理数量;并根据所述处理数量,动态调整区块产生的时间;进而按照调整后的所述时间,产生新的区块。这样,能够有效保证区块产生的速度与业务数据的变化量相匹配,一方面满足业务需求的要求,另一方面,在对业务数据进行共识处理时,也能够保证系统资源的利用率,不会出现系统资源的利用率高低起伏变化的情况,有效实现了实现业务需求与系统资源消耗之间的平衡。It should be noted that the data processing device provided in the embodiment of the present application can be implemented by hardware or software, and no specific limitation is made here. The data processing device monitors the number of consensus-processed business data processed within a set time period; and dynamically adjusts the time for block generation based on the processing number; and then generates new blocks according to the adjusted time. In this way, it can effectively ensure that the speed of block generation matches the amount of change in business data, on the one hand, meeting the requirements of business needs, and on the other hand, when consensus processing is performed on business data, it can also ensure the utilization of system resources, and there will be no fluctuations in the utilization of system resources, effectively achieving a balance between business needs and system resource consumption.
图5为本申请实施例提供的一种基于区块链的数据处理设备的结构示意图。所述数据处理设备包括:至少一个存储器501和至少一个处理器502,所述存储器501中存储有程序,并被配置为由所述至少一个处理器502执行以下步骤:Figure 5 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The data processing device includes: at least one memory 501 and at least one processor 502. The memory 501 stores a program and is configured to execute the following steps by the at least one processor 502:
监控设定时间周期内共识处理业务数据的处理数量;Monitor the amount of consensus processing business data processed within a set time period;
根据所述处理数量,动态调整区块产生的时间;Dynamically adjust the block generation time according to the processing quantity;
按照调整后的所述时间,产生新的区块。A new block is generated according to the adjusted time.
其中,处理器所具备的功能可参见上述实施例中所记载的内容,这里不再一一赘述。Among them, the functions of the processor can be found in the contents recorded in the above embodiments, and will not be described in detail here.
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable GateArray,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware DescriptionLanguage)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(RubyHardware Description Language)等,目前最普遍使用的是VHDL(Very-High-SpeedIntegrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and/or hardware.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to the flowcharts and/or block diagrams of the methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of processes and/or boxes in the flowchart and/or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims (17)
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK1248349A1 HK1248349A1 (en) | 2018-10-12 |
| HK1248349B true HK1248349B (en) | 2021-04-01 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| TWI680656B (en) | Data processing method and equipment based on blockchain | |
| KR102125177B1 (en) | Blockchain-based data processing method and device | |
| TWI691855B (en) | Blockchain-based data processing method and equipment | |
| CN107196989B (en) | A service request processing method and device | |
| CN107196772B (en) | Method and device for broadcasting message | |
| TW201837735A (en) | Block chain consensus method and device | |
| KR20190096391A (en) | Database status determination method and device, and consistency verification method and device | |
| CN107402824A (en) | A kind of method and device of data processing | |
| CN111930343A (en) | Method, device and medium for acquiring random number and generating random number | |
| CN111880922A (en) | Processing method, device and equipment for concurrent tasks | |
| CN107038058A (en) | A kind of code process method and device | |
| HK1248349B (en) | Data processing method and equipment based on blockchain | |
| CN109614388B (en) | A budget deduction method and device | |
| CN107645541B (en) | Data storage method and device and server | |
| CN116243885B (en) | A full adder circuit and multi-bit full adder | |
| CN116382877B (en) | Task execution method and device, storage medium and electronic equipment | |
| HK1248349A1 (en) | Data processing method and equipment based on blockchain | |
| HK1247300B (en) | Data processing method and equipment based on blockchain | |
| HK1247301B (en) | Data processing method and equipment based on blockchain | |
| CN116232919A (en) | Method, device, storage medium and electronic equipment for dense state data statistics | |
| CN117499492A (en) | Data processing method, device and equipment | |
| CN113821325A (en) | A method, apparatus, device and medium for calling application program | |
| CN116643532A (en) | A device control method, device and storage medium | |
| HK1247301A1 (en) | Data processing method and equipment based on blockchain | |
| HK1247315B (en) | Data conversion method and device and electronic equipment |