TW202512695A - Computational task processing method and device - Google Patents
Computational task processing method and device Download PDFInfo
- Publication number
- TW202512695A TW202512695A TW113133773A TW113133773A TW202512695A TW 202512695 A TW202512695 A TW 202512695A TW 113133773 A TW113133773 A TW 113133773A TW 113133773 A TW113133773 A TW 113133773A TW 202512695 A TW202512695 A TW 202512695A
- Authority
- TW
- Taiwan
- Prior art keywords
- field
- intermediate state
- computing task
- computing
- block
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2209/00—Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
- H04L2209/12—Details relating to cryptographic hardware or logic circuitry
- H04L2209/125—Parallelization or pipelining, e.g. for accelerating processing of cryptographic operations
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Power Sources (AREA)
Abstract
Description
本發明屬於計算處理技術領域,具體涉及一種計算任務處理方法及裝置。 本申請要求於2023年9月8日提交的、申請號為CN202311161624.7、標題為“計算任務處理方法及裝置”的中國專利申請的優先權,該中國專利申請的公開內容以引用的方式併入本文。 The present invention belongs to the field of computing processing technology, and specifically relates to a computing task processing method and device. This application claims priority to a Chinese patent application filed on September 8, 2023, with application number CN202311161624.7 and titled "Computing Task Processing Method and Device", the disclosure of which is incorporated herein by reference.
本部分旨在為申請專利範圍中陳述的本發明的實施方式提供背景或上下文。此處的描述不因為包括在本部分中就承認是現有技術。This section is intended to provide a background or context for the implementation of the invention described in the claims. The description herein is not admitted to be prior art by inclusion in this section.
工作量證明(Proof of Work,簡稱POW)是一些加密計算採用的一種共識機制,其基本特徵是需要進行大量的雜湊運算,在特定難度值條件下找到符合條件的雜湊值,也即區塊計算。其本質上是針對給定的區塊頭進行大量的SHA-256運算來求解得到滿足預期難度的一組雜湊數值。如圖1所示,一種加密演算法所用的區塊頭包括4位元組的版本欄位;32位元組的前區塊雜湊;32位元組的雜湊梅克爾(Merkle)根欄位;4位元組的時間戳記;4位元組的目標值;4位元組的亂數。上述區塊頭分為兩個部分,第一部分包括:4位元組的版本欄位;32位元組的前區塊雜湊以及前28位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第一區);第二部分包括:後4位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第二區);4位元組的時間戳記;4位元組的難度目標值;4位元組的亂數。該加密演算法規定,需要先對第一部分進行SHA-256計算,其結果為中間狀態值,基於該中間狀態值和第二部分進行SHA-256計算,最後基於其結果再進行一次SHA-256計算,得到一次計算結果。Proof of Work (POW) is a consensus mechanism used by some cryptographic calculations. Its basic feature is that it requires a large number of hash operations to find a hash value that meets the conditions under a specific difficulty value, that is, block calculation. In essence, it performs a large number of SHA-256 operations on a given block header to solve a set of hash values that meet the expected difficulty. As shown in Figure 1, a block header used by an encryption algorithm includes a 4-byte version field; a 32-byte previous block hash; a 32-byte hash Merkle root field; a 4-byte timestamp; a 4-byte target value; and a 4-byte random number. The above block header is divided into two parts. The first part includes: a 4-byte version field; a 32-byte previous block hash and the first 28-byte hash Merkle root field (the first area of the hash Merkle root); the second part includes: the last 4 bytes of the hash Merkle root field (the second area of the hash Merkle root); a 4-byte timestamp; a 4-byte difficulty target value; and a 4-byte random number. The encryption algorithm stipulates that the first part needs to be calculated by SHA-256 first, and the result is the intermediate state value. Based on the intermediate state value and the second part, SHA-256 calculation is performed. Finally, based on the result, another SHA-256 calculation is performed to obtain a calculation result.
傳統的區塊計算中,版本欄位、前區塊的雜湊值、難度目標值都是確定的,因此需要不斷修改亂數來運算,而亂數只有4位元組,只能做 次運算。因此,通常是通過修改梅克爾(Merkle) 根來尋找更大的計算空間。從圖1的區塊頭結構可知,雜湊梅克爾(Merkle)根被分割在2個部分中,現有技術通常是通過大量的雜湊碰撞尋找多個雜湊梅克爾(Merkle)根後4位元組相同的區塊頭,以便能最大力度節省計算效率,從而達到降低功耗的目的。然而,需要執行雜湊碰撞來尋找相同後4位元組雜湊梅克爾(Merkle)根,其代價較大且未必能得到支持。 In traditional block calculations, the version field, the hash value of the previous block, and the difficulty target value are all fixed, so it is necessary to constantly modify the random number for calculation. However, the random number is only 4 bytes and can only be used to Therefore, it is usually necessary to modify the Merkle root to find a larger computing space. From the block header structure in Figure 1, it can be seen that the hash Merkle root is divided into two parts. The existing technology usually searches for block headers with the same last 4 bytes of multiple hash Merkle roots through a large number of hash collisions, so as to save computing efficiency to the greatest extent and thus achieve the purpose of reducing power consumption. However, it is necessary to perform hash collisions to find the same last 4 bytes of hash Merkle roots, which is costly and may not be supported.
因此,如何以代價較小且功耗更低的方式實現工作量證明的計算是一個亟待解決的問題。Therefore, how to implement proof-of-work calculations in a less costly and power-efficient manner is an urgent problem to be solved.
針對上述現有技術中存在的問題,提出了一種計算任務處理方法及裝置,以最大力度節省計算效率,能夠解決上述工作量證明的計算代價較大且功耗高的問題。In view of the problems existing in the above-mentioned prior art, a computing task processing method and device are proposed to save computing efficiency to the maximum extent, and can solve the problems of high computing cost and high power consumption of the above-mentioned proof of work.
本發明提供了以下方案。The present invention provides the following solutions.
第一方面,提供計算任務處理方法,包括:In a first aspect, a computing task processing method is provided, comprising:
接收計算任務,所述計算任務包括原始版本欄位,執行以下處理步驟:Receive a calculation task, wherein the calculation task includes an original version field, and perform the following processing steps:
對所述原始版本欄位修改得到多個修改版本欄位;Modifying the original version field to obtain a plurality of modified version fields;
基於多個所述修改版本欄位,對所述計算任務執行雜湊運算生成多個中間狀態值,多個所述中間狀態值用於工作量證明計算。Based on the multiple modified version fields, a hash operation is performed on the computing task to generate multiple intermediate state values, and the multiple intermediate state values are used for proof of work calculation.
在一些實施例中,反覆運算執行所述處理步驟,第n+1輪處理步驟中的修改版本欄位和第1輪至n輪處理步驟中的修改版本欄位不一致。In some embodiments, the processing steps are repeatedly performed, and the modified version field in the (n+1)th round of processing steps is inconsistent with the modified version field in the 1st to nth rounds of processing steps.
在一些實施例中,還包括:In some embodiments, it also includes:
接收另一個計算任務,基於所述另一個計算任務的原始版本欄位,執行所述處理步驟。Another computing task is received, and the processing step is executed based on the original version field of the another computing task.
在一些實施例中,所述原始版本欄位包括固定欄位、軟分叉投票欄位及剩餘欄位,所述剩餘欄位用於對所述原始版本欄位進行修改得到多個所述修改版本欄位。In some embodiments, the original version field includes a fixed field, a soft fork voting field, and a remaining field, and the remaining field is used to modify the original version field to obtain a plurality of the modified version fields.
在一些實施例中,對所述剩餘欄位的比特位元進行隨機或固定順序修改,以對所述原始版本欄位進行修改得到多個所述修改版本欄位。In some embodiments, the bits of the remaining fields are modified randomly or in a fixed order to modify the original version fields to obtain multiple modified version fields.
在一些實施例中,所述原始版本欄位為32bit,所述剩餘欄位為16bit。In some embodiments, the original version field is 32 bits and the remaining field is 16 bits.
在一些實施例中,所述計算任務還包括消息欄位,所述消息欄位包括前區塊雜湊和雜湊梅克爾(Merkle)根的第一區。In some embodiments, the computation task further includes a message field, wherein the message field includes a first region of a hash of a previous block and a hash Merkle root.
在一些實施例中,還包括:In some embodiments, it also includes:
基於所述中間狀態值,獲得多個子中間狀態值;Based on the intermediate state value, a plurality of sub-intermediate state values are obtained;
將多個所述子中間狀態值構成的串列資料流程輸出用於工作量證明計算。Outputting a serial data flow consisting of a plurality of sub-intermediate state values for use in proof of work calculation.
在一些實施例中,基於所述中間狀態值,對其拆分獲得多個子中間狀態值。In some embodiments, based on the intermediate state value, it is split into multiple sub-intermediate state values.
在一些實施例中,所述中間狀態值為256bit,所述子中間狀態值為32bit。In some embodiments, the intermediate state value is 256 bits, and the sub-intermediate state value is 32 bits.
在一些實施例中,所述計算任務還包括消息欄位,所述基於多個所述修改版本欄位,對所述計算任務執行雜湊運算生成多個中間狀態值,包括:In some embodiments, the computing task further includes a message field, and based on the plurality of modified version fields, performing a hash operation on the computing task to generate a plurality of intermediate state values includes:
將多個所述修改版本欄位分別和所述消息欄位組合得到多個第一區塊欄位,基於多個所述第一區塊欄位,執行雜湊運算生成多個所述中間狀態值。The plurality of modified version fields are respectively combined with the message fields to obtain a plurality of first block fields, and based on the plurality of first block fields, a hash operation is performed to generate a plurality of the intermediate state values.
在一些實施例中,將每個第一區塊欄位拆分為多個子第一區塊欄位,基於每個第一區塊欄位的多個子第一區塊欄位構成的串列資料流程,執行雜湊運算生成所述中間狀態值。In some embodiments, each first block field is split into a plurality of sub-first block fields, and a hash operation is performed based on a serial data flow consisting of the plurality of sub-first block fields of each first block field to generate the intermediate state value.
在一些實施例中,基於多個所述修改版本欄位的順序值,將每個所述修改版本欄位和所述消息欄位組合得到對應的第一區塊欄位。In some embodiments, based on the sequence values of the plurality of modified version fields, each modified version field and the message field are combined to obtain a corresponding first block field.
在一些實施例中,輸出與所述順序值對應的脈衝電平,回應於所述脈衝電平,將與所述順序值對應的修改版本欄位和所述消息欄位鎖存為所述第一區塊欄位。In some embodiments, a pulse level corresponding to the sequence value is output, and in response to the pulse level, a modified version field corresponding to the sequence value and the message field are locked as the first block field.
在一些實施例中,在第m個所述第一區塊欄位執行雜湊運算生成所述中間狀態值之後,將第m+1個所述修改版本欄位和所述消息欄位組合得到第m+1個所述第一區塊欄位。In some embodiments, after performing a hash operation on the mth first block field to generate the intermediate state value, the m+1th modified version field and the message field are combined to obtain the m+1th first block field.
在一些實施例中,還包括:In some embodiments, it also includes:
基於多個所述中間狀態值和所述計算任務的第二區塊欄位執行雜湊運算,得到工作量證明;所述第二區塊欄位包括所述雜湊梅克爾(Merkle)根的第二區、時間戳記、目標值以及亂數。A hash operation is performed based on the plurality of intermediate state values and a second block field of the computation task to obtain a proof of work; the second block field includes a second area of the hash Merkle root, a timestamp, a target value, and a random number.
在一些實施例中,所述基於多個所述中間狀態值和所述計算任務的第二區塊欄位執行雜湊運算,包括:In some embodiments, performing a hash operation based on the plurality of intermediate state values and the second block field of the computing task includes:
對所述第二區塊欄位進行第一擴展操作,得到第一擴展資料;Performing a first expansion operation on the second block field to obtain first expansion data;
基於多個所述中間狀態值和所述第一擴展操作結果執行多個第一壓縮操作,得到多個第一壓縮資料;Performing a plurality of first compression operations based on the plurality of intermediate state values and the first expansion operation results to obtain a plurality of first compressed data;
基於多個所述第一壓縮資料執行多個第二擴展操作,得到多個所述第二擴展資料;Performing a plurality of second expansion operations based on a plurality of the first compressed data to obtain a plurality of the second expanded data;
基於多個所述第二擴展資料執行多個第二壓縮操作,得到所述工作量證明。A plurality of second compression operations are performed based on the plurality of second extended data to obtain the proof of work.
在一些實施例中,所述中間狀態值在高電壓區生成,生成多個所述中間狀態值之後,將多個所述中間狀態值由高電壓區轉換至低電壓區,用於工作量證明計算。In some embodiments, the intermediate state value is generated in a high voltage region. After generating a plurality of the intermediate state values, the plurality of the intermediate state values are converted from the high voltage region to the low voltage region for proof of work calculation.
在一些實施例中,所述中間狀態值在晶片的頂層區生成。In some embodiments, the intermediate state value is generated in a top region of a wafer.
在一些實施例中,所述雜湊運算為SHA-256運算。In some embodiments, the hashing operation is a SHA-256 operation.
第二方面,提供計算任務處理裝置,包括:In a second aspect, a computing task processing device is provided, comprising:
接收模組,用於接收計算任務,所述計算任務包括原始版本欄位;A receiving module, used for receiving a computing task, wherein the computing task includes an original version field;
修改模組,對所述原始版本欄位修改得到多個修改版本欄位;A modification module modifies the original version field to obtain a plurality of modified version fields;
計算模組,用於基於多個所述修改版本欄位,對所述計算任務執行雜湊運算生成多個所述中間狀態值,多個所述中間狀態值用於工作量證明計算。A computing module is used to perform a hash operation on the computing task based on the multiple modified version fields to generate multiple intermediate state values, and the multiple intermediate state values are used for proof of work calculation.
在一些實施例中,所述修改模組還用於反覆運算修改多個所述修改版本欄位。In some embodiments, the modification module is further used to repeatedly calculate and modify a plurality of the modified version fields.
在一些實施例中,所述接收模組還用於接收新的計算任務,所述修改模組還用於對所述新的計算任務原始版本欄位修改得到多個修改版本欄位。In some embodiments, the receiving module is further used to receive a new computing task, and the modifying module is further used to modify the original version fields of the new computing task to obtain a plurality of modified version fields.
在一些實施例中,所述原始版本欄位包括固定欄位、軟分叉投票欄位及剩餘欄位,所述剩餘欄位用於對所述原始版本欄位進行修改得到多個所述修改版本欄位。In some embodiments, the original version field includes a fixed field, a soft fork voting field, and a remaining field, and the remaining field is used to modify the original version field to obtain a plurality of the modified version fields.
在一些實施例中,所述計算任務還包括消息欄位,所述消息欄位包括前區塊雜湊和雜湊梅克爾(Merkle)根的第一區。In some embodiments, the computation task further includes a message field, wherein the message field includes a first region of a hash of a previous block and a hash Merkle root.
在一些實施例中,還包括位元寬轉換模組,用於將所述計算模組生成的第一位寬的所述中間狀態值拆分為多個第二位寬的子中間狀態值;多個所述子中間狀態值構成的串列資料流程用於工作量證明計算。In some embodiments, a bit width conversion module is also included, which is used to split the intermediate state value of the first bit width generated by the calculation module into multiple sub-intermediate state values of the second bit width; the serial data flow composed of the multiple sub-intermediate state values is used for proof of work calculation.
在一些實施例中,所述計算任務還包括消息欄位,所述計算模組包括第一鎖存器,所述第一鎖存器用於儲存單個所述修改版本欄位和所述消息欄位組合構成的第一區塊欄位,所述計算模組基於多個所述第一區塊欄位,執行雜湊運算生成多個所述中間狀態值。In some embodiments, the computing task also includes a message field, the computing module includes a first register, the first register is used to store a first block field composed of a single modified version field and the message field combination, and the computing module performs a hash operation based on multiple first block fields to generate multiple intermediate state values.
在一些實施例中,所述計算模組包括移位暫存器,所述移位暫存器用於將所述第一區塊欄位拆分為多個子第一區塊欄位,多個所述子第一區塊欄位構成的串列資料流程用於執行雜湊運算生成所述中間狀態值。In some embodiments, the computing module includes a shift register, which is used to split the first block field into multiple sub-first block fields, and the serial data flow composed of the multiple sub-first block fields is used to perform a hash operation to generate the intermediate state value.
在一些實施例中,所述計算模組包括計數器,所述計數器用於產生計數值,所述計算模組根據計數值,基於多個所述修改版本欄位的順序值,將與所述計數值對應的修改版本欄位和所述消息欄位組合得到對應的第一區塊欄位。In some embodiments, the calculation module includes a counter, which is used to generate a count value. The calculation module combines the modified version field corresponding to the count value and the message field to obtain the corresponding first block field based on the count value and the sequence values of the multiple modified version fields.
在一些實施例中,所述計算模組包括電平生成模組,所述電平生成模組根據所述計數值生成對應的脈衝電平,所述計算模組回應於所述脈衝電平將與所述計數值對應的修改版本欄位和所述消息欄位鎖存為所述第一區塊欄位。In some embodiments, the calculation module includes a level generation module, which generates a corresponding pulse level according to the count value, and the calculation module locks the modified version field corresponding to the count value and the message field as the first block field in response to the pulse level.
在一些實施例中,所述計算模組生成單個所述中間狀態值時產生完成信號,所述計數器回應於所述完成信號更新所述計數值,並在多個所述第一區塊欄位全部執行雜湊運算之後將所述計數值恢復至初始值。In some embodiments, the calculation module generates a completion signal when generating a single intermediate state value, the counter updates the count value in response to the completion signal, and restores the count value to the initial value after all the hash operations are performed on multiple first block fields.
在一些實施例中,還包括工作量證明計算模組,用於基於多個所述中間狀態值和所述計算任務的第二區塊欄位執行雜湊運算,得到工作量證明;所述第二區塊欄位包括所述雜湊梅克爾(Merkle)根的第二區、時間戳記、目標值以及亂數。In some embodiments, a proof-of-work calculation module is further included, which is used to perform hash operations based on multiple intermediate state values and a second block field of the computing task to obtain a proof of work; the second block field includes a second area of the hash Merkle root, a timestamp, a target value, and a random number.
在一些實施例中,還包括多個第二鎖存器,用於接收多個所述中間狀態值;第一擴展器,用於對所述第二區塊欄位進行第一擴展操作,得到第一擴展資料;多個第一壓縮器,用於基於多個所述中間狀態值和所述第一擴展操作結果執行多個第一壓縮操作,得到多個第一壓縮資料;多個第二擴展器,用於基於多個所述第一壓縮資料執行多個第二擴展操作,得到多個所述第二擴展資料;多個第二壓縮器,用於基於多個所述第二擴展資料執行多個第二壓縮操作,得到所述工作量證明。In some embodiments, it also includes multiple second registers for receiving multiple intermediate state values; a first expander for performing a first expansion operation on the second block field to obtain first expanded data; multiple first compressors for performing multiple first compression operations based on the multiple intermediate state values and the first expansion operation results to obtain multiple first compressed data; multiple second expanders for performing multiple second expansion operations based on the multiple first compressed data to obtain multiple second expanded data; multiple second compressors for performing multiple second compression operations based on the multiple second expanded data to obtain the workload proof.
在一些實施例中,所述計算模組設置於晶片的頂層區。In some embodiments, the computing module is disposed in the top layer area of the chip.
在一些實施例中,還包括電平轉換器,用於將多個所述中間狀態值由高電壓區轉換至低電壓區。In some embodiments, a level converter is further included to convert the plurality of intermediate state values from a high voltage region to a low voltage region.
在一些實施例中,所述雜湊運算為SHA-256運算。In some embodiments, the hashing operation is a SHA-256 operation.
本申請實施例採用的上述至少一個技術方案能夠達到以下有益效果:本實施例中,通過增加版本欄位的修改,增加了雜湊運算的計算空間,減少接收任務的頻次,達到提升計算效率的目的。並且本申請,無需額外的儲存空間儲存雜湊碰撞運算產生的雜湊梅克爾(Merkle)根後4位元組相同的區塊頭,也無需額外的儲存空間儲存計算出的中間狀態值,基於多個修改版本欄位生成的多個中間狀態值流水式的輸入下一級用於工作量證明計算,實現了減少計算硬體面積,達到降低功耗的目的。At least one of the above technical solutions adopted in the embodiment of the present application can achieve the following beneficial effects: In the present embodiment, by adding the modification of the version field, the computing space of the hash operation is increased, the frequency of receiving tasks is reduced, and the purpose of improving computing efficiency is achieved. In addition, the present application does not require additional storage space to store the block header with the same 4 bytes after the hash Merkle root generated by the hash collision operation, nor does it require additional storage space to store the calculated intermediate state value. The multiple intermediate state values generated based on multiple modified version fields are pipelined and input to the next level for workload proof calculation, thereby reducing the computing hardware area and achieving the purpose of reducing power consumption.
應當理解,上述說明僅是本發明技術方案的概述,以便能夠更清楚地瞭解本發明的技術手段,從而可依照說明書的內容予以實施。為了讓本發明的上述和其它目的、特徵和優點能夠更明顯易懂,以下特舉例說明本發明的具體實施方式。It should be understood that the above description is only an overview of the technical solution of the present invention, so that the technical means of the present invention can be more clearly understood and implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following examples are given to illustrate the specific implementation of the present invention.
下面將參照附圖更詳細地描述本公開的示例性實施例。雖然附圖中顯示了本公開的示例性實施例,然而應當理解,可以以各種形式實現本公開而不應被這裡闡述的實施例所限制。相反,提供這些實施例是為了能夠更透徹地理解本公開,並且能夠將本公開的範圍完整的傳達給本領域的技術人員。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
在本申請實施例的描述中,應理解,諸如“包括”或“具有”等術語旨在指示本說明書中所公開的特徵、數位、步驟、行為、部件、部分或其組合的存在,並且不旨在排除一個或多個其他特徵、數位、步驟、行為、部件、部分或其組合存在的可能性。In the description of the embodiments of the present application, it should be understood that terms such as "including" or "having" are intended to indicate the existence of features, numbers, steps, behaviors, components, parts or combinations thereof disclosed in this specification, and are not intended to exclude the possibility of the existence of one or more other features, numbers, steps, behaviors, components, parts or combinations thereof.
除非另有說明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”僅僅是一種描述關聯物件的關聯關係,表示可以存在三種關係,例如,A和/或B,可以表示:單獨存在A,同時存在A和B,單獨存在B這三種情況。Unless otherwise specified, “/” means or. For example, A/B can mean A or B. The “and/or” in this article is only a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
術語“第一”、“第二”等僅用於描述目的,而不能理解為指示或暗示相對重要性或者隱含指明所指示的技術特徵的數量。由此,限定有“第一”、“第二”等的特徵可以明示或者隱含地包括一個或者更多個該特徵。在本申請實施例的描述中,除非另有說明,“多個”的含義是兩個或兩個以上。The terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "plurality" is two or more.
本申請中的所有代碼都是示例性的,本領域技術人員根據所使用的程式設計語言,具體的需求和個人習慣等因素會在不脫離本申請的思想的條件下想到各種變型。All codes in this application are exemplary, and those skilled in the art may think of various modifications based on the programming language used, specific needs, personal habits, etc. without departing from the concept of this application.
另外還需要說明的是,在不衝突的情況下,本發明中的實施例及實施例中的特徵可以相互組合。下面將參考附圖並結合實施例來詳細說明本發明。It should also be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
參考圖1,從區塊頭結構能看出,雜湊梅克爾(Merkle)根被分割在兩個部分中,前面28位元組的Head(雜湊梅克爾((Merkle))根的第一區),後面4位元組的Tail(雜湊梅克爾((Merkle))根的第二區),中間狀態值的計算僅依賴於於區塊頭的前512bit,傳統的方式是通過雜湊碰撞找到Head部分改變且Tail部分不變的多個梅克爾(Merkle)根的候選值,然後基於此計算出Mid進行後續計算,如此可以增加SHA-256的計算空間,但是改變梅克爾(Merkle)根的Head部分會帶來計算量激增。因此,如果能改變第一部分中的其他域段來遍歷其中的值,可能會有更多的計算空間可以利用。Referring to Figure 1, it can be seen from the block header structure that the hash Merkle root is divided into two parts, the first 28 bytes of the Head (the first area of the hash Merkle root), and the last 4 bytes of the Tail (the second area of the hash Merkle root). The calculation of the intermediate state value depends only on the first 512 bits of the block header. The traditional method is to find multiple Merkle root candidate values with the Head part changed and the Tail part unchanged through hash collision, and then calculate the Mid based on this for subsequent calculations. This can increase the computing space of SHA-256, but changing the Head part of the Merkle root will bring a surge in the amount of calculation. Therefore, if other fields in the first part can be changed to traverse the values therein, more computing space may be available.
區塊頭的第一部分包括版本欄位、前區塊雜湊和梅克爾(Merkle)根的前28位元組,其中,4位元組的版本欄位共32bit,其中前3bit是固定的,剩餘位用於技術升級或者軟分叉時的投票使用,但實際應用過程中,不會同時有這麼多個軟分叉投票。因此可以通過修改節點軟體的方式來忽略其中一些位元,那麼這些位就可以用於一般使用,而不會在軟分叉時候發出錯誤警告。參考BIP320協議,其規定可以佔用版本欄位的13-28位空間,即 0x1fffe000。如可以使用這16bit空間,那麼就多了 次電腦會,當接收到同一個任務後,就可以進行 輪運算,且每一輪運算中可進行 次遍歷亂數的運算,即共 次運算。基於此,本申請將區塊頭的第一部分的版本欄位作為修改項進行使用。 The first part of the block header includes the version field, the previous block hash, and the first 28 bytes of the Merkle root. The 4-byte version field is 32 bits in total, of which the first 3 bits are fixed, and the remaining bits are used for voting during technical upgrades or soft forks. However, in actual applications, there will not be so many soft fork votes at the same time. Therefore, some of these bits can be ignored by modifying the node software, so that these bits can be used for general use without issuing error warnings during soft forks. Refer to the BIP320 protocol, which stipulates that the 13-28-bit space of the version field can be occupied, that is, 0x1fffe000. If this 16-bit space can be used, then there will be more The next computer will receive the same task and then proceed Rounds of calculations, and each round of calculations can be performed The operation of traversing the random number, that is, Based on this, this application uses the version field in the first part of the block header as a modification item.
圖2為根據本申請一實施例的計算任務處理方法的流程示意圖。如圖2所示,本實施例提供的方法可以包括以下步驟:FIG2 is a flow chart of a computing task processing method according to an embodiment of the present application. As shown in FIG2, the method provided by the present embodiment may include the following steps:
步驟210、接收計算任務,計算任務包括原始版本欄位;隨後,執行以下處理步驟:Step 210: receiving a calculation task, the calculation task including an original version field; then, executing the following processing steps:
步驟220、對原始版本欄位修改得到多個修改版本欄位;Step 220: modify the original version field to obtain multiple modified version fields;
步驟230、基於多個修改版本欄位,對計算任務執行雜湊運算生成多個中間狀態值,多個中間狀態值用於工作量證明計算。Step 230: Based on the multiple modified version fields, perform a hash operation on the computing task to generate multiple intermediate state values, and the multiple intermediate state values are used for workload proof calculation.
上述方案中,計算裝置的前端接收到計算任務後,可以利用軟體對原始版本欄位修改配置得到多個修改版本欄位,計算裝置的後端即運算晶片,可以通過APB匯流排接收多個修改版本欄位,計算任務還包括消息欄位,多個修改版本欄位和消息欄位進行組合得到多個第一區塊,運算晶片對其執行雜湊運算得到中間狀態值,中間狀態值輸出至下一級進行後續的雜湊運算,最終得出工作量證明。In the above scheme, after the front end of the computing device receives the computing task, it can use software to modify the configuration of the original version field to obtain multiple modified version fields. The back end of the computing device, namely the computing chip, can receive multiple modified version fields through the APB bus. The computing task also includes a message field. Multiple modified version fields and message fields are combined to obtain multiple first blocks. The computing chip performs a hash operation on them to obtain an intermediate state value. The intermediate state value is output to the next level for subsequent hash operations, and finally the proof of work is obtained.
其中,雜湊運算包括前置雜湊運算,前置雜湊運算包括一次擴展操作和一次壓縮操作,擴展操作用到的資料為區塊頭的前512bit欄位,包括修改版本欄位和消息欄位,消息欄位包括前區塊雜湊和雜湊梅克爾(Merkle)根的第一區。壓縮操作用到的資料為256bit的常數欄位和擴展操作的輸出,最終輸出中間狀態值。The hash operation includes a pre-hash operation, which includes an expansion operation and a compression operation. The data used in the expansion operation is the first 512-bit field of the block header, including the modified version field and the message field. The message field includes the first area of the pre-block hash and the hash Merkle root. The data used in the compression operation is the 256-bit constant field and the output of the expansion operation, and the final output is the intermediate state value.
參考圖3,中間狀態值的生成可以在運算晶片的頂層區,頂層區也可以理解為運算晶片的主控制區,頂層區工作在高電壓區,可以下達運算指令至運算區。運算晶片還包括多個運算區,每個運算區可以理解為運算晶片的運算核。運算核利用中間狀態值和區塊頭的第二部分,即後4位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第二區),4位元組的時間戳記,4位元組的難度目標值,4位元組的亂數,完成工作量證明計算。頂層區工作在高電壓區,可以下達運算指令至運算區,並接收運算區的資料;運算區工作在低電壓區,運算區高頻工作用於計算亂數形成的 次的運算空間。 Referring to Figure 3, the generation of the intermediate state value can be done in the top layer area of the computing chip. The top layer area can also be understood as the main control area of the computing chip. The top layer area works in the high voltage area and can issue computing instructions to the computing area. The computing chip also includes multiple computing areas, each of which can be understood as the computing core of the computing chip. The computing core uses the intermediate state value and the second part of the block header, that is, the last 4 bytes of the hashed Merkle root field (the second area of the hashed Merkle root), a 4-byte timestamp, a 4-byte difficulty target value, and a 4-byte random number to complete the proof of work calculation. The top layer works in the high voltage region and can issue operation instructions to the operation region and receive data from the operation region. The operation region works in the low voltage region and works at a high frequency to calculate the random number generated. times the computational space.
本實施例中,通過增加版本欄位的修改,增加了雜湊運算的計算空間,減少接收任務的頻次,達到提升計算效率的目的。並且本申請,無需額外的儲存空間儲存雜湊碰撞運算產生的雜湊梅克爾(Merkle)根後4位元組相同的區塊頭,也無需額外的儲存空間儲存計算出的中間狀態值,基於多個修改版本欄位生成的多個中間狀態值流水式的輸入下一級用於工作量證明計算,實現了減少計算硬體面積,達到降低功耗的目的。In this embodiment, by adding the modification of the version field, the computing space of the hash operation is increased, the frequency of receiving tasks is reduced, and the purpose of improving computing efficiency is achieved. In addition, this application does not require additional storage space to store the block header with the same 4 bytes after the hash Merkle root generated by the hash collision operation, nor does it require additional storage space to store the calculated intermediate state value. Based on multiple modified version fields, multiple intermediate state values are pipelined and input to the next level for workload proof calculation, thereby reducing the computing hardware area and achieving the purpose of reducing power consumption.
在一些實施例中,反覆運算執行處理步驟,第n+1輪處理步驟中的修改版本欄位和第1輪至n輪處理步驟中的修改版本欄位不一致。In some embodiments, the processing steps are repeatedly performed, and the modified version field in the (n+1)th round of processing steps is inconsistent with the modified version field in the 1st to nth rounds of processing steps.
上述方案中,接收一個計算任務後,原始版本欄位的修改空間為16bit,可以進行 輪運算,每生成一輪多個修改版本欄位,對應生成多個中間狀態值,再進行下一輪原始版本欄位的修改,得到新的修改版本欄位。 In the above scheme, after receiving a calculation task, the modification space of the original version field is 16 bits, which can be In each round of operation, multiple modified version fields are generated, and multiple intermediate state values are generated accordingly. Then, the next round of original version fields are modified to obtain new modified version fields.
在一些實施例中,還包括:接收另一個計算任務,基於另一個計算任務的原始版本欄位,執行處理步驟。In some embodiments, the method further includes: receiving another computing task, and executing a processing step based on the original version field of the other computing task.
上述方案中,在計算任務的計算空間即 次運算計算完成之後,或者計算任務生成目標結果之後,或者上輪計算任務被停止之後,計算裝置的前端接收新的計算任務,然後基於新的計算任務的原始版本欄位修改得到多個修改版本欄位,再基於修改版本欄位生成中間狀態值,最後基於中間狀態值進行工作量證明計算。 In the above scheme, the computational space of the computational task is After the calculation is completed, or after the calculation task generates the target result, or after the previous round of calculation tasks is stopped, the front end of the computing device receives a new calculation task, and then modifies the original version field of the new calculation task to obtain multiple modified version fields, and then generates intermediate status values based on the modified version fields, and finally performs proof of work calculation based on the intermediate status values.
在一些實施例中,原始版本欄位包括固定欄位、軟分叉投票欄位及剩餘欄位,剩餘欄位用於對原始版本欄位進行修改得到多個修改版本欄位。In some embodiments, the original version field includes a fixed field, a soft fork voting field, and a remaining field, and the remaining field is used to modify the original version field to obtain multiple modified version fields.
上述方案中,4位元組的版本欄位共32bit,其中前3bit是固定的即固定欄位,剩餘位用於技術升級或者軟分叉時的投票使用即軟分叉投票欄位,但實際應用過程中,不會同時有這麼多個軟分叉投票。因此可以通過修改節點軟體的方式來忽略其中一些位元,那麼這些位即剩餘欄位就可以用於一般使用,而不會在軟分叉時候發出錯誤警告。參考BIP320協議,其規定可以佔用版本欄位的13-28位空間,即 0x1fffe000。In the above scheme, the 4-byte version field has a total of 32 bits, of which the first 3 bits are fixed, i.e., fixed fields, and the remaining bits are used for voting during technology upgrades or soft forks, i.e., soft fork voting fields. However, in actual applications, there will not be so many soft fork votes at the same time. Therefore, some of these bits can be ignored by modifying the node software, so that these bits, i.e., the remaining fields, can be used for general use without issuing error warnings during soft forks. Referring to the BIP320 protocol, it is stipulated that the 13-28 bits of the version field can be occupied, i.e., 0x1fffe000.
在一些實施例中,對剩餘欄位的比特位元進行隨機或固定順序修改,以對原始版本欄位進行修改得到多個修改版本欄位。In some embodiments, the bits of the remaining fields are modified in a random or fixed order to modify the original version field to obtain multiple modified version fields.
上述方案中,剩餘欄位的比特位佔用版本欄位的13-28位空間,可以對每個比特位元隨機或固定順序進行0或1的修改,從而對原始版本欄位進行修改得到多個修改版本欄位。In the above scheme, the bits of the remaining field occupy 13-28 bits of the version field, and each bit can be modified to 0 or 1 in a random or fixed order, thereby modifying the original version field to obtain multiple modified version fields.
在一些實施例中,原始版本欄位為32bit,剩餘欄位為16bit。In some embodiments, the original version field is 32 bits and the remaining fields are 16 bits.
上述方案中,原始版本欄位為區塊頭的前4節,即32bit,其中剩餘欄位的比特位佔用版本欄位的13-28位空間,可以進行 次修改。 In the above scheme, the original version field is the first 4 sections of the block header, that is, 32 bits, and the bits of the remaining fields occupy 13-28 bits of the version field. Modifications.
在一些實施例中,計算任務還包括消息欄位,消息欄位包括前區塊雜湊和雜湊梅克爾(Merkle)根的第一區。In some embodiments, the computation task further includes a message field, the message field including the first region of the previous block hash and the hash Merkle root.
上述方案中,計算任務為區塊頭,區塊頭包括第一部分,第一部分包括:4位元組的版本欄位;32位元組的前區塊雜湊以及前28位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第一區),修改版本欄位與消息欄位組合構成第一區塊欄位,第一區塊欄位用於執行前置雜湊運算得到中間狀態值。In the above scheme, the calculation task is the block header, which includes the first part, which includes: a 4-byte version field; a 32-byte pre-block hash and the first 28-byte hash Merkle root field (the first zone of the hash Merkle root), and the modified version field and the message field are combined to form the first block field. The first block field is used to perform the pre-hash operation to obtain the intermediate state value.
在一些實施例中,還包括:In some embodiments, it also includes:
基於中間狀態值,獲得多個子中間狀態值;Based on the intermediate state value, multiple sub-intermediate state values are obtained;
將多個子中間狀態值構成的串列資料流程輸出用於工作量證明計算。Output the serial data flow consisting of multiple sub-intermediate state values for proof-of-work calculation.
上述方案中,其中前置雜湊運算發生在高電壓區,後續的雜湊運算發生在低電壓區,生成的中間狀態值的資料位元寬可以是256bit,為了降低高電壓區到低電壓區的走線位元寬要求,可以採用位寬轉換操作。In the above scheme, the pre-hashing operation occurs in the high voltage region, and the subsequent hashing operation occurs in the low voltage region. The data bit width of the generated intermediate state value can be 256 bits. In order to reduce the wiring bit width requirement from the high voltage region to the low voltage region, a bit width conversion operation can be used.
在一些實施例中,基於中間狀態值,對其拆分獲得多個子中間狀態值。In some embodiments, based on the intermediate state value, it is split into multiple sub-intermediate state values.
上述方案中,基於中間狀態值從最低位到最高位對其進行均勻拆分,最終得到多個長度一致的子中間狀態值。In the above scheme, the intermediate state value is evenly split from the lowest bit to the highest bit, and finally a plurality of sub-intermediate state values of the same length are obtained.
在一些實施例中,中間狀態值為256bit,子中間狀態值為64bit。In some embodiments, the intermediate state value is 256 bits and the sub-intermediate state value is 64 bits.
上述方案中,可以將輸出的256bit的每個中間狀態值切分為64bit的子中間狀態值,分別定義為{mid<n>_3,mid<n>_2,mid<n>_1,mid<n>_0}(n=0,1,2,3),其中,n為中間狀態值的標識,每個中間狀態值經過4個迴圈按照64bit資料位元寬進行序列傳輸,如果有4個中間狀態值則根據中間狀態值的標識的順序組成類似如圖4的順序的串列資料流程傳遞給下一級進行使用。In the above scheme, each intermediate state value of the output 256 bits can be divided into 64-bit sub-intermediate state values, which are defined as {mid<n>_3, mid<n>_2, mid<n>_1, mid<n>_0} (n=0,1,2,3), where n is the identifier of the intermediate state value. Each intermediate state value is transmitted in sequence according to the 64-bit data bit width through 4 loops. If there are 4 intermediate state values, they are transmitted to the next level for use in a serial data flow similar to the sequence shown in Figure 4 according to the sequence of the identifiers of the intermediate state values.
在一些實施例中,計算任務還包括消息欄位,基於多個修改版本欄位,對計算任務執行雜湊運算生成多個中間狀態值,包括:In some embodiments, the computing task further includes a message field, and based on the multiple modified version fields, a hash operation is performed on the computing task to generate multiple intermediate state values, including:
將多個修改版本欄位分別和消息欄位組合得到多個第一區塊欄位,基於多個第一區塊欄位,執行雜湊運算生成多個中間狀態值。The plurality of modified version fields are respectively combined with the message field to obtain a plurality of first block fields, and a hash operation is performed based on the plurality of first block fields to generate a plurality of intermediate state values.
上述方案中,第一區塊欄位為區塊頭的第一部分,第一部分包括:4位元組的版本欄位;32位元組的前區塊雜湊以及前28位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第一區),第一區塊欄位為512bit。每次接收多個修改版本欄位,都需要將每個修改版本欄位對應和消息欄位組合構成第一區塊欄位,隨後進行前置雜湊運算生成中間狀態值。In the above scheme, the first block field is the first part of the block header, which includes: a 4-byte version field; a 32-byte pre-block hash and a 28-byte hash Merkle root field (the first area of the hash Merkle root), and the first block field is 512 bits. Each time multiple modified version fields are received, each modified version field needs to be mapped to the message field combination to form the first block field, and then a pre-hashed operation is performed to generate an intermediate state value.
在一些實施例中,將每個第一區塊欄位拆分為多個子第一區塊欄位,基於每個第一區塊欄位的多個子第一區塊欄位構成的串列資料流程,執行雜湊運算生成中間狀態值。In some embodiments, each first block field is split into a plurality of sub-first block fields, and a hash operation is performed based on a serial data flow consisting of the plurality of sub-first block fields of each first block field to generate an intermediate state value.
上述方案中,第一區塊欄位可以為512bit,為了滿足走線位寬要求,同時也便於運算晶片的頂層區執行前置雜湊運算,將該資料拆分成32bit的細細微性的子區塊欄位,以用於SHA-256流水的計算使用。經過64輪擴展和壓縮運算,最終生成中間狀態值。In the above scheme, the first block field can be 512 bits. In order to meet the routing width requirements and facilitate the top layer of the computing chip to perform pre-hashing operations, the data is split into 32-bit fine sub-block fields for SHA-256 pipeline calculations. After 64 rounds of expansion and compression operations, the intermediate state value is finally generated.
在一些實施例中,基於多個修改版本欄位的順序值,將每個修改版本欄位和消息欄位組合得到對應的第一區塊欄位。In some embodiments, based on the sequence values of multiple modified version fields, each modified version field and the message field are combined to obtain the corresponding first block field.
上述方案中,多個修改版本欄位在生成時具有標識即順序值,按照順序值將每個修改版本欄位對應和消息欄位組合構成第一區塊欄位,隨後進行前置雜湊運算生成中間狀態值。In the above scheme, multiple modified version fields have an identifier, i.e., a sequence value, when generated. Each modified version field is combined with the message field according to the sequence value to form the first block field, and then a pre-hashed operation is performed to generate an intermediate state value.
在一些實施例中,輸出與順序值對應的脈衝電平,回應於脈衝電平,將與順序值對應的修改版本欄位和消息欄位鎖存為第一區塊欄位。In some embodiments, a pulse level corresponding to a sequence value is output, and in response to the pulse level, a modified version field and a message field corresponding to the sequence value are locked as first block fields.
上述方案中,輸出與順序值對應的脈衝電平,然後鎖存相應的修改版本欄位和消息欄位構成第一區塊欄位,用於執行前置雜湊運算。In the above scheme, the pulse level corresponding to the sequence value is output, and then the corresponding modified version field and message field are latched to form the first block field for performing the prefix hash operation.
在一些實施例中,在第m個第一區塊欄位執行雜湊運算生成中間狀態值之後,將第m+1個修改版本欄位和消息欄位組合得到第m+1個第一區塊欄位。In some embodiments, after performing a hash operation on the mth first block field to generate an intermediate state value, the m+1th modified version field and the message field are combined to obtain the m+1th first block field.
上述方案中,為了節省運算晶片的硬體電路面積,只設置一個前置雜湊運算單元執行單次擴展操作和壓縮操作,所以每次只能進行單個第一區塊欄位的運算,在生成單個中間狀態值之後,開始鎖存下一個第一區塊欄位執行下一次前置雜湊運算。依次生成的多個中間狀態值,形成串列的流水式資料可以無需儲存直接給到下一級進行工作量證明計算,實現減少計算硬體面積,達到降低功耗的目的。In the above scheme, in order to save the hardware circuit area of the computing chip, only one pre-hashing operation unit is set to perform a single expansion operation and compression operation, so only a single first block field operation can be performed each time. After generating a single intermediate state value, the next first block field is locked to perform the next pre-hashing operation. The multiple intermediate state values generated in sequence form a serial pipeline data that can be directly given to the next level for workload proof calculation without storage, thereby reducing the computing hardware area and achieving the purpose of reducing power consumption.
在一些實施例中,還包括:In some embodiments, it also includes:
基於多個中間狀態值和計算任務的第二區塊欄位執行雜湊運算,得到工作量證明;第二區塊欄位包括雜湊梅克爾(Merkle)根的第二區、時間戳記、目標值以及亂數。A hash operation is performed based on multiple intermediate state values and the second block field of the computational task to obtain a proof of work; the second block field includes the second block of the hash Merkle root, a timestamp, a target value, and a random number.
上述方案中,區塊頭的第二部分即第二區塊欄位包括:後4位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第二區);4位元組的時間戳記;4位元組的難度目標值;4位元組的亂數。工作量證明的最終生成發生在運算晶片的多個運算區,每個運算區要執行兩次雜湊運算,包括第一雜湊運算和第二雜湊運算。In the above scheme, the second part of the block header, i.e., the second block field, includes: the last 4 bytes of the hash Merkle root field (the second area of the hash Merkle root); a 4-byte timestamp; a 4-byte difficulty target value; and a 4-byte random number. The final generation of the proof of work occurs in multiple computing areas of the computing chip, and each computing area performs two hash operations, including the first hash operation and the second hash operation.
在一些實施例中,參考圖5,基於多個中間狀態值和計算任務的第二區塊欄位執行雜湊運算,包括:In some embodiments, referring to FIG. 5 , performing a hash operation based on a plurality of intermediate state values and a second block field of a computing task includes:
步驟510、對第二區塊欄位執行第一擴展操作,得到第一擴展資料;Step 510: Perform a first expansion operation on the second block field to obtain first expansion data;
步驟520、基於多個中間狀態值和第一擴展操作結果和第二區塊欄位執行多個第一壓縮操作,得到多個第一壓縮資料;Step 520: performing a plurality of first compression operations based on the plurality of intermediate state values, the first expansion operation result and the second block field to obtain a plurality of first compressed data;
步驟530、基於多個第一壓縮資料執行多個第二擴展操作,得到多個第二擴展資料;Step 530: performing a plurality of second expansion operations based on the plurality of first compressed data to obtain a plurality of second expanded data;
步驟540、基於多個第二擴展資料執行多個第二壓縮操作,得到工作量證明。Step 540: Perform multiple second compression operations based on the multiple second extended data to obtain a workload proof.
上述方案中,第一雜湊運算包括第一擴展操作和多個第一壓縮操作,第二雜湊運算包括多個第二擴展操作和多個第二壓縮操作。In the above scheme, the first hash operation includes a first expansion operation and multiple first compression operations, and the second hash operation includes multiple second expansion operations and multiple second compression operations.
在執行第一雜湊運算時,單個運算區即運算核包括單個第一擴展器和多個第一壓縮器。第一擴展器利用第二區塊欄位執行第一擴展操作得到第一擴展資料,多個第一壓縮器可以共用單個擴展器的第一擴展資料,多個第一壓縮器對應多個中間狀態值和第二區塊欄位執行多個第一壓縮操作得到多個第一壓縮資料,因為第一擴展器不必佈置多個,不必與多個第一壓縮器一一對應,所以節省了運算核的版圖面積,進一步的降低功耗。When executing the first hash operation, a single operation area, i.e., an operation core, includes a single first expander and multiple first compressors. The first expander uses the second block field to perform the first expansion operation to obtain the first expansion data, and multiple first compressors can share the first expansion data of the single expander. Multiple first compressors correspond to multiple intermediate state values and the second block field to perform multiple first compression operations to obtain multiple first compressed data. Because multiple first expanders do not need to be arranged and do not need to correspond one-to-one with multiple first compressors, the layout area of the operation core is saved, and power consumption is further reduced.
在執行第二雜湊運算時,單個運算區即運算核包括多個第二擴展器和多個第二壓縮器,多個第二擴展器基於多個第一壓縮資料執行多個第二擴展操作,得到多個第二擴展資料,多個第二壓縮器基於多個第二擴展資料和256bit的常數欄位執行多個第二壓縮操作,得到工作量證明。When executing the second hash operation, a single operation area, i.e., an operation core, includes multiple second expanders and multiple second compressors. The multiple second expanders perform multiple second expansion operations based on the multiple first compressed data to obtain multiple second expanded data. The multiple second compressors perform multiple second compression operations based on the multiple second expanded data and a 256-bit constant field to obtain proof of work.
每次完成一輪第一雜湊運算和第二雜湊運算時,下一輪的雜湊運算中,第二區塊欄位中的亂數要在 次的運算空間進行切換,以此遍歷區塊頭的運算空間完成工作量證明計算。 Each time a round of the first hash operation and the second hash operation is completed, in the next round of hash operation, the random number in the second block field must be The computation space of the block header is switched to another one to complete the proof-of-work calculation.
在一些實施例中,中間狀態值在晶片的頂層區生成,中間狀態值在高電壓區生成,生成多個中間狀態值之後,將多個中間狀態值由高電壓區轉換至低電壓區,用於工作量證明計算。In some embodiments, the intermediate state values are generated in the top layer area of the chip, and the intermediate state values are generated in the high voltage area. After generating multiple intermediate state values, the multiple intermediate state values are converted from the high voltage area to the low voltage area for workload proof calculation.
上述方案中,中間狀態值的生成可以在運算晶片的頂層區,頂層區也可以理解為運算晶片的主控制區,頂層區工作在高電壓區,可以下達運算指令至運算區。運算晶片還包括多個運算區,每個運算區可以理解為運算晶片的運算核。頂層區工作在高電壓區,可以下達運算指令至運算區,並接收運算區的資料;運算區工作在低電壓區,運算區高頻工作用於計算亂數形成的 次的運算空間。頂層區執行前置雜湊運算產生中間狀態值至多個運算區,運算區需要在 次的運算空間內遍歷執行第一雜湊運算和第二雜湊運算,所以運算區工作在低電壓高頻環境以此加快計算效率,在運算區遍歷的時間內頂層區不必一直運算生成中間狀態值,而是等運算區遍歷之後才在版本欄位 次可修改範圍內生成下一輪中間狀態值,所以頂層區工作在高電壓低頻環境以此完成前置雜湊運算。將中間狀態值由高電壓區轉換至低電壓區,有利於運算區進行高速計算,提升計算效率。 In the above scheme, the generation of the intermediate state value can be done in the top layer area of the computing chip. The top layer area can also be understood as the main control area of the computing chip. The top layer area works in the high voltage area and can issue computing instructions to the computing area. The computing chip also includes multiple computing areas, each of which can be understood as the computing core of the computing chip. The top layer area works in the high voltage area and can issue computing instructions to the computing area and receive data from the computing area; the computing area works in the low voltage area and the computing area works at a high frequency to calculate the random number formation. The top layer performs pre-hashing operations to generate intermediate state values for multiple operation regions. The first and second hash operations are performed in the computational space of the operation area. Therefore, the computational area works in a low voltage and high frequency environment to speed up the computational efficiency. During the computational area traversal, the top layer area does not have to keep calculating and generating intermediate state values. Instead, it waits until the computational area is traversed before setting the intermediate state values in the version field. The next round of intermediate state values is generated within the modifiable range, so the top layer works in a high voltage and low frequency environment to complete the pre-hashing operation. Converting the intermediate state value from the high voltage area to the low voltage area is conducive to high-speed calculation in the calculation area and improves calculation efficiency.
在一些實施例中,雜湊運算為SHA-256運算。In some embodiments, the hash operation is a SHA-256 operation.
上述方案中,雜湊運算為SHA運算,具體可以為SHA-256運算。本方案還可以適用於SHA-1、SHA-2和RIPEMD家族,其都採用了與SHA-256類似的方案,因此如果能增加可變的域將減少接受輸入的任務的次數,也可以提升計算效率。In the above scheme, the hash operation is a SHA operation, specifically a SHA-256 operation. This scheme can also be applied to the SHA-1, SHA-2 and RIPEMD families, which all use schemes similar to SHA-256. Therefore, if the variable domain can be increased, the number of tasks to accept inputs will be reduced, and the computational efficiency can also be improved.
基於相同的技術構思,本發明實施例還提供計算任務處理裝置,用於執行上述任一實施例所提供的計算任務處理方法。圖6為本發明實施例提供的一種計算任務處理裝置結構示意圖。Based on the same technical concept, the embodiment of the present invention also provides a computing task processing device for executing the computing task processing method provided by any of the above embodiments. FIG6 is a schematic diagram of the structure of a computing task processing device provided by the embodiment of the present invention.
該計算任務處理裝置包括:The computing task processing device comprises:
接收模組610,用於接收計算任務,計算任務包括原始版本欄位;The receiving module 610 is used to receive a computing task, wherein the computing task includes an original version field;
修改模組620,對原始版本欄位修改得到多個修改版本欄位;A modification module 620 modifies the original version field to obtain a plurality of modified version fields;
計算模組630,用於基於多個修改版本欄位,對計算任務執行雜湊運算生成多個中間狀態值,多個中間狀態值用於工作量證明計算。The computing module 630 is used to perform hash operations on the computing tasks based on multiple modified version fields to generate multiple intermediate state values, and the multiple intermediate state values are used for workload proof calculation.
上述方案中,接收模組610和修改模組620可以設置於計算裝置的前端,可以利用軟體對原始版本欄位修改配置得到多個修改版本欄位,計算模組630可以設置於計算裝置的後端,具體可以為運算晶片的頂層區,頂層區也可以理解為運算晶片的主控制區,計算模組630用於完成前置雜湊運算生成中間狀態值,生成的中間狀態值流水式傳輸至運算晶片的多個運算區,用於工作量證明計算。當然,接收模組610和修改模組620也可以設置於運算晶片內,計算模組630也可以一併設置於計算裝置的前端,對此本申請不做具體限制。接收模組610和修改模組620可以設置於計算裝置的前端,計算模組630可以設置於計算裝置的後端,只是作為其中一優選實施例。In the above scheme, the receiving module 610 and the modifying module 620 can be set at the front end of the computing device, and the original version field can be modified and configured using software to obtain multiple modified version fields. The computing module 630 can be set at the back end of the computing device, specifically the top layer area of the computing chip, and the top layer area can also be understood as the main control area of the computing chip. The computing module 630 is used to complete the pre-hashing operation to generate the intermediate state value, and the generated intermediate state value is pipelined to multiple computing areas of the computing chip for workload proof calculation. Of course, the receiving module 610 and the modifying module 620 can also be set in the computing chip, and the computing module 630 can also be set at the front end of the computing device, and this application does not make specific restrictions on this. The receiving module 610 and the modifying module 620 can be arranged at the front end of the computing device, and the computing module 630 can be arranged at the back end of the computing device, which is just one of the preferred embodiments.
本實施例中,通過增加版本欄位的修改,增加了雜湊運算的計算空間,減少接收任務的頻次,達到提升計算效率的目的。並且本申請,無需額外的儲存空間儲存雜湊碰撞運算產生的雜湊梅克爾(Merkle)根後4位元組相同的區塊頭,也無需額外的儲存空間儲存計算出的中間狀態值,基於多個修改版本欄位生成的多個中間狀態值流水式的輸入下一級用於工作量證明計算,實現了減少計算硬體面積,達到降低功耗的目的。In this embodiment, by adding the modification of the version field, the computing space of the hash operation is increased, the frequency of receiving tasks is reduced, and the purpose of improving computing efficiency is achieved. In addition, this application does not require additional storage space to store the block header with the same 4 bytes after the hash Merkle root generated by the hash collision operation, nor does it require additional storage space to store the calculated intermediate state value. Based on multiple modified version fields, multiple intermediate state values are pipelined and input to the next level for workload proof calculation, thereby reducing the computing hardware area and achieving the purpose of reducing power consumption.
在一些實施例中,修改模組630還用於反覆運算修改多個修改版本欄位。In some embodiments, the modification module 630 is further configured to repeatedly modify multiple revision fields.
上述方案中,在一個運算晶片內,運算晶片的頂層區每一輪接收多個修改版本欄位,對應生成多個中間狀態值,生成的中間狀態值流水式傳輸至運算晶片的全部運算區或部分運算區,用於工作量證明計算,運算區遍歷 次第二區塊欄位中的亂數。隨後,運算晶片的頂層區接收下一輪的多個修改版本欄位,如此迴圈,不斷的生成中間狀態值傳輸至運算晶片的運算區,直至計算任務完成或停止。 In the above scheme, in a computing chip, the top layer area of the computing chip receives multiple modified version fields in each round, and generates multiple intermediate state values accordingly. The generated intermediate state values are pipelined to all or part of the computing areas of the computing chip for workload proof calculation. The computing areas are traversed. Then, the top layer of the computing chip receives the next round of multiple modified version fields, and the cycle continues, continuously generating intermediate state values and transmitting them to the computing area of the computing chip until the computing task is completed or stopped.
在一些實施例中,接收模組620還用於接收新的計算任務,修改模組620還用於對新的計算任務原始版本欄位修改得到多個修改版本欄位。In some embodiments, the receiving module 620 is further used to receive a new computing task, and the modifying module 620 is further used to modify the original version fields of the new computing task to obtain multiple modified version fields.
上述方案中,在計算任務的計算空間即 次運算計算完成之後,或者計算任務生成目標結果之後,或者上輪計算任務被停止之後,接收模組610接收新的計算任務,修改模組620基於新的計算任務的原始版本欄位修改得到多個修改版本欄位,計算模組630再基於修改版本欄位生成中間狀態值,最後基於中間狀態值進行工作量證明計算。 In the above scheme, the computational space of the computational task is After the calculation is completed, or after the calculation task generates the target result, or after the previous round of calculation tasks is stopped, the receiving module 610 receives a new calculation task, the modifying module 620 modifies the original version fields of the new calculation task to obtain multiple modified version fields, and the calculation module 630 generates an intermediate state value based on the modified version fields, and finally performs proof of work calculation based on the intermediate state values.
在一些實施例中,原始版本欄位包括固定欄位、軟分叉投票欄位及剩餘欄位,剩餘欄位用於對原始版本欄位進行修改得到多個修改版本欄位。In some embodiments, the original version field includes a fixed field, a soft fork voting field, and a remaining field, and the remaining field is used to modify the original version field to obtain multiple modified version fields.
上述方案中,4位元組的版本欄位共32bit,其中前3bit是固定的即固定欄位,剩餘位用於技術升級或者軟分叉時的投票使用即軟分叉投票欄位,但實際應用過程中,不會同時有這麼多個軟分叉投票。因此可以通過修改節點軟體的方式來忽略其中一些位元,那麼這些位即剩餘欄位就可以用於一般使用,而不會在軟分叉時候發出錯誤警告。參考BIP320協議,其規定可以佔用版本欄位的13-28位空間,即 0x1fffe000。剩餘欄位的比特位佔用版本欄位的13-28位空間,可以對每個比特位元隨機或固定順序進行0或1的修改,從而對原始版本欄位進行修改得到多個修改版本欄位。In the above scheme, the 4-byte version field has a total of 32 bits, of which the first 3 bits are fixed, i.e., fixed fields, and the remaining bits are used for voting during technology upgrades or soft forks, i.e., soft fork voting fields. However, in actual applications, there will not be so many soft fork votes at the same time. Therefore, some of these bits can be ignored by modifying the node software, so that these bits, i.e., the remaining fields, can be used for general use without issuing error warnings during soft forks. Referring to the BIP320 protocol, it is stipulated that the 13-28 bits of the version field can be occupied, i.e., 0x1fffe000. The bits of the remaining fields occupy 13-28 bits of the version field. Each bit can be modified to 0 or 1 in a random or fixed order, thereby modifying the original version field to obtain multiple modified version fields.
在一些實施例中,計算任務還包括消息欄位,消息欄位包括前區塊雜湊和雜湊梅克爾(Merkle)根的第一區。In some embodiments, the computation task further includes a message field, the message field including the first region of the previous block hash and the hash Merkle root.
上述方案中,計算任務為區塊頭,區塊頭包括第一部分,第一部分包括:4位元組的版本欄位;32位元組的前區塊雜湊以及前28位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第一區),修改版本欄位與消息欄位組合構成第一區塊欄位,第一區塊欄位用於計算模組執行前置雜湊運算得到中間狀態值。In the above scheme, the calculation task is the block header, and the block header includes the first part, which includes: a 4-byte version field; a 32-byte front block hash and the first 28-byte hash Merkle root field (the first zone of the hash Merkle root), and the modified version field and the message field are combined to form the first block field. The first block field is used by the calculation module to perform the pre-hash operation to obtain the intermediate state value.
在一些實施例中,還包括位元寬轉換模組,用於將計算模組生成的第一位寬的中間狀態值拆分為多個第二位寬的子中間狀態值;多個子中間狀態值構成的串列資料流程用於工作量證明計算。In some embodiments, a bit width conversion module is also included, which is used to split the intermediate state value of the first bit width generated by the calculation module into multiple sub-intermediate state values of the second bit width; the serial data flow composed of the multiple sub-intermediate state values is used for proof of work calculation.
上述方案中,其中前置雜湊運算發生在高電壓區,後續的雜湊運算發生在低電壓區,生成的中間狀態值的資料位元寬可以是256bit,為了降低高電壓區到低電壓區的走線位元寬要求,可以採用位寬轉換操作。利用位元寬轉換模組可以將輸出的256bit的每個中間狀態值切分為64bit的子中間狀態值,分別定義為{mid<n>_3,mid<n>_2,mid<n>_1,mid<n>_0}(n=0,1,2,3),其中,n為中間狀態值的標識,每個中間狀態值經過4個迴圈按照64bit資料位元寬進行序列傳輸,如果有4個中間狀態值則根據中間狀態值的標識的順序組成類似如圖4的順序的串列資料流程傳遞給下一級進行使用。In the above scheme, the pre-hashing operation occurs in the high voltage region, and the subsequent hashing operation occurs in the low voltage region. The data bit width of the generated intermediate state value can be 256 bits. In order to reduce the wiring bit width requirement from the high voltage region to the low voltage region, a bit width conversion operation can be used. The bit width conversion module can be used to divide each 256-bit intermediate state value of the output into 64-bit sub-intermediate state values, which are defined as {mid<n>_3, mid<n>_2, mid<n>_1, mid<n>_0} (n=0,1,2,3), where n is the identifier of the intermediate state value. Each intermediate state value is transmitted in sequence according to the 64-bit data bit width through 4 loops. If there are 4 intermediate state values, they are transmitted to the next level for use in a serial data flow similar to the sequence shown in Figure 4 according to the sequence of the intermediate state value identifiers.
在一些實施例中,計算任務還包括消息欄位,參考圖7,計算模組630包括第一鎖存器631,第一鎖存器631用於儲存單個修改版本欄位和消息欄位組合構成的第一區塊欄位,計算模組630基於多個第一區塊欄位,執行雜湊運算生成多個中間狀態值。In some embodiments, the computing task also includes a message field. Referring to FIG. 7 , the computing module 630 includes a first latch 631, and the first latch 631 is used to store a first block field composed of a single modified version field and a message field. The computing module 630 performs a hash operation based on multiple first block fields to generate multiple intermediate state values.
上述方案中,第一區塊欄位為區塊頭的第一部分,第一部分包括:4位元組的版本欄位;32位元組的前區塊雜湊以及前28位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第一區),第一區塊欄位為512bit。每次接收多個修改版本欄位,第一鎖存器631都需要將每個修改版本欄位對應和消息欄位組合構成第一區塊欄位,隨後進行前置雜湊運算生成中間狀態值。In the above scheme, the first block field is the first part of the block header, and the first part includes: a 4-byte version field; a 32-byte front block hash and a first 28-byte hash Merkle root field (the first area of the hash Merkle root), and the first block field is 512 bits. Each time multiple modified version fields are received, the first latch 631 needs to correspond each modified version field to the message field combination to form the first block field, and then perform a pre-hash operation to generate an intermediate state value.
在一些實施例中,仍參考圖7,計算模組630包括移位暫存器632,移位暫存器632用於將第一區塊欄位拆分為多個子第一區塊欄位,多個子第一區塊欄位構成的串列資料流程用於執行雜湊運算生成中間狀態值。In some embodiments, still referring to FIG. 7 , the computing module 630 includes a shift register 632, and the shift register 632 is used to split the first block field into a plurality of sub-first block fields, and the serial data flow formed by the plurality of sub-first block fields is used to perform a hash operation to generate an intermediate state value.
上述方案中,第一區塊欄位可以為512bit,為了滿足走線位寬要求,同時也便於運算晶片的頂層區執行前置雜湊運算,利用移位暫存器將該資料拆分成32bit的細細微性的子區塊欄位,以用於SHA-256流水的計算使用。經過64輪擴展和壓縮運算,最終生成中間狀態值。In the above scheme, the first block field can be 512 bits. In order to meet the routing width requirements and facilitate the top layer of the computing chip to perform pre-hashing operations, the data is split into 32-bit sub-block fields using shift registers for SHA-256 pipeline calculations. After 64 rounds of expansion and compression operations, the intermediate state value is finally generated.
在一些實施例中,仍參考圖7,計算模組630包括計數器633,計數器633用於產生計數值,使計算模組630根據計數值,基於多個修改版本欄位的順序值,將與計數值對應的修改版本欄位和消息欄位組合得到對應的第一區塊欄位。In some embodiments, still referring to FIG. 7 , the computing module 630 includes a counter 633, which is used to generate a count value, so that the computing module 630 combines the modified version field and the message field corresponding to the count value to obtain the corresponding first block field based on the count value and the sequence values of multiple modified version fields.
上述方案中,多個修改版本欄位在生成時具有標識即順序值,第一鎖存器631回應於計數值,對應順序值將每個修改版本欄位對應和消息欄位組合構成第一區塊欄位,隨後進行前置雜湊運算生成中間狀態值。In the above scheme, multiple modified version fields have an identification or sequence value when generated, and the first latch 631 responds to the count value. Each modified version field is combined with the message field to form a first block field according to the sequence value, and then a pre-hash operation is performed to generate an intermediate state value.
在一些實施例中,仍參考圖7,計算模組630包括電平生成模組634,電平生成模組634根據計數值生成對應的脈衝電平,計算模組回應於脈衝電平將與計數值對應的修改版本欄位和消息欄位鎖存為第一區塊欄位。In some embodiments, still referring to FIG. 7 , the calculation module 630 includes a level generation module 634, which generates a corresponding pulse level according to the count value, and the calculation module locks the modified version field and the message field corresponding to the count value as the first block field in response to the pulse level.
上述方案中,電平生成模組634根據計數器633輸出的計數值,輸出與計數值對應的脈衝電平,脈衝電平與順序值對應,然後第一鎖存器631鎖存相應的修改版本欄位和消息欄位構成第一區塊欄位,用於執行前置雜湊運算In the above scheme, the level generation module 634 outputs a pulse level corresponding to the count value according to the count value output by the counter 633, and the pulse level corresponds to the sequence value. Then the first latch 631 latches the corresponding modified version field and the message field to form the first block field, which is used to perform the pre-hash operation.
可以理解,鎖存器(Latch)是一種對脈衝電平敏感的儲存單元電路,它們可以在特定輸入脈衝電平作用下改變狀態。鎖存就是把信號暫存以維持某種電平狀態。本實施例中,將計數器633的多個計數值與多個脈衝電平關聯起來,且計數值本身和版本欄位的順序值也具有一一對應的關係,進而可以利用生成的脈衝電平將當前計數值對應的版本欄位和消息欄位鎖存為第一區塊欄位。本實施例通過設置鎖存器和計數器的配合操作,使得可以有序且流水式的生成對應於多個版本欄位的第一區塊欄位。It can be understood that a latch is a storage unit circuit that is sensitive to pulse levels and can change state under the action of a specific input pulse level. Latching is to temporarily store a signal to maintain a certain level state. In this embodiment, multiple count values of the counter 633 are associated with multiple pulse levels, and the count value itself and the sequence value of the version field also have a one-to-one correspondence, and then the version field and message field corresponding to the current count value can be latched as the first block field using the generated pulse level. This embodiment sets the coordinated operation of the latch and the counter, so that the first block field corresponding to multiple version fields can be generated in an orderly and pipelined manner.
在一些實施例中,計算模組630生成單個中間狀態值時產生完成信號,計數器633回應於完成信號更新計數值,並在多個第一區塊欄位全部執行雜湊運算之後將計數值恢復至初始值。In some embodiments, the calculation module 630 generates a completion signal when generating a single intermediate state value, and the counter 633 updates the count value in response to the completion signal, and restores the count value to the initial value after all the hash operations are performed on the multiple first block fields.
上述方案中,為了節省運算晶片的硬體電路面積,計算模組只設置一個前置雜湊運算單元執行單次擴展操作和壓縮操作,所以每次只能進行單個第一區塊欄位的運算。在生成單個中間狀態值之後,開始鎖存下一個第一區塊欄位執行下一次前置雜湊運算。計算模組接收多個修改版本欄位和消息欄位後,計數器633的值為0,此時第一鎖存器631將順序值為0的修改版本欄位和消息欄位鎖存,前置雜湊運算單元生成第0個中間狀態值後產生完成信號,計數器633將計數值更新為1,第一鎖存器631開始鎖存順序值為1的修改版本欄位和消息欄位。直至多個第一區塊欄位全部執行雜湊運算之後,計數器633的計數值恢復至初始值,計算模組等待接收下一輪的多個修改版本欄位和消息欄位。依次生成的多個中間狀態值,形成串列的流水式資料可以無需儲存直接給到下一級進行工作量證明計算,實現減少計算硬體面積,達到降低功耗的目的。In the above scheme, in order to save the hardware circuit area of the computing chip, the computing module only sets up one pre-hashing operation unit to perform a single expansion operation and compression operation, so only a single first block field operation can be performed each time. After generating a single intermediate state value, it starts to lock the next first block field to perform the next pre-hashing operation. After the calculation module receives multiple modified version fields and message fields, the value of the counter 633 is 0. At this time, the first latch 631 locks the modified version fields and message fields with a sequence value of 0. The pre-hash operation unit generates the 0th intermediate state value and generates a completion signal. The counter 633 updates the count value to 1, and the first latch 631 starts to lock the modified version fields and message fields with a sequence value of 1. After all the multiple first block fields are hashed, the count value of the counter 633 is restored to the initial value, and the calculation module waits to receive the next round of multiple modified version fields and message fields. The multiple intermediate state values generated in sequence form a serial pipeline data that can be directly given to the next level for workload proof calculation without storage, thereby reducing the computing hardware area and achieving the purpose of reducing power consumption.
在一些實施例中,還包括工作量證明計算模組,用於基於多個中間狀態值和計算任務的第二區塊欄位執行雜湊運算,得到工作量證明;第二區塊欄位包括雜湊梅克爾(Merkle)根的第二區、時間戳記、目標值以及亂數。In some embodiments, a proof-of-work calculation module is also included, which is used to perform hash operations based on multiple intermediate state values and a second block field of the computational task to obtain a proof of work; the second block field includes a second block of a hash Merkle root, a timestamp, a target value, and a random number.
上述方案中,區塊頭的第二部分即第二區塊欄位包括:後4位元組的雜湊梅克爾(Merkle)根欄位(雜湊梅克爾((Merkle))根的第二區);4位元組的時間戳記;4位元組的難度目標值;4位元組的亂數。工作量證明的最終生成發生在運算晶片的多個運算區,即工作量證明計算模組,也可以稱為運算核,每個運算核要執行兩次雜湊運算,包括第一雜湊運算和第二雜湊運算。In the above scheme, the second part of the block header, i.e., the second block field, includes: the last 4 bytes of the hash Merkle root field (the second area of the hash Merkle root); a 4-byte timestamp; a 4-byte difficulty target value; and a 4-byte random number. The final generation of the proof of work occurs in multiple computing areas of the computing chip, i.e., the proof of work computing module, also known as the computing core. Each computing core must perform two hash operations, including the first hash operation and the second hash operation.
在一些實施例中,還包括多個第二鎖存器,用於接收多個中間狀態值;第一擴展器,用於對第二區塊欄位進行第一擴展操作,得到第一擴展資料;多個第一壓縮器,用於基於多個中間狀態值和第一擴展操作結果和第二區塊欄位執行多個第一壓縮操作,得到多個第一壓縮資料;多個第二擴展器,用於基於多個第一壓縮資料執行多個第二擴展操作,得到多個第二擴展資料;多個第二壓縮器,用於基於多個第二擴展資料執行多個第二壓縮操作,得到工作量證明。In some embodiments, it also includes multiple second registers for receiving multiple intermediate state values; a first expander for performing a first expansion operation on a second block field to obtain first expanded data; multiple first compressors for performing multiple first compression operations based on the multiple intermediate state values and the first expansion operation results and the second block field to obtain multiple first compressed data; multiple second expanders for performing multiple second expansion operations based on the multiple first compressed data to obtain multiple second expanded data; multiple second compressors for performing multiple second compression operations based on the multiple second expanded data to obtain proof of work.
參考圖8,工作量證明計算模組即運算核包括:並行設置的多個第二鎖存器,例如第二鎖存器_0、第二鎖存器_1、第二鎖存器_2、第二鎖存器_3;並行設置的多個第一壓縮器,例如第一壓縮器_0、第一壓縮器_1、第一壓縮器_2、第一壓縮器_3,多個第一壓縮器與多個第二鎖存器一一對應地電連接;第一擴展器,多個第一壓縮器共同電連接至第一擴展器;並行設置的多個第二擴展器,例如第二擴展器_0、第二擴展器_1、第二擴展器_2、第二擴展器_3其與多個第一壓縮器一一對應地電連接;多個第二壓縮器,例如第二壓縮器_0、第二壓縮器_1、第二壓縮器_2、第二壓縮器_3,其與多個第二擴展器一一對應地電連接。Referring to FIG8 , the workload proof computing module, i.e., the computing core, includes: a plurality of second registers arranged in parallel, such as second register_0, second register_1, second register_2, and second register_3; a plurality of first compressors arranged in parallel, such as first compressor_0, first compressor_1, first compressor_2, and first compressor_3, wherein the plurality of first compressors are electrically connected to the plurality of second registers in a one-to-one correspondence; a first expander , multiple first compressors are electrically connected to the first expander in common; multiple second expanders arranged in parallel, such as second expander_0, second expander_1, second expander_2, and second expander_3, are electrically connected to the multiple first compressors in a one-to-one correspondence; multiple second compressors, such as second compressor_0, second compressor_1, second compressor_2, and second compressor_3, are electrically connected to the multiple second expanders in a one-to-one correspondence.
本實施例中的第一鎖存器、第二鎖存器均指具有鎖存功能的電子器件,而不僅限於專用的鎖存器(latch),因此,其他具有鎖存功能的器件也可以作為上述第一鎖存器或第二鎖存器,比如寄存器。The first latch and the second latch in this embodiment refer to electronic devices with a latch function, and are not limited to dedicated latches. Therefore, other devices with a latch function can also be used as the first latch or the second latch, such as a register.
上述方案中,第一雜湊運算包括第一擴展操作和多個第一壓縮操作,第二雜湊運算包括多個第二擴展操作和多個第二壓縮操作。In the above scheme, the first hash operation includes a first expansion operation and multiple first compression operations, and the second hash operation includes multiple second expansion operations and multiple second compression operations.
在執行第一雜湊運算時,單個運算區即運算核包括單個第一擴展器和多個第一壓縮器。第一擴展器利用第二區塊欄位執行第一擴展操作得到第一擴展資料,多個第一壓縮器可以共用單個擴展器的第一擴展資料,多個第一壓縮器對應多個中間狀態值和第二區塊欄位執行多個第一壓縮操作得到多個第一壓縮資料,因為第一擴展器不必佈置多個與多個第一壓縮器一一對應,所以節省了運算核的版圖面積,進一步的降低功耗。When executing the first hash operation, a single operation area, i.e., an operation core, includes a single first expander and multiple first compressors. The first expander uses the second block field to perform the first expansion operation to obtain the first expansion data, and multiple first compressors can share the first expansion data of the single expander. Multiple first compressors correspond to multiple intermediate state values and the second block field to perform multiple first compression operations to obtain multiple first compressed data. Because multiple first expanders do not need to be arranged to correspond one to one with multiple first compressors, the layout area of the operation core is saved, and power consumption is further reduced.
在執行第二雜湊運算時,單個運算區即運算核包括多個第二擴展器和多個第二壓縮器,多個第二擴展器基於多個第一壓縮資料執行多個第二擴展操作,得到多個第二擴展資料,多個第二壓縮器基於多個第二擴展資料和256bit的常數欄位執行多個第二壓縮操作,得到工作量證明。When executing the second hash operation, a single operation area, i.e., an operation core, includes multiple second expanders and multiple second compressors. The multiple second expanders perform multiple second expansion operations based on the multiple first compressed data to obtain multiple second expanded data. The multiple second compressors perform multiple second compression operations based on the multiple second expanded data and a 256-bit constant field to obtain proof of work.
每次完成一輪第一雜湊運算和第二雜湊運算時,下一輪的雜湊運算中,第二區塊欄位中的亂數要在 次的運算空間進行切換,以此遍歷區塊頭的運算空間完成工作量證明計算。 Each time a round of the first hash operation and the second hash operation is completed, in the next round of hash operation, the random number in the second block field must be The computation space of the block header is switched to another one to complete the proof-of-work calculation.
在一些實施例中,計算模組設置於晶片的頂層區。還包括電平轉換器,用於將多個中間狀態值由高電壓區轉換至低電壓區。In some embodiments, the computing module is disposed in the top layer region of the chip and further includes a level converter for converting a plurality of intermediate state values from a high voltage region to a low voltage region.
上述方案中,中間狀態值的生成可以在運算晶片的頂層區,頂層區也可以理解為運算晶片的主控制區,頂層區工作在高電壓區,可以下達運算指令至運算區。運算晶片還包括多個運算區,每個運算區可以理解為運算晶片的運算核。頂層區工作在高電壓區,可以下達運算指令至運算區,並接收運算區的資料;運算區工作在低電壓區,運算區高頻工作用於計算亂數形成的 次的運算空間。頂層區執行前置雜湊運算產生中間狀態值至多個運算區,運算區需要在 次的運算空間內遍歷執行第一雜湊運算和第二雜湊運算,所以運算區工作在低電壓高頻環境以此加快計算效率,在運算區遍歷的時間內頂層區不必一直運算生成中間狀態值,而是等運算區遍歷之後才在版本欄位 次可修改範圍內生成下一輪中間狀態值,所以頂層區工作在高電壓低頻環境以此完成前置雜湊運算。利用電平轉換器將中間狀態值由高電壓區轉換至低電壓區,有利於運算區進行高速計算,提升計算效率。 In the above scheme, the generation of the intermediate state value can be done in the top layer area of the computing chip. The top layer area can also be understood as the main control area of the computing chip. The top layer area works in the high voltage area and can issue computing instructions to the computing area. The computing chip also includes multiple computing areas, each of which can be understood as the computing core of the computing chip. The top layer area works in the high voltage area and can issue computing instructions to the computing area and receive data from the computing area; the computing area works in the low voltage area and the computing area works at a high frequency to calculate the random number formation. The top layer performs pre-hashing operations to generate intermediate state values for multiple operation regions. The first and second hash operations are performed in the computational space of the operation area. Therefore, the computational area works in a low voltage and high frequency environment to speed up the computational efficiency. During the computational area traversal, the top layer area does not have to keep calculating and generating intermediate state values. Instead, it waits until the computational area is traversed before setting the intermediate state values in the version field. The next round of intermediate state values is generated within the modifiable range, so the top layer works in a high voltage and low frequency environment to complete the pre-hashing operation. The intermediate state value is converted from the high voltage area to the low voltage area using a level converter, which is conducive to high-speed calculation in the calculation area and improves calculation efficiency.
在一些實施例中,雜湊運算為SHA-256運算。In some embodiments, the hash operation is a SHA-256 operation.
以下為本申請的其中一具體實施例:The following is one specific embodiment of this application:
接收模組和修改模組可以設置於計算裝置的前端,可以利用軟體對原始版本欄位修改配置得到多個修改版本欄位,計算模組可以設置於計算裝置的後端,具體可以為運算晶片的頂層區,頂層區也可以理解為運算晶片的主控制區。The receiving module and the modifying module can be arranged at the front end of the computing device, and the software can be used to modify the configuration of the original version fields to obtain multiple modified version fields. The computing module can be arranged at the back end of the computing device, specifically the top layer area of the computing chip, and the top layer area can also be understood as the main control area of the computing chip.
計算模組通過APB匯流排接收軟體配置的多個修改版本欄位和消息欄位,比如4個修改版本欄位,該消息欄位包括前區塊雜湊值和雜湊梅克爾(Merkle)根的前28位元組。由於存在4個修改版本欄位,可以維護一組2bit的計數器,2bit的計數器具有4個計數值{0,1,2,3 },其中,計數器的4個計數值{0,1,2,3 }可以與4個修改版本欄位的順序值一一對應。The computing module receives multiple revision fields and message fields of the software configuration via the APB bus, such as 4 revision fields, and the message field includes the first 28 bytes of the previous block hash value and the hash Merkle root. Since there are 4 revision fields, a set of 2-bit counters can be maintained, and the 2-bit counter has 4 count values {0, 1, 2, 3}, wherein the 4 count values of the counter {0, 1, 2, 3} can correspond one-to-one to the sequence values of the 4 revision fields.
進而,可以根據該計數器的當前計數值,將當前計數值對應的修改版本欄位和消息欄位拼接並利用第一鎖存器鎖存下來,從而得到當前計數值對應的第一區塊欄位{修改版本欄位,消息欄位},也即圖1示出的區塊頭的前512bit。Furthermore, according to the current count value of the counter, the modified version field and the message field corresponding to the current count value can be spliced and locked using the first register, thereby obtaining the first block field {modified version field, message field} corresponding to the current count value, that is, the first 512 bits of the block header shown in Figure 1.
然後,在得到第一區塊欄位之後,可以利用鎖存的第一區塊欄位進行前置雜湊運算,為了滿足走線位寬要求,同時也便於運算晶片的頂層區執行前置雜湊運算,利用移位暫存器將該資料拆分成32bit的細細微性的子區塊欄位,以用於SHA-256流水的計算使用。當然子區塊欄位不限於32bit,也可以是其他任意比特。Then, after obtaining the first block field, the locked first block field can be used for pre-hashing operations. In order to meet the routing width requirements and facilitate the top layer of the computing chip to perform pre-hashing operations, the data is split into 32-bit sub-block fields using shift registers for use in SHA-256 pipeline calculations. Of course, the sub-block fields are not limited to 32 bits, but can also be any other bits.
具體可以是對第一區塊欄位執行多次反覆運算的擴展操作和壓縮操作,得到一個256bit的中間狀態值Mid並生成完成信號,該256bit的中間狀態值Mid將即時輸出至下一級運算核以進行後續的雜湊運算,可以將256bit的中間狀態值放置到中間狀態值匯流排上去,通過該中間狀態值匯流排輸出至下一級運算核。Specifically, the expansion operation and compression operation may be performed repeatedly on the first block field to obtain a 256-bit intermediate state value Mid and generate a completion signal. The 256-bit intermediate state value Mid will be immediately output to the next-level computing core for subsequent shuffling operations. The 256-bit intermediate state value may be placed on the intermediate state value bus and output to the next-level computing core through the intermediate state value bus.
該完成信號輸出至計數器,計數器回應於該完成信號將當前計數值加1;之後,根據該計數器的更新後的當前計數值,繼續對下一修改版本欄位對應的第一區塊欄位鎖存,採用前置雜湊運算單元執行雜湊運算。迴圈反覆運算計算多個中間狀態值,直至計數器的技術值溢出,此時說明4個修改版本欄位對應的第一區塊欄位均已計算完成。The completion signal is output to the counter, and the counter responds to the completion signal by adding 1 to the current count value; thereafter, according to the updated current count value of the counter, the first block field corresponding to the next modification version field is locked and the pre-hashing operation unit is used to perform the hash operation. The loop repeatedly calculates multiple intermediate state values until the technical value of the counter overflows, which means that the first block fields corresponding to the four modification version fields have been calculated.
參見圖4,由此可以在反覆運算過程中順序地生成4個版本欄位對應的256bit的中間狀態值,如Mid(0)[255:0]、Mid(1)[255:0]、Mid(2)[255:0]、Mid(3)[255:0]。前一輪的多個中間狀態值計算完成之後計數器清零,或者,也可以在新計算任務到來時將該計數器清零,從而重新計算新任務。See Figure 4. In this way, the 256-bit intermediate state values corresponding to the four version fields can be sequentially generated in the repeated calculation process, such as Mid (0) [255:0], Mid (1) [255:0], Mid (2) [255:0], Mid (3) [255:0]. After the calculation of the multiple intermediate state values of the previous round is completed, the counter is cleared. Alternatively, the counter can be cleared when a new calculation task arrives, thereby recalculating the new task.
前置雜湊運算發生在高電壓區,後續的雜湊運算發生在低電壓區,生成的中間狀態值的資料位元寬可以是256bit,為了降低高電壓區到低電壓區的走線位元寬要求,可以採用位寬轉換操作。可以將輸出的256bit的每個中間狀態值切分為64bit的子中間狀態值,分別定義為{mid<n>_3,mid<n>_2,mid<n>_1,mid<n>_0}(n=0,1,2,3),其中,n為中間狀態值的標識,每個中間狀態值經過4個迴圈按照64bit資料位元寬進行序列傳輸,如果有4個中間狀態值則根據中間狀態值的標識的順序組成類似如圖4的順序的串列資料流程傳遞給下一級運算核進行使用。當然子中間狀態值不限於64bit,也可以是其他任意比特。The pre-hashing operation occurs in the high voltage region, and the subsequent hashing operation occurs in the low voltage region. The data bit width of the generated intermediate state value can be 256 bits. In order to reduce the routing bit width requirement from the high voltage region to the low voltage region, a bit width conversion operation can be used. Each 256-bit output intermediate state value can be divided into 64-bit sub-intermediate state values, which are defined as {mid<n>_3, mid<n>_2, mid<n>_1, mid<n>_0} (n=0,1,2,3), where n is the identifier of the intermediate state value. Each intermediate state value is transmitted in sequence according to the 64-bit data bit width through 4 loops. If there are 4 intermediate state values, they are transmitted to the next-level computing core for use in a serial data flow similar to the sequence shown in Figure 4 according to the sequence of the intermediate state value identifiers. Of course, the sub-intermediate state value is not limited to 64 bits, but can also be any other bit.
中間狀態值的生成可以在運算晶片的頂層區,頂層區也可以理解為運算晶片的主控制區,頂層區工作在高電壓區,可以下達運算指令至運算區。運算晶片還包括多個運算區,每個運算區可以理解為運算晶片的運算核。頂層區工作在高電壓區,可以下達運算指令至運算區,並接收運算區的資料;運算區工作在低電壓區,運算區高頻工作用於計算亂數形成的 次的運算空間。利用電平轉換器將中間狀態值由高電壓區轉換至低電壓區,有利於運算區進行高速計算,提升計算效率。 The generation of intermediate state values can be done in the top layer of the computing chip. The top layer can also be understood as the main control area of the computing chip. The top layer works in the high voltage area and can issue computing instructions to the computing area. The computing chip also includes multiple computing areas, each of which can be understood as the computing core of the computing chip. The top layer works in the high voltage area and can issue computing instructions to the computing area and receive data from the computing area; the computing area works in the low voltage area and the high frequency of the computing area is used to calculate the random number formation. The level converter is used to convert the intermediate state value from the high voltage area to the low voltage area, which is conducive to high-speed calculation in the calculation area and improves the calculation efficiency.
下一級運算核接收傳送來的串列資料流程,例如,串列資料流程為圖4中示出的64bit的串列資料流程,利用多個第二鎖存器將具有第二位元寬的串列資料流程恢復為第一位寬的多個中間狀態值,並分別輸入至多個第一壓縮器中,比如,將圖4中的Mid(0)_0、…、Mid(0)_3順序輸入至第二鎖存器_0,將其恢復為256bit的中間狀態值Mid(0),並將其輸入至對應的第一壓縮器_0,將圖4中的Mid(1)_0、…、Mid(1)_3順序輸入至第二鎖存器_1,將其恢復為256bit的中間狀態值Mid(1),並將其輸入至對應的第一壓縮器_1,以此類推。The next-level computing core receives the transmitted serial data flow, for example, the serial data flow is a 64-bit serial data flow shown in FIG. 4, and uses a plurality of second latches to restore the serial data flow with the second bit width to a plurality of intermediate state values of the first bit width, and respectively inputs them into a plurality of first compressors, for example, Mid(0)_0, ..., Mid(0)_3 in FIG. 4 is sequentially input. The first compressor _0 is input into the second lock register _0, which is restored to the 256-bit intermediate state value Mid (0), and then input into the corresponding first compressor _0. The second lock register _1 is sequentially input into the Mid (1) _0, ..., Mid (1) _3 in FIG. 4, which is restored to the 256-bit intermediate state value Mid (1), and then input into the corresponding first compressor _1, and so on.
下一級運算核還接收第二區塊欄位,其中第二區塊欄位包括雜湊梅克爾(Merkle)根的第二區、時間戳記、目標值以及亂數,共128bit。下一級運算核還接收計算模組的預計算數據,其中預計算數據可以為1408bit,為4組352bit的資料構成,預計算數據不局限於此,還可以是其他任意比特。預計算數據由運算晶片的頂層區的預計算模組對第一區塊欄位和/或中間狀態值計算而得,4組352bit的資料可以供第一擴展器和/或4個第一壓縮器和/或4個第二擴展器和/或4個第二壓縮器使用。在生成中間狀態值的同時,採用預計算模組先計算預計算數據可以減少運算核的運算量,提升了運算效率,減小了運算核的計算版圖面積,降低了功耗。第二區塊欄位和預計算數據由運算晶片的頂層區傳輸至運算核時,也可以通過位元寬轉換模組和電平轉換器進行傳輸,運算核設置有鎖存器用於對第二區塊欄位和預計算數據的串列資料流程進行恢復。The next-level computing core also receives the second block field, wherein the second block field includes the second area of the hashed Merkle root, a timestamp, a target value, and a random number, a total of 128 bits. The next-level computing core also receives the estimated data of the computing module, wherein the estimated data can be 1408 bits, which is composed of 4 groups of 352 bits of data. The estimated data is not limited to this, and can also be any other bit. The estimated data is calculated by the estimated calculation module in the top layer area of the computing chip for the first block field and/or the intermediate state value. The 4 groups of 352 bits of data can be used by the first expander and/or the 4 first compressors and/or the 4 second expanders and/or the 4 second compressors. While generating the intermediate state value, using the pre-calculation module to calculate the pre-calculation data first can reduce the amount of calculation of the computing core, improve the computing efficiency, reduce the computing layout area of the computing core, and reduce power consumption. When the second block field and the pre-calculation data are transmitted from the top layer of the computing chip to the computing core, they can also be transmitted through the bit width conversion module and the level converter. The computing core is equipped with a latch for restoring the serial data flow of the second block field and the pre-calculation data.
利用第一擴展器對第二區塊欄位進行第一擴展操作,並將第一擴展操作結果共用給多個第一壓縮器,如此僅需執行一次擴展操作;多個第一壓縮器各自基於輸入的中間狀態值和擴展操作結果執行第一壓縮操作,並將第一壓縮操作結果分別輸入多個第二擴展器;多個第二擴展器各自基於第一壓縮操作結果執行第二擴展操作,並將第二擴展操作結果輸出各自輸出至電連接的第二壓縮器;第二壓縮器基於第二擴展結果執行第二壓縮操作,得到工作量證明。A first expander is used to perform a first expansion operation on the second block field, and the result of the first expansion operation is shared with multiple first compressors, so that only one expansion operation needs to be performed; multiple first compressors each perform a first compression operation based on the input intermediate state value and the expansion operation result, and input the first compression operation result to multiple second expanders respectively; multiple second expanders each perform a second expansion operation based on the first compression operation result, and output the second expansion operation result to each electrically connected second compressor; the second compressor performs a second compression operation based on the second expansion result to obtain a workload certificate.
在本說明書的描述中,參考術語“一些可能的實施方式”、“一些實施例”、“示例”、“具體示例”、或“一些示例”等的描述意指結合該實施例或示例描述的具體特徵、結構、材料或者特點包含於本發明的至少一個實施例或示例中。在本說明書中,對上述術語的示意性表述不必須針對的是相同的實施例或示例。而且,描述的具體特徵、結構、材料或者特點可以在任一個或多個實施例或示例中以合適的方式結合。此外,在不相互矛盾的情況下,本領域的技術人員可以將本說明書中描述的不同實施例或示例以及不同實施例或示例的特徵進行結合和組合。In the description of this specification, the descriptions with reference to the terms "some possible implementations", "some embodiments", "examples", "specific examples", or "some examples" etc. mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily need to be directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in an appropriate manner. In addition, a person skilled in the art may combine and combine different embodiments or examples described in this specification and features of different embodiments or examples, without contradiction.
此外,術語“第一”、“第二”僅用於描述目的,而不能理解為指示或暗示相對重要性或者隱含指明所指示的技術特徵的數量。由此,限定有“第一”、“第二”的特徵可以明示或者隱含地包括至少一個該特徵。在本發明的描述中,“多個”的含義是至少兩個,例如兩個,三個等,除非另有明確具體的限定。In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
流程圖中或在此以其他方式描述的任何過程或方法描述可以被理解為,表示包括一個或更多個用於實現特定邏輯功能或過程的步驟的可執行指令的代碼的模組、片段或部分,並且本發明的優選實施方式的範圍包括另外的實現,其中可以不按所示出或討論的順序,包括根據所涉及的功能按基本同時的方式或按相反的順序,來執行功能,這應被本發明的實施例所屬技術領域的技術人員所理解。Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing specific logical functions or process steps, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by a technician in the technical field to which the embodiments of the present invention belong.
關於本申請實施例的方法流程圖,將某些操作描述為以一定循序執行的不同的步驟。這樣的流程圖屬於說明性的而非限制性的。可以將在本文中所描述的某些步驟分組在一起並且在單個操作中執行、可以將某些步驟分割成多個子步驟、並且可以以不同於在本文中所示出的順序來執行某些步驟。可以由任何電路結構和/或有形機制(例如,由在電腦設備上運行的軟體、硬體(例如,處理器或晶片實現的邏輯功能)等、和/或其任何組合)以任何方式來實現在流程圖中所示出的各個步驟。Regarding the method flow chart of the embodiment of the present application, certain operations are described as different steps performed in a certain sequence. Such a flow chart is illustrative and not restrictive. Certain steps described in this article can be grouped together and performed in a single operation, certain steps can be divided into multiple sub-steps, and certain steps can be performed in a different order than shown in this article. Each step shown in the flow chart can be implemented in any way by any circuit structure and/or tangible mechanism (for example, by software running on a computer device, hardware (for example, a logical function implemented by a processor or chip), etc., and/or any combination thereof).
需要說明的是,本申請實施例中的裝置可以實現前述方法的實施例的各個過程,並達到相同的效果和功能,這裡不再贅述。It should be noted that the device in the embodiment of the present application can implement each process of the embodiment of the aforementioned method and achieve the same effect and function, which will not be elaborated here.
本申請中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於裝置、設備和電腦可讀儲存介質實施例而言,由於其基本相似於方法實施例,所以其描述進行了簡化,相關之處可參見方法實施例的部分說明即可。Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and computer-readable storage medium embodiments, since they are basically similar to the method embodiment, their descriptions are simplified, and the relevant parts can be referred to the partial description of the method embodiment.
本領域內的技術人員應明白,本發明的實施例可提供為方法、系統或電腦程式產品。因此,本發明可採用完全硬體實施例、完全軟體實施例、或結合軟體和硬體方面的實施例的形式。而且,本發明可採用在一個或多個其中包含有電腦可用程式碼的電腦可用儲存介質(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Thus, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
本發明是參照根據本發明實施例的方法、設備(系統)、和電腦程式產品的流程圖和/或方框圖來描述的。應理解可由電腦程式指令實現流程圖和/或方框圖中的每一流程和/或方框、以及流程圖和/或方框圖中的流程和/或方框的結合。可提供這些電腦程式指令到通用電腦、專用電腦、嵌入式處理機或其他可程式設計資料處理設備的處理器以產生一個機器,使得通過電腦或其他可程式設計資料處理設備的處理器執行的指令產生用於實現在流程圖一個流程或多個流程和/或方框圖一個方框或多個方框中指定的功能的裝置。The present invention is described with reference to the flowchart and/or block diagram of the method, apparatus (system), and computer program product according to the embodiment of the present invention. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the processes and/or boxes in the flowchart and/or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
這些電腦程式指令也可儲存在能引導電腦或其他可程式設計資料處理設備以特定方式工作的電腦可讀記憶體中,使得儲存在該電腦可讀記憶體中的指令產生包括指令裝置的製造品,該指令裝置實現在流程圖一個流程或多個流程和/或方框圖一個方框或多個方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
這些電腦程式指令也可裝載到電腦或其他可程式設計資料處理設備上,使得在電腦或其他可程式設計設備上執行一系列操作步驟以產生電腦實現的處理,從而在電腦或其他可程式設計設備上執行的指令提供用於實現在流程圖一個流程或多個流程和/或方框圖一個方框或多個方框中指定的功能的步驟。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.
在一個典型的配置中,計算設備包括一個或多個處理器 (CPU)、輸入/輸出介面、網路介面和記憶體。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
記憶體可能包括電腦可讀介質中的非永久性記憶體,隨機存取記憶體 (RAM) 和/或非易失性記憶體等形式,如唯讀記憶體 (ROM) 或快閃記憶體(flash RAM)。記憶體是電腦可讀介質的示例。Memory may include non-permanent memory in a computer-readable medium, in the form of random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
電腦可讀介質包括永久性和非永久性、可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是電腦可讀指令、資料結構、程式的模組或其他資料。電腦的儲存介質的例子包括,但不限於相變記憶體 (PRAM)、靜態隨機存取記憶體 (SRAM)、動態隨機存取記憶體 (DRAM)、其他類型的隨機存取記憶體 (RAM)、唯讀記憶體 (ROM)、電可擦除可程式設計唯讀記憶體 (EEPROM)、快閃記憶體或其他記憶體技術、唯讀光碟唯讀記憶體 (CD-ROM)、數位多功能光碟 (DVD) 或其他光學儲存、磁盒式磁帶,磁帶磁磁片儲存或其他磁性存放裝置或任何其他非傳輸介質,可用於儲存可以被計算設備訪問的資訊。此外,儘管在附圖中以特定順序描述了本發明方法的操作,但是,這並非要求或者暗示必須按照該特定順序來執行這些操作,或是必須執行全部所示的操作才能實現期望的結果。附加地或備選地,可以省略某些步驟,將多個步驟合併為一個步驟執行,和/或將一個步驟分解為多個步驟執行。Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic tape cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. In addition, although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and/or one step may be decomposed into multiple steps.
雖然已經參考若干具體實施方式描述了本發明的精神和原理,但是應該理解,本發明並不限於所公開的具體實施方式,對各方面的劃分也不意味著這些方面中的特徵不能組合以進行受益,這種劃分僅是為了表述的方便。本發明旨在涵蓋所附申請專利範圍的精神和範圍內所包括的各種修改和等同佈置。Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit. Such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached patent application.
通過閱讀下文的示例性實施例的詳細描述,本領域普通技術人員將明白本文所述的優點和益處以及其他優點和益處。附圖僅用於示出示例性實施例的目的,而並不認為是對本發明的限制。而且在整個附圖中,用相同的標號表示相同的部件。在附圖中:The advantages and benefits described herein and other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the exemplary embodiments below. The accompanying drawings are only used for the purpose of illustrating exemplary embodiments and are not to be considered as limiting the present invention. Also, the same reference numerals are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
圖1為現有技術中的區塊頭結構的示意圖; 圖2為根據本發明一實施例的工作量證明的計算方法的流程示意圖; 圖3為根據本發明一實施例的運算晶片的結構示意圖; 圖4為根據本發明一實施例的中間狀態值的傳輸狀態示意圖; 圖5為根據本發明另一實施例的工作量證明的計算方法的流程示意圖; 圖6為根據本發明一實施例的工作量證明的計算裝置的結構示意圖; 圖7為根據本發明一實施例的工作量證明的計算裝置的計算模組的結構示意圖; 圖8為根據本發明一實施例的下一級計算核的結構示意圖。 FIG1 is a schematic diagram of a block header structure in the prior art; FIG2 is a schematic diagram of a flow chart of a calculation method for proof of work according to an embodiment of the present invention; FIG3 is a schematic diagram of a structure of a computing chip according to an embodiment of the present invention; FIG4 is a schematic diagram of a transmission state of an intermediate state value according to an embodiment of the present invention; FIG5 is a schematic diagram of a flow chart of a calculation method for proof of work according to another embodiment of the present invention; FIG6 is a schematic diagram of a structure of a calculation device for proof of work according to an embodiment of the present invention; FIG7 is a schematic diagram of a structure of a calculation module of a calculation device for proof of work according to an embodiment of the present invention; FIG8 is a schematic diagram of a structure of a next-level computing core according to an embodiment of the present invention.
在附圖中,相同或對應的標號表示相同或對應的部分。In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Claims (36)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311161624.7A CN117254917A (en) | 2023-09-08 | 2023-09-08 | Computing task processing method and device |
| CN2023111616247 | 2023-09-08 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| TW202512695A true TW202512695A (en) | 2025-03-16 |
Family
ID=89128655
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW113133773A TW202512695A (en) | 2023-09-08 | 2024-09-06 | Computational task processing method and device |
Country Status (3)
| Country | Link |
|---|---|
| CN (1) | CN117254917A (en) |
| TW (1) | TW202512695A (en) |
| WO (1) | WO2025050749A1 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117254917A (en) * | 2023-09-08 | 2023-12-19 | 上海嘉楠捷思信息技术有限公司 | Computing task processing method and device |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| ES2836139T3 (en) * | 2013-11-19 | 2021-06-24 | Circle Line International Ltd | Block mining procedures and apparatus |
| CN105245327A (en) * | 2015-08-21 | 2016-01-13 | 北京比特大陆科技有限公司 | Method, device and circuit for bitcoin workload proof hash calculation chip optimization |
| CN106571925B (en) * | 2016-10-24 | 2020-07-10 | 北京云图科瑞科技有限公司 | Method and device for carrying out workload certification on blocks in block chain system |
| US20240062170A1 (en) * | 2022-08-22 | 2024-02-22 | Chain Reaction Ltd. | Cryptocurrency miner and job distribution |
| CN117254917A (en) * | 2023-09-08 | 2023-12-19 | 上海嘉楠捷思信息技术有限公司 | Computing task processing method and device |
-
2023
- 2023-09-08 CN CN202311161624.7A patent/CN117254917A/en active Pending
-
2024
- 2024-06-14 WO PCT/CN2024/099408 patent/WO2025050749A1/en active Pending
- 2024-09-06 TW TW113133773A patent/TW202512695A/en unknown
Also Published As
| Publication number | Publication date |
|---|---|
| CN117254917A (en) | 2023-12-19 |
| WO2025050749A1 (en) | 2025-03-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR102137956B1 (en) | Block mining methods and apparatus | |
| Jakobsson et al. | Fractal Merkle tree representation and traversal | |
| US5327365A (en) | Generating system of random-number sequences for a parallel computer system | |
| TW202512695A (en) | Computational task processing method and device | |
| TW202143076A (en) | Circuit and method for implementing hash algorithm | |
| CN114527956B (en) | Calculation method for non-fixed point scalar multiplication in SM2 algorithm for resisting SPA attack | |
| WO2022174700A1 (en) | Computing apparatus for proof of work, and asic chip and computing method for proof of work | |
| CN116679905A (en) | BRAM-based iterative NTT staggered storage system | |
| CN117272337A (en) | SM4 fine granularity slice optimization method and system for SIMD instruction | |
| CN108959168A (en) | SHA512 full-flow water circuit based on-chip memory and implementation method thereof | |
| Chakraborty et al. | A fast single-key two-level universal hash function | |
| CN115765975A (en) | Low-power-consumption realization method of SHA-256 algorithm, chip, server and storage medium | |
| CN112564890B (en) | Method, device, processor and electronic equipment for accelerating SM4 algorithm | |
| JP7289983B2 (en) | A certifiable pruning system for ledgers | |
| CN118573357A (en) | Data encryption processing method, device, medium and product | |
| CN118300774A (en) | SM3 password-oriented security assessment method and system | |
| CN114745099B (en) | FPGA-based poseidon hash algorithm optimization method | |
| CN111314054A (en) | Novel high-security lightweight ECEG block cipher realization method, system and storage medium | |
| CN116545605A (en) | Fully Homomorphic Encryption Gate Bootstrapping Method Based on GPU Parallel Optimization of KNTT Algorithm | |
| US20130108038A1 (en) | System and method for a collatz based hash function | |
| CN113225185B (en) | Key generation hardware acceleration architecture and method based on quantum signatures after hashing | |
| Jiang et al. | SimdMSM: SIMD-accelerated Multi-Scalar Multiplication Framework for zkSNARKs | |
| Bhattacharyya et al. | Polynomial hashing over prime order fields | |
| CN114510450A (en) | Accelerated calculation method and device of encryption algorithm and array unit operator system | |
| CN118312138B (en) | Montgomery modular multiplication hardware accelerator implementation method and hardware accelerator |