A method for tracing the provenance of precious metal commemorative coins based on smart contracts.
By collecting and verifying the hash value of the micro-manufacturing texture image features of precious metal commemorative coins in a smart contract, the problem of transaction fraud caused by the easy replication of serial numbers is solved, and the secure traceability and ownership verification of physical assets are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG ZHONGJIN CULTURAL CREATIVE IND CO LTD
- Filing Date
- 2026-04-21
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, the serial numbers of precious metal commemorative coins are easily copied, making it impossible for smart contracts to recognize physical asset replacements and thus unable to defend against transaction fraud.
The system collects microscopic manufacturing texture images of the surface of precious metal commemorative coins, extracts feature vectors, calculates initial physical feature hash values, binds them to the owner's address, and stores them in the smart contract state variables. During transactions, the system verifies the legitimacy of the physical assets through XOR operations and Hamming distance comparisons, thus preventing illegal transfer of ownership.
It achieves mandatory consistency verification between on-chain ownership certificates and the physical state of offline precious metal commemorative coins, preventing fraudulent acquisition of physical assets through the transfer of legitimate serial numbers, and improving the security and reliability of transactions.
Smart Images

Figure CN122134349A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of edge computing technology. This invention discloses a method for tracing the provenance of precious metal commemorative coins based on smart contracts. Background Technology
[0002] In the field of anti-counterfeiting and traceability of precious metal commemorative coins, distributed ledger technology is commonly used to record the asset ownership status. Conventional solutions involve engraving a serial number on the surface of the coin during the issuance phase, binding the serial number to the initial owner's address and storing it in the state variable of a smart contract. In subsequent transactions, the terminal device scans the serial number on the coin's surface and sends it to the smart contract. The smart contract compares the serial number stored on the blockchain with the input serial number. If the comparison is successful, it modifies the owner's address in the state variable, completing the transaction payment. The entire circulation process relies entirely on string matching of the serial number—a macro-identifier—to verify the asset's legitimacy.
[0003] In the aforementioned conventional technical solutions, the serial number is merely a physical imprint attached to the surface of the object. When a physical precious metal commemorative coin is replaced with a counterfeit with the same serial number during circulation, the payment execution logic of the smart contract only performs string comparison and lacks the ability to obtain and verify the intrinsic physical attributes of the physical asset. Attackers who possess the legitimate serial number can pass the string verification of the smart contract, causing the digital payment architecture to be unable to identify the physical asset replacement behavior and unable to defend against transaction fraud caused by the swapping of physical assets. Summary of the Invention
[0004] The purpose of this invention is to provide a solution to the problems described in the background section.
[0005] To achieve the above objectives, the technical solution adopted by this invention is as follows: a method for tracing the origin of precious metal commemorative coins based on smart contracts, comprising: acquiring a microscopic manufacturing texture image of the surface of the precious metal commemorative coin at the issuing end, extracting the feature vector of the microscopic manufacturing texture image and calculating an initial physical feature hash value, and binding the initial physical feature hash value with the owner address and storing it in the state variable of the smart contract; during the transaction payment stage, the receiving node acquires a real-time microscopic texture image of the precious metal commemorative coin to be transferred and calculates a real-time physical feature hash value, and passes the real-time physical feature hash value as a parameter into the payment verification function of the smart contract; the smart contract calls the initial physical feature hash value in the state variable and performs an XOR operation with the real-time physical feature hash value to calculate the Hamming distance; when the Hamming distance is within a preset safety threshold range, the owner address in the state variable is modified to the receiver address, and the real-time physical feature hash value is updated to a new initial physical feature hash value and packaged on the blockchain; when the Hamming distance exceeds the safety threshold range, a transaction rollback instruction is executed and an abnormal termination signal is output.
[0006] Preferably, the step of acquiring micro-manufacturing texture images of the surface of the precious metal commemorative coin at the issuing end includes: controlling multiple narrowband light sources distributed in a ring to sequentially illuminate the surface detection area of the precious metal commemorative coin according to a preset time sequence, and synchronously acquiring local texture images corresponding to each illumination time of the narrowband light source using a high-resolution image sensor; matrix-stitching the local texture images at each time according to the spatial position of the narrowband light source to generate the micro-manufacturing texture image containing multi-angle illumination information; performing mask cropping on the micro-manufacturing texture image, retaining image blocks within the surface detection area with a texture density greater than a preset texture density threshold, and using the retained image blocks as input data for extracting the feature vector.
[0007] Preferably, the step of extracting the feature vector of the micro-manufacturing texture image and calculating the initial physical feature hash value includes: dividing the micro-manufacturing texture image into multiple grid regions of non-overlapping sizes; calculating a local binary pattern histogram for each grid region; concatenating the local binary pattern histograms of all grid regions in spatial order to generate the feature vector; constructing a dimensionality reduction network containing multiple hash mapping layers; inputting the feature vector into the dimensionality reduction network; performing quantization and binarization processing on the feature vector through the hash mapping layers; outputting a fixed-length binary feature code string; filling the binary feature code string with timestamp information; and performing a secure hash algorithm on the filled binary feature code string to generate the initial physical feature hash value.
[0008] Preferably, the step of binding the initial physical feature hash value with the owner address and storing it in the state variable of the smart contract includes: constructing a multi-level Merkle tree data structure in the storage space of the smart contract, using the serial number of the precious metal commemorative coin as the root node index value of the Merkle tree, using the owner address as the leaf node data of the Merkle tree, splitting the initial physical feature hash value into multiple hash fragments and storing them respectively in intermediate nodes adjacent to the leaf nodes; calculating the Merkle hash value for each node data in the Merkle tree, mapping and binding the calculated root hash value with the serial number, and persistently storing the updated Merkle tree data structure as the state variable in the blockchain ledger.
[0009] Preferably, the step of passing the real-time physical feature hash value as a parameter into the payment verification function of the smart contract includes: the receiving node constructing a data transaction package containing the sender address, the recipient address, the payment amount, and the real-time physical feature hash value; digitally signing the data transaction package using the private key of the receiving node to generate signature data; appending the signature data to a specified field of the data transaction package; broadcasting the data transaction package carrying the signature data to the consensus node through the blockchain network; the consensus node calling the smart contract; before executing the payment verification function, the smart contract extracts the signature data from the specified field, verifies the signature data using the public key of the receiving node, and parses and obtains the real-time physical feature hash value only when the verification is successful.
[0010] Preferably, the step of the smart contract retrieving the initial physical feature hash value and the real-time physical feature hash value from the state variable and performing an XOR operation to calculate the Hamming distance includes: the smart contract reading the initial physical feature hash value from the state variable, performing a bit-by-bit XOR operation on the initial physical feature hash value and the real-time physical feature hash value according to byte alignment rules to generate an XOR result sequence; dividing the XOR result sequence into multiple sub-sequences, counting the number of bits with a value of 1 in each sub-sequence to obtain multiple sub-distance values; multiplying the multiple sub-distance values by multiple preset segment weight coefficients one by one and summing them to obtain the Hamming distance; comparing the Hamming distance with the preset security threshold interval and outputting a Boolean value of the comparison result.
[0011] Preferably, the step of controlling multiple narrowband light sources distributed in a ring to sequentially illuminate the surface detection area of the precious metal commemorative coin according to a preset time sequence includes: obtaining the ambient light intensity value of the surface detection area; querying a preset illumination compensation mapping table based on the ambient light intensity value to determine the driving current value of each of the multiple narrowband light sources; controlling the corresponding narrowband light source to emit light according to the driving current value; inserting a sleep duration during the illumination switching interval between any two adjacent narrowband light sources; and performing matrix stitching of the local texture images at each time according to the spatial position of the narrowband light sources includes: extracting the feature points of the overlapping area of two frames of local texture images acquired at adjacent time moments; calculating the disparity value of the feature points of the overlapping area; performing pixel translation compensation on the next frame of local texture image based on the disparity value; and stitching and fusing the local texture image with pixel translation compensation to the previous frame of local texture image.
[0012] Preferably, the step of quantizing and binarizing the feature vector through the hash mapping layer includes: the dimensionality reduction network comprises multiple fully connected layers connected in sequence; the feature vector is input into the first fully connected layer; each fully connected layer performs linear transformation and batch normalization operations on the input data; the final fully connected layer outputs a floating-point vector with the same dimension as the fixed length; the floating-point vector is input into the hash mapping layer, which includes a sign function activation layer; the sign function activation layer performs sign determination on each floating-point number in the floating-point vector, mapping floating-point numbers greater than zero to the value 1, and floating-point numbers less than or equal to 0 to the value 0; the binary sequence generated by the mapping is output as the binary feature code string.
[0013] Preferably, the step of updating the real-time physical feature hash value to a new initial physical feature hash value includes: inputting the real-time physical feature hash value as update data into the smart contract; the smart contract parses the serial number of the precious metal commemorative coin corresponding to the update data and locates the root node index value in the Merkle tree that matches the serial number; extracting the real-time physical feature hash value and splitting it into multiple update hash fragments according to the splitting rules when constructing the Merkle tree; replacing the historical hash fragments in the corresponding intermediate nodes in the Merkle tree with the multiple update hash fragments; recalculating the Merkle hash values of all nodes on the path from the replaced node to the root node from bottom to top; and replacing the historical root hash value persistently stored in the blockchain ledger with the recalculated root hash value.
[0014] Preferably, the step of multiplying the multiple sub-distance values with a preset multiple segmented weight coefficients one by one includes: pre-storing an initial weight coefficient table in the non-state variable storage area of the smart contract; obtaining the environmental humidity value and surface temperature value of the surface detection area of the precious metal commemorative coin when generating the real-time physical feature hash value; inputting the environmental humidity value and the surface temperature value into the polynomial fitting equation deployed in the smart contract to calculate the weight adjustment factor; multiplying the weight adjustment factor with the initial weight coefficients at each position in the initial weight coefficient table to generate the multiple segmented weight coefficients; performing scalar multiplication on the multiple sub-distance values according to the order of arrangement in the XOR result sequence and the multiple segmented weight coefficients that are consistent with the generation order; summing all the multiplication results to output the Hamming distance.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. The present invention introduces the XOR operation of the initial physical feature hash value and the real-time physical feature hash value and the Hamming distance calculation in the payment verification function of the smart contract. The Hamming distance being within the safe threshold range is used as a prerequisite for modifying the owner address. When the Hamming distance exceeds the safe threshold range, a transaction rollback instruction is executed, which blocks the path of illegally obtaining physical assets by using a legitimate serial number and realizes the mandatory consistency verification between the on-chain ownership certificate and the physical state of the offline physical precious metal commemorative coin.
[0016] 2. By using multiple narrowband light sources distributed in a ring to alternately illuminate the image in a time sequence and performing pixel translation compensation stitching based on the disparity values of feature points in overlapping areas, shadow occlusion caused by unidirectional illumination is eliminated, and micro-manufacturing texture images containing multi-angle illumination information are obtained. A cascaded local binary mode histogram combined with a sign function activation layer maps feature vectors to fixed-length binary feature code strings, compressing the storage volume of feature data. A multi-level Merkle tree data structure is used to split physical feature hash values into hash fragments and store them in intermediate nodes. During ownership transfer, only the corresponding intermediate node is replaced, and the node hash value is recalculated from bottom to top, reducing the amount of data read / write operations for smart contract state variables. When calculating Hamming distance, environmental humidity and surface temperature values are combined to generate a weight adjustment factor through a polynomial fitting equation to dynamically adjust the segment weight coefficients, reducing the offset interference caused by changes in physical environment temperature and humidity on micro-texture feature extraction. Attached Figure Description
[0017] Figure 1 This is the main flowchart of the traceability method for precious metal commemorative coins based on smart contracts.
[0018] Figure 2 This is a flowchart of multi-source acquisition and image stitching.
[0019] Figure 3 This is a flowchart of the feature vector extraction and hash generation process.
[0020] Figure 4 A flowchart for Merkle tree storage and state update.
[0021] Figure 5 Flowchart for transaction package construction and verification.
[0022] Figure 6 This is a flowchart of Hamming distance calculation and dynamic weight adjustment. Detailed Implementation
[0023] Please refer to Figure 1This embodiment provides a method for tracing the provenance of precious metal commemorative coins based on smart contracts. The applicable blockchain architecture is a consortium blockchain. The consensus nodes of the consortium blockchain include nodes of the precious metal commemorative coin issuing institution, trading service institution, collector user, and regulatory agency. All consensus nodes synchronously store complete blockchain ledger data and have the authority to call and execute smart contracts. The smart contract is pre-deployed in the genesis block of the consortium blockchain. The contract code has been cross-verified and signed by all consensus nodes. The state variables of the contract are persistently stored in the world state of the blockchain ledger. Modification operations can only be performed through functions defined within the contract; external nodes cannot directly write to the state variables.
[0024] refer to Figure 2 Specifically, during the issuance phase of precious metal commemorative coins, after the issuing node completes the statutory minting process for the commemorative coins to be issued, it performs physical feature acquisition and on-chain ownership initialization operations on each individual coin. The issuing node acquires a microscopic manufacturing texture image of the coin's surface using an image acquisition component. This microscopic manufacturing texture image corresponds to unique microscopic concave-convex texture information formed by die stamping during the coin's minting process. This microscopic concave-convex texture information cannot be completely replicated through secondary reproduction. The issuing node performs preprocessing operations on the acquired microscopic manufacturing texture image, including image denoising, grayscale conversion, and contrast normalization. After preprocessing, it extracts the corresponding feature vector from the microscopic manufacturing texture image. This feature vector is a one-dimensional numerical sequence characterizing the spatial distribution features of the microscopic texture. The issuing node performs a hash operation based on the extracted feature vector to calculate an initial physical feature hash value. This initial physical feature hash value is a fixed-length hexadecimal string with unidirectional irreversibility; any tiny change in the feature vector will lead to unpredictable large-scale changes in the hash value. The issuing node binds the generated initial physical feature hash value with the initial owner address corresponding to the precious metal commemorative coin, writes the bound dataset into the state variable of the smart contract, and completes the on-chain ownership initialization of a single precious metal commemorative coin. The initial owner address is the blockchain account address corresponding to the issuing institution. The account address conforms to the address generation specification of the consortium blockchain and has a unique mapping relationship with the public key information of the issuing institution.
[0025] Furthermore, during the transaction payment phase of the precious metal commemorative coins, after both parties confirm their transaction intentions through the blockchain network, the receiving node performs real-time physical feature acquisition on the precious metal commemorative coins to be transferred. The receiving node uses the same image acquisition parameters and preprocessing rules as the issuing node to obtain a real-time microscopic texture image of the precious metal commemorative coin to be transferred. It then performs feature extraction and hash calculation operations on the real-time microscopic texture image, consistent with the issuance phase, to generate a real-time physical feature hash value. The receiving node uses the generated real-time physical feature hash value as input to the predefined payment verification function in the smart contract, triggering the payment verification process of the smart contract.
[0026] In this embodiment, after receiving the call request for the payment verification function, the smart contract first retrieves the initial physical feature hash value stored in the corresponding state variable of the blockchain ledger, which is bound to the precious metal commemorative coin. It then performs a bitwise XOR operation between the retrieved initial physical feature hash value and the input real-time physical feature hash value, and calculates the Hamming distance between the two hash values based on the result of the XOR operation. The smart contract internally has a preset security threshold range, which is a Hamming distance value range determined in advance through extensive sample testing to distinguish between legitimate and counterfeit entities. The smart contract compares the calculated Hamming distance with a preset security threshold range. When the Hamming distance is within the preset security threshold range, the precious metal commemorative coin to be transferred is determined to be a legitimate entity, the transaction verification passes, and the smart contract performs a state variable modification operation. This modifies the owner address corresponding to the precious metal commemorative coin stored in the state variable from the original sender address to the receiver address. Simultaneously, the real-time physical feature hash value passed in this transaction is updated to a new initial physical feature hash value. The modified state variable data is synchronized to the blockchain ledger and packaged together with the transaction data for on-chain processing. When the calculated Hamming distance exceeds the preset security threshold range, the precious metal commemorative coin to be transferred is determined to be an illegitimate entity, the transaction verification fails, the smart contract immediately executes a transaction rollback instruction, terminating all state modification operations for this transaction. Simultaneously, an abnormal termination signal is output to the node that called the payment verification function. The abnormal termination signal contains a code indicating the reason for the verification failure, which the node uses to execute subsequent exception handling procedures.
[0027] Table 1. Correspondence between Hamming distance comparison results and contract execution actions.
[0028] Specifically, the lower and upper limits of the preset security threshold range in Table 1 are determined comprehensively based on the minting process of precious metal commemorative coins, the fluctuation range of the texture acquisition environment, and the error tolerance of the feature extraction algorithm. When the comparison result has a Boolean value of 1, it means that the entity's legality verification has passed, and the smart contract executes the relevant operations for ownership transfer; when the comparison result has a Boolean value of 0, it means that the entity's legality verification has failed, and the smart contract terminates the transaction process. The correspondence between the execution actions and Hamming distances defined in Table 1 is pre-written into the payment verification function code of the smart contract and can only be modified through the contract upgrade process. Contract upgrades require multi-signature confirmation from all consensus nodes.
[0029] In this embodiment, by converting the micro-manufacturing texture features of the precious metal commemorative coin into physical feature hash values stored on the blockchain, and introducing XOR operations and Hamming distance comparisons of the physical feature hash values into the payment verification process of the smart contract, the consistency verification of the physical features of the entity is used as a prerequisite for ownership transfer. This achieves the mandatory binding of the on-chain ownership certificate with the physical state of the offline precious metal commemorative coin, blocking the fraudulent path of using counterfeit serial numbers to complete illegal ownership transfers, and avoiding the risk of entity swapping caused by relying solely on serial number string comparison in traditional solutions.
[0030] In a preferred embodiment, both the issuing node and the receiving node employ the same image acquisition architecture to perform the acquisition of micro-texture images. The image acquisition architecture includes multiple narrowband light sources arranged in a ring, a high-resolution image sensor, and an image preprocessing unit. The center wavelength of the narrowband light sources is within the visible light band. The multiple narrowband light sources are uniformly distributed in a ring on the same plane with the optical axis of the image sensor as the center. The light emission direction of each narrowband light source points to the surface detection area of the precious metal commemorative coin. The surface detection area is a pre-defined fixed area on the surface of the precious metal commemorative coin that has stable micro-texture features. Once the surface detection area of a single precious metal commemorative coin is defined during the issuance stage, it remains fixed throughout its entire life cycle.
[0031] Specifically, during the acquisition of micro-manufacturing texture images, the sending node first obtains the ambient light intensity value of the surface detection area. This ambient light intensity value is acquired through a built-in light sensor in the image acquisition architecture, and the acquired ambient light intensity value is the average ambient light intensity within the surface detection area. Based on the acquired ambient light intensity value, the sending node queries a pre-set illumination compensation mapping table to determine the corresponding driving current value for each of the multiple narrowband light sources. The illumination compensation mapping table is a dataset of correspondences between ambient light intensity values and narrowband light source driving current values, pre-calibrated and generated. The driving current value and the ambient light intensity value are negatively correlated; when the ambient light intensity value increases, the driving current value of the corresponding narrowband light source decreases, and when the ambient light intensity value decreases, the driving current value of the corresponding narrowband light source increases. The issuing node controls the corresponding narrowband light source to perform illumination operation according to the obtained drive current value. A preset sleep duration is inserted between any two adjacent narrowband light sources during the illumination switching interval. The sleep duration is used to eliminate the interference of the afterglow of the previous narrowband light source on the subsequent image acquisition. The value of the sleep duration is greater than the afterglow decay duration of the narrowband light source. The issuing node controls multiple narrowband light sources distributed in a ring to sequentially illuminate the surface detection area of the precious metal commemorative coin according to a preset time sequence. At the same time, a high-resolution image sensor synchronously acquires the local texture image corresponding to the illumination time of each narrowband light source. Each narrowband light source corresponds to one frame of local texture image, which contains the microscopic texture information of the surface detection area under the corresponding illumination angle.
[0032]
[0033] in, This represents the driving current value corresponding to the i-th narrowband light source. Here, k is the reference driving current value for the narrowband light source, and k is the preset illumination compensation coefficient. The ambient light intensity value of the surface detection area is collected.
[0034] After the issuing node completes the acquisition of local texture images corresponding to all narrowband light sources, it performs a stitching operation on the local texture images acquired at each time step. The issuing node first extracts the feature points of the overlapping region between two frames of local texture images acquired at adjacent time steps. The overlapping region is the common imaging area within the surface detection area under the illumination angles of two adjacent narrowband light sources, and the feature points are pixels in the local texture image that exhibit abrupt changes in grayscale gradient. The issuing node performs a matching operation on the feature points of the overlapping region between the two frames of local texture images, obtaining successfully matched feature point pairs. Based on the successfully matched feature point pairs, it calculates the disparity value of the feature points in the overlapping region. The disparity value is the pixel coordinate offset of the same feature point in the two frames of local texture images.
[0035]
[0036] in, Let m be the disparity value corresponding to the m-th successfully matched feature point pair. The x and y coordinates of this feature point in the local texture image of the previous frame are given. The x and y coordinates of the feature point in the local texture image of the next frame are given.
[0037] The issuing node calculates the average disparity value corresponding to all successfully matched feature point pairs, uses the obtained average disparity value as the pixel translation compensation amount for the local texture image of the next frame, and performs pixel translation compensation operation on the local texture image of the next frame according to the pixel translation compensation amount.
[0038]
[0039] Where x and y are the x and y coordinates of the original pixel in the local texture image of the next frame, and x' and y' are the x and y coordinates of the pixel after pixel translation compensation. This is the amount of compensation for horizontal pixel translation. This is the vertical pixel translation compensation amount. and It is determined by the horizontal and vertical components of the average disparity value.
[0040] The sending node performs a stitching and fusion operation between the local texture image with pixel translation compensation and the previous frame's local texture image. During the stitching and fusion process, the pixel values in the overlapping areas are processed by weighted averaging, with the weight coefficient being positively correlated with the distance from the pixel to the corresponding image edge. The sending node sequentially completes the stitching and fusion of all local texture images according to the spatial arrangement of the narrowband light source, generating a micro-manufacturing texture image containing multi-angle illumination information. The multi-angle illumination information effectively eliminates texture shadow occlusion caused by single-direction illumination, completely restoring the micro-uneven texture structure within the surface detection area.
[0041] Furthermore, the issuing node performs a masking and cropping operation on the generated micro-manufacturing texture image. First, a corresponding mask matrix is generated based on the preset coordinate range of the surface detection area. Elements within the surface detection area in the mask matrix have a value of 1, while elements outside the surface detection area have a value of 0. The mask matrix is then multiplied pixel-wise with the micro-manufacturing texture image to remove image content outside the surface detection area. The issuing node then divides the masked image into multiple continuous image blocks of the same size. The texture density within each image block is calculated; the texture density is the ratio of the number of pixels with abrupt gray-level gradients within the image block to the total number of pixels in the image block. The issuing node compares the texture density of each image block with a preset texture density threshold, retaining image blocks with a texture density greater than the threshold and discarding those with a texture density less than or equal to the threshold. All retained image blocks are then combined in spatial order as input data for subsequent feature vector extraction.
[0042] Table 2 Timing Control Parameters for Ring Narrowband Light Source
[0043] Specifically, the eight narrowband light sources defined in Table 2 are uniformly distributed in a 360° ring around the optical axis of the image sensor. The spatial azimuth angle interval between adjacent light sources is 45°, and the lighting sequence number is consistent with the increasing order of the spatial azimuth angle. This ensures that the acquired local texture images are arranged in the order of continuous change of illumination angle, reducing the computational complexity of subsequent stitching operations. The single-frame illumination duration is determined based on the luminous flux of the narrowband light source and the photosensitivity of the image sensor, while the switching sleep duration is determined based on the afterglow attenuation characteristics of the narrowband light source, ensuring that there is no illumination interference during the acquisition of adjacent frames. The parameters in Table 2 are consistent in both the issuing and receiving nodes, ensuring that the image acquisition environment is consistent between the issuance and trading stages, reducing the impact of differences in the acquisition environment on the feature extraction results.
[0044] In this embodiment, local texture images under multi-angle illumination are acquired by sequentially illuminating the image with narrow-band light sources distributed in a ring according to a preset time sequence. Pixel translation compensation and stitching are performed by combining the disparity values of feature points in overlapping areas, eliminating shadow occlusion from a single illumination direction and completely restoring the three-dimensional structural information of the micro-manufacturing texture. Real-time acquisition of ambient light intensity and dynamic compensation of driving current reduce the impact of ambient light changes on image acquisition quality. Mask clipping and texture density filtering eliminate invalid low-texture image content, improving the effectiveness and stability of subsequent feature extraction.
[0045] refer to Figure 3In another preferred embodiment, the issuing node and the receiving node use the same feature extraction and hash calculation rules to complete the conversion of the micro-manufacturing texture image into a physical feature hash value. Specifically, the issuing node acquires the preprocessed and cropped micro-manufacturing texture image, divides the micro-manufacturing texture image into multiple non-overlapping grid regions, each grid region having the same size, and the number of grid regions is determined based on the total size of the micro-manufacturing texture image and the preset single grid pixel size. All grid regions completely cover the effective content area of the micro-manufacturing texture image, with no overlap or omission.
[0046] For each divided grid region, the issuing node calculates the corresponding local binary pattern histogram. The local binary pattern histogram is used to characterize the local texture spatial distribution features within the grid region.
[0047]
[0048] in, The coordinates of the center pixel within the grid area. Let P be the grayscale value of the center pixel, and let P be the number of neighboring pixels surrounding the center pixel. Let p be the gray value of the p-th neighboring pixel. For symbolic functions, their definition is:
[0049] The issuing node performs Local Binary Pattern (LBP) calculations on all pixels within a grid region to obtain the LBP value for each pixel. It then calculates the frequency distribution of all LBP values within the grid region and generates a local binary pattern histogram for that region. The histogram's dimensions correspond to the range of LBP values. The issuing node then concatenates all the local binary pattern histograms for all grid regions according to their spatial arrangement in the micro-manufacturing texture image, generating a feature vector representing the entire micro-manufacturing texture image.
[0050]
[0051] Where F is the cascaded feature vector, and N is the total number of grid regions. The local binary pattern histogram corresponding to the i-th grid region Figure 1 The dimensional sequence and cascading order are consistent with the row-first order of the grid regions.
[0052] The issuing node constructs a dimensionality reduction network containing multiple hash mapping layers. This network performs dimensionality reduction and binarization on high-dimensional feature vectors, outputting a fixed-length binary feature code string. The dimensionality reduction network consists of multiple fully connected layers connected sequentially, and a hash mapping layer placed after the final fully connected layer. The weight and bias parameters of all fully connected layers are pre-trained and fixed before the issuance stage. The pre-training process uses feature vectors from a large number of micro-texture images of precious metal commemorative coins as the training dataset. The training objective is to minimize the Hamming distance between the binary feature code strings output by feature vectors of similar entities and maximize the Hamming distance between the binary feature code strings output by feature vectors of dissimilar entities.
[0053] Specifically, the issuing node inputs the cascaded feature vectors into the first fully connected layer of the dimensionality reduction network, and each fully connected layer performs linear transformation and batch normalization operations on the input data.
[0054]
[0055] in, The linear transformation output of the l-th fully connected layer. Let be the weight matrix of the l-th fully connected layer. Let be the bias vector of the l-th fully connected layer. The output data is the (l-1)th layer, and the input data of the first fully connected layer is the feature vector F.
[0056]
[0057] in, For the batch normalized output of the l-th fully connected layer, To input the mean of the batch data, To input the variance of the batch data, The preset numerical stability constant, For scaling parameters, For offset parameters, and These are the learnable parameters that are fixed during network training.
[0058] In the dimensionality reduction network, the fully connected layer at the end outputs a floating-point vector with a dimension equal to the fixed length of the preset binary feature code string. Each element of the floating-point vector is a consecutive floating-point value. The issuing node inputs the floating-point vector output by the fully connected layer at the end into a hash mapping layer. The hash mapping layer contains a sign function activation layer, which performs sign determination on each floating-point number in the floating-point vector, completing the quantization and binarization process.
[0059]
[0060] in, Let j be the binary value of the j-th bit in the binary feature string. Let be the floating-point value of the j-th element in the floating-point vector.
[0061] The hash mapping layer outputs the binary sequence generated after symbol determination as a fixed-length binary feature string. The length of the binary feature string is consistent with the output dimension of the terminal fully connected layer and remains fixed throughout its entire lifecycle.
[0062] Furthermore, the issuing node performs a timestamp information filling operation on the generated binary feature code string. The timestamp information is the timestamp corresponding to the block height where the issuing node performed the feature extraction operation. The timestamp information is filled into a preset fixed position in the binary feature code string, and the length of the filled binary feature code string remains fixed. The issuing node performs a secure hash algorithm calculation on the filled binary feature code string to generate an initial physical feature hash value. The secure hash algorithm adopts a one-way hash algorithm that conforms to the national cryptographic management standard. The output length of the algorithm is fixed, and it has one-way irreversibility and collision resistance characteristics.
[0063]
[0064] in, The generated initial physical feature hash value, for Secure hash algorithm This is a binary feature code string filled with timestamp information.
[0065] Table 3. Correspondence of operational parameters for each layer of the dimensionality reduction network
[0066] Specifically, the dimensionality reduction network defined in Table 3 consists of three fully connected layers and one hash mapping layer. The input dimension corresponds to the total length of the feature vectors, and the output dimension of the final fully connected layer corresponds to the fixed length of the binary feature code string, which is 256 bits. The first and second fully connected layers use the ReLU activation function to achieve nonlinear transformation. The third fully connected layer does not have an activation function and directly outputs a floating-point vector to the hash mapping layer. The hash mapping layer performs binarization processing through a sign function, outputting a 256-bit binary feature code string. Batch normalization is enabled in all fully connected layers to reduce the impact of changes in input data distribution on the network output and improve the stability of feature extraction. The network parameters defined in Table 3 are kept completely consistent in the issuing and receiving nodes to ensure that the feature vector and hash value calculation rules are consistent between the issuance and transaction stages.
[0067] In this embodiment, by cascading mesh partitioning and local binary pattern histograms, the micro-manufacturing texture image is transformed into a high-dimensional feature vector, fully preserving the spatial distribution information of the texture. A dimensionality reduction network containing fully connected layers is used to perform dimensionality reduction processing on the high-dimensional feature vector, and a sign function activation layer is combined to complete quantization binarization, generating a fixed-length binary feature code string. This compresses the storage volume of the feature data and reduces the resource consumption of on-chain storage. By filling in timestamp information and calculating with a secure hash algorithm, a physical feature hash value with unidirectional irreversible properties is generated, avoiding the risk of feature data tampering and improving the security of physical feature verification.
[0068] refer to Figure 4 In another preferred embodiment, the smart contract employs a multi-level Merkle tree data structure to perform the binding storage of the initial physical feature hash value and the owner's address, as well as data update operations during the transaction process. Specifically, during the issuance phase, the smart contract constructs a multi-level Merkle tree data structure in its own storage space. The number of levels in the Merkle tree is determined based on the storage data dimension of a single precious metal commemorative coin and a preset tree structure depth. All node data in the Merkle tree undergoes hash calculation using the same one-way hash algorithm as the physical feature hash value.
[0069] The smart contract uses the serial number of the precious metal commemorative coin to be issued as the root node index value of the Merkle tree. The serial number is the unique legal identifier of a single precious metal commemorative coin, and there is a unique mapping relationship between the root node index value and the root node data of the Merkle tree. The smart contract uses the owner address corresponding to the precious metal commemorative coin as the leaf node data of the Merkle tree. The leaf node corresponds to the owner address of a single precious metal commemorative coin, and each leaf node stores only a single owner address. The smart contract splits the generated initial physical feature hash value into multiple hash fragments according to a preset splitting rule. The splitting rule corresponds to the number of intermediate nodes in the Merkle tree, and each hash fragment has the same length. All hash fragments can be concatenated to completely restore the initial physical feature hash value. The smart contract stores the multiple hash fragments obtained from the splitting into intermediate nodes adjacent to the leaf nodes. Each intermediate node stores only a single hash fragment, and there is a fixed mapping relationship between the intermediate node and the corresponding leaf node.
[0070]
[0071] in, The resulting hash shard sequence is denoted as M, where M is the total number of intermediate nodes adjacent to the leaf nodes. For the k-th hash partition, the length of each hash partition is 1 / M of the total length of the initial physical feature hash values.
[0072] After the smart contract completes the data filling of all nodes in the Merkle tree, it performs Merkle hash value calculation on the data of each node in the Merkle tree. The calculation order is from bottom to top, starting from the leaf node and calculating the Merkle hash value of the upper-level node in turn, until the root node.
[0073]
[0074] in, Let be the Merkle hash value of the i-th non-leaf node in the Merkle tree. and This represents the hash values of the two child nodes corresponding to this node. || represents the string concatenation operation. The hash value of the leaf node is the result of performing an operation on the owner address data stored in the leaf node. The result obtained from the calculation.
[0075] The smart contract will map and bind the calculated root hash value of the root node with the serial number of the corresponding precious metal commemorative coin, and use the updated Merkle tree data structure as the state variable of the smart contract, which will be persistently stored in the world state of the blockchain ledger.
[0076] Furthermore, during the transaction payment phase, before the receiving node passes the real-time physical feature hash value as a parameter to the payment verification function of the smart contract, it first constructs a corresponding data transaction package. The data transaction package includes the sender's address, the receiver's address, the payment amount, the serial number of the precious metal commemorative coin to be transferred, and the real-time physical feature hash value. The sender's address is the blockchain account address corresponding to the transferor during the transaction, the receiver's address is the blockchain account address corresponding to the transferee during the transaction, the payment amount is the on-chain transfer amount corresponding to this transaction, and the serial number is used to locate the Merkle tree data structure of the corresponding precious metal commemorative coin in the smart contract. The receiving node uses its own private key to perform a digital signature operation on the constructed data transaction package, generating corresponding signature data. The digital signature algorithm adopts an asymmetric encryption signature algorithm that conforms to national cryptographic management standards. The private key is securely stored locally by the receiving node and is not publicly disclosed. The receiving node appends the generated signature data to the designated signature field of the data transaction package and broadcasts the data transaction package carrying the signature data to all consensus nodes of the consortium blockchain through the blockchain network.
[0077] refer to Figure 5After receiving a data transaction packet, the consensus node of the consortium blockchain invokes a smart contract to execute the transaction verification process. Before executing the payment verification function, the smart contract first extracts the signature data from the specified signature field of the data transaction packet and obtains the public key information corresponding to the receiving node. This public key information has a unique mapping relationship with the blockchain account address of the receiving node and can be retrieved through the blockchain ledger. The smart contract uses the receiving node's public key to perform a signature verification operation on the extracted signature data. Only when the verification is successful does the smart contract parse the data transaction packet to obtain its real-time physical feature hash value and other transaction parameters, triggering the execution of the payment verification function. If the verification fails, the smart contract directly terminates the transaction process and outputs an error signal indicating verification failure.
[0078] In this embodiment, when the smart contract executes the payment verification function, it first locates the corresponding Merkle tree data structure from the state variables based on the sequence number in the data transaction package. It then reads all hash fragments from the intermediate nodes of the Merkle tree and concatenates them in reverse order according to the splitting rules to restore the initial physical feature hash value. The smart contract then performs a bitwise XOR operation between the restored initial physical feature hash value and the input real-time physical feature hash value according to the byte alignment rules, generating an XOR result sequence. The length of the XOR result sequence is the same as the length of the two hash values. A value of 1 at each position in the XOR result sequence indicates that the two hash values have different bit values at that position, while a value of 0 indicates that the two hash values have the same bit values at that position.
[0079]
[0080] in, The result sequence is the XOR result. To reconstruct the binary sequence corresponding to the initial physical feature hash value, The binary sequence corresponding to the real-time physical feature hash value. This is the bitwise XOR operator.
[0081] The smart contract divides the generated XOR result sequence into multiple subsequences, each of equal length, and the number of subsequences matches the number of preset segmentation weight coefficients. The smart contract then counts the number of bits with a value of 1 in each subsequence, resulting in multiple sub-distance values, the number of which is the same as the number of subsequences.
[0082] Before calculating the final Hamming distance, the smart contract first generates segmented weight coefficients. The non-state variable storage area of the smart contract pre-stores an initial weight coefficient table. This table contains multiple initial weight coefficients, the number of which matches the number of subsequences. The initial weight coefficients are determined based on the characteristic stability of the hash slices corresponding to the subsequences; regions with higher characteristic stability have larger initial weight coefficients. When the smart contract obtains and generates real-time physical feature hash values from the data transaction package, it collects the environmental humidity and surface temperature values of the surface detection area of the precious metal commemorative coin uploaded by the acquisition device. These values are synchronously acquired through the temperature and humidity sensors built into the acquisition device, maintaining consistency with the acquisition time of the real-time microscopic texture image. The smart contract inputs the acquired environmental humidity and surface temperature values into a polynomial fitting equation deployed within the contract to calculate the weight adjustment factor. This polynomial fitting equation is a pre-generated equation relating temperature and humidity values to the weight adjustment factor, fitted using a large amount of environmental test data.
[0083]
[0084] in, Here, T represents the calculated weighting adjustment factor, and H represents the surface temperature and ambient humidity. to These are the preset polynomial fitting coefficients, which are determined by least-squares fitting of the environmental test dataset.
[0085] The smart contract multiplies the calculated weight adjustment factor with each initial weight coefficient in the initial weight coefficient table, generating multiple segmented weight coefficients, the number of which matches the number of initial weight coefficients. The smart contract then performs scalar multiplication on the multiple sub-distance values, according to their order in the XOR result sequence, with the same order of generation of the segmented weight coefficients. Finally, it sums all the multiplication results and outputs the final Hamming distance.
[0086]
[0087] in, The final calculated Hamming distance is given by K, where K is the total number of subsequences. Let i be the weight coefficient of the i-th segment. This is the sub-distance value corresponding to the i-th subsequence.
[0088] The smart contract performs a numerical comparison between the calculated Hamming distance and the preset safety threshold range, and outputs a Boolean value for the comparison result. When the Boolean value of the comparison result is true, the ownership transfer and data update operations are performed. When the Boolean value of the comparison result is false, the transaction rollback operation is performed.
[0089] refer to Figure 6 Specifically, when the Hamming distance is within a preset safety threshold range, the smart contract uses the real-time physical feature hash value passed in this transaction as update data and executes an update operation on the Merkle tree data structure. The smart contract first parses the serial number of the precious metal commemorative coin corresponding to the update data, locates the root node index value in the Merkle tree that matches the serial number, extracts the real-time physical feature hash value passed in this transaction, and splits the real-time physical feature hash value into multiple update hash fragments according to the splitting rules used when constructing the Merkle tree. The smart contract uses these multiple update hash fragments to replace the historical hash fragments in the corresponding intermediate nodes in the Merkle tree. After updating the intermediate node data, it recalculates the Merkle hash values of all nodes on the path from the replaced node to the root node from bottom to top, and replaces the historical root hash value persistently stored in the blockchain ledger with the recalculated root hash value. Simultaneously, the smart contract modifies the owner address data of the corresponding leaf nodes in the Merkle tree, replacing the original sender address with the receiver address, and recalculates the Merkle hash values of all nodes on the path from the leaf node to the root node, completing a full update of the state variables. The smart contract packages the updated Merkle tree data structure together with the transaction data and synchronizes it to the blockchain ledger of all consensus nodes, thus completing the ownership transfer process for this transaction.
[0090] When the Hamming distance exceeds the preset safety threshold range, the smart contract immediately executes the transaction rollback instruction, cancels all state variable modification operations triggered by this transaction, restores the world state before the transaction execution, and outputs an abnormal termination signal to the node that called the contract. The abnormal termination signal contains the failure reason code that the Hamming distance exceeds the threshold.
[0091] Table 4. Merkel Tree Node Data Structure Definition Table
[0092] Specifically, the Merkle tree defined in Table 4 is a four-level structure, with the root node at level 0, leaf nodes at level 3, and four secondary intermediate nodes and four leaf nodes. The initial physical feature hash value is split into four equal-length hash fragments, stored in four secondary intermediate nodes, with each secondary intermediate node corresponding to one leaf node. The leaf nodes store the owner's address of the corresponding precious metal commemorative coin, and the root node stores the commemorative coin's serial number and root hash value, achieving a unique binding between the serial number, physical feature hash value, and owner's address. During ownership transfer, only the hash fragments in the secondary intermediate nodes and the owner's address in the leaf nodes need to be updated, and the hash values of the nodes along the corresponding path need to be recalculated to complete the state update. This eliminates the need to reconstruct the entire Merkle tree, reducing the amount of data read / write operations on smart contract state variables and lowering the gas consumption of contract execution.
[0093] In this embodiment, a multi-level Merkle tree data structure is used to split the physical feature hash value into hash shards and store them in intermediate nodes, while the owner address is stored in leaf nodes. This achieves a structured binding of physical feature data and ownership data, improving the efficiency of on-chain data query and update. Digital signatures and verification operations on transaction data ensure the legitimacy of the transaction initiator's identity, preventing malicious transaction requests from illegitimate nodes. By combining multinomial fitting of environmental temperature and humidity values to generate weight adjustment factors, the segmented weight coefficients of the Hamming distance calculation are dynamically adjusted, reducing the offset interference caused by changes in physical environmental temperature and humidity on micro-texture feature extraction and improving the accuracy of entity legitimacy verification. Through a bottom-up Merkle tree node hash recalculation mechanism, only the data of the corresponding node needs to be updated during ownership transfer, reducing the amount of read / write operations on smart contract state variables and improving transaction execution efficiency.
Claims
1. A method for tracing the provenance of precious metal commemorative coins based on smart contracts, characterized in that, include: At the issuing end, a microscopic manufacturing texture image of the surface of the precious metal commemorative coin is collected, the feature vector of the microscopic manufacturing texture image is extracted and the initial physical feature hash value is calculated, and the initial physical feature hash value is bound to the owner address and stored in the state variable of the smart contract. During the transaction payment stage, the receiving node obtains the real-time microscopic texture image of the precious metal commemorative coin to be transferred and calculates the real-time physical feature hash value, and passes the real-time physical feature hash value as a parameter into the payment verification function of the smart contract. The smart contract retrieves the initial physical feature hash value and the real-time physical feature hash value from the state variable, performs an XOR operation to calculate the Hamming distance, and when the Hamming distance is within a preset safety threshold range, modifies the owner address in the state variable to the receiver address, updates the real-time physical feature hash value to the new initial physical feature hash value, and packages it on the blockchain, and when the Hamming distance exceeds the safety threshold range, executes a transaction rollback instruction and outputs an abnormal termination signal.
2. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 1, characterized in that, The steps for acquiring microscopic manufacturing texture images of the surface of precious metal commemorative coins at the issuance end include: controlling multiple narrow-band light sources distributed in a ring to sequentially illuminate the surface detection area of the precious metal commemorative coin according to a preset time sequence, and synchronously acquiring local texture images corresponding to each illumination time of the narrow-band light source through a high-resolution image sensor; The local texture images at each time point are matrix-stitched according to the spatial position of the narrowband light source to generate the micro-manufacturing texture image containing multi-angle illumination information. The micro-manufacturing texture image is masked and cropped to retain image blocks within the surface detection area whose texture density is greater than a preset texture density threshold. The retained image blocks are used as input data for extracting the feature vector.
3. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 1, characterized in that, The steps of extracting the feature vector of the micro-manufacturing texture image and calculating the initial physical feature hash value include: dividing the micro-manufacturing texture image into multiple grid regions with non-overlapping sizes, calculating a local binary pattern histogram for each grid region, and concatenating the local binary pattern histograms of all grid regions in spatial order to generate the feature vector; A dimensionality reduction network containing multiple hash mapping layers is constructed. The feature vector is input into the dimensionality reduction network, and the feature vector is quantized and binarized through the hash mapping layers to output a fixed-length binary feature code string. The binary feature code string is filled with timestamp information, and a secure hash algorithm is performed on the filled binary feature code string to generate the initial physical feature hash value.
4. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 1, characterized in that, The step of binding the initial physical feature hash value with the owner address and storing it in the state variable of the smart contract includes: constructing a multi-level Merkle tree data structure in the storage space of the smart contract, using the serial number of the precious metal commemorative coin as the root node index value of the Merkle tree, using the owner address as the leaf node data of the Merkle tree, splitting the initial physical feature hash value into multiple hash fragments and storing them respectively in the intermediate nodes adjacent to the leaf nodes; Calculate the Merkle hash value for each node in the Merkle tree, map and bind the calculated root hash value to the sequence number, and persistently store the updated Merkle tree data structure as the state variable in the blockchain ledger.
5. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 1, characterized in that, The steps of passing the real-time physical feature hash value as a parameter into the payment verification function of the smart contract include: the receiving node constructs a data transaction package containing the sender address, the receiver address, the payment amount and the real-time physical feature hash value, and uses the private key of the receiving node to digitally sign the data transaction package to generate signature data; The signature data is appended to a designated field of the data transaction packet, and the data transaction packet carrying the signature data is broadcast to the consensus node through the blockchain network; The consensus node invokes the smart contract. Before executing the payment verification function, the smart contract extracts the signature data from the specified field, verifies the signature data using the public key of the receiving node, and parses and obtains the real-time physical feature hash value only when the verification is successful.
6. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 1, characterized in that, The step of the smart contract retrieving the initial physical feature hash value and the real-time physical feature hash value from the state variable and performing an XOR operation to calculate the Hamming distance includes: the smart contract reading the initial physical feature hash value from the state variable, performing a bitwise XOR operation between the initial physical feature hash value and the real-time physical feature hash value according to the byte alignment rule, and generating an XOR result sequence; The XOR result sequence is divided into multiple subsequences, and the number of bits with a value of 1 in each subsequence is counted to obtain multiple sub-distance values; The Hamming distance is obtained by multiplying the multiple sub-distance values one by one with the preset multiple segment weight coefficients and summing them. The Hamming distance is numerically compared with the preset security threshold range, and the comparison result is output as a Boolean value.
7. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 2, characterized in that, The step of controlling multiple narrowband light sources distributed in a ring to sequentially illuminate the surface detection area of the precious metal commemorative coin according to a preset time sequence includes: obtaining the ambient light intensity value of the surface detection area, querying a preset light compensation mapping table based on the ambient light intensity value, and determining the driving current value of each of the multiple narrowband light sources; The corresponding narrowband light source is controlled to emit light according to the driving current value, and a sleep duration is inserted during the illumination switching interval between any two adjacent narrowband light sources. The step of matrix stitching the local texture images at each time step according to the spatial position of the narrowband light source includes: extracting feature points of the overlapping region of two frames of local texture images acquired at adjacent time steps, calculating the disparity value of the feature points of the overlapping region, performing pixel translation compensation on the next frame of local texture image according to the disparity value, and stitching and fusing the local texture image with the pixel translation compensation completed with the previous frame of local texture image.
8. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 3, characterized in that, The step of quantizing and binarizing the feature vector through the hash mapping layer includes: the dimensionality reduction network contains multiple fully connected layers connected in sequence; the feature vector is input into the first fully connected layer; each fully connected layer performs linear transformation and batch normalization operations on the input data; and the final fully connected layer outputs a floating-point vector with the same dimension as the fixed length. The floating-point number vector is input into the hash mapping layer, which includes a sign function activation layer. The sign function activation layer performs a sign determination on each floating-point number in the floating-point number vector, mapping floating-point numbers greater than zero to the value 1, and floating-point numbers less than or equal to 0 to the value 0. The binary sequence generated by the mapping is output as the binary feature code string.
9. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 4, characterized in that, The step of updating the real-time physical feature hash value to a new initial physical feature hash value includes: inputting the real-time physical feature hash value as update data into the smart contract, the smart contract parsing the serial number of the precious metal commemorative coin corresponding to the update data, and locating the root node index value in the Merkle tree that matches the serial number; Extract the real-time physical feature hash value and split the real-time physical feature hash value into multiple update hash fragments according to the splitting rules when constructing the Merkle tree; The historical hash fragments in the corresponding intermediate nodes of the Merkle tree are replaced by the multiple updated hash fragments. The Merkle hash values of all nodes on the path from the replaced node to the root node are recalculated from bottom to top. The historical root hash value persistently stored in the blockchain ledger is replaced with the recalculated root hash value.
10. The method for tracing the provenance of precious metal commemorative coins based on smart contracts according to claim 6, characterized in that, The step of multiplying the multiple sub-distance values with the multiple preset segment weight coefficients one by one includes: pre-storing an initial weight coefficient table in the non-state variable storage area of the smart contract, and obtaining the environmental humidity value and surface temperature value of the surface detection area of the precious metal commemorative coin when generating the real-time physical feature hash value. The ambient humidity value and the surface temperature value are input into the polynomial fitting equation deployed in the smart contract to calculate the weight adjustment factor; The weight adjustment factor is multiplied by the initial weight coefficients at each position in the initial weight coefficient table to generate the multiple segmented weight coefficients; The multiple sub-distance values are arranged in the XOR result sequence, and scalar multiplication is performed on the multiple segmented weight coefficients that are consistent with the generation order. All multiplication results are summed to output the Hamming distance.