A kind of tobacco based on block chain is false proof and source tracing method and system
Technical field
The present invention relates to false proof and tracing technology field, more particularly to a kind of tobacco based on block chain is false proof and the side of tracing to the source
Method and system.
Background technology
China is always tobacco consumption big country, with the improvement of people's living standards, tobacco consumption is also increasing.《2015
Year Chinese Adult tobacco survey report》Report display, population of China smoking rate no significant changes compared with before 5 years, it is
27.7%.Wherein, smoking rate in male 52.1%, women 2.7%.Because population increases, pushed away according to current smoking rate
Calculate, the present number of smokers of China than 5 years before increase 15,000,000, up to 3.16 hundred million.Smoker's averagely smoking 15.2 daily
Branch, compared with before 5 years, adds 1.In January, 2016, the national case of cigarette sales volume 4,780,000, single box pin sell average price 3.41 ten thousand
Member, total value about 163,000,000,000, whole year are estimated not less than 1.956 trillion.But thering is professional to point out, false smoke is sold about over the years
For the 15% of normal sale volume, calculated by the budget total value in this year, false smoke market scale will be up to 293,400,000,000;National loss tax revenue surpasses
90000000000.In late November, 2015, State Tobacco Monopoly Bureau was in emphasis such as Guangdong, Guangxi, Fujian, Henan in early March, 2016
Cigarette is carried out and has cracked down on counterfeit goods focus efforts on special areas of combatting smuggling in area.Circular display, 4 emphasis save (area) and discover and seize 2.16 ten thousand (standards of false smoke altogether
Hundred million) part every 10,000, total value 1.36, discover and seize smuggled cigarrete 1.18 ten thousand, discover and seize 873.1 tons of pipe tobacco tobacco leaf, track down more than 50,000 yuan
Case 279 rises;It can be seen that illegal tobacco monopoly commodities quantity is substantially increased, Fujian, Guangdong are discovered and seized false smoke quantity and increased respectively on year-on-year basis
40%th, 31%, Fujian, Guangxi discover and seize smuggled cigarrete quantity and increase by 213%, 186% respectively on year-on-year basis, and pipe tobacco cigarette is discovered and seized in Guangxi, Fujian
Number of sheets amount increases by 211%, 77% respectively on year-on-year basis.
Tobacco personation is directed to, the anti-counterfeiting technology of tobacco is all the focus technology of tobacco business concern over the years, traditional
Method for anti-counterfeit have 3D hologram film, fluorescence private mark is false proof, frequency conversion ink is false proof, photochromatic printing ink is false proof, package printing process is false proof,
Cork paper is decorated false proof etc.;High-grade cigarette is used in combination even with multiple anti-fake technology;But traditional anti-counterfeiting technology cost is high, such as cloud
Cigarette 2016 estimates that the box of shipment amount 11,800,000,000 calculates, and singly does 3D hologram film one, for cost just close to 1.2 hundred million, cost is very high;Together
When, externally circular does not publicize this type of information for most producers itself, and smoker is simultaneously unaware of, so that false proof effect is low
It is micro-;In addition, anti-counterfeiting technology stops vision aspect more, reproducibility is high, and memory is difficult, identification is more difficult to, so being directed to current tobacco row
The present situation of industry anti-counterfeiting technology is, it is necessary to propose a kind of relatively reliable efficient false proof and source tracing method.
The content of the invention
A kind of relatively reliable efficient tobacco is false proof and source tracing method in order to provide, and the embodiments of the invention provide a kind of base
In the tobacco of block chain is false proof and source tracing method and system.The technical scheme is as follows:
First aspect, there is provided a kind of tobacco based on block chain is false proof and source tracing method, methods described include:
S1, generate hash values for every cigarette, the first identification code according to corresponding to the hash values of every cigarette generate respectively,
First identification code is printed on corresponding every cigarette, and the hash values of every cigarette are write block chain
Merkle trees;
S2, according to the hash values of every cigarette in a deck calculate the first tree root hash values, according to first tree
Root hash values generate the second identification code, by second identification code printing corresponding to the deck packing box on, and will
The merkle trees of first tree root hash values write-in block chain corresponding to the often bag cigarette calculated;
S3, according in a cigarette often bag cigarette hash values calculate the second tree root hash values, according to the second tree root hash
Value the 3rd identification code of generation, the 3rd identification code is printed on the packing box of one carton of cigarette, and by every cigarette of calculating
The merkle trees of corresponding second tree root hash values write-in block chain;
S4, hash values the 3rd tree root hash values of calculating according to every cigarette in one case cigarette, according to the 3rd tree root hash
Value the 4th identification code of generation, the 4th identification code is printed on the packing box of one case cigarette, and by every case cigarette of calculating
The merkle trees of corresponding 3rd tree root hash values write-in block chain;
S5, according to a batch of hash values the 4th tree root hash values of calculating per case cigarette, and by the 4th tree root hash
Value write-in block chain merkle trees;
During S6, carrier transportation, by identifying per the identification code on case tobacco, transit node information and time are recorded
Information, and the transit node information and temporal information are write in block chain chain, and according to differentiating identification marking code
The true and false of tobacco;
After S7, retailer and consumer obtain the tobacco, differentiate the true and false of the tobacco according to identification code.
With reference in a first aspect, in the first mode in the cards, it is additionally included in when performing step S2 in block chain
Write Tobacco Reference;
The Tobacco Reference includes manufacturer, date of manufacture, production address, product batch number.
With reference to the first mode in the cards of first aspect, in second of mode in the cards, the retail
After business and consumer obtain tobacco, the true and false for differentiating the tobacco according to identification code includes:
After the retailer and consumer obtain tobacco, the 4th mark on the packing box by identifying one case tobacco
Code, hash values corresponding to acquisition, and by identifying the 3rd identification code in the case on the packing box of one carton of cigarette, obtain
Corresponding hash values;
The hash values corresponding with the 3rd identification code of hash values corresponding to the 4th identification code of acquisition are calculated, really
Whether a fixed cigarette belongs to the case;And/or
The 3rd identification code on packing box by identifying one carton of cigarette, hash values corresponding to acquisition, and pass through knowledge
Second identification code on the packing box of a deck in not described cigarette, hash values corresponding to acquisition;
The hash values corresponding with second identification code of hash values corresponding to the 3rd identification code of acquisition are calculated, really
Whether the fixed deck belongs to a cigarette;And/or
Second identification code on packing box by identifying a deck, hash values corresponding to acquisition, and pass through knowledge
The first identification code on a cigarette in not described deck, hash values corresponding to acquisition;
The hash values of second identification code of acquisition hash values corresponding with first identification code are calculated, determine institute
State whether a cigarette belongs to the deck;
Wherein, after Tobacco Reference being write into block chain, shared in block chain, by the 4th mark for identifying one case cigarette
Code, the 3rd identification code, the second identification code of a deck and the first identification code of a cigarette of one carton of cigarette obtain the Tobacco Reference.
With reference in a first aspect, in the third mode in the cards, during the carrier transportation, marked according to identification
Know code and differentiate that the true and false of the tobacco includes:
The 4th identification code on case tobacco by identifying examination at random, obtains hash values corresponding with the 4th identification code;
Calculated according to the hash values of acquisition and this batch kinds of goods hash values, determining the case tobacco of the examination at random is
It is no to belong to the batch.
With reference to the third any one mode in the cards of first aspect to first aspect, may be realized at the 4th kind
Mode in, the identification code includes Quick Response Code, bar code or RFID codes.
Second aspect, there is provided a kind of tobacco based on block chain is false proof and traceability system, the system include first eventually
End equipment, identification equipment and second terminal equipment, wherein,
The first terminal equipment includes:
Every cigarette hash value generation module, for generating hash values for every cigarette;
Identification code generating module, for the first identification code corresponding to being generated respectively according to the hash values of every cigarette;
Module is printed, for first identification code to be printed on into corresponding every cigarette;
First writing module, for the hash values of every cigarette being write the merkle trees of block chain;
First tree root hash value computing modules, for calculating the first tree according to the hash values of every cigarette in a deck
Root hash values;
The identification code generating module is additionally operable to generate the second identification code according to the first tree root hash values;
It is described printing module be additionally operable to by second identification code printing corresponding to the deck packing box on;
First writing module is additionally operable to the first tree root hash values write-in block chain corresponding to the often bag cigarette of calculating
Merkle trees;
Second tree root hash value computing modules, for according to often the hash values of bag cigarette calculate the second tree root hash in a cigarette
Value;
The identification code generating module is additionally operable to generate the 3rd identification code according to the second tree root hash values;
The printing module is additionally operable to the 3rd identification code being printed on the packing box of one carton of cigarette;
First writing module is additionally operable to the second tree root hash values write-in block chain corresponding to every cigarette of calculating
Merkle trees;
3rd tree root hash value generation modules, the 3rd tree root hash is calculated for the hash values according to every cigarette in one case cigarette
Value;
The identification code generating module is additionally operable to generate the 4th identification code according to the 3rd tree root hash values;
The printing module is additionally operable to the 4th identification code being printed on the packing box of one case cigarette;
First writing module is additionally operable to the 3rd tree root hash values write-in block chain corresponding to every case cigarette of calculating
Merkle trees;
4th tree root hash value computing modules, for calculating the 4th tree root hash according to a batch of hash values per case cigarette
Value;
First writing module is additionally operable to the 4th tree root hash values writing block chain merkle trees;
The identification equipment includes:
First identification code identification module, during carrier transportation, identify per the identification code on case tobacco;
Logging modle, for by identifying per the identification code on case tobacco, recording transit node information and temporal information;
Second writing module, for by the transit node information and temporal information write-in block chain chain;
First identification module, for differentiating the true and false of the tobacco according to identification marking code;
Second terminal equipment includes:
Second identification module, for after retailer and consumer obtain the tobacco, differentiating the cigarette according to identification code
The true and false of grass.
With reference to second aspect, in the first mode in the cards, first writing module is additionally operable in block chain
Middle write-in Tobacco Reference;
The Tobacco Reference includes manufacturer, date of manufacture, production address, product batch number.
With reference to the first mode in the cards of second aspect, in second of mode in the cards, described second
Identification module includes:
Second identification code recognition unit, for after the retailer and consumer obtain tobacco, identifying one case tobacco
The 4th identification code on packing box;
First hash value acquiring units, the 4th identification code on the packing box by identifying one case tobacco obtain
Corresponding hash values;
The second identification code recognition unit is additionally operable to identify in the case the 3rd mark on the packing box of one carton of cigarette
Know code;
The first hash value acquiring units are additionally operable to by identifying in the case described on the packing box of one carton of cigarette
Hash values corresponding to the acquisition of three identification codes;
First determining unit, for hash values corresponding to the 4th identification code by acquisition and the 3rd identification code pair
The hash values answered calculate, and determine whether a cigarette belongs to the case;And/or
The first hash value acquiring units are additionally operable to the 3rd identification code on the packing box by one carton of cigarette of identification,
Hash values corresponding to acquisition;
The second identification code recognition unit is additionally operable to identify described on the packing box of the deck in a cigarette
Second identification code;
The first hash value acquiring units are additionally operable on the packing box by identifying the deck in one carton of cigarette
Hash values corresponding to the second identification code acquisition;
First determining unit is additionally operable to hash values corresponding to the 3rd identification code of acquisition and the described second mark
Know hash values corresponding to code to calculate, determine whether the deck belongs to a cigarette;And/or
The first hash value acquiring units are additionally operable to by second identification code on the packing box that identifies a deck,
Hash values corresponding to acquisition;
The second identification code recognition unit is additionally operable to identify the first identification code on a cigarette in the deck;
The first hash value acquiring units are additionally operable to by identifying the first mark on a cigarette in the deck
Hash values corresponding to code acquisition;
First determining unit is additionally operable to the hash values of second identification code of acquisition and first identification code
Corresponding hash values calculate, and determine whether a cigarette belongs to the deck;
Wherein, after Tobacco Reference is write block chain by first writing module, shared in block chain, the second identification code
Recognition unit is by identifying the second identification code and one of the 4th identification code of one case cigarette, the 3rd identification code of one carton of cigarette, a deck
First identification code of branch cigarette obtains the Tobacco Reference.
With reference to second aspect, in the third mode in the cards, first identification module includes:
2nd hash value acquiring units, for by identify examination at random case tobacco on the 4th identification code, obtain with it is described
Hash values corresponding to 4th identification code;
Second determining unit, calculated for the hash values according to acquisition and this batch kinds of goods hash values, it is determined that
Whether the case tobacco of the examination at random belongs to the batch.
With reference to the third any one mode in the cards of second aspect to second aspect, may be realized at the 4th kind
Mode in, the identification code includes Quick Response Code, bar code or RFID codes.
The beneficial effect that technical scheme provided in an embodiment of the present invention is brought is:
The embodiments of the invention provide a kind of tobacco based on block chain is false proof and source tracing method and system, method by for
Every cigarette generates hash values, the hash values of every cigarette generate respectively corresponding to the first identification code be printed on corresponding every cigarette,
First tree root hash values, deck bag corresponding to generation the second identification code printing are calculated according to the hash values of every cigarette in a deck
In mounted box;According to often the hash values of bag cigarette calculate the second tree root hash values in a cigarette, the 3rd identification code of generation is printed on one article
On the packing box of cigarette;3rd tree root hash values, generation the 4th identification code printing are calculated according to the hash values of every cigarette in one case cigarette
On the packing box of one case cigarette;4th tree root hash values are calculated according to a batch of hash values per case cigarette;And by tobacco from
Every hash value to bag, bar, case and batch writes block chain merkle trees;So cause tobacco from batch to the batch bag
All case tobaccos for containing, the every packaging included to every case tobacco tobacco, arrive often bag tobacco that every tobacco includes, finally again
The every tobacco included to often bag tobacco has unique corresponding hash values, and often the hash values of bag tobacco are every by what is wherein included
The hash values of branch tobacco are calculated, and the hash values of every tobacco are calculated by the hash values of the often bag tobacco wherein included,
It is calculated per the hash values of case tobacco by the hash values of the every tobacco wherein included, the hash values of a collection of tobacco are by wherein wrapping
The hash values of the every case tobacco contained are calculated, so so that tobacco from, bag, bar to case and batch pass through it is stacked
Merkle trees realize management, merkle trees deposit block chain so that every cigarette is bound with bag cigarette, and often bag cigarette is tied up with stip cigarette packing
Fixed, every packaging cigarette is bound with case packing cigarette, if a cigarette therein or a deck or cigarette etc. change, can be caused
The hash values of all tree nodes of whole block chain merkle trees deposit change, so as to ensure tobacco in block chain
The true and false is with tracing to the source;Meanwhile during carrier transportation, by identifying per the identification code on case tobacco, record transit node information
And temporal information, and the transit node information and temporal information are write in block chain chain, and reflected according to identification marking code
The true and false of not described tobacco;And after retailer and consumer obtain the tobacco, the true of the tobacco is differentiated according to identification code
It is pseudo-;When so forwarding agent or other departments inspect tobacco by random samples, by identifying hash values corresponding to the acquisition of the identification code on case packing,
Being calculated by the hash values and the hash values of the batch tobacco, both match, it is determined that the case tobacco belongs to the batch, from
And it ensure that the authenticity of the case tobacco;After retailer obtains tobacco, the identification code or correspondingly in bar packaging can be identified
Hash values, the hash values for passing through the hash values and the case tobacco calculate, and both match, it is determined that this carton packaging tobacco belongs to this
Case, so as to which retailer can determine tobacco authenticity, after consumer gets deck grass, identify that the identification code in cigarette obtains
Hash values are taken, are calculated by the hash values and the hash values of the bag tobacco, both match, it is determined that the branch tobacco belongs to the bag,
So that each link can authenticate to the true and false of tobacco and inquire the Tobacco References such as the place of production, production time, supply
Each node of chain can also verify the real reliability of product, so as to which tobacco provided in an embodiment of the present invention is false proof and traces to the source
Method, improves the intelligibility of checking, conveniently recognizes and efficient;In addition, in the packaging that the identification code of generation need to only be printed, with showing
Have the 3D hologram mould of technology, that fluorescence private mark is false proof, frequency conversion ink is false proof, photochromatic printing ink is false proof etc. is low compared to cost, and print
Process is convenient, without other costs or anti-fake material.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing.
Fig. 1 is that a kind of tobacco based on block chain provided in an embodiment of the present invention is false proof and source tracing method flow chart;
Fig. 2 is that a kind of tobacco based on block chain provided in an embodiment of the present invention is false proof and traceability system structural representation.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached in the embodiment of the present invention
Figure, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only this
Invention part of the embodiment, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art exist
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Embodiment one
The embodiments of the invention provide a kind of tobacco based on block chain is false proof and source tracing method, shown in reference picture 1, method
Including:
S1, generate hash values for every cigarette, the first identification code according to corresponding to the hash values of every cigarette generate respectively, by the
One identification code is printed on corresponding every cigarette, and the hash values of every cigarette is write the merkle trees of block chain.
Wherein, the identification code described in the embodiment of the present invention includes Quick Response Code, bar code or RFID codes, can also be that other are suitable
For printing or the subsidiary identification code on tobacco or other commodity, the present invention implements involved first, second, third, the
Four identification codes are the identification code.
Specifically, the process of hash values is generated for every cigarette to be included:
A, flag code is distributed for every cigarette;
The flag code is used as flag code including the use of ASCII character arrangement.
For example, marking every cigarette with ASCII character, 7 bit ASCII codes can be with unduplicated mark 1287Branch cigarette;Can also
Using other flag codes of numeral, symbol or letter as every cigarette, the embodiment of the present invention is not limited to this.
B, according to the flag code of every cigarette, hash values corresponding with every cigarette are generated;
Specifically, according to the flag code distributed for every cigarette, corresponding hash values are calculated by hash algorithm.
Wherein, if first identification code is Quick Response Code, by every cigarette hash value generate respectively corresponding to Quick Response Code, then will
The Quick Response Code of every cigarette is printed on the overwrap of cigarette, and the hash values of every cigarette is write the merkle trees of block chain
(described tree in data structure) is recorded.
By distributing flag code for every cigarette to generate corresponding hash values, mark is generated further according to the hash values of every cigarette
Code, it is printed upon on corresponding every cigarette, and the hash values of every cigarette is write to the merkle trees of block chain, so as to passes through area
Block chain records to every cigarette, if the tobacco of personation, then corresponding hash values can not be got in block chain, so as to really
Not being counterfeited for every cigarette has been protected, and it can have been traced to the source.
S2, according to the hash values of every cigarette in a deck calculate the first tree root hash values, according to the first tree root hash values
The second identification code is generated, by corresponding to the printing of the second identification code on the packing box of a deck, and the often bag cigarette of calculating is corresponding
The first tree root hash values write-in block chain merkle trees.
Wherein, it is additionally included in block chain and writes Tobacco Reference;
Tobacco Reference includes manufacturer, date of manufacture, production address, product batch number;In addition, other cigarettes can also be included
Careless information, such as the tobacco place of production, each component content of tobacco, the embodiment of the present invention are not limited the Tobacco Reference specifically write
It is fixed.
Specifically, when the first tree root hash values corresponding to every bag cigarette to be write to the merkle of block chain, while by the cigarette
Careless information is in company with often bag cigarette write-in block chain, to share the Tobacco Reference in block chain.
By the way that Tobacco Reference is write into block chain in company with often bag cigarette, facilitate other people and obtain Tobacco Reference, meanwhile, because
The Tobacco Reference of write-in block chain can be shared, so as to when other people identify cigarette, a deck or cigarette etc., can obtain
Tobacco Reference, facilitate user checked with realize tobacco is traced to the source.
S3, according in a cigarette often bag cigarette hash values calculate the second tree root hash values, according to the second tree root hash values life
Into the 3rd identification code, the 3rd identification code is printed on the packing box of one carton of cigarette, and by the second tree corresponding to every cigarette of calculating
Root hash values write the merkle trees of block chain.
S4, hash values the 3rd tree root hash values of calculating according to every cigarette in one case cigarette, give birth to according to the 3rd tree root hash values
Into the 4th identification code, the 4th identification code is printed on the packing box of one case cigarette, and by three-tree corresponding to every case cigarette of calculating
Root hash values write the merkle trees of block chain.
S5, hash values the 4th tree root hash values of calculating according to a batch of every case cigarette, and the 4th tree root hash values are write
Enter block chain merkle trees.
Specifically, also include:
By the merkle trees of the 4th tree root hash values write-in block chain corresponding to the tobacco of every batch.
During S6, carrier transportation, by identifying per the identification code on case tobacco, transit node information and time are recorded
Information, and transit node information and temporal information are write in block chain chain, and the true of tobacco is differentiated according to identification marking code
It is pseudo-.
Specifically, during carrier transportation, differentiating the process of the true and false of tobacco according to identification marking code can include:
The 4th identification code on case tobacco by identifying examination at random, obtains hash values corresponding with the 4th identification code;
Calculated according to the hash values of acquisition and this batch kinds of goods hash values, criticized it is determined that whether the case tobacco of examination at random belongs to
It is secondary.
After S7, retailer and consumer obtain tobacco, differentiate the true and false of tobacco according to identification code.
Retailer and consumer may get case packing tobacco, in bar packaging tobacco, bag are packed tobacco and often wrapped
Every tobacco, the true and false of checking tobacco is can verify that from every, bag, bar to case, and preferable retailer is by verifying every cigarette
It is no belong to the case and often bag cigarette whether belong to this carry out verify the tobacco true and false, consume very preferably by whether verifying every cigarette
Belong to the bag checking tobacco true and false;
Specifically, the process can include:
After retailer and consumer obtain tobacco, the 4th identification code on packing box by identifying one case tobacco, obtain
Corresponding hash values, and by identifying the 3rd identification code in case on the packing box of one carton of cigarette, hash values corresponding to acquisition;
The hash values corresponding with the 3rd identification code of hash values corresponding to 4th identification code of acquisition are calculated, determine a cigarette
Whether case is belonged to;And/or
The 3rd identification code on packing box by identifying one carton of cigarette, hash values corresponding to acquisition, and pass through identification one
The second identification code on the packing box of a deck in bar cigarette, hash values corresponding to acquisition;
The hash values corresponding with the second identification code of hash values corresponding to 3rd identification code of acquisition are calculated, determine a deck
Whether a cigarette is belonged to;And/or
The second identification code on packing box by identifying a deck, hash values corresponding to acquisition, and pass through identification one
The first identification code on a cigarette in bag cigarette, hash values corresponding to acquisition;
The hash values of second identification code of acquisition hash values corresponding with the first identification code are calculated, whether determine a cigarette
Belong to a deck;
Wherein, after Tobacco Reference being write into block chain, shared in block chain, by the 4th mark for identifying one case cigarette
Code, the 3rd identification code, the second identification code of a deck and the first identification code of a cigarette of one carton of cigarette obtain Tobacco Reference.
Optionally, this method provided in an embodiment of the present invention can also be applied to medicine, food, vaccine, brand article, luxurious
The fields such as wasteful product it is false proof with tracing to the source, if used in these fields it is false proof with source tracing method with of the invention on the false proof of tobacco
Belong to same thinking with source tracing method, then within protection scope of the present invention.
Optionally, method provided in an embodiment of the present invention can be applied to share chain, alliance's chain and privately owned chain in block chain
In any one.
The embodiments of the invention provide a kind of tobacco based on block chain is false proof and source tracing method, by being generated for every cigarette
Hash values, the hash values of every cigarette generate respectively corresponding to the first identification code be printed on corresponding on every cigarette, according to a deck
In the hash values of every cigarette calculate the first tree root hash values, the second identification code of generation print corresponding on deck packing box;Root
According to often the hash values of bag cigarette calculate the second tree root hash values in a cigarette, the 3rd identification code of generation is printed on the packing box of one carton of cigarette
On;3rd tree root hash values are calculated according to the hash values of every cigarette in one case cigarette, the 4th identification code is generated and is printed on one case cigarette
On packing box;4th tree root hash values are calculated according to a batch of hash values per case cigarette;And by tobacco from every to bag,
The hash values of bar, case and batch write block chain merkle trees;Tobacco is so caused to be included from batch to the batch all
Case tobacco, the every packaging included to every case tobacco tobacco, arrive often bag tobacco that every tobacco includes again, finally arrive often bag cigarette
Every tobacco that straw bag contains have it is unique corresponding to hash values, and often the hash values of bag tobacco by every tobacco wherein including
Hash values are calculated, and the hash values of every tobacco are calculated by the hash values of the often bag tobacco wherein included, per case tobacco
Hash values be calculated by the hash values of the every tobacco wherein included, the hash values of a collection of tobacco are by every case for wherein including
The hash values of tobacco are calculated, so so that tobacco from, bag, bar to case and batch realized by stacked merkle trees
Management, merkle trees deposit block chain so that every cigarette is bound with bag cigarette, and often bag cigarette is bound with stip cigarette packing, every packaging cigarette
Bound with case packing cigarette, if a cigarette therein or a deck or cigarette etc. change, whole block chain can be caused
The hash values of all tree nodes of merkle trees deposit change, so as to ensure the true and false of tobacco in block chain with tracing back
Source;Meanwhile during carrier transportation, by identifying per the identification code on case tobacco, record transit node information and time letter
Breath, and transit node information and temporal information are write in block chain chain, and differentiate the true and false of tobacco according to identification marking code;
And after retailer and consumer obtain tobacco, differentiate the true and false of tobacco according to identification code;So forwarding agent or other departments
Inspect by random samples tobacco when, by identify the identification code on case packing obtain corresponding to hash values, pass through the hash values and the batch tobacco
Hash values calculated, both match, it is determined that the case tobacco belongs to the batch, ensures that the true of the case tobacco
Property;After retailer obtains tobacco, the identification code in bar packaging or corresponding hash values can be identified, by the hash values and
The hash values of the case tobacco calculate, and both match, it is determined that this packs tobacco and belong to the case, so as to which retailer can determine cigarette
Careless authenticity, after consumer gets deck grass, identify that the identification code in cigarette obtains hash values, by the hash values and
The hash values of the bag tobacco calculate, and both match, it is determined that the branch tobacco belongs to the bag, so that each link can
Authenticate to the true and false of tobacco and inquire the Tobacco References such as the place of production, production time, each node of supply chain can also be verified
The real reliability of product, so as to which tobacco provided in an embodiment of the present invention is false proof and source tracing method, the intelligibility of checking is improved,
Conveniently recognize and efficient;In addition, in the packaging that the identification code of generation need to only be printed, 3D hologram mould, fluorescence with prior art
It is low compared to cost that private mark is false proof, frequency conversion ink is false proof, photochromatic printing ink is false proof etc., and it is convenient to print process, without other costs or
Anti-fake material.
Embodiment two
The embodiments of the invention provide a kind of tobacco based on block chain is false proof and traceability system, shown in reference picture 2, this is
System 2 includes first terminal equipment 21, identification equipment 22 and second terminal equipment 23, wherein,
First terminal equipment 21 includes:
Every cigarette hash values generation module 211, for generating hash values for every cigarette;
Identification code generating module 212, for the first identification code corresponding to being generated respectively according to the hash values of every cigarette;
Module 213 is printed, for the first identification code to be printed on into corresponding every cigarette;
First writing module 214, for the hash values of every cigarette being write the merkle trees of block chain;
First tree root hash values computing module 215, for calculating the first tree according to the hash values of every cigarette in a deck
Root hash values;
Identification code generating module 212 is additionally operable to generate the second identification code according to the first tree root hash values;
Printing module 213 be additionally operable to by the second identification code printing corresponding to a deck packing box on;
First writing module 214 is additionally operable to the first tree root hash values write-in block chain corresponding to the often bag cigarette of calculating
Merkle trees;
Second tree root hash values computing module 216, for according to often the hash values of bag cigarette calculate the second tree root in a cigarette
Hash values;
Identification code generating module 212 is additionally operable to generate the 3rd identification code according to the second tree root hash values;
Printing module 213 is additionally operable to the 3rd identification code being printed on the packing box of one carton of cigarette;
First writing module 214 is additionally operable to the second tree root hash values write-in block chain corresponding to every cigarette of calculating
Merkle trees;
3rd tree root hash values generation module 217, the 3rd tree root is calculated for the hash values according to every cigarette in one case cigarette
Hash values;
Identification code generating module 212 is additionally operable to generate the 4th identification code according to the 3rd tree root hash values;
Printing module 213 is additionally operable to the 4th identification code being printed on the packing box of one case cigarette;
First writing module 214 is additionally operable to the 3rd tree root hash values write-in block chain corresponding to every case cigarette of calculating
Merkle trees;
4th tree root hash values computing module 218, for calculating the 4th tree root according to a batch of hash values per case cigarette
Hash values;
First writing module 214 is additionally operable to the 4th tree root hash values writing block chain merkle trees;
Identification equipment 22 includes:
First identification code identification module 221, during carrier transportation, identify per the identification code on case tobacco;
Logging modle 222, for by identifying per the identification code on case tobacco, recording transit node information and time letter
Breath;
Second writing module 223, for by transit node information and temporal information write-in block chain chain;
First identification module 224, for differentiating the true and false of tobacco according to identification marking code;
Second terminal equipment 23 includes:
Second identification module 231, for after retailer and consumer obtain tobacco, differentiating the true of tobacco according to identification code
It is pseudo-.
Optionally, the first writing module 214 is additionally operable to write Tobacco Reference in block chain;
Tobacco Reference includes manufacturer, date of manufacture, production address, product batch number.
Optionally, the second identification module 231 includes:
Second identification code recognition unit 2311, for after retailer and consumer obtain tobacco, identifying one case tobacco
The 4th identification code on packing box;
First hash values acquiring unit 2312, the 4th identification code on the packing box by identifying one case tobacco obtain
Corresponding hash values;
Second identification code recognition unit 2311 is additionally operable to identify the 3rd identification code in case on the packing box of one carton of cigarette;
First hash values acquiring unit 2312 is additionally operable to by identifying the 3rd identification code in case on the packing box of one carton of cigarette
Hash values corresponding to acquisition;
First determining unit 2313, it is corresponding with the 3rd identification code for hash values corresponding to the 4th identification code by acquisition
Hash values calculate, and determine whether a cigarette belongs to case;And/or
First hash values acquiring unit 2312 is additionally operable to the 3rd identification code on the packing box by one carton of cigarette of identification, obtains
Corresponding hash values;
Second identification code recognition unit 2311 is additionally operable to identify the second mark on the packing box of the deck in a cigarette
Code;
First hash values acquiring unit 2312 is additionally operable to second on the packing box by the deck in one carton of cigarette of identification
Hash values corresponding to identification code acquisition;
First determining unit 2313 is additionally operable to hash values corresponding to the 3rd identification code of acquisition is corresponding with the second identification code
Hash values calculate, determine whether a deck belongs to a cigarette;And/or
First hash values acquiring unit 2312 is additionally operable to, by the second identification code on the packing box that identifies a deck, obtain
Corresponding hash values;
Second identification code recognition unit 2311 is additionally operable to identify the first identification code on a cigarette in a deck;
First hash values acquiring unit 2312 is additionally operable to by identifying that the first identification code on a cigarette in a deck obtains
Hash values corresponding to taking;
First determining unit 2313 is additionally operable to the hash values of the second identification code of acquisition is corresponding with the first identification code
Hash values calculate, and determine whether a cigarette belongs to a deck;
Wherein, after Tobacco Reference is write block chain by the first writing module 214, shared in block chain, the second identification code
Recognition unit 2311 is by identifying the second identification code of the 4th identification code of one case cigarette, the 3rd identification code of one carton of cigarette, a deck
And the first identification code of a cigarette obtains Tobacco Reference.
Optionally, the first identification module 224 includes:
2nd hash values acquiring unit 2241, for by identify examination at random case tobacco on the 4th identification code, obtain with
Hash values corresponding to 4th identification code;
Second determining unit 2242, calculated for the hash values according to acquisition and this batch kinds of goods hash values, it is determined that
Whether the case tobacco of examination at random belongs to batch.
Optionally, identification code includes Quick Response Code, bar code or RFID codes.
The embodiments of the invention provide a kind of tobacco based on block chain is false proof and traceability system, the system pass through as every
Cigarette generates hash values, the hash values of every cigarette generate respectively corresponding to the first identification code be printed on corresponding every cigarette, according to
The hash values of every cigarette calculate the first tree root hash values, deck packing box corresponding to generation the second identification code printing in a deck
On;According to often the hash values of bag cigarette calculate the second tree root hash values in a cigarette, generate the 3rd identification code and be printed on one carton of cigarette
On packing box;3rd tree root hash values are calculated according to the hash values of every cigarette in one case cigarette, the 4th identification code of generation is printed on one
On the packing box of case cigarette;4th tree root hash values are calculated according to a batch of hash values per case cigarette;And by tobacco from every
Hash values to bag, bar, case and batch write block chain merkle trees;So cause what tobacco included from batch to the batch
All case tobaccos, the every packaging included to every case tobacco tobacco, arrive often bag tobacco that every tobacco includes again, finally arrive often
Every tobacco that bag tobacco includes have it is unique corresponding to hash values, and often the hash values of bag tobacco by every cigarette wherein including
The hash values of grass are calculated, and the hash values of every tobacco are calculated by the hash values of the often bag tobacco wherein included, per case
The hash values of tobacco are calculated by the hash values of the every tobacco wherein included, and the hash values of a collection of tobacco are by wherein including
Hash values per case tobacco are calculated, so so that tobacco from, wrap, bar to case and batch pass through stacked merkle trees
Realize management, merkle trees deposit block chain so that every cigarette is bound with bag cigarette, and often bag cigarette is bound with stip cigarette packing, every bag
Fill cigarette and case packing cigarette to bind, if a cigarette therein or a deck or cigarette etc. change, whole block can be caused
The hash values of all tree nodes of chain merkle trees deposit change, so as to ensure the true and false of tobacco in block chain with tracing back
Source;Meanwhile during carrier transportation, by identifying per the identification code on case tobacco, record transit node information and time letter
Breath, and transit node information and temporal information are write in block chain chain, and differentiate the true and false of tobacco according to identification marking code;
And after retailer and consumer obtain tobacco, differentiate the true and false of tobacco according to identification code;So forwarding agent or other departments
Inspect by random samples tobacco when, by identify the identification code on case packing obtain corresponding to hash values, pass through the hash values and the batch tobacco
Hash values calculated, both match, it is determined that the case tobacco belongs to the batch, ensures that the true of the case tobacco
Property;After retailer obtains tobacco, the identification code in bar packaging or corresponding hash values can be identified, by the hash values and
The hash values of the case tobacco calculate, and both match, it is determined that this packs tobacco and belong to the case, so as to which retailer can determine cigarette
Careless authenticity, after consumer gets deck grass, identify that the identification code in cigarette obtains hash values, by the hash values and
The hash values of the bag tobacco calculate, and both match, it is determined that the branch tobacco belongs to the bag, so that each link can
Authenticate to the true and false of tobacco and inquire the Tobacco References such as the place of production, production time, each node of supply chain can also be verified
The real reliability of product, so as to which tobacco provided in an embodiment of the present invention is false proof and source tracing method, the intelligibility of checking is improved,
Conveniently recognize and efficient;In addition, in the packaging that the identification code of generation need to only be printed, 3D hologram mould, fluorescence with prior art
It is low compared to cost that private mark is false proof, frequency conversion ink is false proof, photochromatic printing ink is false proof etc., and it is convenient to print process, without other costs or
Anti-fake material.
Above-mentioned all optional technical schemes, any combination can be used to form the alternative embodiment of the present invention, herein no longer
Repeat one by one.
It should be noted that:The tobacco based on block chain that above-described embodiment provides is false proof and traceability system is based in execution
The tobacco of block chain is false proof and during source tracing method, only with the division progress of above-mentioned each functional module for example, in practical application,
It can be completed as needed and by above-mentioned function distribution by different functional modules, i.e., the internal structure of system is divided into difference
Functional module, to complete all or part of function described above.In addition, above-described embodiment provide based on block chain
Tobacco is false proof and traceability system and the tobacco based on block chain are false proof and source tracing method embodiment belongs to same design, its specific reality
Existing process refers to embodiment of the method, repeats no more here.
One of ordinary skill in the art will appreciate that hardware can be passed through by realizing all or part of step of above-described embodiment
To complete, by program the hardware of correlation can also be instructed to complete, described program can be stored in a kind of computer-readable
In storage medium, storage medium mentioned above can be that branch reads memory, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc., it should be included in the scope of the protection.