WO2020147269A1 - 一种区块链扩链方法、***及电子设备和存储介质 - Google Patents
一种区块链扩链方法、***及电子设备和存储介质 Download PDFInfo
- Publication number
- WO2020147269A1 WO2020147269A1 PCT/CN2019/094555 CN2019094555W WO2020147269A1 WO 2020147269 A1 WO2020147269 A1 WO 2020147269A1 CN 2019094555 W CN2019094555 W CN 2019094555W WO 2020147269 A1 WO2020147269 A1 WO 2020147269A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- chain
- extended
- blockchain
- extension
- target
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 230000004044 response Effects 0.000 claims description 70
- 230000008569 process Effects 0.000 claims description 16
- 238000005516 engineering process Methods 0.000 description 10
- 238000004891 communication Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000009466 transformation Effects 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
- 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
- This application relates to the field of blockchain technology, and more specifically, to a blockchain extension method and system, an electronic device, and a computer-readable storage medium.
- Thunder Chain used to consist of a total of 64 chains, and each chain runs the same program, and requests from different users are forwarded to different chains for processing through the routing module.
- this chain needs to be extended. The final result is that some requests on the old chain are routed to the new chain for processing.
- the purpose of this application is to provide a blockchain chain extension method and system, an electronic device and a computer-readable storage medium, which realize the blockchain chain extension operation.
- this application provides a blockchain extension method, including:
- determining the chain extension height of the chain to be extended includes:
- the sum of the product of the expected chain expansion duration and the block growth rate and the current block height is determined as the chain expansion height of the chain to be expanded.
- the data structure of the blockchain node in the blockchain system includes the identifier of the blockchain node, the extended chain height of the parent node, the extended chain information, the start bit and the end bit used to calculate the extended chain And the number of modulo bits.
- the response chain of the processing request is determined according to the user account, so that the response chain can process the processing request.
- determining the target chain corresponding to the user account in the processing request includes:
- Determining the number of basic chains of the blockchain system wherein the number of basic chains is the number of blockchains when the blockchain system is not performing chain extension operations;
- the target chain is determined according to the modulo result.
- the target chain If the target chain does not have an extended chain or the current block height does not reach the extended height of the target chain, the target chain is used as the response chain for the processing request.
- determining the response chain of the processing request according to the user account includes:
- the candidate response chain is determined as the response chain.
- the present application provides an electronic device, the electronic device includes a memory and a processor, the memory stores a blockchain extension program that can run on the processor, and the block When the chain extension program is executed by the processor, the steps of the above-mentioned blockchain extension method are realized.
- this application provides a blockchain extension system, including:
- the determining module is used to determine the chain to be expanded and the chain expansion height of the chain to be expanded;
- the synchronization module is used to synchronize the blocks before the height of the extended chain in the chain to be extended in the extended chain.
- the present application provides a computer-readable storage medium with a blockchain extension program stored on the computer-readable storage medium.
- the blockchain extension program is executed by a processor, the implementation is as described above Steps of blockchain extension method.
- this application provides a computer program product, including computer instructions, which when run on a computer, enable the computer to execute any one of the aforementioned blockchain extension methods.
- a blockchain extension method includes: determining the chain to be extended and the extension height of the chain to be extended; creating the extension corresponding to the chain to be extended in the blockchain system Chain; synchronize the blocks before the height of the extended chain in the chain to be extended in the extended chain.
- the blockchain expansion method in the blockchain expansion method provided by this application, when the chain to be expanded needs to perform a chain expansion operation, a corresponding expansion chain is established for the chain to be expanded, and the block data of the expanded chain is consistent with the chain to be expanded.
- the transactions routed to the chain to be extended can be processed normally.
- some requests on the chain to be extended are routed to the extended chain for processing, realizing the chain extension operation of the blockchain.
- the application also discloses a blockchain extension system, an electronic device and a computer-readable storage medium, which can also achieve the above technical effects.
- Fig. 1 is a flowchart of a blockchain extension method disclosed in an embodiment of the application
- FIG. 2 is a flowchart of another blockchain extension method disclosed in an embodiment of the application.
- FIG. 3 is a flowchart of another blockchain extension method disclosed in an embodiment of the application.
- FIG. 4 is a structural diagram of a blockchain extension system disclosed in an embodiment of the application.
- FIG. 5 is a structural diagram of an electronic device disclosed in an embodiment of the application.
- Fig. 6 is a structural diagram of another electronic device disclosed in an embodiment of the application.
- the embodiment of the application discloses a method for chain extension of a block chain, which realizes the chain extension operation of the block chain.
- a flowchart of a method for extending a blockchain chain disclosed in an embodiment of the present application, as shown in Fig. 1, includes:
- the user can directly set it, or it can be set by setting the desired chain extension time length, which is not specifically limited in this embodiment.
- the step of determining the chain extension height of the chain to be expanded may include: determining the current block height and block growth rate of the chain to be expanded, and obtaining the expected chain expansion duration of the chain to be expanded set by the user terminal ; Determine the sum of the product of the expected chain extension duration and the block growth rate and the current block height as the chain extension height of the chain to be extended.
- the expected chain extension time is the interval from the current moment to the expected chain extension time.
- the current block is 100
- the block growth rate is 1 block per second
- the expected chain extension time is 50
- S102 Create an extended chain corresponding to the chain to be extended in the blockchain system
- this step create a corresponding expansion chain for the chain to be expanded.
- this embodiment does not limit the number of expansion chains, that is, one chain to be expanded may correspond to one expansion chain, or may correspond to multiple expansion chains.
- This embodiment also does not limit the level of the chain extension, that is, the extended chain can be re-used as the chain to be extended and the chain extension operation can be continued.
- the data structure of the blockchain node in this embodiment may include the identity of the blockchain node, the height of the extended chain, the information of the extended chain, the start bit, the end bit, and the number of modulo bits used to calculate the extended chain.
- Sbit, Ebit, and Mod can be used to calculate the extension chain
- Mod is the number of extension chains corresponding to the node plus one
- the child node information can store the identification information of the extension chain.
- S103 Synchronize the blocks before the height of the extended chain in the chain to be extended in the extended chain.
- FIG. 2 a flowchart of another blockchain extension method provided by an embodiment of the present application, as shown in Fig. 2, includes:
- this step when a processing request is received, the user account included in the processing request is first determined, and the corresponding target chain is determined according to the user account.
- this step may include: determining the number of basic chains of the blockchain system; performing a modulo operation of the number of basic chains on the first target bit of the user account in the processing request ; Determine the target chain according to the modulo result.
- the number of basic chains is the number of blockchains when the blockchain system is not performing chain extension operations.
- the first target bit is not specifically limited here, and it is preferably the last two digits of the user account.
- the number of basic chains in the blockchain system is 64
- the user account in the processing request is 12345
- the modulo result of 64 is 57
- the target chain identifier corresponding to the processing request is 57.
- S202 Determine whether the target chain has an extended chain and whether the current block height has reached the extended height of the target chain; if both are, then go to S203; otherwise, go to S204;
- S203 Determine a response chain of the processing request according to the user account, so that the response chain can process the processing request.
- the processing request falling into the target chain will be divided into several parts, that is, some processing requests are responded by the target chain, and other processing requests are extended by the target chain. Chain response. Therefore, in this step, the response chain needs to be determined so that the response chain can process the processing request.
- S204 Use the target chain as a response chain of the processing request, so that the response chain can process the processing request.
- the target chain when the target chain does not have an extended chain or the current block height does not reach the extended height, the target chain is used as the response chain for processing the request, that is, the target chain is used to process the request in response to the user account.
- this embodiment further explains and optimizes the technical solution. specific:
- FIG. 3 a flowchart of another blockchain extension method provided by an embodiment of the present application, as shown in Fig. 3, includes:
- S301 When a processing request is received, determine the number of basic chains of the blockchain system; wherein, the number of basic chains is the number of blockchains when the blockchain system is not performing chain extension operations;
- S302 Perform a modulo operation on the number of basic chains on the first target bit of the user account in the processing request, and determine the target chain corresponding to the processing request according to the modulo result;
- S303 Determine whether there is an extension chain in the target chain and whether the current block height reaches the extension height of the target chain; if they are both, go to S304; otherwise, go to S309;
- S304 Determine the number of extended chains of the target chain, and perform a modulo operation of the number of extended chains plus one on the second target bit of the user account;
- This embodiment also does not specifically limit the second target. It is preferably the second digit of the user account, which can be defined in the data structure of the blockchain node, that is, Sbit and Ebit in the data structure introduced in the first embodiment. . Both the target chain and its extended chain can respond to the processing request and perform a modulo operation of the number of extended chains plus one on the second target bit of the user account to determine the candidate response chain. It is equivalent to creating an array with the identifiers of the target chain and its extension chain, and the modulo result corresponds to the number of elements in the array.
- the second target bit of the user account is modulo 4
- the candidate response chain with a modulo result of 0 is the target chain
- the candidate response with a modulo result of 1 The chain is the first extended chain
- the candidate response chain with a modulo result of 2 is the second extended chain
- the candidate response chain with a modulo result of 3 is the third extended chain.
- S305 Determine the candidate response chain according to the result of the modulus, determine whether the candidate response chain is the same as the target chain, if yes, go to S308; if not, go to S306;
- the candidate response chain is the target chain
- the candidate response chain or target chain
- the candidate response chain is directly used as the response chain.
- the candidate response chain is not the target chain, continue to judge the candidate Whether there is an extension chain in the response chain.
- S306 Determine whether the candidate response chain has an extended chain; if yes, go to S307; if not, go to S308;
- This embodiment also does not specifically limit the second target, which is preferably the second digit of the user account.
- the second target which is preferably the second digit of the user account.
- the identifiers are 70 and 71 respectively, and the blockchain 57 reaches the extended chain height
- the second digit of the user account 12345 is 3
- the modulo result of is 2, therefore, the blockchain 70 is used as the candidate response chain.
- the block chain 70 has an extended chain 72 and reaches the extended chain height
- the block chain 70 is used as the target chain
- the second digit of the user account 12345 is modulated by 2 to 2
- the modulo result is 0, then the block The chain 70 is determined to be a candidate response chain. Since the candidate response chain and the target chain are both the blockchain 70, and there is no need to continue iteration, the blockchain 70 is the final response chain for responding to the processing request of the user account 12345.
- the following describes the blockchain extension method provided by this application in an application embodiment. Specifically, among the 64 chains of the Thunder chain, the chain processing pressure of zoneid 10 is too heavy, and chain extension operations are required.
- the extension scheme is to extend a new chain zoneid 65, and the user accounts that were originally processed by zoneid 10 need to be divided into two groups, one of which will continue to be processed by zoneid 10, and the other group will be processed by the new chain zoneid 65.
- the grouping rules are:
- zoneid 10 Assuming that the current block height of zoneid 10 is 10000, one block is generated in one second, and zoneid 10 hopes to automatically expand the chain after 5000 seconds, then I set the block height when expanding the chain to 15000 (10000+5000), new The chain zoneid 65 must synchronize at least 15000 and previous blocks from zoneid 10. Before the 15000 block, the account originally processed by zoneid 10 will continue to be processed by zoneid 10, starting from 15001 blocks, and send by the account modulo 1 in the previous step The transaction will be routed to the new chain zoneid 65 for processing.
- the routing rules are: first modulo 64 for the last 2 digits of the user address, if the modulo result is 10, then modulo 2 for the second digit of the user address, if the modulo result is 0, route to zoneid 10 and take the modulo The result is 1, then route to the new chain zoneid 65.
- the following introduces a blockchain extension system provided by an embodiment of the present application.
- the blockchain extension system described below and the blockchain extension method described above can be cross-referenced.
- a structural diagram of a blockchain extension system provided by an embodiment of the present application, as shown in Fig. 4, includes:
- the determining module 401 is configured to determine the chain to be expanded and the chain expansion height of the chain to be expanded;
- the creation module 402 is used to create an expansion chain corresponding to the chain to be expanded in the blockchain system
- the synchronization module 403 is configured to synchronize the blocks before the height of the extended chain in the chain to be extended in the extended chain.
- the determining module 401 includes:
- the first determining unit is used to determine the chain to be extended
- An obtaining unit configured to determine the current block height and block growth rate of the chain to be expanded, and obtain the expected chain expansion duration of the chain to be expanded set by the user terminal;
- the second determining unit is configured to determine the sum of the product of the expected chain extension duration and the block growth rate and the current block height as the chain extension height of the chain to be extended.
- the data structure of the blockchain node in the blockchain system includes the identity of the blockchain node, the extension height of the parent node, and extension chain information , Used to calculate the start bit, end bit and modulus bits of the extended chain.
- the receiving module is used to determine the target chain corresponding to the user account in the processing request when the processing request is received;
- a judging module for judging whether there is an extension chain in the target chain and whether the current block height reaches the extension height of the target chain
- the first determining response chain module is used to determine the response chain of the processing request according to the user account when an extended chain exists in the target chain and the current block height reaches the extended height of the target chain, so that the response The chain processes the processing request.
- the receiving module includes:
- the unit for determining the number of basic chains is used to determine the number of basic chains of the blockchain system when a processing request is received; wherein, the number of basic chains is the block when the blockchain system is not performing chain extension operations Number of chains
- a first modulo unit configured to perform a modulo operation on the number of basic chains on the first target bit of the user account in the processing request
- the target chain unit is determined for determining the target chain according to the result of the modulo.
- the second determining response chain module is configured to use the target chain as the response chain of the processing request if there is no extended chain in the target chain or the current block height does not reach the extended height of the target chain.
- the first determination response chain module includes:
- a second modulus unit configured to determine the number of extended chains of the target chain, and perform a modulo operation of the number of extended chains plus one on the second target bit of the user account;
- the unit for determining the candidate response chain is used to determine the candidate response chain according to the result of the modulus, and determine whether the candidate response chain is the same as the target chain; if so, use the target chain as the response chain; if not, start Judging the workflow of the unit;
- the judging unit is used to judge whether the candidate response chain has an extended chain; if it exists, the candidate response chain is used as the target chain, and the workflow of the judgment module is restarted; if it does not exist, the candidate The response chain is determined as the response chain.
- This application also provides an electronic device, which may be a PC (Personal Computer, personal computer), or a terminal device such as a smart phone, a tablet computer, a palmtop computer, and a portable computer.
- the electronic device may be a node forming a CDN network or a blockchain network.
- FIG. 5 a structural diagram of an electronic device provided by an embodiment of the present application, as shown in FIG. 5, may include a memory 11, a processor 12, and a bus 13.
- the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like.
- the memory 11 may be an internal storage unit of an electronic device, such as a hard disk of the electronic device.
- the memory 11 may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) card equipped on the electronic device. Flash Card, etc.
- the memory 11 may also include both an internal storage unit of an electronic device and an external storage device.
- the memory 11 can be used not only to store application software and various data of the installed electronic device, such as the code of the blockchain extension program 01, etc., but also to temporarily store data that has been output or will be output.
- the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11
- the data implements the blockchain extension method provided by any of the above embodiments, such as executing the blockchain extension program 01.
- the bus 13 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
- PCI peripheral component interconnect
- EISA extended industry standard architecture
- the bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one thick line is used in FIG. 5 to represent, but it does not mean that there is only one bus or one type of bus.
- a corresponding expansion chain is established for the chain to be expanded, and the block data of the expanded chain is consistent with the chain to be expanded.
- the transactions routed to the chain to be extended can be processed normally.
- some requests on the chain to be extended are routed to the extended chain for processing, realizing the chain extension operation of the blockchain.
- the electronic device further includes:
- the input interface 14 is used to obtain externally imported computer programs, parameters, and instructions, and store them in the memory 11 under the control of the processor 12.
- the input interface 14 can be connected to an input device to receive parameters or instructions manually input by the user.
- the input device may be a touch layer covered on the display screen, a button, a trackball or a touchpad provided on the terminal shell, or a keyboard, a touchpad, or a mouse.
- the display unit 15 is used for displaying the data processed by the processor 12 and for displaying a visualized user interface.
- the display unit 15 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
- the network port 16 is used to communicate with external terminal devices.
- the communication technology used in the communication connection can be wired communication technology or wireless communication technology, such as mobile high-definition link technology (MHL), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, communication technology based on IEEE802.11s, etc.
- MHL mobile high-definition link technology
- USB universal serial bus
- HDMI high-definition multimedia interface
- WiFi wireless fidelity technology
- Bluetooth communication technology low-power Bluetooth communication technology
- Figure 6 only shows the electronic equipment with components 11-16 and the blockchain extension program 01. Those skilled in the art can understand that the structure shown in Figure 6 does not constitute a limitation on the electronic equipment, and may include Fewer or more parts are shown, or some parts are combined, or different parts are arranged.
- the computer program product includes one or more computer instructions.
- the computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices.
- the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be from a website site, computer, server or data center Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
- wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
- wireless such as infrared, wireless, microwave, etc.
- the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device including a server, a data center, and the like integrated with one or more available media.
- the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
- the disclosed system, device, and method may be implemented in other ways.
- the device embodiments described above are only schematic.
- the division of the unit is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical, or other forms.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or software function unit.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
- the technical solution of the present application essentially or part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种区块链扩链方法、***及一种电子设备和计算机可读存储介质,该方法包括:确定待扩展链和所述待扩展链的扩链高度;在区块链***中创建所述待扩展链对应的扩展链;在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。本申请提供的区块链扩链方法,当待扩展链需要进行扩链操作时,为该待扩展链建立对应的扩展链,扩展链的区块数据与待扩展链保持一致。在扩链完成前,路由到待扩展链的交易能够正常处理,扩链完成后,待扩展链上的部分请求被路由到扩展链上处理,实现了区块链的扩链操作。
Description
本申请要求于2019年1月14日提交中国专利局、申请号为201910046625.4、发明名称为“一种区块链扩链方法、***及电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及区块链技术领域,更具体地说,涉及一种区块链扩链方法、***及一种电子设备和一种计算机可读存储介质。
在区块链***中,迅雷链之前总共是由64条链构成,每条链上都运行相同的程序,不同用户的请求会通过路由模块转发到不同的链上进行处理。当某条链的用户请求过多导致交易处理性能降低时,需要对此链进行扩展,最终的结果是旧链上的部分请求被路由到新链上处理。
因此,如何实现区块链的扩链操作是本领域技术人员需要解决的技术问题。
发明内容
本申请的目的在于提供一种区块链扩链方法、***及一种电子设备和一种计算机可读存储介质,实现了区块链的扩链操作。
为实现上述目的,本申请提供了一种区块链扩链方法,包括:
确定待扩展链和所述待扩展链的扩链高度;
在区块链***中创建所述待扩展链对应的扩展链;
在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
其中,确定所述待扩展链的扩链高度,包括:
确定所述待扩展链的当前区块高度和区块增长速度,并获取用户终端设置的所述待扩展链的期望扩链时长;
将所述期望扩链时长和所述区块增长速度的乘积与所述当前区块高度的和确定为所述待扩展链的扩链高度。
其中,所述区块链***中的区块链节点的数据结构包括所述区块链节点的标识、父节点的扩链高度、扩展链信息、用于计算扩展链的起始位、结束位和取模位数。
其中,还包括:
当接收到处理请求时,确定所述处理请求中用户账户对应的目标链;
判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度;
若均是,则根据所述用户账户确定所述处理请求的响应链,以便所述响应链处理所述处理请求。
其中,确定所述处理请求中用户账户对应的目标链,包括:
确定所述区块链***的基础链数量;其中,所述基础链数量为所述区块链***未进行扩链操作时的区块链数量;
对所述处理请求中的所述用户账户的第一目标位进行所述基础链数量的取模运算;
根据取模结果确定所述目标链。
其中,还包括:
若所述目标链不存在扩展链或当前区块高度未达到所述目标链的扩展高度,则将所述目标链作为所述处理请求的响应链。
其中,根据所述用户账户确定所述处理请求的响应链,包括:
确定所述目标链的扩展链数量,并对所述用户账户的第二目标位进行所述扩展链数量加一的取模运算;
根据取模结果确定候选响应链,判断所述候选响应链与所述目标链是否相同;
若是,则将所述目标链作为所述响应链;若否,则判断所述候选响应链是否存在扩展链;
若存在,则将所述候选响应链作为所述目标链,并重新执行判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度的步骤;
若不存在,则将所述候选响应链确定为所述响应链。
为实现上述目的,本申请提供了一种电子设备,所述电子设备包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的区块链扩链程序,所述区块链扩链程序被所述处理器执行时实现如上述区块链扩链方法的步骤。
为实现上述目的,本申请提供了一种区块链扩链***,包括:
确定模块,用于确定待扩展链和所述待扩展链的扩链高度;
创建模块,用于在区块链***中创建所述待扩展链对应的扩展链;
同步模块,用于在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
为实现上述目的,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有区块链扩链程序,所述区块链扩链程序被处理器执行时实现如上述区块链扩链方法的步骤。
为实现上述目的,本申请提供了一种计算机程序产品,包括计算机指令,当其在计算机上运行时,使得计算机可以执行上述任一项所述区块链扩链方法。
通过以上方案可知,本申请提供的一种区块链扩链方法,包括:确定待扩展链和所述待扩展链的扩链高度;在区块链***中创建所述待扩展链对应的扩展链;在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
本申请提供的区块链扩链方法,当待扩展链需要进行扩链操作时,为该待扩展链建立对应的扩展链,扩展链的区块数据与待扩展链保持一致。在扩链完成前,路由到待扩展链的交易能够正常处理,扩链完成后,待扩展链上的部分请求被路由到扩展链上处理,实现了区块链的扩链操作。本申请还公开了一种区块链扩链***及一种电子设备和一种计算机可读存储介质,同样能实现上述技术效果。
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地, 下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例公开的一种区块链扩链方法的流程图;
图2为本申请实施例公开的另一种区块链扩链方法的流程图;
图3为本申请实施例公开的又一种区块链扩链方法的流程图;
图4为本申请实施例公开的一种区块链扩链***的结构图;
图5为本申请实施例公开的一种电子设备的结构图;
图6为本申请实施例公开的另一种电子设备的结构图。
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、***、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
需要说明的是,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现 相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
在现有技术中,区块链***中的某条链的用户请求过多会导致交易处理性能降低,因此,在本申请中,为用户请求较多的待扩展建立扩展链,扩展链的区块数据与待扩展链保持一致。在扩链完成前,路由到待扩展链的交易能够正常处理,扩链完成后,待扩展链上的部分请求被路由到扩展链上处理,实现了区块链的扩链操作。
本申请实施例公开了一种区块链扩链方法,实现了区块链的扩链操作。
参见图1,本申请实施例公开的一种区块链扩链方法的流程图,如图1所示,包括:
S101:确定待扩展链和所述待扩展链的扩链高度;
在本步骤中,首先确定用户请求较多的待扩展链,并确定其扩链高度。对于扩链高度,用户可以对其进行直接设置,也可以通过设置期望扩链时长的方式进行设置,本实施例不进行具体限定。
也就是说,确定待扩展链的扩链高度的步骤可以包括:确定所述待扩展链的当前区块高度和区块增长速度,并获取用户终端设置的所述待扩展链的期望扩链时长;将所述期望扩链时长和所述区块增长速度的乘积与所述当前区块高度的和确定为所述待扩展链的扩链高度。
期望扩链时长即为当前时刻到期望扩链时刻的间隔时长。例如,当前区块为100,区块增长速度为每秒1块,用户期望50秒后自动扩链,期望扩链时长为50,扩链高度为100+50=150。
S102:在区块链***中创建所述待扩展链对应的扩展链;
在本步骤中,为待扩展链创建对应的扩展链。需要说明的是,本实施例不对扩展链的数量限定进行限定,即一个待扩展链可以对应一个扩展链,也可以对应多个扩展链。本实施例也不对扩链的层次进行限定,即可以将扩展链重新作为待扩展链并对其继续进行扩链操作。
需要说明的是,待扩展链与扩展链的对应关系可以依据区块链节点的数据结构进行存储。本实施例中区块链节点的数据结构可以包括该区块链节点的标识、扩链高度、扩展链信息、用于计算扩展链的起始位、结束位 和取模位数等。例如:
type ZoneRoute struct{
Zoneid int 该节点的标识
Height*big.Int 该节点的父节点***时的高度(即扩链高度)
Sbit int 用于计算扩展链的起始位
Ebit int 用于计算扩展链的结束位
Mod int 用于计算扩展链的取模数
Children[]ZoneRoute 子节点信息
}
可以理解的是,Sbit、Ebit和Mod可用于计算扩展链,Mod即为该节点对应的扩展链数量加一,子节点信息即可存储扩展链的标识信息。
S103:在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
可以理解的是,为保证扩展链可以与待扩展链响应相同的处理请求,在本步骤中,需要为扩展链需要同步待扩展链中扩链高度之前的区块,即同步上述数据结构中高度小于Height值的区块。
本实施例提供的区块链扩链方法,当待扩展链需要进行扩链操作时,为该待扩展链建立对应的扩展链,扩展链的区块数据与待扩展链保持一致。在扩链完成前,路由到待扩展链的交易能够正常处理,扩链完成后,待扩展链上的部分请求被路由到扩展链上处理,实现了区块链的扩链操作。
下面详细介绍本申请提供的区块链的路由规则,具体的:
参见图2,本申请实施例提供的另一种区块链扩链方法的流程图,如图2所示,包括:
S201:当接收到处理请求时,确定所述处理请求中用户账户对应的目标链;
在本步骤中,当接收到处理请求时,首先确定该处理请求中包含的用户账户,并根据该用户账户确定对应的目标链。作为一种优选实施方式,本步骤可以包括:确定所述区块链***的基础链数量;对所述处理请求中的所述用户账户的第一目标位进行所述基础链数量的取模运算;根据取模 结果确定所述目标链。
其中,基础链数量为区块链***未进行扩链操作时的区块链数量。此处不对第一目标位进行具体限定,优选为用户账户的后两位。例如,区块链***中的基础链数量为64,处理请求中的用户账户为12345,对64的取模结果为57,该处理请求对应的目标链标识即为57。
S202:判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度;若均是,则进入S203;否则进入S204;
确定目标链后,判断该目标链是否存在扩展链,若否,则直接进入S204,若是,则判断该目标链的当前高度是否达到扩链高度,若达到则进入S203,若未达到则进入S204。
S203:根据所述用户账户确定所述处理请求的响应链,以便所述响应链处理所述处理请求。
在具体实施中,当目标链存在扩展链且达到扩链高度时,落入该目标链的处理请求会被分为几部分,即部分的处理请求由该目标链响应,其他的处理请求由扩展链响应。因此在本步骤中需要确定响应链,以便该响应链处理该处理请求。
S204:将所述目标链作为所述处理请求的响应链,以便所述响应链处理所述处理请求。
在本实施例中,当目标链不存在扩展链或当前区块高度未达到扩展高度时,将目标链作为处理请求的响应链,即利用目标链该用户账户的响应处理请求。
相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。具体的:
参见图3,本申请实施例提供的又一种区块链扩链方法的流程图,如图3所示,包括:
S301:当接收到处理请求时,确定所述区块链***的基础链数量;其中,所述基础链数量为所述区块链***未进行扩链操作时的区块链数量;
S302:对所述处理请求中的所述用户账户的第一目标位进行所述基础 链数量的取模运算,并根据取模结果确定处理请求对应的目标链;
S303:判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度;若均是,则进入S304;否则进入S309;
S304:确定所述目标链的扩展链数量,并对所述用户账户的第二目标位进行所述扩展链数量加一的取模运算;
本实施例同样不对第二目标为进行具体限定,优选为用户账户的第二位,可以在区块链节点的数据结构中进行定义,即第一个实施例介绍的数据结构中的Sbit和Ebit。目标链和其扩展链均可以响应该处理请求,对该用户账户的第二目标位进行扩展链数量加一的取模运算,以确定候选响应链。相当于将该目标链和其扩展链的标识建立一个数组,取模结果对应该数组的元素位数。例如,当该目标区块链存在3个扩展链时,对用户账户的第二目标位对4取模,取模结果为0的候选响应链为该目标链,取模结果为1的候选响应链为第一个扩展链,取模结果为2的候选响应链为第二个扩展链,取模结果为3的候选响应链为第三个扩展链。
S305:根据取模结果确定候选响应链,判断所述候选响应链与所述目标链是否相同,若是,则进入S308;若否,则进入S306;
可以理解的是,当候选响应链为目标链时,不需要继续进行迭代过程,直接将该候选响应链(或目标链)作为响应链,当候选响应链不为目标链时,继续判断该候选响应链是否存在扩展链。
S306:判断所述候选响应链是否存在扩展链;若是,则进入S307;若否,则进入S308;
S307:将所述候选响应链作为所述目标链,并重新进入S303;
S308:将所述候选响应链确定为处理请求的响应链;
确定候选响应链后,需要判断该候选响应链是否存在扩展链,若是,则重新判断该候选响应链是否存在扩展链且达到扩链高度的步骤,若否,则将其确定为响应链。
S309:将目标链确定为处理请求的响应链;
本实施例同样不对第二目标为进行具体限定,优选为用户账户的第二位。在上述实施例举出的例子中,若标识为57的区块链存在2个扩展链, 标识分别为70和71,且区块链57达到扩链高度,用户账户12345的第二位对3的取模结果为2,因此,将区块链70作为候选响应链。若区块链70存在扩展链72且达到扩链高度,此时将区块链70作为目标链,对用户账户12345的第二位2对2取模,取模结果为0,则将区块链70确定为候选响应链,由于候选响应链与目标链均为区块链70,不需要继续进行迭代,则区块链70即为最终的响应链,用于响应用户账户12345的处理请求。
下面在应用实施例中介绍本申请提供的区块链扩链方法。具体的,目前迅雷链的64条链中,zoneid 10的链处理压力过大,需要进行扩链操作。扩展方案为新扩展一条链zoneid 65,则需要将原来由zoneid 10处理的用户账号分成两组,其中一组继续由zoneid 10处理,另一组由新链zoneid 65处理,分组规则为:
1、使用用户账号地址的某一位(假设是第2位)或多位对2进行取模,取模结果为0的由zoneid 10处理,取模结果为1的由新链zoneid 65处理;
2、假设zoneid 10当前区块高度为10000,一秒钟出一个区块,zoneid 10希望5000秒后自动扩链,则我将扩链时的区块高度设置为15000(10000+5000),新链zoneid 65至少要从zoneid 10同步15000及之前的区块,在15000区块以前,原由zoneid 10处理的账号继续由zoneid 10处理,从15001个区块开始,上一步取模为1的账号发送的交易就路由到新链zoneid 65处理。
路由规则为:先对用户地址的后2位对64取模,如果取模结果是10,再对用户地址第二位对2取模,取模结果如果是0,路由到zoneid 10,取模结果是1,则路由到新链zoneid 65。
下面对本申请实施例提供的一种区块链扩链***进行介绍,下文描述的一种区块链扩链***与上文描述的一种区块链扩链方法可以相互参照。
参见图4,本申请实施例提供的一种区块链扩链***的结构图,如图4所示,包括:
确定模块401,用于确定待扩展链和所述待扩展链的扩链高度;
创建模块402,用于在区块链***中创建所述待扩展链对应的扩展链;
同步模块403,用于在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
本实施例提供的区块链扩链***,当待扩展链需要进行扩链操作时,为该待扩展链建立对应的扩展链,扩展链的区块数据与待扩展链保持一致。在扩链完成前,路由到待扩展链的交易能够正常处理,扩链完成后,待扩展链上的部分请求被路由到扩展链上处理,实现了区块链的扩链操作。
在上述实施例的基础上,作为一种优选实施方式,所述确定模块401包括:
第一确定单元,用于确定待扩展链;
获取单元,用于确定所述待扩展链的当前区块高度和区块增长速度,并获取用户终端设置的所述待扩展链的期望扩链时长;
第二确定单元,用于将所述期望扩链时长和所述区块增长速度的乘积与所述当前区块高度的和确定为所述待扩展链的扩链高度。
在上述实施例的基础上,作为一种优选实施方式,所述区块链***中的区块链节点的数据结构包括所述区块链节点的标识、父节点的扩链高度、扩展链信息、用于计算扩展链的起始位、结束位和取模位数。
在上述实施例的基础上,作为一种优选实施方式,还包括:
接收模块,用于当接收到处理请求时,确定所述处理请求中用户账户对应的目标链;
判断模块,用于判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度;
第一确定响应链模块,用于当所述目标链存在扩展链且当前区块高度达到所述目标链的扩展高度时,根据所述用户账户确定所述处理请求的响应链,以便所述响应链处理所述处理请求。
在上述实施例的基础上,作为一种优选实施方式,所述接收模块包括:
确定基础链数量单元,用于当接收到处理请求时,确定所述区块链***的基础链数量;其中,所述基础链数量为所述区块链***未进行扩链操 作时的区块链数量;
第一取模单元,用于对所述处理请求中的所述用户账户的第一目标位进行所述基础链数量的取模运算;
确定目标链单元,用于根据取模结果确定所述目标链。
在上述实施例的基础上,作为一种优选实施方式,还包括:
第二确定响应链模块,用于若所述目标链不存在扩展链或当前区块高度未达到所述目标链的扩展高度,则将所述目标链作为所述处理请求的响应链。
在上述实施例的基础上,作为一种优选实施方式,所述第一确定响应链模块包括:
第二取模单元,用于确定所述目标链的扩展链数量,并对所述用户账户的第二目标位进行所述扩展链数量加一的取模运算;
确定候选响应链单元,用于根据取模结果确定候选响应链,判断所述候选响应链与所述目标链是否相同;若是,则将所述目标链作为所述响应链;若否,则启动判断单元的工作流程;
判断单元,用于判断所述候选响应链是否存在扩展链;若存在,则将所述候选响应链作为所述目标链,并重新启动判断模块的工作流程;若不存在,则将所述候选响应链确定为所述响应链。
本申请还提供了一种电子设备,该电子设备可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、掌上电脑、便携计算机等终端设备。该电子设备可以是组成CDN网络或者区块链网络的节点。
参见图5,本申请实施例提供的一种电子设备的结构图,如图5所示,可以包括存储器11、处理器12和总线13。
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是电子设备的内部存储单元,例如该电子设备的硬盘。存储器11在另一些实施例中也可 以是电子设备的外部存储设备,例如电子设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括电子设备的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装电子设备的应用软件及各类数据,例如区块链扩链程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,实现上述任一实施例提供的区块链扩链方法,例如执行区块链扩链程序01等。
该总线13可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图5中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
本实施例当待扩展链需要进行扩链操作时,为该待扩展链建立对应的扩展链,扩展链的区块数据与待扩展链保持一致。在扩链完成前,路由到待扩展链的交易能够正常处理,扩链完成后,待扩展链上的部分请求被路由到扩展链上处理,实现了区块链的扩链操作。
在上述实施例的基础上,作为优选实施方式,参见图6,所述电子设备还包括:
输入接口14,用于获取外部导入的计算机程序、参数和指令,经处理器12控制保存至存储器11中。该输入接口14可以与输入装置相连,接收用户手动输入的参数或指令。该输入装置可以是显示屏上覆盖的触摸层,也可以是终端外壳上设置的按键、轨迹球或触控板,也可以是键盘(Keyboard)、触控板或鼠标等。
显示单元15,用于显示处理器12处理的数据以及用于显示可视化的用户界面。该显示单元15可以为LED显示器、液晶显示器、触控式液晶 显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。
网络端口16,用于与外部各终端设备进行通信连接。该通信连接所采用的通信技术可以为有线通信技术或无线通信技术,如移动高清链接技术(MHL)、通用串行总线(USB)、高清多媒体接口(HDMI)、无线保真技术(WiFi)、蓝牙通信技术、低功耗蓝牙通信技术、基于IEEE802.11s的通信技术等。
图6仅示出了具有组件11-16以及区块链扩链程序01的电子设备,本领域技术人员可以理解的是,图6示出的结构并不构成对电子设备的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的 对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的***,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括 为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
Claims (10)
- 一种区块链扩链方法,其特征在于,包括:确定待扩展链和所述待扩展链的扩链高度;在区块链***中创建所述待扩展链对应的扩展链;在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
- 根据权利要求1所述区块链扩链方法,其特征在于,确定所述待扩展链的扩链高度,包括:确定所述待扩展链的当前区块高度和区块增长速度,并获取用户终端设置的所述待扩展链的期望扩链时长;将所述期望扩链时长和所述区块增长速度的乘积与所述当前区块高度的和确定为所述待扩展链的扩链高度。
- 根据权利要求1所述区块链扩链方法,其特征在于,所述区块链***中的区块链节点的数据结构包括所述区块链节点的标识、父节点的扩链高度、扩展链信息、用于计算扩展链的起始位、结束位和取模位数。
- 根据权利要求1-3任一项所述区块链扩链方法,其特征在于,还包括:当接收到处理请求时,确定所述处理请求中用户账户对应的目标链;判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度;若均是,则根据所述用户账户确定所述处理请求的响应链,以便所述响应链处理所述处理请求。
- 根据权利要求4所述区块链扩链方法,其特征在于,确定所述处理请求中用户账户对应的目标链,包括:确定所述区块链***的基础链数量;其中,所述基础链数量为所述区块链***未进行扩链操作时的区块链数量;对所述处理请求中的所述用户账户的第一目标位进行所述基础链数量的取模运算;根据取模结果确定所述目标链。
- 根据权利要求4所述区块链扩链方法,其特征在于,还包括:若所述目标链不存在扩展链或当前区块高度未达到所述目标链的扩展高度,则将所述目标链作为所述处理请求的响应链。
- 根据权利要求6所述区块链扩链方法,其特征在于,根据所述用户账户确定所述处理请求的响应链,包括:确定所述目标链的扩展链数量,并对所述用户账户的第二目标位进行所述扩展链数量加一的取模运算;根据取模结果确定候选响应链,判断所述候选响应链与所述目标链是否相同;若是,则将所述目标链作为所述响应链;若否,则判断所述候选响应链是否存在扩展链;若存在,则将所述候选响应链作为所述目标链,并重新执行判断所述目标链是否存在扩展链且当前区块高度是否达到所述目标链的扩展高度的步骤;若不存在,则将所述候选响应链确定为所述响应链。
- 一种电子设备,其特征在于,所述电子设备包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的区块链扩链程序,所述区块链扩链程序被所述处理器执行时实现如权利要求1至7任一项所述区块链扩链方法的步骤。
- 一种区块链扩链***,其特征在于,包括:确定模块,用于确定待扩展链和所述待扩展链的扩链高度;创建模块,用于在区块链***中创建所述待扩展链对应的扩展链;同步模块,用于在所述扩展链中同步所述待扩展链中所述扩链高度之前的区块。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有区块链扩链程序,所述区块链扩链程序被处理器执行时实现如权利要求1至7任一项所述区块链扩链方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910046625.4A CN109819025B (zh) | 2019-01-14 | 2019-01-14 | 一种区块链扩链方法、***及电子设备和存储介质 |
CN201910046625.4 | 2019-01-14 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020147269A1 true WO2020147269A1 (zh) | 2020-07-23 |
Family
ID=66604606
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/094555 WO2020147269A1 (zh) | 2019-01-14 | 2019-07-03 | 一种区块链扩链方法、***及电子设备和存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109819025B (zh) |
WO (1) | WO2020147269A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109819025B (zh) * | 2019-01-14 | 2020-11-06 | 深圳市网心科技有限公司 | 一种区块链扩链方法、***及电子设备和存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108600353A (zh) * | 2018-04-12 | 2018-09-28 | 北京天德科技有限公司 | 一种区块链节点的并行块同步方法 |
WO2018204939A1 (en) * | 2017-05-05 | 2018-11-08 | Jeff Stollman | Systems and methods for extending the utility of blockchains through use of related child blockchains |
CN109086325A (zh) * | 2018-06-29 | 2018-12-25 | 阿里巴巴集团控股有限公司 | 基于区块链的数据处理方法和装置 |
CN109819025A (zh) * | 2019-01-14 | 2019-05-28 | 深圳市网心科技有限公司 | 一种区块链扩链方法、***及电子设备和存储介质 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108256354B (zh) * | 2018-01-29 | 2022-02-22 | 张天 | 一种基于试验数据的存储方法及存储介质 |
CN109067863B (zh) * | 2018-07-25 | 2021-03-05 | 上海点融信息科技有限责任公司 | 用于管理区块链节点的节点标识的方法、装置及存储介质 |
CN109087105A (zh) * | 2018-08-31 | 2018-12-25 | 深圳付贝科技有限公司 | 用于挖矿的哈希搜索方法、挖矿机及区块链*** |
-
2019
- 2019-01-14 CN CN201910046625.4A patent/CN109819025B/zh active Active
- 2019-07-03 WO PCT/CN2019/094555 patent/WO2020147269A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018204939A1 (en) * | 2017-05-05 | 2018-11-08 | Jeff Stollman | Systems and methods for extending the utility of blockchains through use of related child blockchains |
CN108600353A (zh) * | 2018-04-12 | 2018-09-28 | 北京天德科技有限公司 | 一种区块链节点的并行块同步方法 |
CN109086325A (zh) * | 2018-06-29 | 2018-12-25 | 阿里巴巴集团控股有限公司 | 基于区块链的数据处理方法和装置 |
CN109819025A (zh) * | 2019-01-14 | 2019-05-28 | 深圳市网心科技有限公司 | 一种区块链扩链方法、***及电子设备和存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN109819025B (zh) | 2020-11-06 |
CN109819025A (zh) | 2019-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020206847A1 (zh) | 一种基于区块链的数据处理方法、***及相关设备 | |
CN110286768B (zh) | 虚拟物体显示方法、终端设备及计算机可读存储介质 | |
WO2018019139A1 (zh) | 信息推送方法和装置 | |
US20170019459A1 (en) | File transmission method, file transmission apparatus, and file transmission system | |
WO2020181696A1 (zh) | 一种网络带宽评测方法、装置、***以及存储介质 | |
KR102498223B1 (ko) | Ufs 장치의 작동 방법, ufs 호스트의 작동 방법, 및 이들을 포함하는 시스템의 작동 방법 | |
CN108038112B (zh) | 文件处理方法、移动终端及计算机可读存储介质 | |
WO2018103405A1 (zh) | 识别接入点和热点的方法及相关产品 | |
CN111414374B (zh) | 一种区块链交易并发处理方法、装置及设备 | |
US20170257382A1 (en) | Maintaining dynamic configuration information of a multi-host off-cluster service on a cluster | |
WO2015013981A1 (zh) | 一种图像显示方法和装置 | |
US20090049459A1 (en) | Dynamically converting symbolic links | |
EP4095686A2 (en) | Method for switching skin of mini-program page, and electronic device | |
WO2020147269A1 (zh) | 一种区块链扩链方法、***及电子设备和存储介质 | |
CN110730244A (zh) | Dht***的组网方法、***及网络设备和存储介质 | |
WO2017148283A1 (zh) | 状态信息管理***、方法及电子设备 | |
WO2020206879A1 (zh) | Pcie宽度自动适配方法、装置及电子设备和存储介质 | |
CN108255434B (zh) | 标签管理方法、管理装置及计算机可读存储介质 | |
TWI637616B (zh) | 基於快取一致性之控制方法 | |
WO2020015192A1 (zh) | 网页数据爬取方法、装置及存储介质 | |
CN107480240B (zh) | 一种数据库***及其数据处理方法 | |
WO2018133556A1 (zh) | 一种用于实现用户在应用中通信的方法、装置与设备 | |
TWI505100B (zh) | 在區域網路中進行資料分享與數據同步的方法 | |
CN109739857B (zh) | 高并发下的数据分布式写入方法、装置、终端及存储介质 | |
CN110147328B (zh) | 一种数据库性能测试方法、***、电子设备和存储介质 |
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: 19910403 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 03/11/2021) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19910403 Country of ref document: EP Kind code of ref document: A1 |