CN112685422A - Method and device for processing UTXO database and electronic equipment - Google Patents

Method and device for processing UTXO database and electronic equipment Download PDF

Info

Publication number
CN112685422A
CN112685422A CN202011640960.6A CN202011640960A CN112685422A CN 112685422 A CN112685422 A CN 112685422A CN 202011640960 A CN202011640960 A CN 202011640960A CN 112685422 A CN112685422 A CN 112685422A
Authority
CN
China
Prior art keywords
information
target
compressed information
transaction
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011640960.6A
Other languages
Chinese (zh)
Inventor
吴良顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Original Assignee
Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuo Erzhi Lian Wuhan Research Institute Co Ltd filed Critical Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Priority to CN202011640960.6A priority Critical patent/CN112685422A/en
Publication of CN112685422A publication Critical patent/CN112685422A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a method, a device and electronic equipment for processing a UTXO database, wherein the method comprises the following steps: acquiring transaction information to be stored, wherein the transaction information comprises an input part and an output part; compressing the input part to generate compressed information; carrying out hash processing on the account address according to a preset hash function, taking a hash processing result as an address pointer, and storing the account address to a position corresponding to the address pointer; generating a key-value pair using the compressed information as a key and the address pointer and other information as values, and storing the key-value pair in the UTXO database. By the method, the device and the electronic equipment for processing the UTXO database, the transaction information can be compressed and then stored in the UTXO database, the account address is uniquely stored in the position corresponding to the address pointer, the account address does not need to be repeatedly recorded, and the storage space occupied by the UTXO database is greatly reduced.

Description

Method and device for processing UTXO database and electronic equipment
Technical Field
The present invention relates to the field of block chain technology, and in particular, to a method and an apparatus for processing a UTXO database, an electronic device, and a computer-readable storage medium.
Background
In a block chain based on UTXO (Unspent Transaction Output), the verification process is a process that uses the records in the UTXO as evidence to determine if the Transaction is valid — all inputs to the Transaction must be in the UTXO database to be valid. A typical UTXO block chain verification process is: the transaction (abbreviated TX) consists of two parts, input and output. The input part mainly comprises input transaction information of payment and signature, and the output part comprises a user account address for verifying the signature, coin value and the like. To improve efficiency, the UTXO set is loaded into a key-value (K-V) database, where the key (K) corresponds to the input portion and the value (V) corresponds to the output portion. When the node receives a new transaction, it will query the UTXO database through the keys in the input section to check if the input transaction is in the UTXO set, and if so, the UTXO database will return an output section for subsequent signature verification.
However, with the drastic increase in the size of the UTXO set, it is difficult for a small computer to store the entire UTXO set in a DRAM (Dynamic Random Access Memory). The large UTXO set must be stored on a low speed disk and authenticating the transaction will take a significant amount of time because disk access latency is orders of magnitude longer than DRAM. The continuous expansion of the UTXO set scale will quickly become the largest obstacle for the node to verify large-capacity transactions in time, and finally become the bottleneck for realizing a high throughput block chain.
Disclosure of Invention
In order to solve the technical problem that the existing UTXO database occupies a large space, embodiments of the present invention provide a method, an apparatus, an electronic device, and a computer-readable storage medium for processing the UTXO database.
In a first aspect, an embodiment of the present invention provides a method for processing a UTXO database, including:
acquiring transaction information to be stored, wherein the transaction information comprises an input part and an output part, and the output part comprises an account address and other information except the account address;
compressing the input part to generate compressed information, wherein the length of the compressed information is smaller than that of the input part;
carrying out hash processing on the account address according to a preset hash function, taking a hash processing result as an address pointer, and storing the account address to a position corresponding to the address pointer;
and generating a key value pair by taking the compressed information as a key and the address pointer and the other information as values, and storing the key value pair in a UTXO database.
In a second aspect, an embodiment of the present invention further provides an apparatus for processing an UTXO database, including:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring transaction information to be stored, the transaction information comprises an input part and an output part, and the output part comprises an account address and other information except the account address;
the compression module is used for compressing the input part to generate compressed information, and the length of the compressed information is smaller than that of the input part;
the account address processing module is used for carrying out hash processing on the account address according to a preset hash function, taking a hash processing result as an address pointer and storing the account address to a position corresponding to the address pointer;
and the storage module is used for generating a key-value pair by taking the compressed information as a key and the address pointer and the other information as values, and storing the key-value pair to the UTXO database.
In a third aspect, an embodiment of the present invention provides an electronic device, including a bus, a transceiver, a memory, a processor, and a computer program stored on the memory and executable on the processor, where the transceiver, the memory, and the processor are connected via the bus, and when the computer program is executed by the processor, the method for processing a UTXO database as described in any one of the above is implemented.
In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the method for processing the UTXO database described in any one of the above.
The method, the device, the electronic equipment and the computer readable storage medium for processing the UTXO database provided by the embodiment of the invention compress an input part of transaction information, map an account address of an output part into an address pointer with smaller storage space, and store the account address to a corresponding address pointer; the method can compress the transaction information and then store the transaction information into the UTXO database, and the account address is only stored in the position corresponding to the address pointer without repeatedly recording the account address, thereby greatly reducing the storage space occupied by the UTXO database.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments or the background art of the present invention, the drawings required to be used in the embodiments or the background art of the present invention will be described below.
Fig. 1 is a flow chart illustrating a method of processing a UTXO database provided by an embodiment of the present invention;
fig. 2 is a schematic structural diagram illustrating an apparatus for processing an UTXO database according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device for executing a method of processing a UTXO database according to an embodiment of the present invention.
Detailed Description
In the description of the embodiments of the present invention, it should be apparent to those skilled in the art that the embodiments of the present invention can be embodied as methods, apparatuses, electronic devices, and computer-readable storage media. Thus, embodiments of the invention may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), a combination of hardware and software. Furthermore, in some embodiments, embodiments of the invention may also be embodied in the form of a computer program product in one or more computer-readable storage media having computer program code embodied in the medium.
The computer-readable storage media described above may take any combination of one or more computer-readable storage media. The computer-readable storage medium includes: an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of the computer-readable storage medium include: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only Memory (ROM), an erasable programmable read-only Memory (EPROM), a Flash Memory, an optical fiber, a compact disc read-only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any combination thereof. In embodiments of the invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, device, or apparatus.
The computer program code embodied on the computer readable storage medium may be transmitted using any appropriate medium, including: wireless, wire, fiber optic cable, Radio Frequency (RF), or any suitable combination thereof.
Computer program code for carrying out operations for embodiments of the present invention may be written in assembly instructions, Instruction Set Architecture (ISA) instructions, machine related instructions, microcode, firmware instructions, state setting data, integrated circuit configuration data, or in one or more programming languages, including an object oriented programming language, such as: java, Smalltalk, C + +, and also include conventional procedural programming languages, such as: c or a similar programming language. The computer program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be over any of a variety of networks, including: a Local Area Network (LAN) or a Wide Area Network (WAN), which may be connected to the user's computer, may be connected to an external computer.
The method, the device and the electronic equipment are described through the flow chart and/or the block diagram.
It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions. These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing apparatus to function in a particular manner. Thus, the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
The embodiments of the present invention will be described below with reference to the drawings.
Fig. 1 is a flowchart illustrating a method for processing a UTXO database according to an embodiment of the present invention. The method stores the transaction information into the UTXO database by compressing and then storing the transaction information, as shown in fig. 1, and includes:
step 101: the method comprises the steps of obtaining transaction information to be stored, wherein the transaction information comprises an input part and an output part, and the output part comprises an account address and other information except the account address.
In the embodiment of the invention, the transaction information is information generated when the blockchain has a transaction, and if the transaction information needs to be stored in the UTXO database, the transaction information is the transaction information to be stored. The transaction information may be generated in real time, or may be historical data stored in other UTXO databases, which is not limited in this embodiment.
In the embodiment of the invention, the transaction information comprises an input part and an output part, wherein the input part is a key of the transaction information, and the output part is a value of the transaction information. Specifically, the input section includes a Transaction identification (Transaction ID, also referred to as Transaction ID) and a Transaction Index (Index); wherein the Transaction ID is typically derived from the SHA-2(Secure Hash Algorithm 2) Hash of the Transaction information, which is typically a 32 byte Hash value. Index is a 4-byte value that indicates the location of the output portion in the transaction. The output portion includes an account address (account address) of 20 bytes, a coin value of 2 bytes, a block height of 3 bytes, and the like, and information other than the account address is collectively referred to as other information in the present embodiment, that is, the other information includes the coin value, the block height, and the like.
Step 102: the input part is compressed to generate compressed information, and the length of the compressed information is smaller than that of the input part.
In the embodiment of the invention, the input part and the output part of the transaction information are respectively processed to reduce the storage space occupied by the transaction information. Specifically, the input part is subjected to compression processing to generate compressed information of a smaller length; wherein, the input part and the compressed information are expected to be in one-to-one correspondence, that is, one input part corresponds to unique compressed information. The input portion may be hashed, and the input portion is replaced by a shorter hash value, which is the compressed information. Or, a part of information in the input portion may be subjected to hash processing, and optionally, the step of "performing compression processing on the input portion to generate compressed information" includes:
step A1: and carrying out hash processing on the transaction identifier to generate first sub-compressed information, wherein the length of the first sub-compressed information is smaller than that of the transaction identifier.
Step A2: and carrying out remainder processing on the transaction index to generate second sub-compressed information, wherein the length of the second sub-compressed information is smaller than that of the transaction index.
Step A3: and generating compressed information according to the first sub-compressed information and the second sub-compressed information.
In the embodiment of the present invention, the transaction identifier is a 32-byte hash value, and at this time, the transaction identifier may be hashed again, but a hash algorithm with a shorter output byte is used, for example, SHA-1 (20 bytes output) or MD5 (16 bytes output), so that the transaction identifier may be converted into the first sub-compression information with a smaller length.
And for the transaction index of 4 bytes, adopting remainder processing, and taking the remainder as second compression sub information. The divisor used in the remainder processing may be determined according to actual conditions, for example, 2^16 ^ 65536 may be used as the divisor, and hashing may be completed by calculating the remainder, so that the transaction index of 4 bytes is changed into the second compressed sub-information of 2 bytes. After the transaction identification and the transaction index are compressed, final compressed information is generated.
Step 103: and carrying out hash processing on the account address according to a preset hash function, taking a hash processing result as an address pointer, and storing the account address to a position corresponding to the address pointer.
In the embodiment of the invention, the output part of the transaction information comprises an account address and other information, and the account address is 20 bytes of information, which occupies a larger space and accounts for more than 70% of the whole output part; in addition, since the same account can initiate or receive multiple transactions, the account addresses of output parts in different transaction information may be the same, and the traditional UTXO database directly stores the transaction information, which may cause the problem of repeatedly storing the account addresses, and occupy too much space of the UTXO database. In the embodiment of the invention, the account address is mapped into the address pointer in a hash processing mode, and the general pointer is 4 bytes, namely, the account address of 20 bytes can be mapped into the address pointer of 4 bytes, so that the occupied space is greatly reduced; meanwhile, the account address is stored in the storage position corresponding to the address pointer, so that only one account address can be stored, the account address is recorded once without related transaction information, the occupied space is further reduced, the account address can be indexed through the address pointer, and the account address query is not influenced.
Step 104: generating a key-value pair using the compressed information as a key and the address pointer and other information as values, and storing the key-value pair in the UTXO database.
In the embodiment of the invention, the traditional UTXO database also stores transaction information in a key-value pair form, but directly stores an input part (key) and an output part (value) of the transaction information; in this embodiment, the compressed information of the input part is used as a key, and the account address in the output part is changed into an address pointer as a value, so as to generate a key value pair occupying a smaller space and store the key value pair in the UTXO database, so that the UTXO database can record the original transaction information by using the compressed key value pair and the storage space storing all the account addresses, and the space can be greatly saved.
The method for processing the UTXO database provided by the embodiment of the invention compresses the input part of the transaction information, maps the account address of the output part into the address pointer with smaller storage space, and stores the account address to the corresponding address pointer; the method can compress the transaction information and then store the transaction information into the UTXO database, and the account address is only stored in the position corresponding to the address pointer without repeatedly recording the account address, thereby greatly reducing the storage space occupied by the UTXO database.
On the basis of the above embodiment, since the transaction information is massive, when the transaction information is compressed, there may be a problem of collision, that is, the compressed results of different transaction information (or input parts) are the same, and this embodiment solves this problem by establishing a collision table. Specifically, before the step 104 "generating key-value pairs", the method further comprises:
step B1: and judging whether the compressed information collides with other compressed information or not.
Step B2: if a collision occurs, the compressed information and transaction information corresponding to other compressed information with which the compressed information has collided are stored in a collision table.
Step B3: if no collision occurs, the process of generating key-value pairs is executed, i.e. step 104 is executed.
In the embodiment of the invention, if the compressed information collides with other compressed information, the corresponding transaction information is stored in the collision table, namely the complete transaction information is still stored in the traditional way. The transaction information corresponding to the compressed information and the other compressed information that has collided with the compressed information need to be stored in the collision table. For example, if the compressed information of the transaction information a is the same as the compressed information of the transaction information B, both the transaction information a and the transaction information B are stored in the collision table. If no collision occurs, it means that the transaction information can be stored in the UTXO database in a compressed form, i.e., step 104 is executed.
In addition, the address pointer obtained by hashing the account address may have a possibility of collision, and at this time, a collision table may be established or other existing manners may be adopted to solve the collision problem. In addition, because the number of the account addresses is far less than the number of the transaction information, the possibility of collision of the address pointers is low, and the problem of collision of the address pointers can be also not considered under the condition that the number of the account addresses is small.
Based on the above embodiment, the UTXO database stores compressed transaction information, but can still verify the transaction information to implement the verification function of the conventional UTXO database. Specifically, the verification process includes:
step C1: target information to be verified is obtained, and the target information comprises a target input part and a target output part.
In the embodiment of the invention, when some transaction information needs to be verified, the transaction information is only used as the target information to be verified, namely the target information is also a piece of transaction information essentially.
Step C2: the same compression processing is performed on the target input part, target compression information is determined, and the target compression information is matched with the key value pairs stored in the UTXO database.
Step C3: if the matching is successful, determining a target address pointer and other target information corresponding to the target compressed information; and reading the target account address at the corresponding position according to the target address pointer, and taking the target account address and other target information as output values which are used for comparing with a target output part.
In the embodiment of the present invention, the same compression processing is performed on the target input part in the target information, that is, the compression processing in step C2 is the same as the compression processing in step 102 described above. For example, the target input part also includes a transaction identifier and a transaction index, and the same hash processing and the same remainder processing may be performed on the transaction identifier and the transaction index, so that if the input part of the transaction information is the same as the target input part, the compression results obtained after the input part and the target input part are respectively compressed are also the same, that is, the compression information corresponding to the transaction information is the same as the target compression information, so that the target compression information is successfully matched. If the matching of the target compression information fails, it indicates that the target information does not exist in the UTXO database, and the target information may be illegal, so that the verification process may be terminated.
Under the condition that the target compression information is successfully matched, because the UTXO database stores data in the form of key value pairs, the target compression information is the same as a key of one of the key value pairs, and corresponding values, that is, an address pointer and other information, may be further determined. Reading the account address of the corresponding position according to the target address pointer, namely the target account address; the target account address and other target information are combined to generate an output part of the original transaction information, so that the output value can be used as an output value to be compared with the target output part of the target information, and if the output value is consistent with the target output part of the target information, the target information is legal.
Further alternatively, if there is a collision table, such as generated by the above-described steps B1-B2, then the following process may be performed before the same compression process is performed on the target input portion:
step D1: it is determined whether the target input portion matches the transaction information stored in the collision table.
Step D2: if so, the output part in the transaction information matched with the target input part is used as an output value for comparison with the target output part.
Step D3: if not, the same compression processing process is performed on the target input part.
In the embodiment of the invention, after target information to be verified is acquired, whether a target input part of the target information is matched with an input part of transaction information in a collision table is judged, if the target input part of the target information is matched with the input part of the transaction information in the collision table, the target input part of the target information does not need to be compared with compressed data stored in a UTXO database, at the moment, an output part in the transaction information corresponding to the target data part can be determined through the transaction information stored in the collision table, and the output part can be compared with a target output part of the target information; if the two are consistent, the target information is legal. If the two are not matched, verification is required by the UTXO database, i.e. the above-mentioned step C2 "perform the same compression processing on the target input portion" and step C3 are performed.
The method for processing the UTXO database provided by the embodiment of the invention compresses the input part of the transaction information, maps the account address of the output part into the address pointer with smaller storage space, and stores the account address to the corresponding address pointer; the method can compress the transaction information and then store the transaction information into the UTXO database, and the account address is only stored in the position corresponding to the address pointer without repeatedly recording the account address, thereby greatly reducing the storage space occupied by the UTXO database. When other transaction information needs to be verified, normal verification can be achieved through the compressed UTXO database, and the verification function of the UTXO database is not affected.
The method for processing the UTXO database according to the embodiments of the present invention is described in detail above, and the method may also be implemented by a corresponding apparatus, and the apparatus for processing the UTXO database according to the embodiments of the present invention is described in detail below.
Fig. 2 is a schematic structural diagram illustrating an apparatus for processing a UTXO database according to an embodiment of the present invention. As shown in fig. 2, the apparatus for processing the UTXO database includes:
the acquisition module 21 is configured to acquire transaction information to be stored, where the transaction information includes an input portion and an output portion, and the output portion includes an account address and other information except the account address;
a compression module 22, configured to perform compression processing on the input part to generate compressed information, where a length of the compressed information is smaller than a length of the input part;
the account address processing module 23 is configured to perform hash processing on the account address according to a preset hash function, use a hash processing result as an address pointer, and store the account address to a position corresponding to the address pointer;
and the storage module 24 is configured to generate a key-value pair by using the compressed information as a key and using the address pointer and the other information as values, and store the key-value pair in the UTXO database.
On the basis of the above embodiment, the device further comprises a collision module; before the storage module 24 generates key-value pairs, the collision module is to:
judging whether the compressed information collides with other compressed information or not;
if collision occurs, storing the compressed information and transaction information corresponding to other compressed information collided with the compressed information into a collision table;
if no collision occurs, the storage module 24 generates a key-value pair.
On the basis of the above embodiment, the input part includes a transaction identifier and a transaction index;
the compressing module 22 compresses the input part to generate compressed information, including:
performing hash processing on the transaction identifier to generate first sub-compressed information, wherein the length of the first sub-compressed information is smaller than that of the transaction identifier;
carrying out remainder processing on the transaction index to generate second sub-compressed information, wherein the length of the second sub-compressed information is smaller than that of the transaction index;
and generating compressed information according to the first sub-compressed information and the second sub-compressed information.
On the basis of the above embodiment, the apparatus further includes: a verification module to:
acquiring target information to be verified, wherein the target information comprises a target input part and a target output part;
performing the same compression processing on the target input part, determining target compression information, and matching the target compression information with a key value pair stored in the UTXO database;
if the matching is successful, determining a target address pointer and other target information corresponding to the target compressed information; and reading a target account address of a corresponding position according to the target address pointer, and taking the target account address and the other target information as output values, wherein the output values are used for comparing with the target output part.
On the basis of the foregoing embodiment, if there is a collision table, the verification module is further configured to, before performing the same compression processing on the target input part:
judging whether the target input part is matched with the transaction information stored in the collision table;
if the transaction information is matched with the target input part, taking an output part in the transaction information matched with the target input part as an output value for comparison with the target output part;
and if not, executing the same compression processing process on the target input part.
The device for processing the UTXO database provided by the embodiment of the invention compresses the input part of the transaction information, maps the account address of the output part into the address pointer with smaller storage space, and stores the account address to the corresponding address pointer; the device can compress the transaction information and then store the transaction information into the UTXO database, and the account address is only stored at the position corresponding to the address pointer, so that the account address does not need to be repeatedly recorded, and the storage space occupied by the UTXO database is greatly reduced. When other transaction information needs to be verified, normal verification can be achieved through the compressed UTXO database, and the verification function of the UTXO database is not affected.
In addition, an embodiment of the present invention further provides an electronic device, including a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, where the transceiver, the memory, and the processor are connected via the bus, and when the computer program is executed by the processor, the processes of the embodiment of the method for processing the UTXO database are implemented, and the same technical effects can be achieved, and are not described herein again to avoid repetition.
Specifically, referring to fig. 3, an embodiment of the present invention further provides an electronic device, which includes a bus 1110, a processor 1120, a transceiver 1130, a bus interface 1140, a memory 1150, and a user interface 1160.
In an embodiment of the present invention, the electronic device further includes: a computer program stored on the memory 1150 and executable on the processor 1120, the computer program when executed by the processor 1120 implementing the processes of the method embodiments of processing the UTXO database described above.
A transceiver 1130 for receiving and transmitting data under the control of the processor 1120.
In embodiments of the invention in which a bus architecture (represented by bus 1110) is used, bus 1110 may include any number of interconnected buses and bridges, with bus 1110 connecting various circuits including one or more processors, represented by processor 1120, and memory, represented by memory 1150.
Bus 1110 represents one or more of any of several types of bus structures, including a memory bus, and memory controller, a peripheral bus, an Accelerated Graphics Port (AGP), a processor, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include: an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA (EISA) bus, a Video Electronics Standards Association (VESA), a Peripheral Component Interconnect (PCI) bus.
Processor 1120 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits in hardware or instructions in software in a processor. The processor described above includes: general purpose processors, Central Processing Units (CPUs), Network Processors (NPs), Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs), Complex Programmable Logic Devices (CPLDs), Programmable Logic Arrays (PLAs), Micro Control Units (MCUs) or other Programmable Logic devices, discrete gates, transistor Logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in embodiments of the present invention may be implemented or performed. For example, the processor may be a single core processor or a multi-core processor, which may be integrated on a single chip or located on multiple different chips.
Processor 1120 may be a microprocessor or any conventional processor. The steps of the method disclosed in connection with the embodiments of the present invention may be directly performed by a hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), a register, and other readable storage media known in the art. The readable storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The bus 1110 may also connect various other circuits such as peripherals, voltage regulators, or power management circuits to provide an interface between the bus 1110 and the transceiver 1130, as is well known in the art. Therefore, the embodiments of the present invention will not be further described.
The transceiver 1130 may be one element or may be multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. For example: the transceiver 1130 receives external data from other devices, and the transceiver 1130 transmits data processed by the processor 1120 to other devices. Depending on the nature of the computer system, a user interface 1160 may also be provided, such as: touch screen, physical keyboard, display, mouse, speaker, microphone, trackball, joystick, stylus.
It is to be appreciated that in embodiments of the invention, the memory 1150 may further include memory located remotely with respect to the processor 1120, which may be coupled to a server via a network. One or more portions of the above-described networks may be an ad hoc network (ad hoc network), an intranet (intranet), an extranet (extranet), a Virtual Private Network (VPN), a Local Area Network (LAN), a Wireless Local Area Network (WLAN), a Wide Area Network (WAN), a Wireless Wide Area Network (WWAN), a Metropolitan Area Network (MAN), the Internet (Internet), a Public Switched Telephone Network (PSTN), a plain old telephone service network (POTS), a cellular telephone network, a wireless fidelity (Wi-Fi) network, and combinations of two or more of the above. For example, the cellular telephone network and the wireless network may be a global system for Mobile Communications (GSM) system, a Code Division Multiple Access (CDMA) system, a Worldwide Interoperability for Microwave Access (WiMAX) system, a General Packet Radio Service (GPRS) system, a Wideband Code Division Multiple Access (WCDMA) system, a Long Term Evolution (LTE) system, an LTE Frequency Division Duplex (FDD) system, an LTE Time Division Duplex (TDD) system, a long term evolution-advanced (LTE-a) system, a Universal Mobile Telecommunications (UMTS) system, an enhanced Mobile Broadband (eMBB) system, a mass Machine Type Communication (mtc) system, an Ultra Reliable Low Latency Communication (urrllc) system, or the like.
It is to be understood that the memory 1150 in embodiments of the present invention can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. Wherein the nonvolatile memory includes: Read-Only Memory (ROM), Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or Flash Memory.
The volatile memory includes: random Access Memory (RAM), which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as: static random access memory (Static RAM, SRAM), Dynamic random access memory (Dynamic RAM, DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (Double Data Rate SDRAM, DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DRRAM). The memory 1150 of the electronic device described in the embodiments of the invention includes, but is not limited to, the above and any other suitable types of memory.
In an embodiment of the present invention, memory 1150 stores the following elements of operating system 1151 and application programs 1152: an executable module, a data structure, or a subset thereof, or an expanded set thereof.
Specifically, the operating system 1151 includes various system programs such as: a framework layer, a core library layer, a driver layer, etc. for implementing various basic services and processing hardware-based tasks. Applications 1152 include various applications such as: media Player (Media Player), Browser (Browser), for implementing various application services. A program implementing a method of an embodiment of the invention may be included in application program 1152. The application programs 1152 include: applets, objects, components, logic, data structures, and other computer system executable instructions that perform particular tasks or implement particular abstract data types.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned method for processing an UTXO database, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The computer-readable storage medium includes: permanent and non-permanent, removable and non-removable media may be tangible devices that retain and store instructions for use by an instruction execution apparatus. The computer-readable storage medium includes: electronic memory devices, magnetic memory devices, optical memory devices, electromagnetic memory devices, semiconductor memory devices, and any suitable combination of the foregoing. The computer-readable storage medium includes: 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), non-volatile random access memory (NVRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic tape cartridge storage, magnetic tape disk storage or other magnetic storage devices, memory sticks, mechanically encoded devices (e.g., punched cards or raised structures in a groove having instructions recorded thereon), or any other non-transmission medium useful for storing information that may be accessed by a computing device. As defined in embodiments of the present invention, the computer-readable storage medium does not include transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses traveling through a fiber optic cable), or electrical signals transmitted through a wire.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, electronic device and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electrical, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to solve the problem to be solved by the embodiment of the invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present invention may be substantially or partially contributed by the prior art, or all or part of the technical solutions may be embodied in a software product stored in a storage medium and including instructions for causing a computer device (including a personal computer, a server, a data center, or other network devices) to execute all or part of the steps of the methods of the embodiments of the present invention. And the storage medium includes various media that can store the program code as listed in the foregoing.
The above description is only a specific implementation of the embodiments of the present invention, but the scope of the embodiments of the present invention is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present invention, and all such changes or substitutions should be covered by the scope of the embodiments of the present invention. Therefore, the protection scope of the embodiments of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of processing a UTXO database, comprising:
acquiring transaction information to be stored, wherein the transaction information comprises an input part and an output part, and the output part comprises an account address and other information except the account address;
compressing the input part to generate compressed information, wherein the length of the compressed information is smaller than that of the input part;
carrying out hash processing on the account address according to a preset hash function, taking a hash processing result as an address pointer, and storing the account address to a position corresponding to the address pointer;
and generating a key value pair by taking the compressed information as a key and the address pointer and the other information as values, and storing the key value pair in a UTXO database.
2. The method of claim 1, prior to the generating key-value pairs, further comprising:
judging whether the compressed information collides with other compressed information or not;
if collision occurs, storing the compressed information and transaction information corresponding to other compressed information collided with the compressed information into a collision table;
if no collision occurs, the process of generating key-value pairs is executed.
3. The method of claim 1, wherein the input portion comprises a transaction identification and a transaction index;
the compressing the input part to generate compressed information includes:
performing hash processing on the transaction identifier to generate first sub-compressed information, wherein the length of the first sub-compressed information is smaller than that of the transaction identifier;
carrying out remainder processing on the transaction index to generate second sub-compressed information, wherein the length of the second sub-compressed information is smaller than that of the transaction index;
and generating compressed information according to the first sub-compressed information and the second sub-compressed information.
4. The method of any one of claims 1-3, further comprising:
acquiring target information to be verified, wherein the target information comprises a target input part and a target output part;
performing the same compression processing on the target input part, determining target compression information, and matching the target compression information with a key value pair stored in the UTXO database;
if the matching is successful, determining a target address pointer and other target information corresponding to the target compressed information; and reading a target account address of a corresponding position according to the target address pointer, and taking the target account address and the other target information as output values, wherein the output values are used for comparing with the target output part.
5. The method of claim 4, wherein prior to performing the same compression processing on the target input portion if a collision table exists, further comprising:
judging whether the target input part is matched with the transaction information stored in the collision table;
if the transaction information is matched with the target input part, taking an output part in the transaction information matched with the target input part as an output value for comparison with the target output part;
and if not, executing the same compression processing process on the target input part.
6. An apparatus for processing a UTXO database, comprising:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring transaction information to be stored, the transaction information comprises an input part and an output part, and the output part comprises an account address and other information except the account address;
the compression module is used for compressing the input part to generate compressed information, and the length of the compressed information is smaller than that of the input part;
the account address processing module is used for carrying out hash processing on the account address according to a preset hash function, taking a hash processing result as an address pointer and storing the account address to a position corresponding to the address pointer;
and the storage module is used for generating a key-value pair by taking the compressed information as a key and the address pointer and the other information as values, and storing the key-value pair to the UTXO database.
7. The pointer as recited in claim 6, further comprising a collision module; before the storage module generates a key-value pair, the collision module is to:
judging whether the compressed information collides with other compressed information or not;
if collision occurs, storing the compressed information and transaction information corresponding to other compressed information collided with the compressed information into a collision table;
and if the collision does not occur, the storage module generates a key-value pair.
8. The pointer of claim 6, wherein the input section comprises a transaction identification and a transaction index;
the compression module compresses the input part to generate compressed information, and the compressed information comprises:
performing hash processing on the transaction identifier to generate first sub-compressed information, wherein the length of the first sub-compressed information is smaller than that of the transaction identifier;
carrying out remainder processing on the transaction index to generate second sub-compressed information, wherein the length of the second sub-compressed information is smaller than that of the transaction index;
and generating compressed information according to the first sub-compressed information and the second sub-compressed information.
9. An electronic device comprising a bus, a transceiver, a memory, a processor and a computer program stored on the memory and executable on the processor, the transceiver, the memory and the processor being connected via the bus, characterized in that the computer program realizes the steps in the method of processing a UTXO database as claimed in any one of the claims 1 to 5 when executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of processing a UTXO database as claimed in any one of the claims 1 to 5.
CN202011640960.6A 2020-12-31 2020-12-31 Method and device for processing UTXO database and electronic equipment Pending CN112685422A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011640960.6A CN112685422A (en) 2020-12-31 2020-12-31 Method and device for processing UTXO database and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011640960.6A CN112685422A (en) 2020-12-31 2020-12-31 Method and device for processing UTXO database and electronic equipment

Publications (1)

Publication Number Publication Date
CN112685422A true CN112685422A (en) 2021-04-20

Family

ID=75456788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011640960.6A Pending CN112685422A (en) 2020-12-31 2020-12-31 Method and device for processing UTXO database and electronic equipment

Country Status (1)

Country Link
CN (1) CN112685422A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360951A (en) * 2021-05-12 2021-09-07 电子科技大学 Electronic evidence preservation method based on partitioned block chain
CN113821536A (en) * 2021-11-23 2021-12-21 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508334A (en) * 2018-11-23 2019-03-22 中科驭数(北京)科技有限公司 For the data compression method of block chain database, access method and system
CN109583861A (en) * 2018-11-23 2019-04-05 中科驭数(北京)科技有限公司 Data compression method, access method and system in key-value database
US20200382279A1 (en) * 2019-05-29 2020-12-03 International Business Machines Corporation Approximate hash verification of unused blockchain output

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508334A (en) * 2018-11-23 2019-03-22 中科驭数(北京)科技有限公司 For the data compression method of block chain database, access method and system
CN109583861A (en) * 2018-11-23 2019-04-05 中科驭数(北京)科技有限公司 Data compression method, access method and system in key-value database
US20200382279A1 (en) * 2019-05-29 2020-12-03 International Business Machines Corporation Approximate hash verification of unused blockchain output

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360951A (en) * 2021-05-12 2021-09-07 电子科技大学 Electronic evidence preservation method based on partitioned block chain
CN113821536A (en) * 2021-11-23 2021-12-21 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium

Similar Documents

Publication Publication Date Title
CN112685422A (en) Method and device for processing UTXO database and electronic equipment
CN111581627A (en) Data processing method and device and electronic equipment
WO2017095671A1 (en) Adding privacy to standard credentials
US11249987B2 (en) Data storage in blockchain-type ledger
EP3813001B1 (en) Data reading method based on a plurality of block chain networks and system
US11275835B2 (en) Method of speeding up a full antivirus scan of files on a mobile device
CN110334542B (en) Network evidence preservation and network evidence preservation verification method and device
US20230169016A1 (en) Obfuscating cryptographic material in memory
CN110347745B (en) Time service authentication method, device and equipment for block chain type account book
US10936734B2 (en) Blockchain authorization
CN110597461B (en) Data storage method, device and equipment in block chain type account book
KR102302952B1 (en) Integrated financial transaction platform apparatus performing a differential login authentication process based on user login security level and operating method thereof
CN112800486A (en) Bill information processing method, device and system
CN111600879B (en) Data output/acquisition method and device and electronic equipment
US10771241B2 (en) Time authentication method, apparatus and device in blockchain-type ledger
CN110515591B (en) Random number generation method and device based on block chain
CN110597462A (en) Data storage method, system, device and equipment in block chain type account book
CN111292082B (en) Public key management method, device and equipment in block chain type account book
CN114692124A (en) Data reading and writing method and device and electronic equipment
CN114253956A (en) Edge caching method and device and electronic equipment
JP6763096B1 (en) system
CN113645176A (en) Method and device for detecting counterfeit flow and electronic equipment
CN117459323B (en) Threat modeling method and device for intelligent evolution Internet of things equipment
CN114844650B (en) Equipment signature method and system
CN117318892B (en) Computing system, data processing method, network card, host computer and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210420