TWI676134B - Accelerated calculating architecture for proof of work in blockchain based on lookup table method - Google Patents

Accelerated calculating architecture for proof of work in blockchain based on lookup table method Download PDF

Info

Publication number
TWI676134B
TWI676134B TW107143268A TW107143268A TWI676134B TW I676134 B TWI676134 B TW I676134B TW 107143268 A TW107143268 A TW 107143268A TW 107143268 A TW107143268 A TW 107143268A TW I676134 B TWI676134 B TW I676134B
Authority
TW
Taiwan
Prior art keywords
value
circuit
dag
nonce
calculus
Prior art date
Application number
TW107143268A
Other languages
Chinese (zh)
Other versions
TW202022597A (en
Inventor
趙士銘
Shi-Ming Zhao
張銘哲
Ming Che Chang
陳治蓁
Chih-Jhen Chen
Original Assignee
資富電子股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 資富電子股份有限公司 filed Critical 資富電子股份有限公司
Priority to TW107143268A priority Critical patent/TWI676134B/en
Application granted granted Critical
Publication of TWI676134B publication Critical patent/TWI676134B/en
Publication of TW202022597A publication Critical patent/TW202022597A/en

Links

Abstract

本發明揭露一種用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構。該加速演算架構包含一DAG頁數據獲取電路、一位置更新電路、一第一工作量證明電路、一第二工作量證明電路、一判斷電路、一nonce值暫存記憶體、一資料存儲電路及一比較電路。由於加速演算架構可與主演算架構同步對同一DAG頁數據進行計算,擺脫了一般以查表法為基礎之區塊鏈中工作量證明的瓶頸,可以大大減少需要找到工作量證明演算法之解的時間。The invention discloses an accelerated calculus framework for proof of work in a blockchain based on a look-up table method. The accelerated calculus architecture includes a DAG page data acquisition circuit, a position update circuit, a first workload proof circuit, a second workload proof circuit, a judgment circuit, a nonce value temporary storage memory, a data storage circuit, and A comparison circuit. Because the accelerated calculus architecture can calculate the same DAG page data in synchronization with the main calculus architecture, it gets rid of the bottleneck of proof of workload in general blockchain based on table lookup method, which can greatly reduce the need to find the solution of proof of workload algorithm time.

Description

用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構Accelerated calculus framework for proof-of-work in blockchain based on look-up table method

本發明關於一種加速演算架構,特別是一種用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構。The invention relates to an accelerated calculus architecture, in particular to an accelerated calculus framework for proof of work in a blockchain based on a table lookup method.

區塊鏈(Blockchain )是基於無數台的小礦工(挖礦機)的個別運算力,累積而成的巨大網路雲端化的分散式儲存運算力。整個區塊鏈要達成去中心化與不可竄改性的重要核心的目標。在基於完成交易帳本的紀錄後給予最快速完成記帳步驟的礦工獎勵(虛擬貨幣),因此,各IC設計大廠無不投入提高算力的ASIC晶片開發。Blockchain (Blockchain) is based on the individual computing power of countless small miners (mining machines), a huge network of cloud-based distributed storage computing power. The entire blockchain must achieve the important core goals of decentralization and immutability. Miner rewards (virtual currency) are given to the fastest completion of the bookkeeping step based on the record of the completed transaction ledger. Therefore, all major IC design manufacturers have invested in the development of ASIC chips that increase computing power.

由於ASIC低價格、大量生產且算力強大的特性,反而造成了運算力過於集中的延伸出來的弱點。是故,以以太坊為首的組織提出了基於有向無環圖(Directed Acyclic Graph,DAG)生成出的巨量單位的表單作為查表的挖礦驗算法。該表單儲存位元數過高,因此只能存放於SDRAM中,藉由SDRAM的頻寬限制侷限了運算力,進而限制了ASIC的不公平競爭。Due to the low price, mass production, and powerful computing power of ASICs, it has resulted in a weak point where the computing power is too concentrated. Therefore, the organization headed by Ethereum has proposed a form based on a large number of units generated by Directed Acyclic Graph (DAG) as a table inspection mining inspection algorithm. The form has a high number of storage bits, so it can only be stored in SDRAM. The bandwidth limitation of SDRAM limits the computing power, thereby limiting the unfair competition of ASIC.

然而,SDRAM的頻寬的限制可以其它手段來減緩影響,提升運算力。本發明即在此提出一種創新的加速演算法,特別是用以提升以查表法為基礎之區塊鏈中工作量證明的加速演算架構。However, the bandwidth limitation of SDRAM can reduce the impact and increase the computing power by other means. The invention proposes an innovative accelerated algorithm here, in particular to accelerate the calculation framework of proof of work in the blockchain based on the look-up table method.

本段文字提取和編譯本發明的某些特點。其它特點將被揭露於後續段落中。其目的在涵蓋附加的申請專利範圍之精神和範圍中,各式的修改和類似的排列。This paragraph extracts and compiles certain features of the invention. Other features will be revealed in subsequent paragraphs. Its purpose is to cover the spirit and scope of the scope of additional patent applications, with various modifications and similar arrangements.

本發明的一目的在於提供一種用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構,用於與一主演算架構同步執行同一標頭(Header)哈希值與不同區段nonce值工作量證明運算,包含:一DAG(Directed Acyclic Graph)頁數據獲取電路,與該主演算架構訊號連接,用以取得該主演算架構獲取之用來對一第一區段中的nonce值進行工作量證明運算程序的一DAG頁數據與一DAG指標;一第一工作量證明電路,依序對一第二區段中的各nonce值與該標頭哈希值執行一輪第一工作量證明運算以獲得一初始位置值;一第二工作量證明電路,對該第二區段中該DAG頁指標對應的記憶體區段中的nonce值與該標頭哈希值,對該DAG頁數據執行一輪第二工作量證明運算以獲得一更新位置值;一判斷電路,與該第二工作量證明電路訊號連接,用以判斷nonce值對應的一狀態值是否大於一演算次數門檻值、若狀態值不大於該演算次數門檻值時將該狀態值加1,並依照判斷結果將nonce值與對應的狀態值分別輸出;一nonce值暫存記憶體,具有複數個記憶體區段並,用以暫存nonce值及其對應的狀態值,其中每一組nonce值及狀態值儲存於相同的記憶體區段中;一位置更新電路,與該DAG頁數據獲取電路、該第二工作量證明電路及該判斷電路訊號連接,用以取得DAG指標對應的記憶體區段中的所有nonce值及其對應的狀態值,並連同該標頭哈希值與該DAG頁數據發送給該第二工作量證明電路、接收來自該判斷電路的不大於該演算次數門檻值之狀態值與對應的nonce值及來自該第二工作量證明電路對應前述nonce值的更新位置值,及設定一更新程序以將前述nonce值與對應的狀態值更新至與該更新位置值對應的記憶體區段;及一資料存儲電路,與該第一工作量證明電路、該位置更新電路及該nonce值暫存記憶體訊號連接,用以依照初始位置值儲存nonce值與為0的狀態值於對應的記憶體區段、執行該更新程序,及依照來自該位置更新電路的該DAG指標找出與其對應的記憶體區段,並將前述記憶體區段中的所有nonce值與對應的狀態值回傳。An object of the present invention is to provide an accelerated calculus architecture for proof-of-work in a blockchain based on a look-up table method, which is used to execute the same header hash value and different regions in synchronization with a main calculus architecture. The segment nonce value proof-of-work operation includes a DAG (Directed Acyclic Graph) page data acquisition circuit connected to the main calculus architecture signal to obtain the nonce in the first segment obtained by the main calculus architecture. A DAG page data and a DAG index of the workload proof operation program; a first workload proof circuit, which sequentially performs a first round of work on each nonce value in the second section and the header hash value Quantity proof operation to obtain an initial position value; a second workload proof circuit for the nonce value and the header hash value in the memory section corresponding to the DAG page index in the second section, and the DAG Page data performs a second workload proof operation to obtain an updated position value; a judgment circuit is connected to the second workload proof circuit signal to determine whether a state value corresponding to the nonce value is greater than a calculation Count the threshold value, if the state value is not greater than the threshold of the number of calculations, add 1 to the state value, and output the nonce value and the corresponding state value according to the judgment result; Segments are used to temporarily store nonce values and their corresponding status values, where each group of nonce values and status values are stored in the same memory segment; a position update circuit, the DAG page data acquisition circuit, the The second proof of work circuit and the judgment circuit are connected to obtain all nonce values and corresponding state values in the memory section corresponding to the DAG indicator, and send the header hash value and the DAG page data together. Give the second workload proof circuit, receive a state value from the judgment circuit that is not greater than the threshold of the number of calculations and a corresponding nonce value, and an updated position value from the second workload proof circuit corresponding to the aforementioned nonce value, and set An update program to update the aforementioned nonce value and corresponding state value to the memory section corresponding to the updated position value; and a data storage circuit, the first workload proof circuit, The position update circuit and the nonce value temporary memory signal are connected to store the nonce value and the state value of 0 in the corresponding memory section according to the initial position value, execute the update procedure, and follow the The DAG indicator finds a memory segment corresponding to the DAG index, and returns all nonce values and corresponding status values in the foregoing memory segment.

最好,該演算次數門檻值可為63。Preferably, the threshold of the number of calculations may be 63.

最好,該第一工作量證明電路可進一步包含:一第一SHA-3運算單元,用以依序將該標頭哈希值與不同的nonce值進行一SHA-3運算;及一第一混合算單元,用以將SHA-3運算結果混合後進行FNV運算以取得不同的初始位置值。Preferably, the first workload proof circuit may further include: a first SHA-3 arithmetic unit for sequentially performing a SHA-3 operation on the header hash value and different nonce values; and a first A mixing unit is used to mix the results of the SHA-3 operation and perform the FNV operation to obtain different initial position values.

最好,該第一工作量證明電路可進一步包含:一第二SHA-3運算單元,用以將該標頭哈希值與不同的nonce值進行一SHA-3運算;及一第二混合算單元,用以將SHA-3運算結果與該DAG頁數據混合後進行FNV運算以取得不同的更新位置值。Preferably, the first workload proof circuit may further include: a second SHA-3 operation unit for performing a SHA-3 operation on the header hash value and different nonce values; and a second mixed operation A unit for mixing SHA-3 operation results with the DAG page data and performing FNV operations to obtain different update position values.

最好,該DAG指標與該記憶體區段的對應關係可為依序一對一對應。Preferably, the correspondence between the DAG index and the memory segment may be a one-to-one correspondence in sequence.

最好,該DAG指標可與該初始位置值或更新位置值的數值型態相同。Preferably, the DAG indicator may be the same as the numerical pattern of the initial position value or the updated position value.

最好,該資料存儲電路可符合高級可擴展介面(Advanced eXtensible Interface,AXI)協議架構規範。Preferably, the data storage circuit can conform to the Advanced eXtensible Interface (AXI) protocol architecture specification.

最好,該加速演算架構可進一步包含一比較電路,與該判斷電路訊號連接,接收來自該判斷電路之大於該演算次數門檻值之狀態值所對應的nonce值與該更新位置值、將該更新位置值執行一後執行函式以得到一混合摘要(Mix Digest)、將該混合摘要與一目標門檻值比較,及當該混合摘要小於該目標門檻值時將該nonce值送出。Preferably, the accelerated calculation architecture may further include a comparison circuit connected to the judgment circuit signal, receiving a nonce value corresponding to a state value from the judgment circuit that is greater than the calculation number threshold, and the update position value, and the update The position value executes a post-execution function to obtain a mixed digest, compares the mixed digest with a target threshold, and sends the nonce value when the mixed digest is less than the target threshold.

最好,該DAG頁數據獲取電路可暫存該些DAG頁數與DAG指標,並依照先進先出(First In, First Out,FIFO)方式提供DAG頁數據與DAG指標。Preferably, the DAG page data acquisition circuit can temporarily store the number of DAG pages and DAG indicators, and provide DAG page data and DAG indicators according to a First In, First Out (FIFO) method.

最好,該nonce值暫存記憶體可為同步動態隨機存取記憶體(Synchronous Dynamic Random Access Memory,SDRAM)。Preferably, the nonce value temporary storage memory may be a Synchronous Dynamic Random Access Memory (SDRAM).

依照本發明,由於加速演算架構可與主演算架構同步對同一DAG頁數據進行計算,擺脫了一般以查表法為基礎之區塊鏈中工作量證明的瓶頸,可以大大減少需要找到工作量證明演算法之解的時間。According to the present invention, since the accelerated calculus architecture can calculate the same DAG page data in synchronization with the main calculus architecture, it gets rid of the bottleneck of proof of workload in the general blockchain based on table lookup method, which can greatly reduce the need to find proof of workload Algorithmic solution time.

本發明將藉由參照下列的實施方式而更具體地描述。The present invention will be described more specifically by referring to the following embodiments.

在開始說明本發明的技術特徵前,先對本發明應用的標的,以查表法為基礎之區塊鏈中工作量證明,之運作方式。請見圖1,該圖為乙太坊(Ethereum)所使用的工作量證明演算法,Ethash,的運算流程圖。值得說明的是本發明不限於應用在Ethash相關的區塊鏈架構中;相反地,只要任何區塊鏈的工作量證明是基於查表法,以取得記憶體內部數據來計算,而非依靠大量硬體資源來處理的,都可以是本發明應用的對象。圖1揭示Ethash一開始取得當下預處理標頭(Preprocessed Header)的哈希值(Hash)32-Byte,加上任意指定的8-Byte的nonce值(一種以二位元表達的連續整數數值),進行類SHA3函式運算。由該類SHA3函式的運算結果稱作Mix,Mix 0代表第一輪的運算結果。Mix經過進一步的計算,得到了128-Byte的DAG(Directed Acyclic Graph)頁的位置,並依照該位置到儲存於計算機記憶體中的DAG的對應位置取得數據。該取得的數據與Mix 0結合並經過一混合函式計算得到下一輪的Mix值,Mix 1。重複Mix運算的作業64次直到獲得Mix64。Mix64經過後執行函式處理,得到一個32-Byte的混合摘要(Digest)。該混合摘要將會與一預設的32-Byte的目標門檻值相比。若是混合摘要小於該目標門檻值,當前的nonce值就滿足Ethash演算法要求,運算結果成功並將該nonce值送出。反之,運算失敗,下一個nonce值將被用來重新執行以上所有流程。Before starting to explain the technical features of the present invention, the operation method of the proof of workload in the blockchain based on the table lookup method applied to the subject of the present invention. Please refer to Figure 1, which is a flowchart of the Ethereum's proof-of-work algorithm, Ethash. It is worth noting that the present invention is not limited to application in Ethash-related blockchain architectures; on the contrary, as long as the proof of workload of any blockchain is based on a look-up table method, the internal data of the memory is calculated instead of relying on a large number of All hardware resources to process can be the object of the application of the present invention. Figure 1 reveals that Ethash initially obtained the Hash of the current Preprocessed Header 32-Byte, plus any specified 8-Byte nonce value (a continuous integer value expressed in two bits) To perform SHA3-like function operations. The operation result of this type of SHA3 function is called Mix, and Mix 0 represents the first operation result. After further calculation, Mix obtained the position of the 128-Byte DAG (Directed Acyclic Graph) page, and obtained data according to the position to the corresponding position of the DAG stored in the computer memory. The obtained data is combined with Mix 0 and a mixed function calculation is performed to obtain the next Mix value, Mix 1. The operation of Mix operation is repeated 64 times until Mix64 is obtained. Mix64 performs function processing after getting a 32-Byte mixed digest. The mixed digest will be compared with a preset 32-Byte target threshold. If the mixed digest is less than the target threshold, the current nonce value meets the requirements of the Ethash algorithm, the operation result is successful and the nonce value is sent out. Otherwise, the operation fails and the next nonce value will be used to re-execute all the above processes.

符合該目標門檻值的nonce值會有很多個,因此整個Ethash演算法是以暴力破解方式(或稱為窮舉法)來找到解答。每個參與工作量證明的計算機本身具備一定實力的運算能力,但因需要頻繁取得記憶體中的數據來運算,故不會發生運算力過於集中的變相「中心化」。由以上的說明可知,Ethash演算法的天然瓶頸(延時)存在於記憶體存取的頻寬限制。若要解決這種問題,依靠複製DAG到其它外加記憶體中以進行同步運算的方法是不現實的,因為DAG會在每約100小時以後增加其內容(目前其內容約2GB大小),且延時問題仍然存在。然而,另一種可行的方法是將取得的DAG頁數據同步提供所有需要的其它nonce值進行部分運算,並將計算結果反覆配合新獲取的DAG頁數據進行運算直到有一個nonce值獲得的最終混合摘要小於目標門檻值。這是本發明的精神,其實施例以圖2來說明。There will be many nonce values that meet the target threshold, so the entire Ethash algorithm uses a brute force method (or exhaustive method) to find the solution. Each computer that participates in the proof of work has a certain level of computing power, but because it needs to frequently obtain data in the memory for calculation, there will not be a disguised "centralization" in which the computing power is too concentrated. As can be seen from the above description, the natural bottleneck (latency) of the Ethash algorithm exists in the bandwidth limitation of memory access. To solve this problem, it is unrealistic to rely on copying the DAG to other external memory for synchronous calculation, because the DAG will increase its content every 100 hours (currently its content is about 2GB), and the delay is the problem still exists. However, another feasible method is to synchronize the obtained DAG page data with all other required nonce values for partial calculations, and repeatedly calculate the calculation results with the newly acquired DAG page data until there is a final mixed summary obtained from the nonce values. Less than the target threshold. This is the spirit of the present invention, and an embodiment thereof is illustrated in FIG. 2.

在圖2中,一種用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構是用來與一主演算架構1同步執行同一標頭(Header)哈希值與不同區段nonce值的工作量證明運算(即Ethash演算法)。主演算架構1是按Ethash演算法的要求來執行相關程序的硬體。相比之下,加速演算架構只是用來執行部分Ethash演算法的要求,不實際到記憶體(比如一SDRAM)中取得需要的DAG頁數據。此外,加速演算架構儲存許多需要對應DAG頁數據的nonce值,並在nonce值通過了64次的工作量證明運算程序後,將滿足混合摘要小於目標門檻值之nonce值直接送出到區塊鏈的各節點以完成一個區塊的工作量證明,不必通過主演算架構1。主演算架構1與加速演算架構間的差異還包括運算的nonce值不同。如果主演算架構1由0開始向下依序計算nonce值直到總數量的一半,加速演算架構運算的nonce值則可從總數量的一半的下一個開始直到最後一個nonce值。此外,主演算架構1和加速演算架構還可依照運算力不同而分配不同數量的nonce,比如1:2。然而,針對一個主演算架構1,可以配合一個以上的加速演算架構,每一個演算架構都負責不同的nonce值,更可加快工作量證明運算。In Figure 2, an accelerated calculus architecture for proof-of-work in a blockchain based on a look-up table method is used to execute the same header hash value and different sections in synchronization with a main calculus architecture 1 Nonce value proof-of-work operation (ie Ethash algorithm). The main calculus architecture 1 is the hardware that executes related programs according to the requirements of the Ethash algorithm. In contrast, the accelerated calculus architecture is only used to perform part of the requirements of the Ethash algorithm, and does not actually go to memory (such as an SDRAM) to obtain the required DAG page data. In addition, the accelerated calculus architecture stores many nonce values that need to correspond to DAG page data, and after the nonce value passes the workload proof operation program 64 times, the nonce value that satisfies the mixed digest less than the target threshold is sent directly to the blockchain. Each node proves the workload of completing a block without having to pass the main calculus architecture1. The difference between the main calculus architecture 1 and the accelerated calculus architecture also includes the difference in the nonce value of the operation. If the main calculus architecture 1 calculates nonce values in sequence from 0 down to half of the total number, the nonce value of the accelerated calculus calculation operation can start from the next half of the total number to the last nonce value. In addition, the main calculus architecture 1 and accelerated calculus architecture can also assign different numbers of nonce according to different computing power, such as 1: 2. However, for one main calculus architecture 1, more than one accelerated calculus architecture can be matched, and each calculus architecture is responsible for a different nonce value, which can speed up the workload proof operation.

加速演算架構包含了一DAG頁數據獲取電路10、一位置更新電路20、一第一工作量證明電路30、一第二工作量證明電路40、一判斷電路50、一nonce值暫存記憶體60、一資料存儲電路70及一比較電路80。以下詳述前述元件的功能及互動關係。The accelerated calculus architecture includes a DAG page data acquisition circuit 10, a position update circuit 20, a first workload proof circuit 30, a second workload proof circuit 40, a judgment circuit 50, and a nonce value temporary storage memory 60. A data storage circuit 70 and a comparison circuit 80. The functions and interactions of the aforementioned elements are detailed below.

DAG頁數據獲取電路10訊號連接主演算架構1,可用以取得主演算架構1獲取之用來對一第一區段中的nonce值進行工作量證明運算程序的一DAG頁數據與一DAG指標。第一區段中的nonce值是主演算架構1負責處理的,之後提及的第二區段中的nonce值則是由加速演算架構負責處理。兩個區段間的nonce數量分配已如上所提及,此處不再贅述。在某些實施例中,DAG頁數據獲取電路10還可暫存該些DAG頁數與DAG指標,並依照先進先出(First In, First Out,FIFO)方式提供DAG頁數據與DAG指標。The DAG page data acquisition circuit 10 is connected to the main calculus structure 1 for obtaining a DAG page data and a DAG index obtained by the main calculus structure 1 and used to perform a workload proof operation procedure on a nonce value in a first section. The nonce value in the first section is handled by the main calculus architecture 1. The nonce value in the second section mentioned later is handled by the accelerated calculus architecture. The allocation of the number of nonce between the two sections has been mentioned above and will not be repeated here. In some embodiments, the DAG page data acquisition circuit 10 may also temporarily store the number of DAG pages and DAG indicators, and provide DAG page data and DAG indicators according to a First In, First Out (FIFO) method.

第一工作量證明電路30依序對第二區段中的各nonce值與該標頭哈希值執行一輪第一工作量證明運算,以獲得一初始位置值。這裡,第一工作量證明電路30主要是進行圖1中取得Mix 0的程序。初始位置值與DAG指標都是按照Ethash演算法所獲得的,為指向DAG中某一頁的位置資訊,二者數值型態相同。然為了說明方便起見,來自主演算架構1的DAG指標還是稱作DAG指標,在加速演算架構中計算獲得的DAG指標,依照不同來源而有初始位置值與更新位置值的名稱。由於取得Mix 0的程序包含了兩個主要的子演算法,故第一工作量證明電路30還可進一步分為一第一SHA-3運算單元32與一第一混合算單元34。第一SHA-3運算單元32是用以依序將目前區塊的標頭哈希值與不同的nonce值進行一SHA-3運算,而第一混合算單元34則是用以將SHA-3運算結果混合後進行FNV運算以取得不同的初始位置值。The first workload proof circuit 30 sequentially performs a first workload proof operation on each nonce value in the second section and the header hash value to obtain an initial position value. Here, the first workload proof circuit 30 mainly performs the procedure of obtaining Mix 0 in FIG. 1. Both the initial position value and the DAG index are obtained in accordance with the Ethash algorithm. The position information points to a page in the DAG, and the numerical values of the two are the same. However, for convenience of explanation, the DAG indicator from the main calculus structure 1 is also called a DAG indicator. The DAG indicator calculated in the accelerated calculus structure has initial position values and updated position values according to different sources. Since the program for obtaining Mix 0 includes two main sub-algorithms, the first workload proof circuit 30 can be further divided into a first SHA-3 arithmetic unit 32 and a first hybrid arithmetic unit 34. The first SHA-3 operation unit 32 is used to sequentially perform a SHA-3 operation on the header hash value of the current block and different nonce values, and the first mixed operation unit 34 is used to perform the SHA-3 operation. After the operation results are mixed, FNV operation is performed to obtain different initial position values.

第二工作量證明電路40可對第二區段中DAG頁指標對應的記憶體區段中的nonce值與該標頭哈希值,對DAG頁數據執行一輪第二工作量證明運算以獲得一更新位置值。這裡,第二工作量證明電路40主要是進行圖1中取得Mix 1~Mix 64的程序。同樣地,更新位置值與DAG指標都是按照Ethash演算法所獲得的,為指向DAG中某一頁的位置資訊,二者數值型態相同。由於取得Mix 1~Mix 64的程序也包含了兩個主要的子演算法,第二工作量證明電路40還可進一步分為一第二SHA-3運算單元42與一第一混合算單元44。第一SHA-3運算單元32是用以依序將目前區塊的標頭哈希值與不同的nonce值進行一SHA-3運算,而第一混合算單元34則是用以將SHA-3運算結果混合後進行FNV運算以取得不同的初始位置值。第二SHA-3運算單元42用以將該標頭哈希值與不同的nonce值進行一SHA-3運算,第二混合算單元44用以將SHA-3運算結果與DAG頁數據混合後進行FNV運算以取得不同的更新位置值。在本實施例中,要注意的是,第一工作量證明電路30只會對一個nonce值進行一次的運算,然而第二工作量證明電路40會因為運氣關係,對每一個nonce值進行最多64次、最少0次的運算。The second proof-of-work circuit 40 may perform a second proof-of-work operation on the DAG page data for a nonce value in the memory section corresponding to the DAG page index in the second section and the header hash value. Update the position value. Here, the second workload proof circuit 40 mainly performs a program for obtaining Mix 1 to Mix 64 in FIG. 1. Similarly, the updated position value and the DAG index are both obtained according to the Ethash algorithm. To point to the position information of a page in the DAG, the numerical values of the two are the same. Since the program for obtaining Mix 1 ~ Mix 64 also includes two main sub-algorithms, the second workload proof circuit 40 can be further divided into a second SHA-3 arithmetic unit 42 and a first hybrid arithmetic unit 44. The first SHA-3 operation unit 32 is used to sequentially perform a SHA-3 operation on the header hash value of the current block and different nonce values, and the first mixed operation unit 34 is used to perform the SHA-3 operation. After the operation results are mixed, FNV operation is performed to obtain different initial position values. The second SHA-3 operation unit 42 is used to perform a SHA-3 operation on the header hash value and different nonce values, and the second mixing operation unit 44 is used to perform the operation after mixing the SHA-3 operation result with the DAG page data. FNV operations to obtain different update position values. In this embodiment, it should be noted that the first workload proof circuit 30 will only perform one operation on one nonce value, but the second workload proof circuit 40 will perform a maximum of 64 on each nonce value due to luck. Operations, at least 0 operations.

判斷電路50與第二工作量證明電路40訊號連接,用以判斷nonce值對應的一狀態值是否大於一演算次數門檻值、若狀態值不大於該演算次數門檻值時將該狀態值加1,並依照判斷結果將nonce值與對應的狀態值分別輸出。依照不同的工作量證明演算法,執行的第二工作量證明運算的數量會不一樣。在本實施例中,演算次數門檻值為第二工作量證明運算的數量減1,63。也就是說,藉由判斷電路50控制nonce值運算64次後,該nonce值便有可能是Ethash演算法的一個解。所以,若其它工作量證明演算法將第二工作量證明運算的數量調整,演算次數門檻值也會跟著變動。The judging circuit 50 is connected to the second workload proof circuit 40 by a signal, and is used to judge whether a state value corresponding to the nonce value is greater than a threshold value of calculations. If the state value is not greater than the threshold value of calculations, the status value is increased by 1, The nonce value and the corresponding state value are output separately according to the judgment result. According to different proof-of-work algorithms, the number of second proof-of-work operations performed will be different. In this embodiment, the threshold for the number of calculations is the number of second workload proof operations minus 1,63. That is, after the nonce value is controlled 64 times by the judgment circuit 50, the nonce value may be a solution of the Ethash algorithm. Therefore, if other proof-of-work algorithms adjust the number of second proof-of-work operations, the threshold of the number of calculations will also change.

nonce值暫存記憶體60,比如一個同步動態隨機存取記憶體(Synchronous Dynamic Random Access Memory,SDRAM),具有複數個記憶體區段(每一記憶體區段具有相同數量的記憶體胞),用以暫存nonce值及其對應的狀態值。每一組nonce值及狀態值儲存於相同的記憶體區段中,其資料儲存形態將於之後藉一個操作例子來說明。Nonce value temporary memory 60, such as a synchronous dynamic random access memory (SDRAM), has a plurality of memory segments (each memory segment has the same number of memory cells), Used to temporarily store nonce values and their corresponding status values. Each set of nonce value and status value is stored in the same memory section, and its data storage form will be explained by an operation example later.

位置更新電路20與DAG頁數據獲取電路10、第二工作量證明電路40及判斷電路50訊號連接,用以取得DAG指標對應的記憶體區段中的所有nonce值及其對應的狀態值40,並將該些nonce值及狀態值連同標頭哈希值及DAG頁數據發送給第二工作量證明電路40。此外,位置更新電路20還可接收來自判斷電路50的不大於該演算次數門檻值之狀態值與對應的nonce值及來自第二工作量證明電路40對應前述nonce值的更新位置值,及設定一更新程序以將前述nonce值與對應的狀態值更新至與該更新位置值對應的記憶體區段。前述的更新程序及包含了nonce值、更新的狀態值與更新位置值,可用以要求資料存儲電路70進行記憶體區段更新(將原記憶體區段中的nonce值與舊的狀態值刪除,在更新位置值對應的記憶體區段暫存該nonce值與更新的狀態值)。這裡要對記憶體區段與DAG指標、初始位置值及更新位置值間的對應關係進行說明。請見圖3,該圖為nonce值暫存記憶體60初始化的說明圖。為了簡化說明,以下說明連同其後的操作例子接假設DAG中只有10個DAG頁資料(Page 1至Page 10),其對應的DAG指標也只有10個(Index-1至Index-10),實作上是百萬倍於此。依照本發明,DAG指標與記憶體區段的對應關係為依序一對一對應。也就是說在nonce值暫存記憶體60中設置10個記憶體區段(Section 1至Section 10),每一個記憶體區段為一DAG指標所指向。由於初始位置值與更新位置值就是DAG指標(在不同地方取得),所以初始位置值或更新位置值也會對應到一個記憶體區段,只是每個nonce值的初始位置值與後續計算的更新位置值會不一樣(計算的DAG指標變了)。The position update circuit 20 is connected to the DAG page data acquisition circuit 10, the second workload certification circuit 40, and the determination circuit 50, and is used to obtain all nonce values and corresponding state values 40 in the memory section corresponding to the DAG index. The nonce values and status values are sent to the second workload certification circuit 40 together with the header hash value and the DAG page data. In addition, the position update circuit 20 may also receive the state value from the judgment circuit 50 that is not greater than the threshold value of the calculation times and the corresponding nonce value, and the updated position value from the second workload proof circuit 40 corresponding to the aforementioned nonce value, and set a The update program updates the nonce value and the corresponding status value to the memory segment corresponding to the update position value. The foregoing update procedure and the nonce value, the updated status value, and the updated position value can be used to request the data storage circuit 70 to perform a memory segment update (deleting the nonce value in the original memory segment and the old status value, The nonce value and the updated status value are temporarily stored in the memory section corresponding to the update position value). The correspondence between the memory segment and the DAG index, the initial position value, and the updated position value will be described here. Please refer to FIG. 3, which is a diagram illustrating initialization of the nonce value temporary storage memory 60. In order to simplify the description, the following description and the following operation examples assume that there are only 10 DAG pages of data (Page 1 to Page 10) in the DAG, and the corresponding DAG index is only 10 (Index-1 to Index-10). It is millions of times. According to the present invention, the correspondence between the DAG index and the memory segment is a one-to-one correspondence. That is to say, 10 memory sections (Section 1 to Section 10) are set in the nonce value temporary storage memory 60, and each memory section is pointed by a DAG indicator. Since the initial position value and the updated position value are DAG indicators (obtained in different places), the initial position value or the updated position value will also correspond to a memory segment, but the initial position value of each nonce value and the update of subsequent calculations The position value will be different (the calculated DAG indicator has changed).

資料存儲電路60與第一工作量證明電路30、位置更新電路20及nonce值暫存記憶體60訊號連接,其功用是依照初始位置值儲存nonce值與為0的狀態值於對應的記憶體區段、執行位置更新電路20的更新程序,及依照來自位置更新電路20的DAG指標找出與其對應的記憶體區段,並將前述記憶體區段中的所有nonce值與對應的狀態值回傳給位置更新電路20,以供第二工作量證明電路40運算使用。實作上,資料存儲電路60可以符合高級可擴展介面(Advanced eXtensible Interface,AXI)協議架構規範,藉以達成電路間快速有效資料存取。The data storage circuit 60 is connected to the first workload proof circuit 30, the position update circuit 20, and the nonce value temporary storage memory 60. Its function is to store the nonce value and the state value of 0 in the corresponding memory area according to the initial position value. Segment, execute the update procedure of the position update circuit 20, and find out the corresponding memory segment according to the DAG index from the position update circuit 20, and return all nonce values and corresponding status values in the aforementioned memory segment The position update circuit 20 is used for calculation by the second workload proof circuit 40. In practice, the data storage circuit 60 can conform to the Advanced eXtensible Interface (AXI) protocol architecture specification, so as to achieve fast and effective data access between circuits.

比較電路80與判斷電路50訊號連接,可接收來自該判斷電路50之大於該演算次數門檻值之狀態值所對應的nonce值與更新位置值、將該更新位置值執行一後執行函式以得到一混合摘要(Mix Digest)、將該混合摘要與一目標門檻值比較,及當該混合摘要小於該目標門檻值時將該nonce值送出。也就是說,比較電路80執行了圖1中點線框所包含的步驟。The comparison circuit 80 is connected to the judgment circuit 50, and can receive the nonce value and the updated position value corresponding to the state value from the judgment circuit 50 that is greater than the threshold value of the calculation times, execute the updated position value and execute the function to obtain A mixed digest (Mix Digest), comparing the mixed digest with a target threshold, and sending the nonce value when the mixed digest is less than the target threshold. That is, the comparison circuit 80 performs the steps included in the dotted line frame in FIG. 1.

接著,以一操作例子來說明加速演算架構的運作。Next, an operation example is used to explain the operation of the accelerated calculus architecture.

請見同時參閱圖3至圖9。圖3如前所述,是加速演算架構還未開始進行運算時,nonce值暫存記憶體60與DAG指標的對應關係。在本操作例子中,假設nonce的總數量為20個(nonce值1到20)。主演算架構1處理nonce值1到10,加速演算架處理nonce值11到20。實際上,在針對一個區塊進行工作量證明運算時使用到的nonce值,遠遠超過20個。當主演算架構1開始針對第一個nonce值,1,進行運算時,它發現需要DAG指標Index-4與對應的DAG頁資料Page 4,因此花了些時間取得。同時,第一工作量證明電路30針對nonce值11到15進行了運算,分別得到了初始位置值Index-2、Index-6、Index-9、Index-4及Index-6。因此,資料存儲電路70便將nonce值11到15依序填入記憶體區段Section 2、Section 6、Section 9、Section 4及Section 6中,如圖4所示。接著,DAG頁數據獲取電路10由主演算架構1取得了DAG指標Index-4與DAG頁資料Page 4,並透過位置更新電路20取得DAG指標對應的記憶體區段中的所有nonce值及其對應的狀態值,即nonce值14與狀態值0,並連同當下區塊的標頭哈希值與該DAG頁數據Page 4發送給第二工作量證明電路40進行運算。第二工作量證明電路40獲得了更新位置值,Index-3。同時,判斷電路50判斷nonce值14對應的狀態值0不大於演算次數門檻值,所以將更新位置值Index-3、nonce值14及狀態值1交給了位置更新電路20,以設定更新程序,進一步透過資料存儲電路70將原記憶體區段Section 4中的資料清空,並將記憶體區段Section 3暫存了nonce值14與狀態值1,如圖5所示。Please refer to FIGS. 3 to 9 at the same time. As mentioned above, FIG. 3 is the correspondence between the nonce value temporary storage memory 60 and the DAG index when the accelerated calculation framework has not yet started to perform calculations. In this operation example, it is assumed that the total number of nonce is 20 (nonce values 1 to 20). The main calculus architecture 1 processes nonce values from 1 to 10, and the accelerated calculus framework processes nonce values from 11 to 20. In fact, more than 20 nonce values are used in proof-of-work calculations for a block. When the main calculus architecture 1 started to operate on the first nonce value, 1, it found that the DAG index Index-4 and the corresponding DAG page data Page 4 were needed, so it took some time to obtain. At the same time, the first workload proof circuit 30 performs operations on the nonce values 11 to 15 and obtains the initial position values Index-2, Index-6, Index-9, Index-4, and Index-6, respectively. Therefore, the data storage circuit 70 fills the nonce values 11 to 15 into the memory sections Section 2, Section 6, Section 9, Section 4 and Section 6, as shown in FIG. 4. Next, the DAG page data acquisition circuit 10 obtains the DAG index Index-4 and the DAG page data Page 4 from the main calculus architecture 1, and obtains all nonce values and their correspondences in the memory section corresponding to the DAG index through the position update circuit 20. The state value, that is, the nonce value 14 and the state value 0, are sent to the second workload proof circuit 40 for calculation together with the header hash value of the current block and the DAG page data Page 4. The second workload proof circuit 40 obtains the updated position value, Index-3. At the same time, the judging circuit 50 judges that the state value 0 corresponding to the nonce value 14 is not greater than the threshold of the number of calculations, so the updated position value Index-3, the nonce value 14 and the state value 1 are given to the position update circuit 20 to set the update program. Further, the data in the original memory section Section 4 is emptied through the data storage circuit 70, and the memory section Section 3 temporarily stores the nonce value 14 and the state value 1, as shown in FIG. 5.

接著,主演算架構1開始針對第二個nonce值,2,進行運算。主演算架構1算出DAG指標Index-6及對應的DAG頁資料Page 6,亦花了些時間取得。同時,第一工作量證明電路30針對nonce值16到20進行了運算,分別得到了初始位置值Index-4、Index-7、Index-1、Index-4及Index-6。因此,資料存儲電路70便將nonce值16到20依序填入記憶體區段Section 4、Section 7、Section 1、Section 4及Section 6中,如圖6所示。接著,DAG頁數據獲取電路10由主演算架構1取得了DAG指標Index-6與DAG頁資料Page 6,並透過位置更新電路20取得DAG指標對應的記憶體區段中的所有nonce值及其對應的狀態值,即nonce值12與狀態值0、nonce值15與狀態值0及nonce值20與狀態值0。位置更新電路20將前述資料連同當下區塊的標頭哈希值與DAG頁數據Page 6分別發送給第二工作量證明電路40進行運算。第二工作量證明電路40因而為nonce值12、15與20分別算得了更新位置值Index-5、Index-6及Index-10。判斷電路5依序判斷各nonce值對應的狀態值0皆不大於演算次數門檻值,所以將各更新位置值連同其nonce值14及加了1的狀態值1交給了位置更新電路20。從而資料存儲電路70將原記憶體區段Section 6中的資料清空,並將記憶體區段Section 5暫存了nonce值12與狀態值1,記憶體區段Section 10暫存了nonce值20與狀態值1,而記憶體區段Section 6再度暫存了nonce值15與狀態值1,如圖7所示。Then, the main calculus architecture 1 starts to perform operations on the second nonce value, 2. The main calculation framework 1 calculated the DAG index Index-6 and the corresponding DAG page data Page 6 and also took some time to obtain it. At the same time, the first workload proof circuit 30 performs operations on the nonce values 16 to 20, and obtains the initial position values Index-4, Index-7, Index-1, Index-4, and Index-6, respectively. Therefore, the data storage circuit 70 fills the nonce values 16 to 20 into the memory sections Section 4, Section 7, Section 1, Section 4 and Section 6, as shown in FIG. 6. Next, the DAG page data acquisition circuit 10 obtains the DAG index Index-6 and the DAG page data Page 6 from the main calculus architecture 1, and obtains all nonce values in the memory section corresponding to the DAG index and their correspondence through the position update circuit 20. The state values are nonce value 12 and state value 0, nonce value 15 and state value 0 and nonce value 20 and state value 0. The position update circuit 20 sends the foregoing data together with the header hash value of the current block and the DAG page data Page 6 to the second workload proof circuit 40 for calculation. The second workload proof circuit 40 thus calculates the updated position values Index-5, Index-6, and Index-10 for the nonce values 12, 15, and 20, respectively. The judging circuit 5 sequentially judges that the state value 0 corresponding to each nonce value is not greater than the threshold of the number of calculations, so each updated position value is given to the position update circuit 20 along with its nonce value 14 and the state value 1 which is added by 1. Therefore, the data storage circuit 70 empties the data in the original memory section 6 and temporarily stores the nonce value 12 and the state value 1 in the memory section 5 and the memory section 10 temporarily stores the nonce value 20 and The state value is 1, and the memory section Section 6 temporarily stores the nonce value and the state value 1, as shown in FIG. 7.

在完成兩輪運算後,主演算架構1開始針對第三個nonce值,3,進行運算。主演算架構1算出DAG指標Index-10及對應的DAG頁資料Page 10。這時,第一工作量證明電路30已無nonce可運算。然而,實作上這種情形較少,除非加速演算架構與的主演算架構1數量比很高。因此,在DAG頁數據獲取電路10開始運算前,記憶體區段內的資料沒有變動,如圖8所示。接著,DAG頁數據獲取電路10由主演算架構1取得了DAG指標Index-10與DAG頁資料Page 10,並透過位置更新電路20取得DAG指標對應的記憶體區段中的所有nonce值及其對應的狀態值,即nonce值20與狀態值1。位置更新電路20將前述資料連同當下區塊的標頭哈希值與DAG頁數據Page 10分別發送給第二工作量證明電路40進行運算。第二工作量證明電路40因而為nonce值20算得了更新位置值Index-7。判斷電路5依序判斷各nonce值對應的狀態值1不大於演算次數門檻值,所以將更新位置值連同其nonce值20及加了1的狀態值2交給了位置更新電路20。從而,資料存儲電路70將原記憶體區段Section 10中的資料清空,並將記憶體區段Section 7另外暫存了nonce值20與狀態值2,如圖9所示。After completing two rounds of calculations, the main calculus architecture 1 starts to operate on the third nonce value, 3. The main calculation framework 1 calculates the DAG index Index-10 and the corresponding DAG page data Page 10. At this time, the first workload proof circuit 30 is no longer operable. However, this is rarely the case in practice unless the number of accelerated calculus architectures and main calculus architecture 1 is high. Therefore, before the DAG page data acquisition circuit 10 starts the operation, the data in the memory section does not change, as shown in FIG. 8. Next, the DAG page data acquisition circuit 10 obtains the DAG index Index-10 and the DAG page data Page 10 from the main calculus architecture 1, and obtains all nonce values and their correspondences in the memory section corresponding to the DAG index through the position update circuit 20. The status value, namely the nonce value of 20 and the status value of 1. The position update circuit 20 sends the foregoing data together with the header hash value of the current block and the DAG page data Page 10 to the second workload certification circuit 40 respectively for calculation. The second workload proof circuit 40 thus calculates the update position value Index-7 for the nonce value 20. The judging circuit 5 sequentially judges that the state value 1 corresponding to each nonce value is not greater than the threshold of the number of calculations, so the updated position value is given to the position update circuit 20 along with its nonce value 20 and the state value 2 added by 1. Therefore, the data storage circuit 70 clears the data in the original memory section Section 10 and temporarily stores the nonce value 20 and the state value 2 in the memory section 7 as shown in FIG. 9.

在不斷重複前述的步驟後,最終會有nonce值的狀態值大於63。該nonce值有可能是Ethash演算法的解,故會被送到比較電路80中進行後續處理。當然,滿足這條件的nonce值會依序算出很多個,也都會被送給比較電路80進行後續處理。整個作業會在約15秒內完成對一個區塊的工作量證明,從而重新來過(即主演算架構1重新由nonce值1開始運算,找出滿足此輪的解)。After continuously repeating the foregoing steps, there will eventually be a state value of nonce value greater than 63. The nonce value may be the solution of the Ethash algorithm, so it will be sent to the comparison circuit 80 for subsequent processing. Of course, a number of nonce values that satisfy this condition will be calculated in sequence, and will also be sent to the comparison circuit 80 for subsequent processing. The whole operation will complete the proof of work for a block in about 15 seconds, and restart it (that is, the main calculus architecture 1 restarts from the nonce value 1 to find a solution that meets this round).

雖然本發明已以實施方式揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明之精神和範圍內,當可作些許之更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。Although the present invention has been disclosed as above in the embodiments, it is not intended to limit the present invention. Any person with ordinary knowledge in the technical field can make some modifications and retouching without departing from the spirit and scope of the present invention. The protection scope of the present invention shall be determined by the scope of the attached patent application.

1‧‧‧主演算架構1‧‧‧ lead calculus structure

10‧‧‧DAG頁數據獲取電路 10‧‧‧DAG page data acquisition circuit

20‧‧‧位置更新電路 20‧‧‧Position update circuit

30‧‧‧第一工作量證明電路 30‧‧‧First workload proof circuit

32‧‧‧第一SHA-3運算單元 32‧‧‧The first SHA-3 arithmetic unit

34‧‧‧第一混合算單元 34‧‧‧The first mixed arithmetic unit

40‧‧‧第二工作量證明電路 40‧‧‧Second workload proof circuit

42‧‧‧第二SHA-3運算單元 42‧‧‧Second SHA-3 arithmetic unit

44‧‧‧第二混合算單元 44‧‧‧Second Mixed Computing Unit

50‧‧‧判斷電路 50‧‧‧ Judgment Circuit

60‧‧‧nonce值暫存記憶體 60‧‧‧nonce value temporary memory

70‧‧‧資料存儲電路 70‧‧‧Data storage circuit

80‧‧‧比較電路 80‧‧‧ comparison circuit

圖1為習知技術所使用的工作量證明演算法;圖2為依照本發明的實施例的一種用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構;圖3至圖9說明該加速演算架構運作下的例子。FIG. 1 is a workload proof algorithm used in the conventional technology; FIG. 2 is an accelerated algorithm framework for workload proof in a blockchain based on a table lookup method according to an embodiment of the present invention; Figure 9 illustrates an example of the operation of the accelerated calculus architecture.

Claims (10)

一種用於以查表法為基礎之區塊鏈中工作量證明的加速演算架構,用於與一主演算架構同步執行同一標頭(Header)哈希值與不同區段nonce值工作量證明運算,包含: 一DAG(Directed Acyclic Graph)頁數據獲取電路,與該主演算架構訊號連接,用以取得該主演算架構獲取之用來對一第一區段中的nonce值進行工作量證明運算程序的一DAG頁數據與一DAG指標; 一第一工作量證明電路,依序對一第二區段中的各nonce值與該標頭哈希值執行一輪第一工作量證明運算以獲得一初始位置值; 一第二工作量證明電路,對該第二區段中該DAG頁指標對應的記憶體區段中的nonce值與該標頭哈希值,對該DAG頁數據執行一輪第二工作量證明運算以獲得一更新位置值; 一判斷電路,與該第二工作量證明電路訊號連接,用以判斷nonce值對應的一狀態值是否大於一演算次數門檻值、若狀態值不大於該演算次數門檻值時將該狀態值加1,並依照判斷結果將nonce值與對應的狀態值分別輸出; 一nonce值暫存記憶體,具有複數個記憶體區段並,用以暫存nonce值及其對應的狀態值,其中每一組nonce值及狀態值儲存於相同的記憶體區段中; 一位置更新電路,與該DAG頁數據獲取電路、該第二工作量證明電路及該判斷電路訊號連接,用以取得DAG指標對應的記憶體區段中的所有nonce值及其對應的狀態值,並連同該標頭哈希值與該DAG頁數據發送給該第二工作量證明電路、接收來自該判斷電路的不大於該演算次數門檻值之狀態值與對應的nonce值及來自該第二工作量證明電路對應前述nonce值的更新位置值,及設定一更新程序以將前述nonce值與對應的狀態值更新至與該更新位置值對應的記憶體區段;及 一資料存儲電路,與該第一工作量證明電路、該位置更新電路及該nonce值暫存記憶體訊號連接,用以依照初始位置值儲存nonce值與為0的狀態值於對應的記憶體區段、執行該更新程序,及依照來自該位置更新電路的該DAG指標找出與其對應的記憶體區段,並將前述記憶體區段中的所有nonce值與對應的狀態值回傳。An accelerated calculus architecture for proof-of-work in a blockchain based on a look-up table method, used to perform the same proof-of-work workload for the same Header hash value and nonce value in different sections in synchronization with a main calculus architecture , Including: A DAG (Directed Acyclic Graph) page data acquisition circuit, connected to the main calculus architecture signal, used to obtain the main calculus architecture to obtain a workload proof operation program for a nonce value in a first section A DAG page of data and a DAG indicator; a first workload proof circuit, which sequentially performs a first workload proof operation on each nonce value and the header hash value in a second section to obtain an initial Position value; a second workload proof circuit that performs a second round of work on the nong value and the header hash value in the memory section corresponding to the DAG page index in the second section Quantity proof operation to obtain an updated position value; a judging circuit connected to the second workload proof circuit signal to determine whether a state value corresponding to the nonce value is greater than a threshold value of a calculation number, if the state value When the threshold is exceeded, the state value is increased by 1, and the nonce value and the corresponding state value are respectively output according to the judgment result. A nonce value is temporarily stored in the memory, and a plurality of memory sections are used for temporary storage. nonce value and corresponding state value, wherein each group of nonce value and state value are stored in the same memory section; a position update circuit, the DAG page data acquisition circuit, the second workload proof circuit and the The judging circuit signal is connected to obtain all nonce values and corresponding state values in the memory segment corresponding to the DAG indicator, and send them to the second workload certification circuit together with the header hash value and the DAG page data. Receive a state value from the judging circuit that is not greater than the threshold of the number of calculations and a corresponding nonce value, and an updated position value corresponding to the aforementioned nonce value from the second workload proof circuit, and set an update program to convert the aforementioned nonce value Update the corresponding state value to the memory section corresponding to the updated position value; and a data storage circuit, the first workload proof circuit, the position update circuit, and the The nonce value temporarily stores the memory signal connection, which is used to store the nonce value and the state value of 0 in the corresponding memory section according to the initial position value, execute the update process, and find out according to the DAG index from the position update circuit. A corresponding memory segment, and returns all nonce values and corresponding status values in the foregoing memory segment. 如申請專利範圍第1項所述的加速演算架構,其中該演算次數門檻值為63。The accelerated calculus architecture described in item 1 of the scope of patent application, wherein the threshold for the number of calculus times is 63. 如申請專利範圍第1項所述的加速演算架構,其中該第一工作量證明電路進一步包含: 一第一SHA-3運算單元,用以依序將該標頭哈希值與不同的nonce值進行一SHA-3運算;及 一第一混合算單元,用以將SHA-3運算結果混合後進行FNV運算以取得不同的初始位置值。The accelerated calculus architecture according to item 1 of the scope of patent application, wherein the first workload proof circuit further comprises: a first SHA-3 arithmetic unit for sequentially hashing the header with a different nonce value A SHA-3 operation is performed; and a first mixed operation unit is used to mix the results of the SHA-3 operation and perform the FNV operation to obtain different initial position values. 如申請專利範圍第1項所述的加速演算架構,其中該第一工作量證明電路進一步包含: 一第二SHA-3運算單元,用以將該標頭哈希值與不同的nonce值進行一SHA-3運算;及 一第二混合算單元,用以將SHA-3運算結果與該DAG頁數據混合後進行FNV運算以取得不同的更新位置值。The accelerated calculus architecture according to item 1 of the scope of patent application, wherein the first workload proof circuit further comprises: a second SHA-3 arithmetic unit for performing a hash of the header with a different nonce value. SHA-3 operation; and a second hybrid operation unit, which is used to mix the SHA-3 operation result with the DAG page data and perform FNV operation to obtain different update position values. 如申請專利範圍第1項所述的加速演算架構,其中該DAG指標與該記憶體區段的對應關係為依序一對一對應。The accelerated calculus architecture described in item 1 of the scope of patent application, wherein the corresponding relationship between the DAG index and the memory segment is a one-to-one correspondence. 如申請專利範圍第1項所述的加速演算架構,其中該DAG指標與該初始位置值或更新位置值的數值型態相同。The accelerated calculus architecture described in item 1 of the scope of the patent application, wherein the DAG index has the same numerical form as the initial position value or the updated position value. 如申請專利範圍第1項所述的加速演算架構,其中該資料存儲電路符合高級可擴展介面(Advanced eXtensible Interface,AXI)協議架構規範。The accelerated calculus architecture described in item 1 of the patent application scope, wherein the data storage circuit complies with the Advanced eXtensible Interface (AXI) protocol architecture specification. 如申請專利範圍第1項所述的加速演算架構,進一步包含一比較電路,與該判斷電路訊號連接,接收來自該判斷電路之大於該演算次數門檻值之狀態值所對應的nonce值與該更新位置值、將該更新位置值執行一後執行函式以得到一混合摘要(Mix Digest)、將該混合摘要與一目標門檻值比較,及當該混合摘要小於該目標門檻值時將該nonce值送出。The accelerated calculation architecture described in item 1 of the scope of the patent application, further comprising a comparison circuit connected to the judgment circuit signal, and receiving a nonce value corresponding to a state value from the judgment circuit that is greater than the threshold value of the calculation times and the update. Position value, execute a post-execution function to obtain a mixed digest (Mix Digest), compare the mixed digest with a target threshold, and set the nonce value when the mixed digest is less than the target threshold Submit. 如申請專利範圍第1項所述的加速演算架構,其中該DAG頁數據獲取電路暫存該些DAG頁數與DAG指標,並依照先進先出(First In, First Out,FIFO)方式提供DAG頁數據與DAG指標。The accelerated calculus architecture described in item 1 of the scope of patent application, wherein the DAG page data acquisition circuit temporarily stores the number of DAG pages and DAG indicators, and provides DAG pages according to the First In, First Out (FIFO) method Data and DAG indicators. 如申請專利範圍第1項所述的加速演算架構,其中該nonce值暫存記憶體為同步動態隨機存取記憶體(Synchronous Dynamic Random Access Memory,SDRAM)。The accelerated calculus architecture according to item 1 of the scope of patent application, wherein the nonce value temporary storage memory is a Synchronous Dynamic Random Access Memory (SDRAM).
TW107143268A 2018-12-03 2018-12-03 Accelerated calculating architecture for proof of work in blockchain based on lookup table method TWI676134B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW107143268A TWI676134B (en) 2018-12-03 2018-12-03 Accelerated calculating architecture for proof of work in blockchain based on lookup table method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107143268A TWI676134B (en) 2018-12-03 2018-12-03 Accelerated calculating architecture for proof of work in blockchain based on lookup table method

Publications (2)

Publication Number Publication Date
TWI676134B true TWI676134B (en) 2019-11-01
TW202022597A TW202022597A (en) 2020-06-16

Family

ID=69189163

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107143268A TWI676134B (en) 2018-12-03 2018-12-03 Accelerated calculating architecture for proof of work in blockchain based on lookup table method

Country Status (1)

Country Link
TW (1) TWI676134B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108256337A (en) * 2018-02-26 2018-07-06 北京阿尔山金融科技有限公司 Intelligent contract leak detection method, device and electronic equipment
CN108491269A (en) * 2018-03-23 2018-09-04 中科声龙科技发展(北京)有限公司 A kind of method and circuit of the optimization of proof of work operation chip
CN108777612A (en) * 2018-05-18 2018-11-09 中科声龙科技发展(北京)有限公司 A kind of optimization method and circuit of proof of work operation chip core calculating unit
WO2018209190A1 (en) * 2017-05-11 2018-11-15 Shapeshift Ag Trusted agent blockchain oracle

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018209190A1 (en) * 2017-05-11 2018-11-15 Shapeshift Ag Trusted agent blockchain oracle
CN108256337A (en) * 2018-02-26 2018-07-06 北京阿尔山金融科技有限公司 Intelligent contract leak detection method, device and electronic equipment
CN108491269A (en) * 2018-03-23 2018-09-04 中科声龙科技发展(北京)有限公司 A kind of method and circuit of the optimization of proof of work operation chip
CN108777612A (en) * 2018-05-18 2018-11-09 中科声龙科技发展(北京)有限公司 A kind of optimization method and circuit of proof of work operation chip core calculating unit

Also Published As

Publication number Publication date
TW202022597A (en) 2020-06-16

Similar Documents

Publication Publication Date Title
CN109345388B (en) Block chain intelligent contract verification method and device and storage medium
US7889672B2 (en) Communication apparatus and method of calculating round trip time
CN108241968B (en) Method for leading processor to participate block chain consensus
US20140195545A1 (en) High performance hash-based lookup for packet processing in a communication network
US8762534B1 (en) Server load balancing using a fair weighted hashing technique
US9665284B2 (en) Partition extension method and apparatus
KR101753548B1 (en) Parallel processing of a single data buffer
WO2019144761A1 (en) Data synchronization method, distributed system and device
RU2610250C2 (en) Transmission node and buffer status reporting method
WO2023071373A1 (en) Blockchain consensus method, apparatus, and device, and storage medium
JP6558188B2 (en) Distributed processing system, learning model creation method, data processing method, learning model creation program, and data processing program
AU2016230539B2 (en) Retrieval device, retrieval method, program, and recording medium
WO2018027839A1 (en) Method for accessing table entry in translation lookaside buffer (tlb) and processing chip
WO2020199713A1 (en) Data verification method, system, apparatus, and device
CN115941598B (en) Flow table semi-unloading method, equipment and medium
CN111563277A (en) Workload proving method in block chain network and block chain
JP2014186397A (en) Cache memory device, information processor and cache memory control method
TWI676134B (en) Accelerated calculating architecture for proof of work in blockchain based on lookup table method
JP2007155715A (en) System and method for verifying metadata during measuring processing
CN104375946A (en) Method and device for processing data
US20210226775A1 (en) Memory optimization for nested hash operations
US9882705B2 (en) Communication apparatus, communication method, and computer readable medium using propagation delay for time synchronization
CN116701248B (en) Page table management method, unit, SOC, electronic device and readable storage medium
WO2019095952A1 (en) Synchronization method and apparatus
JP2018517947A (en) Vector processing for segmented hash calculation