Blockchain is widely used in encrypted currency, Internet of Things (IoT), supply chain finance, data sharing, and other fields. However, there are security problems in blockchains to varying degrees. As an important component of blockchain, hash function has relatively low computational efficiency. Therefore, this paper proposes a new scheme to optimize the blockchain hashing algorithm based on PRCA (Proactive Reconfigurable Computing Architecture). In order to improve the calculation performance of hashing function, the paper realizes the pipeline hashing algorithm and optimizes the efficiency of communication facilities and network data transmission by combining blockchains with mimic computers. Meanwhile, to ensure the security of data information, this paper chooses lightweight hashing algorithm to do multiple hashing and transforms the hash algorithm structure as well. The experimental results show that the scheme given in the paper not only improves the security of blockchains but also improves the efficiency of data processing.
Blockchain is a kind of distributed general ledger technology, originated from the literature [
However, with the continuous development of blockchain, its security issues become increasingly prominent. The lightweight hash function SHA1 in the blockchain is no longer regarded as an attacker that can withstand sufficient funds and computing resources. SHA256 can replace SHA1 for information exchange with good anticollision ability, while it cannot be changed at will. To avoid chain breakage, it is necessary to modify the hash values of all blocks behind the block at the same time. As a result, a large computational complexity is needed and the security of the blockchain is not guaranteed.
In the process of executing operations, the PRCA (Proactive Reconfigurable Computing Architecture) generates the optimal computation structure set by self-perception and dynamic selection. All the software and hardware variants are dynamically variable. Therefore, in the process of application processing, they can select optimal solutions according to the independent variables in the program to get the variable optimal solution sets with equivalent function and different computing efficiency [
This paper proposes an optimization scheme of blockchain hashing algorithm based on PRCA. Aiming at the blockchain hash algorithm structure, a reconfigurable hash algorithm with high performance is implemented in a full pipeline way. At the same time, 10,000 Mbp communication is realized by mimic computer to reduce data transmission delay, and data is read from memory by DMA, which improves transmission efficiency. In each transaction, the hash algorithm is negotiated and the mimic computer is reconstructed, which aims to transform the hash algorithm structure through using lightweight hash algorithm for many times. This scheme not only improves the efficiency of processing data for blockchain but also increases its security.
PRCA is an operation mechanism based on multidimensional reconstructed functional structure and dynamic multibody. When proactive reconfigurable computation is processing data, execution structures, such as computing, storage, and interconnection, are changing dynamically with the efficiency of transaction processing, instead of improving the algorithm to improve the operation performance without changing the basic hardware. There are many functional equivalents in PRCA, but they are accomplished by combining different hardware structures with this algorithm. The purpose is to achieve the high performance of computing, that is, how to automatically perceive variables to generate the optimal computing set and autonomously reconstruct the computing in the processing algorithm [
PRCA has variable infrastructure and algorithm, which makes it possible to obtain optimal solutions to different problems. It pursues different services and comprehensive high performance under different loads or other conditions, builds the most appropriate processing components, and forms the most appropriate architecture. Proactive reconfigurable computation combines the advantages of general computing and special computing to achieve the goal of solving problems efficiently. In terms of the general computing structure, it is characterized by its determined structures and variable algorithm and may calculate any computable problems with high efficiency. Its principle is shown in Figure
The basic concept of PRCA.
Proactive reconfigurable computer is a new type of computer developed according to the principle of mimetic computing to achieve the high performance of computing. The computational structure can be regarded as a high-order function. In the analysis of the calculation, the computational structure will generate the most efficient set of settlement structures by selecting the perceptual independent variables. The essence of proactive reconfigurable computer is the functionalization of computational structure. Its high performance and efficiency are very suitable for the processing and analysis of big data nowadays. Compared with the traditional computer, the energy efficiency of proactive reconfigurable computer has been improved more than 10 times. The structure of the principle prototype of the proactive reconfigurable computer is shown in Figure
Principle prototype structure of the proactive reconfigurable computer.
The purpose of proactive reconfigurable computer is to deal with intensive computing. It consists of an ATOM general microprocessor, four high-order reconfigurable large-scale reconfigurable FPGAs, and DDR3 memory, which connects LVDS bus FULL-MESH through floor GTX, and is controlled by the control unit BMC and synchronized by clock synchronization unit. The prototype supports multiple interfaces and storage media and reconstructs FPGA processing core, I/O interface, and on-chip interconnection network according to the application requirements, so as to achieve the purpose of high-efficiency computing [
Proactive reconfigurable computers use dynamic randomicity to build an asymmetric defense system, which expands the attack surface to weaken intrinsic attacks of feature sniffing and state transition [
The proactive reconfigurable computer is configured as a node in the blockchain network. Users and proactive reconfigurable computers establish a connection. The proactive reconfigurable computer catches the data in the DDR memory and realizes the direct connection high-speed transmission from network to the memory data by the asynchronous FIFO, reducing the intermediate transmission level. In blockchain, a high-performance hash algorithm is implemented by means of pipelines and the key segment calculation data hash is extracted from memory [
Blockchain system architecture based on PRCA.
The block stores all the information about transactions, including the generation time of transaction, the record index number of transaction, the hash value of transactions, bitcoin’s expenditure address and its amount of expenditures, and other types of transaction. A Merkle value will be generated in the transaction. The hash node value in the transaction determines that each address cannot be repeatedly traded and forged. To further improve the security of transactions, a proactive reconfigurable hash is added to the blockchain, which is composed of various types and structures of hash algorithms and can be used separately or in series. The concrete structure model is shown in Figure
Proactive reconfigurable hash structure in blockchain.
Unit nodes in blockchains monitor network traffic to calculate transaction volume [
In the interaction, the sensor layer on the spot collects data. The sensor transmits data to unit nodes and requests the transaction to store the data. If unit nodes successfully complete the transaction mining, the blockchain network will update the block. After that, the blockchain network returns the field layer data to the control layer. Then block mining will be started. After the block mining is finished, the blockchain network receives the node of transaction and broadcasts the block and validation request to other nodes. Other nodes using hash algorithm confirmed from the block header for verification. After the successful verification, they will update the block and store nodes and blocks. If the contents of transactions are transferring data or commands, the requested node will transfer the data or command to the other layers. The specific block mining and updating are shown in Figure
Mining and updating of block.
At the same time, the random number generator randomly chooses the new hash algorithm at intervals, and the two sides negotiate again and update for new hash algorithm to improve security.
Hash function is an important part of many cryptographic algorithms. An important component of blockchain technology is to apply hash function for many operations. Hashing is a method of applying hash function to data that computes a relatively unique output for almost any size of input. It allows individuals to independently obtain input data and hash data and produce the same results, proving that the data has not changed. Take SHA256 as an example to illustrate the optimization and implementation of hash algorithm on proactive reconfigurable computers.
The throughput of the algorithm solves the computational performance of the algorithm. The specific implementation formula is as follows:
In equation (
The following is an introduction to the optimization of SHA256, which can be extended to SHA1.
For messages with a length no more than Add great many 0 bits to the input data until 448 bits. Then add 64-bit length to the input data until 512 bits. Divide the spliced 512-bit data into 16 groups: Initialize the vectors Set the variable Let
In the above algorithm,
From the processing of the SHA256 algorithm, it can be seen that the key is to update the values of A and
The time consumption of the SHA256 operation is mainly in the iteration part of Step 4, and the most time-consuming part is the calculation of
In this way,
FPGA is suitable for bit operation. Carry-Save Adders (CSA) strategy can reduce addition operation, minimize critical path length, and ensure pipeline throughput. For
By dividing the critical paths, it takes
The critical path segmentation method and the CSA strategy reduce the operation of
After the optimization of critical path partition, the time consumption of the longest path is reduced. For serial computing, the total time consumption does not decrease. Therefore, it is necessary to use the parallel characteristics of FPGA and pipeline method for optimization, so as to truly reduce the total time consumption of computing.
According to the characteristics of the SHA256 algorithm and the optimization of critical path, the core processing of the algorithm is divided into three modules:
While data are being calculated, in the first clock cycle, the first data are input to the
Pipeline structure of the SHA256 algorithm.
For adapting to the calculation of blockchain hash, the concrete structure of proactive reconfigurable computer is shown in Figure
On-chip architecture of proactive reconfigurable computer.
The functions of each module are as follows:
Block data are cached to CTL_DDR3_0 via I_10G network interface, hash values are read and calculated by Hash_Core, and results are cached into CTL_DDR3_1 and finally sent to the network by I_10G. The host computer controls the proactive reconfigurable computer in real time through I_1G Gigabit interface and Ctl_Core according to the information reported by State_U.
10G network is implemented based on IP protocol, and the content of data transmission is controlled by external users. It uses FIFO interface to communicate with external devices [
The whole structure of 10G network.
In Figure
Read-write memory is implemented by four groups of FIFOs in burst mode. Every time before it reads and writes memory, it will calculate the memory address range according to the length of the data and store it in wrrdinfo_fifo. At the same time, the data will be cached in wfifo_fifo, and according to the information of wrrdinfo_fifo, the read-write arbitration module determines whether it is a reading operation or a writing one. If it is a writing operation, the data will be written to memory through the DDR write module. The process of reading memory data is similar to that of writing. The read information and data will be cached in out_rdinfo_fifo and rififo_fifo, respectively. The read-write structure of memory is shown in Figure
The read-write structure of memory.
When the initialization of memory is completed, that is, phy_init_done is set to 1, the CTL_DDR3_0 and CTL_DDR3_1 modules are in the read-write state, and the read-write state jump will be completed according to the wrrdinfo_
Memory state management mechanism.
Public and private keys in blockchains are a pair of keys obtained by a kind of algorithm. It will be encrypted with public key and decrypted with corresponding private key. After three times of SHA256 computation and one time of RIPEMD160 computation for the public key, a public key hash can be obtained, and the address can finally be obtained through base58 encoding [
The application of hash algorithm in blockchain.
In this paper, the communication equipment and network are optimized. In a relatively safe environment, a relatively simple and lightweight hash algorithm is chosen to replace the complex hash algorithm, so as to improve the running speed of the system and reduce the energy consumption of the system. Meanwhile, multiple hash algorithm is used to reduce the attack of length expansion and ensure the integrity and tamper-proofing of information, which reflects the security performance of blockchain.
In this paper, proactive reconfigurable computer is used for experiments. The software platform is ISE software integrating design, simulation, integration, wiring, and generation. First, the comparison of CPU running speed and resource utilization is given by optimizing the hash algorithm deeply. Second, the collision resistance of proactive reconfigurable hashes is analyzed. Finally, the security of this scheme is analyzed from many aspects.
The configuration information of each computing unit used in the experiment is shown in Table
The configuration information of each computing unit.
Calculation component | Configuration information |
---|---|
CPU server | 4-core CPU; model: i5-7500; main frequency: 3.40 GHz; memory: 24 GB |
PRCA | 4 FPGA cards; on-chip resources slices: 85920; memory: 24 GB |
10G switch | 24 1/10G SFP + ports; 4 10/100/1000 m electrical interface |
On the proactive reconfigurable computer, the SHA256 and SHA1 algorithms are implemented, respectively. Their resource occupation, frequency, and throughput are shown in Table
The actual operation of SHA256 and SHA1.
Regs (687, 360) | LUTs (343, 680) | Slices (85, 920) | Frequency (MHz) | Throughput (Mbps) | |
---|---|---|---|---|---|
SHA1 | 24,703 | 18,899 | 6106 | 243.8 | 124825.6 |
SHA256 | 27669 | 25648 | 7745 | 172.0 | 88064 |
As seen from Table
The actual operation of SHA256 and SHA1.
Next is the performance comparison of SHA256 and SHA1 between the proactive reconfigurable computer and CPU, as is shown in Table
The performance comparison of SHA256 and SHA1 between the proactive reconfigurable computer and CPU.
Calculation component | Number of parallel modules | Frequency (MHz) | Running speed (m) | |
---|---|---|---|---|
PRCA | SHA1 | 40 | 200 | 8000 |
SHA256 | 24 | 150 | 4800 | |
CPU | SHA1 | — | — | 270.6 |
SHA256 | — | — | 119.3 |
From Table
Meanwhile, the proactive reconfigurable computer is equipped with a 10-gigabit network, whose data transmission peak is about 10 Gbps, which can meet the communication requirements of blockchain high-frequency transactions. As each clock cycle can transmit 8 bytes of data, the clock frequency is 156.25 MHz; while the FIFO interface and frequency of DDR are 8 bytes and 156.25 MHz, the data transmitted by 10G network can be synchronized through FIFO cache and written into memory with 64 bytes and 300 MHz. Two memory modules are configured: one is responsible for writing operation of 10G network and reading operation of hash module, and the other is responsible for writing operation of hash module and reading operation of 10G network. The two memory modules work independently, which improves the efficiency of data transmission.
Hash operation is irreversible and gets different values for different contents. Any change of input information will lead to significant changes in hash results. Moreover, hash operation is also anticollision; that is, two pieces of information with the same hash result cannot be found, which can effectively prevent differential attack [
Assuming that the output value of hash function is uniformly distributed and the message digest has
If
According to the above calculation, if the hash function has an output digest of
The threshold of hash function conflict.
Hash function | Function collision threshold |
---|---|
SHA1 | |
SHA256 |
Bitcoin obtains hash data through the SHA256 algorithm and runs two iterations in block trading to mitigate the length expansion attack. PRCA blockchain system can be described by a triple tuple as
The hash algorithm of PRCA blockchain system
Encryption of information is the key link of blockchain, which mainly includes hash function and asymmetric encryption algorithms [
From the perspective of information security, the main advantages of this scheme are as follows: Multiple hash algorithms are jointly used to ensure the integrity and nontampering of information There is a pseudorandom dynamic selection and the hash algorithm is updated to increase the difficulty of attack in time dimension By using the hardware implementation of proactive reconfigurable computer, the attack surface is expanded and the attack threshold is raised
Obviously, the blockchain based on PRCA enhances the confidentiality, authenticity, and integrity of data and enhances the overall security of blockchain transactions with its reliability, security, and tamper-resistance.
In order to improve the efficiency and security of blockchain hash algorithm, a scheme of blockchain hash algorithm optimization based on PRCA is proposed in this paper. This scheme combines blockchain with proactive reconfigurable computer to improve the performance of blockchain hash function. In terms of security performance, several lightweight hash algorithms are used to exchange information to ensure the integrity and tamper-proofing of information. The proactive reconfigurable computer hardware is used to expand the attack surface, improve the attack threshold, and ensure the security of blockchain.
Blockchain security is the most important part of the system, which includes data, intelligent contract, privacy protection, and application risk. Meanwhile, the data of blockchain is unique. Under the condition of its own security, data writing cannot be changed. Based on the security problem of data immutability, the data structure, cryptography technology, and communication network at the bottom of blockchain are improved to promote the healthy development of blockchain application.
The data used support the findings of the study are available from the corresponding authors upon request.
The authors declare that there are no conflicts of interest regarding the publication of this paper.
This research work was supported by the Innovative Research Groups of the National Natural Science Foundation of China (61521003), Intergovernmental Special Programme of National Key Research and Development Programme (2016YFE0100300 and 2016YFE0100600), National Scientific Fund Programme for Young Scholar (61672470), and Science and Technology Project of Henan Province (182102210617).