CN109815372A - Scrypt algorithm workload proving method and device - Google Patents

Scrypt algorithm workload proving method and device Download PDF

Info

Publication number
CN109815372A
CN109815372A CN201910068396.6A CN201910068396A CN109815372A CN 109815372 A CN109815372 A CN 109815372A CN 201910068396 A CN201910068396 A CN 201910068396A CN 109815372 A CN109815372 A CN 109815372A
Authority
CN
China
Prior art keywords
data
task
storing data
current
storing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910068396.6A
Other languages
Chinese (zh)
Other versions
CN109815372B (en
Inventor
徐英韬
张楠赓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Canaan Jiesi Information Technology Co ltd
Original Assignee
Hangzhou Canaan Creative Information Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Canaan Creative Information Technology Ltd filed Critical Hangzhou Canaan Creative Information Technology Ltd
Priority to CN201910068396.6A priority Critical patent/CN109815372B/en
Priority claimed from CN201910068396.6A external-priority patent/CN109815372B/en
Publication of CN109815372A publication Critical patent/CN109815372A/en
Application granted granted Critical
Publication of CN109815372B publication Critical patent/CN109815372B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure relates to a method and a device for workload certification of a Scrypt algorithm, wherein the method comprises a plurality of tasks certified by workloads, the tasks comprise a first stage and a second stage, and the method comprises the following steps: in the first stage of each task, extracting partial data from the first data as storage data for storage, wherein the quantity of the storage data is less than that of the first data; in the second stage of each task, each task is respectively corresponding to different first time slots in the first period, corresponding first data are determined according to the stored data of the target task in the first time slot corresponding to the target task, second data are generated according to the corresponding first data, the target task comprises any task, the first period comprises a plurality of first time slots, and the number of the first time slots is larger than or equal to that of the tasks. The embodiment of the disclosure can save storage space and improve the execution efficiency of multiple tasks.

Description

Scrypt algorithm proof of work method and device
Technical field
This disclosure relates to block chain technical field more particularly to a kind of Scrypt algorithm proof of work method and device.
Background technique
In the proof of work method of block chain technology, the first stage of Scrypt algorithm proof of work method, which generates, to be set First data of fixed number amount, and use the first data to generate the second data at random in second stage.The quantity of first data is more, Biggish memory space is occupied, so that the volume of the realization chip of Scrypt algorithm proof of work method is larger, is unfavorable for Reduce the volume of relevant device.
Summary of the invention
In view of this, the present disclosure proposes a kind of Scrypt algorithm proof of work method and devices.To solve The problem of Scrypt algorithm proof of work method occupancy memory space is big, can not reduce related chip volume.
According to the one side of the disclosure, a kind of Scrypt algorithm proof of work method is provided, the method includes more The task of a proof of work, the task include first stage and second stage, which comprises
In the first stage of each task, extraction section data are stored as storing data in the first data, described The quantity of storing data is less than the quantity of first data;
In the second stage of each task, each task is respectively corresponding to the first time slot different in the period 1, with mesh In corresponding first time slot of mark task, corresponding first data are determined according to the storing data of the goal task, according to described Corresponding first data generate the second data, and the goal task includes any task, and the period 1 includes multiple First time slot, the quantity of first time slot are greater than or equal to the quantity of the task.
In one possible implementation, in the first stage of each task, extraction section data are made in the first data It is stored for storing data, comprising:
In the first stage of each task, each task is respectively corresponding to the second time slot different in second round,
In the second time slot corresponding with the goal task, the first data, and the extraction section in the first data are generated Memory is written as storing data in data, and the second round includes multiple second time slots, and the quantity of second time slot is big In or equal to the task quantity.
In one possible implementation, corresponding first data are determined according to the storing data of the goal task, The second data are generated according to corresponding first data, comprising:
The first data corresponding with current second data are searched in the storing data of the goal task;
When the first data corresponding with current second data can not be found in the storing data, according to closest Storing data, determining the first data corresponding with current second data;
According to current corresponding first data of second data and current second data, obtain described current Next second data of two data.
In one possible implementation, first data are ordered sequence, the extracting part score in the first data It is stored according to as storing data, comprising:
The storage address of the storing data is determined according to the sequence number of the storing data;
The first data corresponding with current second data are searched in the storing data of the goal task, comprising:
Index address is generated according to the data preset in numerical digit in current second data of the goal task, described The index address is searched in storage address, and the first data corresponding with current second data are determined according to lookup result.
In one possible implementation, according to immediate storing data, determining and current second data pair The first data answered, comprising:
Determine the difference between immediate storage address and the index address;
According to the number of iterations that the difference determines, the storing data in immediate storage address is iterated fortune It calculates, obtains the first data corresponding with the index address.
In one possible implementation, extraction section data are stored as storing data in the first data, It includes any of the following:
Extraction storing data is spaced according to preset extraction in the first data to be stored;
Storing data is extracted according to preset sequence number range in the first data to be stored;
The storing data that preset quantity is randomly selected in the first data is stored.
In one possible implementation, the storing data of each task is stored in the different memory spaces of memory, institute The quantity for stating memory space is greater than or equal to the quantity of the task.
In one possible implementation, with the second round in preceding, the described period 1 in the rear execution formed Period executes each task.
In one possible implementation, the period 1 further includes free timeslot, the quantity of the free timeslot Or duration is determined according to the delay of the memory.
In one possible implementation, the period 1 and the second round are parallel.
In one possible implementation, the method also includes:
When at least one task execution in the multiple task finishes, when being finished for task is corresponding first Gap is distributed to new task.
According to another aspect of the present disclosure, a kind of Scrypt algorithm proof of work device is provided, described device is used for The task of multiple proof of work is executed, the task includes first stage and second stage, and described device includes:
Abstraction module, for the first stage in each task, extraction section data are as storing data in the first data It is stored, the quantity of the storing data is less than the quantity of first data;
Each task is respectively corresponding in the period 1 by period 1 execution module for the second stage in each task The first different time slot, in the first time slot corresponding with goal task, according to determining pair of the storing data of the goal task The first data answered generate the second data according to corresponding first data, and the goal task includes any task, The period 1 includes multiple first time slots, and the quantity of first time slot is greater than or equal to the quantity of the task.
In one possible implementation, the abstraction module, comprising:
Each task is respectively corresponding to second round for the first stage in each task by second round implementation sub-module Interior the second different time slot generates the first data, and in the first data in the second time slot corresponding with the goal task Memory is written as storing data in extraction section data, and the second round includes multiple second time slots, second time slot Quantity be greater than or equal to the task quantity.
In one possible implementation, the period 1 execution module, comprising:
Corresponding data searches submodule, for searching in the storing data of the goal task and current second number According to corresponding first data;
Corresponding data determines submodule, for corresponding with current second data when that can not find in the storing data The first data when, according to immediate storing data, determining the first data corresponding with current second data;
Second data acquisition submodule, for according to the first data corresponding with current second data and described current Second data obtain next second data of current second data.
In one possible implementation, first data are ordered sequence, the abstraction module, comprising:
Storage address submodule, for determining according to the sequence number of the storing data storage of the storing data Location;
The corresponding data searches submodule, is used for:
Index address is generated according to the data preset in numerical digit in current second data of the goal task, described The index address is searched in storage address, and the first data corresponding with current second data are determined according to lookup result.
In one possible implementation, the corresponding data determines submodule, is used for:
Determine the difference between immediate storage address and the index address;
According to the number of iterations that the difference determines, the storing data in immediate storage address is iterated fortune It calculates, obtains the first data corresponding with the index address.
In one possible implementation, extraction section data are stored as storing data in the first data, It includes any of the following:
Extraction storing data is spaced according to preset extraction in the first data to be stored;
Storing data is extracted according to preset sequence number range in the first data to be stored;
The storing data that preset quantity is randomly selected in the first data is stored.
In one possible implementation, the storing data of each task is stored in the different memory spaces of memory, institute The quantity for stating memory space is greater than or equal to the quantity of the task.
In one possible implementation, with the second round in preceding, the described period 1 in the rear execution formed Period executes each task.
In one possible implementation, the period 1 further includes free timeslot, the quantity of the free timeslot Or duration is determined according to the delay of the memory.
In one possible implementation, the period 1 and the second round are parallel.
In the embodiments of the present disclosure, in the first stage of Scrypt algorithm proof of work, the extracting part in the first data Divided data is stored as storing data, can save memory space.Multiple tasks are respectively corresponding in the period 1 not The first same time slot, generates the second data in the first time slot corresponding with each task, the execution efficiency of multitask can be improved.
According to below with reference to the accompanying drawings to detailed description of illustrative embodiments, the other feature and aspect of the disclosure will become It is clear.
Detailed description of the invention
Comprising in the description and constituting the attached drawing of part of specification and specification together illustrates the disclosure Exemplary embodiment, feature and aspect, and for explaining the principles of this disclosure.
Fig. 1 shows the flow chart of the Scrypt algorithm proof of work method according to one embodiment of the disclosure;
Fig. 2 shows the flow charts according to the Scrypt algorithm proof of work method of one embodiment of the disclosure;
Fig. 3 shows the flow chart of the Scrypt algorithm proof of work method according to one embodiment of the disclosure;
Fig. 4 shows the block diagram of the Scrypt algorithm proof of work device according to one embodiment of the disclosure.
Specific embodiment
Various exemplary embodiments, feature and the aspect of the disclosure are described in detail below with reference to attached drawing.It is identical in attached drawing Appended drawing reference indicate element functionally identical or similar.Although the various aspects of embodiment are shown in the attached drawings, remove It non-specifically points out, it is not necessary to attached drawing drawn to scale.
Dedicated word " exemplary " means " being used as example, embodiment or illustrative " herein.Here as " exemplary " Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, giving numerous details in specific embodiment below to better illustrate the disclosure. It will be appreciated by those skilled in the art that without certain details, the disclosure equally be can be implemented.In some instances, for Method, means, element and circuit well known to those skilled in the art are not described in detail, in order to highlight the purport of the disclosure.
Fig. 1 shows the flow chart of the Scrypt algorithm proof of work method according to one embodiment of the disclosure, such as Fig. 1 institute Show, method includes:
Step S10, the first stage of each task, extraction section data are deposited as storing data in the first data Storage, the quantity of storing data are less than the quantity of the first data.
In one possible implementation, in virtual digit coin technology, proof of work is to realize system conformance Important mechanisms.Proof of work requires participant to pay a certain amount of computing resource, to prove oneself to complete certain work It measures.In the Scrypt algorithm of virtual digit coin technology, proof of work includes first stage and second stage.In the first rank Section obtains multiple first data after random number being carried out operation using HASH function.There is cascade between each first data Relationship, can be with composition sequence.For example, in the first stage, first can be obtained according to random number 1 using after HASH functional operation A first data.Second the first data can be obtained by first the first data using after HASH functional operation.It can use HASH function obtains the first data of preset quantity after carrying out multiple operation.Each first data can be stored.To save Memory space, the present embodiment extraction section data can be stored as storing data in the first data, can save and deposit Store up space.
In one possible implementation, the quantity of storing data is less than the quantity of the first data, due to the second data It needs to use the first data at random.When the first data needed for calculating the second data are not stored, need according to storage number According to calculating to obtaining, to expend certain computing resource, computational efficiency is reduced.It can be according to saving memory space and guarantee Two aspect demands of computational efficiency, determine the quantity of storing data.
In one possible implementation, extraction section data are stored as storing data in the first data, It includes any of the following:
Extraction storing data is spaced according to preset extraction in the first data to be stored;
Storing data is extracted according to preset sequence number range in the first data to be stored;
The storing data that preset quantity is randomly selected in the first data is stored.
In one possible implementation, extraction interval can be preset.For example, default interval of extracting can be three the One data.First the first data, the 4th the first data, the 8th the first data ... can be then extracted, directly It is stored to the last one storing data is drawn into.In the calculating process of the second data, the first data can be made by random Use, according to extract interval be drawn into column are sought in storage, extraction storing data that can be average in the first data, so that depositing The probability used for storing up data is suitable.
In one possible implementation, there is cascade connection between each first data, each first data can form one A sequence.Sequence number between each first data can be determined according to the genesis sequence of the first data.It can be in the first data Storing data is extracted according to preset sequence number range.For example, sharing 1024 the first data, 1-50,100- can be extracted 150, the first data of the sequence number range of 200-250 ... are as storing data.It can be extracted according to multiple sequence number ranges Storing data can also extract storing data according to a sequence number range.The quantity of the unlimited sequence number range of the disclosure, The length of each sequence number range is not limited.
In one possible implementation, the storing data that preset quantity can be randomly selected in the first data carries out Storage.For example, 256 storing datas can be randomly selected by sharing 1024 the first data, first, the 5th can be randomly selected A, the 15th the first data ... are as storing data.
Step S20, in the second stage of each task, when each task is respectively corresponding to different first in the period 1 Gap determines corresponding first data according to the storing data of goal task in the first time slot corresponding with goal task, according to Corresponding first data generate the second data, and goal task includes any task, and the period 1 includes multiple first time slots, and first The quantity of time slot is greater than or equal to the quantity of task.
In one possible implementation, in second stage, HASH letter can be utilized according to the first data and random number Number carries out operation and obtains the second data.For example, in second stage, can according to the last one first data or according to random number 2, Operation is carried out using HASH function, obtains first the second data.First the second data can be carried out using HASH function Operation obtains the operation result of first the second data, can determine the first data corresponding with first the second data, can be with The operation result of the first data corresponding with first the second data and first the second data is subjected to XOR operation, obtains the Two the second data.Second data can be subjected to operation using HASH function, obtain the operation result of second the second data, Can determine first data corresponding with second the second data, can will it is corresponding with second the second data first number XOR operation is carried out according to the operation result with second the second data, obtains the second data of third.And so on, until obtaining Second data of preset quantity.
It in one possible implementation, can be according to the data and preset set in current second data in numerical digit Data conversion rule obtains the first data corresponding with current second data.Data conversion rule can be determined according to demand, this It is open not limit this.It, can be according to any first data, by calculating due to having cascade connection between each first data To the first data corresponding with any second data.The first number corresponding with each second data can be obtained according to storing data According to.
In one possible implementation, there is cascade connection between the second data.Using in the embodiment of the present disclosure Method is calculated the last one second data, and the last one second data being calculated is exported to Scrypt algorithm Other calculation steps of middle proof of work part, to complete proof of work in Scrypt algorithm, those skilled in the art can With understanding, specific second data export other steps into Scrypt algorithm, with the Scrypt algorithm workload of completion The associated description of proof can refer to the prior art.
In one possible implementation, in the second stage of each task, corresponding with current second data the is determined It is not storing data there are corresponding first data during one data, needs to obtain and work as according to after storing data operation Corresponding first data of preceding second data, obtain next in the first data corresponding with current second data obtained according to operation The case where a second data.In each task, hit rate of corresponding first data of current second data in storing data is different, The number of iterations for obtaining corresponding first data according to storing data operation is different, and operation time is also different, leads to each task Duration needed for second stage is different.In traditional proof of work method, when multiple proof of work task simultaneously When execution, after needing to wait current second data of all tasks to generate, the generating process of next second data just can be carried out, The execution efficiency of each task is low.
In one possible implementation, in the second stage of each task, each task can be respectively corresponding to first The first different time slot in period, period 1 include multiple first time slots, and the quantity of the first time slot is greater than or equal to task Quantity.For example, the period 1 is T1, T1 includes 10 the first time slots, can respectively correspond 10 different tasks, first the One time slot corresponds to task 1, and second the first time slot corresponds to task 2, and the first time slot of third corresponds to task 3 ....At first Within the scope of the corresponding duration of first time slot, the second stage of task 1 is executed, in the corresponding duration range of second the first time slot It is interior, the second stage of task 2 is executed, and so on, until executing next period 1 after the period 1 is finished.
In one possible implementation, it after at least one task execution in multiple tasks, can will hold Corresponding first time slot allocation of task that finishes of row is to new task.For example, task 3 is finished in 10 tasks.It can incite somebody to action The first time slot allocation of third corresponding with task 3 is to new task 11, to improve multitask execution efficiency.
In the present embodiment, in the first stage of Scrypt algorithm proof of work, the extracting part score in the first data It is stored according to as storing data, memory space can be saved.Multiple tasks are respectively corresponding to different in the period 1 First time slot generates the second data in the first time slot corresponding with each task, the execution efficiency of multitask can be improved.
Fig. 2 shows the flow charts according to the Scrypt algorithm proof of work method of one embodiment of the disclosure, such as Fig. 2 institute Show, method includes: step S11, step S20, and wherein step S20 can refer to associated description in above-mentioned Fig. 1, and step S11 includes:
Step S11, in the first stage of each task, when each task is respectively corresponding to different second in second round Gap generates the first data in the second time slot corresponding with goal task, and the conduct of extraction section data is deposited in the first data It stores up data and memory is written, second round includes multiple second time slots, and the quantity of the second time slot is greater than or equal to the quantity of task.
In one possible implementation, when the difference second that each task can be respectively corresponding in second round Gap is in corresponding second time slot of goal task, the first stage of performance objective task, generates the first data, and first Memory is written as storing data in extraction section data in data.It, will since the execution duration of each task second stage is different After each task is respectively corresponding to the period 1, after the completion of one of task, the first corresponding time slot can be discharged, and The first time slot released is used for new task.Correspondingly, can will be corresponding in second round corresponding with the task of completion The second time slot also discharge, and the second time slot released is also distributed to new task, to improve the execution efficiency of multitask.
In one possible implementation, each task period 1 corresponding first time slot serial number, can with The serial number of corresponding second time slot is identical or different in second round.
In the present embodiment, in the first stage of each task, each task is respectively corresponding to different in second round Two time slots generate the first data in the second time slot corresponding with goal task, and extraction section data are made in the first data Memory is written for storing data.By the first stage of each task, also completes, can further mention in corresponding first time slot The execution efficiency of high multitask.
Fig. 3 shows the flow chart of the Scrypt algorithm proof of work method according to one embodiment of the disclosure, such as Fig. 3 institute Show, method includes: step S10, step S21, step S22, step S23, and wherein step S10 can refer to correlation in above-mentioned Fig. 1 and retouch It states, step S21, step S22 and step S23 include:
Step S21 searches the first data corresponding with current second data in the storing data of goal task.
In one possible implementation, storing data is the first data of part.Corresponding with current second data One data may be storing data, it is also possible to not be storing data.When the first data corresponding with current second data are storage When data, the calculating of current second data is used for after can extracting in storing data.
Step S22, when the first data corresponding with current second data can not be found in storing data, according to most Close storing data determines the first data corresponding with current second data.
In one possible implementation, when corresponding with current second data can not be found in storing data , can be according to immediate storing data, after being calculated using HASH function when one data, determining and current second data pair The first data answered.For example, the Serial No. 14 of the first data corresponding with current second data, each first number in storing data According to sequence number be respectively 1,6,11,16 ... etc..It can be utilized according to the 16th the first data closest to sequence number 14 HASH function carries out cascaded computation, obtains the first data of Serial No. 14 corresponding with current second data.
In one possible implementation, sequence number can be less than the first data corresponding with current second data Immediate storing data in sequence number, is determined as immediate storing data.For example, can in the sequence number less than 14, According to the first data of immediate Serial No. 11, cascaded computation is carried out using HASH function, is obtained and current second data First data of corresponding Serial No. 14.
Step S23 obtains current second number according to the first data corresponding with current second data and current second data According to next second data.
In one possible implementation, current second data can be subjected to operation using HASH function and obtains operation As a result, the first data corresponding with current second data and operation result can be carried out XOR operation, current second number is obtained According to next second data.
In the present embodiment, when the first data corresponding with current second data can not be found in each storing data When, according to immediate storing data, determine the first data corresponding with current second data, and according to current second data Corresponding first data and current second data obtain next second data of current second data.Second data can root It is calculated according to storing data, memory space needed for reducing the first data.
In one possible implementation, the first data are ordered sequence, step S10 in method, comprising:
The storage address of storing data is determined according to the sequence number of storing data.
In one possible implementation, the sequence number of storing data can be determined according to the sequence number of the first data. For example, when the first data of Serial No. 1,10,15,20 are as storing data, the sequence number of storing data is also 1,10, 15,20.It can be using the sequence number of storing data as the storage address of storing data.The storage address of i.e. each storing data be 1, 10、15、20。
Step S21, comprising: generate index ground according to the data preset in numerical digit in current second data of goal task Index address is searched in location in storage address, determines the first data corresponding with current second data according to lookup result.
It in one possible implementation, can be the truth of a matter with 2, to preset the data in numerical digit in current second data For index, the index address of current second data is generated.For example, the quantity of the first data is 1024.It can be the truth of a matter with 2, Data using in the second data in last 10 numerical digits obtain 1024 as a result, 1024 first numbers can be corresponded to as index According to.Quantity and the position of default numerical digit can be determined according to demand.
In one possible implementation, index address can be searched in storage address.If in storage address Index address is found, the storing data in storage address identical with index address can be determined as and current second number According to corresponding first data.It, can be in the storage for being less than index address if not finding index address in storage address In address, lookup and the storing data in the immediate storage address of index address obtain and current second by cascade clearing Corresponding first data of data.For example, index address is 14, and storage address 1,5,10,15, it can be 10 according to storage address Storing data, by cascaded computation obtain storage address be 14 the first data.
In the present embodiment, the storage address that storing data is determined according to the sequence number of storing data, according to current second The data preset in numerical digit in data generate index address, and index address is searched in storage address, are determined according to lookup result The first data corresponding with current second data.By storage address and index address, can make and current second data pair The search procedure for the first data answered is simple, reliable.
In one possible implementation, according to immediate storing data, determination is corresponding with current second data First data, comprising:
Determine the difference between immediate storage address and index address.
According to the number of iterations that difference determines, the storing data in immediate storage address is iterated operation, is obtained To the first data corresponding with index address.
In one possible implementation, can be in the storage address for being less than index address, determining and index address Immediate storage address.The difference between immediate storage address and index address can be calculated.For example, index address is 14, the storage address of each storing data is 1,5,10,15,20 ....Storage address 10 can be determined as immediate storage Address determines that difference is 14-10=4.
In one possible implementation, due to having cascade connection between the first data.It can be according to difference, to most Storing data in close storage address is iterated calculating, obtains the first data corresponding with index address.For example, difference It is 4, the storing data in the storage address of most proximity can be subjected to four interative computations using HASH function, obtains and rope Draw corresponding first data in address.
In this embodiment, the difference between immediate storage address and index address can be determined;It is determined according to difference The number of iterations, the storing data in immediate storage address is iterated operation, obtains corresponding with index address One data.The number of iterations is determined according to difference, is calculated according to storing data with can be convenient corresponding with current second data The first data.
In one possible implementation, method further include:
The storing data of each task is stored in the different memory spaces of memory, and the quantity of memory space, which is greater than or equal to, appoints The quantity of business.
In one possible implementation, memory can be divided into different memory spaces.It can be according to task Quantity determine the quantity of memory space.For example, corresponding to 10 tasks, memory can be divided into 10 memory spaces, The corresponding task of each memory space.Storing data can be stored in corresponding memory space by each task, and corresponding Storing data is extracted in memory space, and the second data are calculated.
In the present embodiment, by the way that memory access to be divided into different memory spaces, each task is in corresponding memory space The read-write for carrying out data, can be improved data read-write efficiency, improves the execution efficiency of multitask.
In one possible implementation, it is executed in preceding, second round in the rear execution period formed with the period 1 Each task.
In one possible implementation, for executing the Scrypt algorithm proof of work method of the embodiment of the present disclosure Chip, can be read-only in synchronization or only write.When the method in the embodiment of the present disclosure be applied to synchronization it is read-only or When the chip only write, each task can will be executed in the rear execution period formed in the preceding, period 1 with second round.
For example, a length of T2 when second round, when period 1 a length of T1, be the duration for executing the period with T3=T1+T2.It holds Period 1 T1 is executed after first carrying out second round T2 in the row period.Each task is successively executed to execute cycle T 3, in T3 In T2 duration, the first stage of each task is executed.In T1 duration in T3, the second stage of each task is executed.
In the present embodiment, each task is executed in rear execution period for forming in the preceding, period 1 with second round, it can be with Meet synchronization is read-only or the use environment of chip that only write, improves the applicability of the embodiment of the present disclosure.
In one possible implementation, the period 1 further includes free timeslot, the quantity or duration root of free timeslot It is determined according to the delay of memory.
In one possible implementation, since the time-consuming of the second stage of each task is longer than first stage, first week Interim can also include free timeslot.The duration of period 1 including free timeslot can be longer than the duration of second round.It is empty The quantity or duration of idle gap can be determined according to the lag characteristic of memory.Free timeslot can be used for corresponding to each task Duration needed for computing overhead enables the first time slot in the period 1 to be aligned with each task.
In the present embodiment, the period 1 can also include free timeslot.Free timeslot is used to correspond to the operation of each task Each first time slot in period 1 is aligned with each task, improves the execution efficiency of each task by duration needed for expense.
In one possible implementation, period 1 and second round are parallel.
In one possible implementation, for executing the Scrypt algorithm proof of work method of the embodiment of the present disclosure Chip, can be read while write in synchronization.Method in the embodiment of the present disclosure is applied to read simultaneously in synchronization When the chip write, the period 1 can be parallel with second round.
In the present embodiment, period 1 and second round can satisfy the core that can be read while write in synchronization parallel The use environment of piece improves the applicability of the embodiment of the present disclosure.
Fig. 4 shows the block diagram of the Scrypt algorithm proof of work device according to one embodiment of the disclosure, as shown in figure 4, Device is used to execute the task of multiple proof of work, and task includes first stage and second stage, and device includes:
Abstraction module 10, for the first stage in each task, extraction section data are as storage number in the first data According to being stored, the quantity of storing data is less than the quantity of the first data;
Each task is respectively corresponding to the period 1 for the second stage in each task by period 1 execution module 20 Interior the first different time slot is determined according to the storing data of goal task and is corresponded in the first time slot corresponding with goal task The first data, generate the second data according to corresponding first data, goal task includes any task, and the period 1 includes more A first time slot, the quantity of the first time slot are greater than or equal to the quantity of task.
In one possible implementation, abstraction module 10, comprising:
Each task is respectively corresponding to second round for the first stage in each task by second round implementation sub-module Interior the second different time slot generates the first data, and extract in the first data in the second time slot corresponding with goal task Memory is written as storing data in partial data, and second round includes multiple second time slots, the quantity of the second time slot be greater than or Equal to the quantity of task.
In one possible implementation, period 1 execution module 20, comprising:
Corresponding data searches submodule, corresponding with current second data for searching in the storing data of goal task First data;
Corresponding data determines submodule, for when can not find corresponding with current second data the in storing data When one data, according to immediate storing data, the first data corresponding with current second data are determined;
Second data acquisition submodule, for according to the first data corresponding with current second data and current second number According to obtaining next second data of current second data.
In one possible implementation, the first data are ordered sequence, abstraction module 10, comprising:
Storage address submodule determines the storage address of storing data for the sequence number according to storing data;
Corresponding data searches submodule, is used for:
Index address is generated according to the data preset in numerical digit in current second data of goal task, in storage address Middle lookup index address determines the first data corresponding with current second data according to lookup result.
In one possible implementation, corresponding data determines submodule, is used for:
Determine the difference between immediate storage address and index address;
According to the number of iterations that difference determines, the storing data in immediate storage address is iterated operation, is obtained To the first data corresponding with index address.
In one possible implementation, extraction section data are stored as storing data in the first data, It includes any of the following:
Extraction storing data is spaced according to preset extraction in the first data to be stored;
Storing data is extracted according to preset sequence number range in the first data to be stored;
The storing data that preset quantity is randomly selected in the first data is stored.
In one possible implementation, the storing data of each task is stored in the different memory spaces of memory, deposits The quantity for storing up space is greater than or equal to the quantity of task.
In one possible implementation, it is executed in the preceding, period 1 in the rear execution period formed with second round Each task.
In one possible implementation, the period 1 further includes free timeslot, the quantity or duration root of free timeslot It is determined according to the delay of memory.
In one possible implementation, period 1 and second round are parallel.
In one possible implementation, device further include: distribution module, for when at least one of multiple tasks When task execution finishes, by corresponding first time slot allocation of being finished for task to new task.
The presently disclosed embodiments is described above, above description is exemplary, and non-exclusive, and It is not limited to disclosed each embodiment.Without departing from the scope and spirit of illustrated each embodiment, for this skill Many modifications and changes are obvious for the those of ordinary skill in art field.The selection of term used herein, purport In the principle, practical application or technological improvement to the technology in market for best explaining each embodiment, or lead this technology Other those of ordinary skill in domain can understand each embodiment disclosed herein.

Claims (22)

1. a kind of Scrypt algorithm proof of work method, which is characterized in that the method includes appointing for multiple proof of work Business, the task includes first stage and second stage, which comprises
In the first stage of each task, extraction section data are stored as storing data in the first data, the storage The quantity of data is less than the quantity of first data;
In the second stage of each task, each task is respectively corresponding to the first time slot different in the period 1, is appointed with target It is engaged in corresponding first time slot, corresponding first data is determined according to the storing data of the goal task, according to the correspondence The first data generate the second data, the goal task includes any task, and the period 1 includes multiple first Time slot, the quantity of first time slot are greater than or equal to the quantity of the task.
2. the method according to claim 1, wherein being extracted in the first data in the first stage of each task Partial data is stored as storing data, comprising:
In the first stage of each task, each task is respectively corresponding to the second time slot different in second round,
In the second time slot corresponding with the goal task, the first data, and the extraction section data in the first data are generated Memory is written as storing data, the second round includes multiple second time slots, the quantity of second time slot be greater than or Equal to the quantity of the task.
3. the method according to claim 1, wherein being determined according to the storing data of the goal task corresponding First data generate the second data according to corresponding first data, comprising:
The first data corresponding with current second data are searched in the storing data of the goal task;
When the first data corresponding with current second data can not be found in the storing data, deposited according to immediate Store up data, determining the first data corresponding with current second data;
According to current corresponding first data of second data and current second data, obtain it is described it is current second number According to next second data.
4. according to the method described in claim 3, it is characterized in that, first data are ordered sequence, in the first data Extraction section data are stored as storing data, comprising:
The storage address of the storing data is determined according to the sequence number of the storing data;
The first data corresponding with current second data are searched in the storing data of the goal task, comprising:
Index address is generated according to the data preset in numerical digit in current second data of the goal task, in the storage The index address is searched in address, and the first data corresponding with current second data are determined according to lookup result.
5. according to the method described in claim 4, it is characterized in that, being determined and described current according to immediate storing data Corresponding first data of second data, comprising:
Determine the difference between immediate storage address and the index address;
According to the number of iterations that the difference determines, the storing data in immediate storage address is iterated operation, is obtained To the first data corresponding with the index address.
6. the method according to claim 1, wherein extraction section data are as storing data in the first data It is stored, is included any of the following:
Extraction storing data is spaced according to preset extraction in the first data to be stored;
Storing data is extracted according to preset sequence number range in the first data to be stored;
The storing data that preset quantity is randomly selected in the first data is stored.
7. according to the method described in claim 2, it is characterized in that, the difference that the storing data of each task is stored in memory is deposited Space is stored up, the quantity of the memory space is greater than or equal to the quantity of the task.
8. according to the method described in claim 2, it is characterized in that, with the second round in preceding, the described period 1 rear The execution period of composition executes each task.
9. the method according to claim 1, wherein the period 1 further includes free timeslot, the free time The quantity or duration of time slot are determined according to the delay of the memory.
10. according to the method described in claim 2, it is characterized in that, the period 1 and the second round it is parallel.
11. the method according to claim 1, wherein the method also includes:
When at least one task execution in the multiple task finishes, by corresponding first time slot point of being finished for task It is assigned to new task.
12. a kind of Scrypt algorithm proof of work device, which is characterized in that described device is for executing multiple proof of work Task, the task includes first stage and second stage, and described device includes:
Abstraction module, for the first stage in each task, extraction section data are carried out as storing data in the first data Storage, the quantity of the storing data are less than the quantity of first data;
Each task is respectively corresponding in the period 1 different by period 1 execution module for the second stage in each task The first time slot determined according to the storing data of the goal task corresponding in the first time slot corresponding with goal task First data generate the second data according to corresponding first data, and the goal task includes any task, described Period 1 includes multiple first time slots, and the quantity of first time slot is greater than or equal to the quantity of the task.
13. device according to claim 12, which is characterized in that the abstraction module, comprising:
Each task is respectively corresponding in second round not by second round implementation sub-module for the first stage in each task The second same time slot generates the first data, and extract in the first data in the second time slot corresponding with the goal task Memory is written as storing data in partial data, and the second round includes multiple second time slots, the number of second time slot Amount is greater than or equal to the quantity of the task.
14. device according to claim 12, which is characterized in that the period 1 execution module, comprising:
Corresponding data searches submodule, for searching and current second data pair in the storing data of the goal task The first data answered;
Corresponding data determines submodule, for when can not find corresponding with current second data the in the storing data When one data, according to immediate storing data, determining the first data corresponding with current second data;
Second data acquisition submodule, for according to the first data corresponding with current second data and described current second Data obtain next second data of current second data.
15. device according to claim 14, which is characterized in that first data are ordered sequence, the extraction mould Block, comprising:
Storage address submodule, for determining the storage address of the storing data according to the sequence number of the storing data;
The corresponding data searches submodule, is used for:
Index address is generated according to the data preset in numerical digit in current second data of the goal task, in the storage The index address is searched in address, and the first data corresponding with current second data are determined according to lookup result.
16. device according to claim 15, which is characterized in that the corresponding data determines submodule, is used for:
Determine the difference between immediate storage address and the index address;
According to the number of iterations that the difference determines, the storing data in immediate storage address is iterated operation, is obtained To the first data corresponding with the index address.
17. device according to claim 12, which is characterized in that extraction section data are as storage number in the first data According to being stored, include any of the following:
Extraction storing data is spaced according to preset extraction in the first data to be stored;
Storing data is extracted according to preset sequence number range in the first data to be stored;
The storing data that preset quantity is randomly selected in the first data is stored.
18. device according to claim 13, which is characterized in that the storing data of each task is stored in the difference of memory Memory space, the quantity of the memory space are greater than or equal to the quantity of the task.
19. device according to claim 13, which is characterized in that existed with the second round in preceding, the described period 1 The execution period formed afterwards executes each task.
20. device according to claim 12, which is characterized in that the period 1 further includes free timeslot, the sky The quantity or duration of idle gap are determined according to the delay of the memory.
21. device according to claim 13, which is characterized in that the period 1 and the second round are parallel.
22. device according to claim 12, which is characterized in that described device further include:
Distribution module, the task pair for will be finished when at least one task execution in the multiple task finishes The first time slot allocation answered is to new task.
CN201910068396.6A 2019-01-24 Scrypt algorithm workload proving method and Scrypt algorithm workload proving device Active CN109815372B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910068396.6A CN109815372B (en) 2019-01-24 Scrypt algorithm workload proving method and Scrypt algorithm workload proving device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910068396.6A CN109815372B (en) 2019-01-24 Scrypt algorithm workload proving method and Scrypt algorithm workload proving device

Publications (2)

Publication Number Publication Date
CN109815372A true CN109815372A (en) 2019-05-28
CN109815372B CN109815372B (en) 2024-11-08

Family

ID=

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1920781A (en) * 2005-08-24 2007-02-28 松下电器产业株式会社 Task execution device and method
CN1971710A (en) * 2006-12-08 2007-05-30 中兴通讯股份有限公司 Single-chip based multi-channel multi-voice codec scheduling method
CN104718428A (en) * 2012-10-15 2015-06-17 株式会社日立高新技术 Pattern inspecting and measuring device and program
CN105515565A (en) * 2015-12-14 2016-04-20 天津光电通信技术有限公司 Hardware logical resource reuse module and method for realizing reuse
WO2016147279A1 (en) * 2015-03-13 2016-09-22 富士通株式会社 Data management control program, data management control device, and data management control method
CN106919628A (en) * 2015-12-28 2017-07-04 阿里巴巴集团控股有限公司 A kind for the treatment of method and apparatus of diagram data
CN107396447A (en) * 2017-08-02 2017-11-24 苏州欧普照明有限公司 Slot allocation method, the apparatus and system of the star-like networkings of LoRa
CN107451292A (en) * 2017-08-16 2017-12-08 北京京东尚科信息技术有限公司 Scene feature data storage method, system and data extraction system on line
CN107748794A (en) * 2017-11-03 2018-03-02 中国人民解放军陆军工程大学 Spatial data storage method
CN108322304A (en) * 2018-02-28 2018-07-24 北京比特大陆科技有限公司 The computational methods and device of proof of work, electronic equipment, program and medium
CN108549830A (en) * 2018-04-11 2018-09-18 思力科(深圳)电子科技有限公司 A kind of RFID reader and block chain network applied to block chain

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1920781A (en) * 2005-08-24 2007-02-28 松下电器产业株式会社 Task execution device and method
US20070050779A1 (en) * 2005-08-24 2007-03-01 Matsushita Electric Industrial Co., Ltd. Task execution device and method
CN1971710A (en) * 2006-12-08 2007-05-30 中兴通讯股份有限公司 Single-chip based multi-channel multi-voice codec scheduling method
CN104718428A (en) * 2012-10-15 2015-06-17 株式会社日立高新技术 Pattern inspecting and measuring device and program
WO2016147279A1 (en) * 2015-03-13 2016-09-22 富士通株式会社 Data management control program, data management control device, and data management control method
CN105515565A (en) * 2015-12-14 2016-04-20 天津光电通信技术有限公司 Hardware logical resource reuse module and method for realizing reuse
CN106919628A (en) * 2015-12-28 2017-07-04 阿里巴巴集团控股有限公司 A kind for the treatment of method and apparatus of diagram data
CN107396447A (en) * 2017-08-02 2017-11-24 苏州欧普照明有限公司 Slot allocation method, the apparatus and system of the star-like networkings of LoRa
CN107451292A (en) * 2017-08-16 2017-12-08 北京京东尚科信息技术有限公司 Scene feature data storage method, system and data extraction system on line
CN107748794A (en) * 2017-11-03 2018-03-02 中国人民解放军陆军工程大学 Spatial data storage method
CN108322304A (en) * 2018-02-28 2018-07-24 北京比特大陆科技有限公司 The computational methods and device of proof of work, electronic equipment, program and medium
CN108549830A (en) * 2018-04-11 2018-09-18 思力科(深圳)电子科技有限公司 A kind of RFID reader and block chain network applied to block chain

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
古古今今: "莱特币背后的秘密-白话scrypt密码算法", Retrieved from the Internet <URL:https://zhuanlan.zhihu.com/p/32484253?fro> *
斯雪明: "区块链安全研究综述", 密码学报 *
阿尔文德 林华等: "区块链:技术驱动金融", vol. 2016, 31 August 2016, 中信出版社, pages: 249 - 280 *

Similar Documents

Publication Publication Date Title
JP4339381B2 (en) Shared memory multiprocessor system and information processing method thereof
CN105630955B (en) A kind of data acquisition system member management method of high-efficiency dynamic
Raghavan et al. On randomly interleaved memories
CN106033420A (en) A Hash table processing method and device
CN110058882B (en) OPU instruction set definition method for CNN acceleration
CN109298888B (en) Queue data access method and device
CN110187965A (en) The running optimizatin and data processing method of neural network, equipment and storage medium
CN105159987B (en) A kind of storage of data, lookup method and device
CN107480771B (en) Deep learning-based activation function realization method and device
CN105359142A (en) Hash join method, device and database management system
CN109033365A (en) A kind of data processing method and relevant device
US9081561B2 (en) Method for improving execution performance of multiply-add instruction during compiling
CN110019184A (en) A kind of method of the orderly integer array of compression and decompression
CN110019205A (en) A kind of data storage, restoring method, device and computer equipment
CN108762719B (en) Parallel generalized inner product reconstruction controller
CN109815372A (en) Scrypt algorithm workload proving method and device
CN110362577B (en) Data insertion method, device, equipment and storage medium
Shang et al. LACS: A high-computational-efficiency accelerator for CNNs
US20070156769A1 (en) Partition elimination system for a database that uses a multi-level partitioning definition
CN110515860A (en) The address of storing data identifies method, system and device in a kind of memory
CN109816110A (en) Scrypt algorithm workload proving method and device
CN110059378B (en) Automatic manufacturing system Petri network state generation method based on GPU parallel computing
CN116450334A (en) GPU resource scheduling method
CN112464157B (en) Vector ordering method and system
CN111143456A (en) Spark-based Cassandra data import method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20211025

Address after: 200436 room 138, No. 5 and 6, Lane 1188, Wanrong Road, Jing'an District, Shanghai

Applicant after: Shanghai Canaan Jiesi Information Technology Co.,Ltd.

Address before: 310026 room 1203, floor 12, building 4, No. 9, Jiuhuan Road, Jianggan District, Hangzhou, Zhejiang Province

Applicant before: Hangzhou Canaan Creative Information Technology Ltd.

TA01 Transfer of patent application right
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant