WO2021068726A1 - 一种区块链中的交易哈希值存储和搜索方法及装置 - Google Patents

一种区块链中的交易哈希值存储和搜索方法及装置 Download PDF

Info

Publication number
WO2021068726A1
WO2021068726A1 PCT/CN2020/116236 CN2020116236W WO2021068726A1 WO 2021068726 A1 WO2021068726 A1 WO 2021068726A1 CN 2020116236 W CN2020116236 W CN 2020116236W WO 2021068726 A1 WO2021068726 A1 WO 2021068726A1
Authority
WO
WIPO (PCT)
Prior art keywords
nth
transaction
index
ciphertext
hash value
Prior art date
Application number
PCT/CN2020/116236
Other languages
English (en)
French (fr)
Inventor
张中俊
严强
李辉忠
张开翔
范瑞彬
Original Assignee
深圳前海微众银行股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2021068726A1 publication Critical patent/WO2021068726A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9014Indexing; Data structures therefor; Storage structures hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction

Definitions

  • the invention relates to the field of financial technology (Fintech) and the field of blockchain (Blockchain), in particular to a method and device for storing and searching transaction hash values in a blockchain.
  • transaction hash values are mainly stored in two ways.
  • the first method is to store the user's transaction hash value in plain text. Obviously, this method is likely to cause the transaction hash value to leak; the second method is to hash the user's transaction hash value. After the value is encrypted, the transaction hash value is stored as ciphertext, but in this way, the transaction hash value cannot be searched on the ciphertext according to the index parameter. Therefore, the prior art cannot not only satisfy the storage security of the transaction hash value, but also can search for the corresponding transaction hash value according to the index parameters, which is a problem to be solved urgently.
  • the embodiment of the application provides a method and device for storing and searching the transaction hash value in the blockchain, which solves the problem that the prior art cannot not only satisfy the storage security of the transaction hash value, but also can search for corresponding information according to index parameters.
  • the issue of transaction hash value is not only satisfy the storage security of the transaction hash value, but also can search for corresponding information according to index parameters.
  • the embodiment of the application provides a method for storing transaction hash value in the blockchain: the client obtains the transaction hash value of the Nth transaction initiated by the user on the client and the Nth transaction hash value.
  • the index parameter of the transaction is determined from the transaction information of the transaction to be used for searching the transaction log; N is a positive integer; the client terminal obtains the N-1th status character corresponding to the index parameter String; the N-1th status string is generated for the N-1th transaction; the client uses the N-1th status string and the transaction hash value of the Nth transaction as the first N data to be encrypted; the client generates an Nth state character string, and determines the Nth key and Nth index position information according to the Nth state character string and the search token of the index parameter; the client The Nth key is used to encrypt the Nth data to be encrypted into an Nth ciphertext, and a unique mapping relationship between the Nth index position information and the Nth ciphertext is established.
  • the client terminal obtains the transaction hash value of the Nth transaction initiated by the user on the client terminal and the N-1th state string corresponding to the index parameter of the Nth transaction, and then according to the Nth
  • the search token of the state string and the index parameter determines the Nth key and the Nth index position information; and uses the Nth key to encrypt the Nth data to be encrypted into the Nth ciphertext, because the Nth key is used to encrypt the Nth ciphertext.
  • the status string is generated for the N-1th transaction, that is to say, for each N, the Nth ciphertext requires the participation of the N-1th status string, which is generated in an interlocking manner
  • the plaintext is highly confidential; in addition, since the unique mapping relationship between the Nth index position information and the Nth ciphertext is established, the Nth ciphertext can be searched through the Nth index position information. Therefore, the transaction in the above method
  • the storage of the hash value is more secure, while maintaining searchability when storing it.
  • the client side uses the N-1th status string and the transaction hash value of the Nth transaction as the Nth to-be-encrypted data, including: the client side The string composed of the N-1th state string and the transaction hash value of the Nth transaction as the Nth to-be-encrypted data; the client uses the Nth key to transfer the Nth Encrypting the data to be encrypted into the Nth ciphertext includes: calculating according to a preset bit, and using the bit operation result of the Nth data to be encrypted and the Nth key as the Nth ciphertext.
  • the client terminal concatenates the N-1th state string and the transaction hash value of the Nth transaction as the Nth to-be-encrypted data, and uses a preset position
  • the Nth ciphertext is obtained by the operation, so that the Nth data to be encrypted can be encrypted in a simple and efficient way.
  • the client determining the Nth key and the Nth index position information according to the Nth status character string and the search token of the index parameter includes: the client sends the The Nth state string and the search token of the index parameter are mapped according to the first preset hash algorithm as the Nth key; the client combines the Nth state string and the index The parameter search token is mapped according to the second preset hash algorithm as the Nth index position information; the first hash algorithm and the second hash algorithm are different hash algorithms.
  • the client determines the Nth key and the Nth index position through different first hash algorithms and second hash algorithms according to the Nth state string and the search token of the index parameter.
  • Information which not only establishes a mapping relationship with the Nth state string and the search token of the index parameter, but also enhances confidentiality through different hash algorithms.
  • this application provides a transaction hash value search method in the blockchain, including: the index server obtains the search token and the Nth state string of the index parameter from the client; the index parameter is obtained from the transaction
  • the keyword used to search the transaction log is determined in the transaction information; N is a positive integer; the Nth status string is generated when the user initiates the Nth transaction on the client; the index server is based on The search token of the index parameter and the Nth state string to obtain the Nth index position information of the index parameter; the Nth index position information is uniquely mapped to the Nth ciphertext; the Nth ciphertext Is the ciphertext encrypted by the client on the transaction hash value of the Nth transaction; the index server obtains the Nth uniquely mapped to the Nth index position information according to the Nth index position information The ciphertext; the index server generates the Nth key according to the search token and the Nth state character string; the index server decrypts the Nth ciphertext into the Nth key according to the Nth key Data
  • the index server obtains the search token and the Nth state character string of the index parameter from the client, and obtains the Nth state character string of the index parameter according to the search token of the index parameter and the Nth state character string.
  • Index position information Since the Nth index position information is uniquely mapped to the Nth ciphertext, the Nth ciphertext can be searched for according to the Nth index position information, and the Nth ciphertext can be searched for through the search token and the Nth state character string to generate the Nth ciphertext.
  • N key then use the Nth key to decrypt the Nth ciphertext into the Nth to-be-encrypted data, and extract the transaction hash value of the Nth transaction, so as to realize the Nth transaction Search for the transaction hash value.
  • the index server extracts the N-1th status character string according to the Nth data to be encrypted; the index server extracts the N-1th status string according to the search token of the index parameter and the first N-1 status string to obtain the N-1th index position information of the index parameter; the index server obtains the N-1th index position information uniquely mapped according to the N-1th index position information N-1 ciphertext; the index server decrypts the N-1th ciphertext into the N-1th data to be encrypted according to the search token and the N-1th status string; the index server According to the N-1th data to be encrypted, the transaction hash value of the N-1th transaction is extracted, so that the search of the transaction hash value of the N-1th transaction is completed.
  • the index server extracts the N-1th status character string according to the Nth to-be-encrypted data, and obtains the N-1th index position information of the index parameter, and obtains the Nth-th 1
  • the N-1th ciphertext uniquely mapped by the index location information that is, the index server can obtain the N-1th ciphertext based on the Nth to-be-encrypted data after decrypting the Nth to-be-encrypted data, and extract the N-1th ciphertext based on the Nth to-be-encrypted data.
  • the transaction hash value in the N-1 transaction, so that the search of the transaction hash value in the N-1th transaction is completed.
  • the Nth ciphertext is a bit operation result of the data to be encrypted and the Nth key according to a preset bit operation; the index server calculates the data according to the Nth key.
  • Decrypting the Nth ciphertext into the Nth to-be-encrypted data the index server operates according to the preset bit and uses the bit operation result of the Nth ciphertext and the Nth key as the Nth to-be-encrypted data Encrypt data.
  • the index server calculates the Nth ciphertext according to the preset bit.
  • Text decryption that is, the bit operation result of the Nth ciphertext and the Nth key is used as the Nth data to be encrypted.
  • this application provides a transaction hash value storage device in a blockchain, including: an acquisition module for acquiring the transaction hash value of the Nth transaction initiated by the user on the client and the The index parameter of the Nth transaction; the index parameter is a keyword determined from the transaction information of the transaction for the transaction log search; the N-1th status string corresponding to the index parameter is obtained; the Nth -1 The status string is generated for the N-1th transaction; N is a positive integer; the encryption module is used to take the N-1th status string and the transaction hash value of the Nth transaction as the first N data to be encrypted; generate an Nth state string, and determine the Nth key and Nth index position information according to the Nth state string and the search token of the index parameter; use the Nth key to The Nth data to be encrypted is encrypted into an Nth ciphertext, and a unique mapping relationship between the Nth index position information and the Nth ciphertext is established.
  • the encryption module is specifically configured to: concatenate the string of the N-1th status string and the transaction hash value of the Nth transaction as the Nth pending string. Encrypted data; according to a preset bit operation, the bit operation result of the Nth to-be-encrypted data and the Nth key is used as the Nth ciphertext.
  • the encryption module is specifically configured to: use the Nth state string and the search token of the index parameter as the result of mapping the first preset hash algorithm as the Nth Key; the Nth state string and the search token of the index parameter are mapped according to the second preset hash algorithm as the Nth index position information; the first hash algorithm and the search token
  • the second hash algorithm is a different hash algorithm.
  • the present application provides a transaction hash value storage device in a blockchain, including: an acquisition module for acquiring a search token and an Nth state string of an index parameter from a client; the index parameter is The keyword used for searching the transaction log is determined from the transaction information of the transaction; the Nth status string is generated when the user initiates the Nth transaction on the client terminal; N is a positive integer; The search token of the index parameter and the Nth state character string to obtain the Nth index position information of the index parameter; the Nth index position information is uniquely mapped to the Nth ciphertext; the Nth ciphertext is The client encrypts the ciphertext of the transaction hash value of the Nth transaction; obtains the Nth ciphertext uniquely mapped to the Nth index position information according to the Nth index position information; decryption module , Used to generate the Nth key according to the search token and the Nth state character string; decrypt the Nth ciphertext into the Nth data to be encrypted according to the Nth key
  • the acquisition module is further configured to: extract the N-1th state string according to the Nth data to be encrypted; and the search token according to the index parameter and the first N-1 status string, obtain the N-1th index position information of the index parameter; obtain the N-1th secret uniquely mapped to the N-1th index position information according to the N-1th index position information
  • the decryption module is also used to: decrypt the N-1th ciphertext into the N-1th to-be-encrypted data according to the search token and the N-1th state string; according to the first The N-1 to-be-encrypted data extracts the transaction hash value of the N-1th transaction, so that the search of the transaction hash value of the N-1th transaction is completed.
  • the Nth ciphertext is a bit operation result of the data to be encrypted and the Nth key according to a preset bit operation; the index server calculates the data according to the Nth key.
  • Decrypting the Nth ciphertext into the Nth to-be-encrypted data the index server operates according to the preset bit and uses the bit operation result of the Nth ciphertext and the Nth key as the Nth to-be-encrypted data Encrypt data.
  • an embodiment of the present application provides a computer device, including a program or instruction.
  • the program or instruction When the program or instruction is executed, it is used to execute each of the above-mentioned first aspect and first aspect embodiments or the second and second aspects. Aspects of the methods of various embodiments.
  • an embodiment of the present application provides a storage medium, including a program or instruction, when the program or instruction is executed, it is used to execute each of the above-mentioned first aspect and first aspect embodiments or the second and second aspects. Aspects of the methods of various embodiments.
  • Figure 1 is a schematic diagram of the structure of the blockchain
  • Figure 2 is a schematic diagram of the flow of event invocation and log generation
  • FIG. 3 is a schematic diagram of a process of a method for storing and searching transaction hash values according to an embodiment of the application
  • FIG. 4 is a schematic flow diagram of the steps of a method for storing transaction hash values according to an embodiment of the application
  • FIG. 5 is a schematic flowchart of steps of a method for searching transaction hash values according to an embodiment of the application
  • FIG. 6 is a schematic structural diagram of a storage device for transaction hash values provided by an embodiment of the application.
  • FIG. 7 is a schematic structural diagram of a searching device for transaction hash value provided by an embodiment of the application.
  • Block chain As shown in Figure 1, the block chain is a chain composed of a series of blocks. In addition to recording the data of this block, each block also records the hash value of the previous block. Through this Way to form a chain.
  • Smart contract is a computer protocol designed to spread, verify, or execute a contract in an information-based way. Smart contracts allow for trusted transactions without a third party, which are traceable and irreversible.
  • the specific form of the smart contract is the code that is deployed on the blockchain to complete specific functions.
  • a log is a special type of data defined by Ethereum.
  • the log is associated with the smart contract and is part of the transaction receipt.
  • the transaction that contains a particular log is unique, and the transaction in Ethereum is generally represented by its transaction hash value.
  • the logs are generated by the client when the transaction is executed, and they can be retrieved in the blockchain storage. As long as a block can be accessed, its related log can be accessed. However, in the contract, it is not possible to directly access the log and event data (even the contract that created the log). Generally, the log can only be accessed through the transaction hash value.
  • the log includes two parts: topic and data. The topic part is used for quick search, and the data part is used to store the original log.
  • Event An event is an interface provided by the Ethereum virtual machine on the basis of the log mechanism. By triggering an event, a log can be generated and written to the blockchain.
  • the event mechanism is usually used to record the user's operation records. For example, define a transfer event event transfer (address indexed from, address indexed to, uint value), when the event is triggered, the parameters from, to, and value will generate a log, which will be written to the blockchain .
  • the application can monitor or call events through the remote procedure call (RPC) interface of the Ethereum client, as shown in Figure 2.
  • RPC remote procedure call
  • Event parameters When defining an event, you need to specify the event parameters. There are two types of parameters, one is modified by indexed, and the other is not modified by indexed. The difference between these two parameters is that the former will be stored in the topic field of the log, while the latter will be stored in the data field of the log.
  • the topic field of the log can be used for search, but the data field cannot be used for search.
  • a transfer event event transfer (address indexed from, address indexed to, uint value)
  • search for all records whose from is equal to address A (equivalent to search for outgoing records of address A)"
  • Hash function The hash function is also known as the hash function, which transforms an input of any length into a fixed-length output through a hash algorithm.
  • the output is the hash value.
  • This conversion is a compression mapping, that is, the space of the hash value is usually much smaller than the space of the input, and different inputs may be hashed into the same output, so it is impossible to determine the unique input value from the hash value.
  • the hash function can be formally defined as: H:(0,1) x ⁇ (0,1) n . Where x is any length, and n is a fixed length.
  • Pseudo-random function is a way to generate random strings. Unlike the hash function, the input of the pseudo-random function includes a key k and a message m, and k is kept secretly. The output of the pseudo-random function is jointly determined by k and m.
  • the pseudo-random function can be formally defined as F:(0,1) ⁇ ⁇ (0,1) x ⁇ (0,1) n . Where ⁇ is the length of the key k, x is the length of the message m, and n is the length of the output.
  • means connection
  • k ⁇ m means the result of connecting k and m.
  • Search token is a variant of search keywords.
  • the user needs to process the keywords first.
  • the process of generating the search token requires the participation of the user's key to ensure that the attacker cannot forge it.
  • the search token will not reveal any information of the original keyword.
  • a pseudo-random function is usually used to generate the search token corresponding to the search keyword. If the keyword to be searched is w and the user key is k, the search token is F(k,w).
  • transaction hash values are mainly stored in two ways.
  • the first method is to store the user's transaction hash value in plain text. Obviously, this method is likely to cause the transaction hash value to leak; the second method is to hash the user's transaction hash value.
  • the transaction hash value is stored as ciphertext, but in this way, the transaction hash value cannot be searched on the ciphertext according to the index parameter. Therefore, the prior art cannot not only satisfy the storage security of the transaction hash value, but also can search for the corresponding transaction hash value according to the index parameter. This situation will also cause the task scheduling signal transmission delay to be too long. This situation does not meet the needs of banks and other financial institutions, and cannot guarantee the efficient operation of various businesses of financial institutions.
  • the present invention designs a scheme to support the storage and search of transaction hash values in the blockchain for the existing event mechanism. This solution ensures that the transmitted data is ciphertext during the entire process of user interaction with the blockchain. In addition, users can search the data in the topic field and the data field at the same time.
  • each keyword corresponds to a state chain.
  • a node in the state chain corresponds to a file containing the keyword, and each node is uniquely identified by the state st.
  • the client In the update phase, the client first generates a new state st c+1 , and then according to the keyword w, the search token t w of the keyword w, the file name ind, the operation type op (including two cases of adding and deleting), etc. The information generates a new node and adds the node to the state chain. When searching, you only need to know t w and st c+1 to get the last node, so that all nodes on the state chain can be traversed.
  • the file name corresponds to the transaction hash value
  • the keyword corresponds to the parameter modified by indexed in the user-defined event.
  • a transfer event event transfer address indexed from, address indexed to, uint value.
  • the program mainly includes three main bodies:
  • Block chain Any kind of block chain with event mechanism for distributed storage of data.
  • the user is required to have a certain storage capacity for storing some information related to keywords.
  • the user's storage form is also different: for example, the server can be used in the application of the client/server (Client/Server, C/S) architecture; in the browser/server structure (Browser/Server, B/S) architecture, the server can be used.
  • the data (cookie) stored in the user's local terminal by the browser can be used in the application of the S) architecture.
  • Index server When the user's storage capacity is insufficient, the index location information can be outsourced to a trusted server. When searching, the index server first searches for the transaction hash value that meets the conditions, and then the user queries the specific log based on the transaction hash value.
  • system initialization Before storing or searching the transaction hash value, system initialization is required. The process of system initialization is described in detail below:
  • the user determines the long-term key k.
  • the long-term key is essentially a binary string.
  • the long-term key needs to be properly kept by the user and will be used to generate the search token corresponding to the keyword.
  • the user initializes the local storage structure.
  • the storage structure is a data structure of a key-value (map) structure, where the key is a keyword, and the value is the latest state corresponding to the keyword.
  • Step 401 The client terminal obtains the transaction hash value of the Nth transaction initiated by the user on the client and the index parameter of the Nth transaction.
  • the index parameter is a keyword used to search the transaction log determined from the transaction information of the transaction; N is a positive integer.
  • Step 402 The client obtains the N-1th status character string corresponding to the index parameter.
  • the N-1th status string is generated for the N-1th transaction.
  • Step 403 The client uses the N-1th status string and the transaction hash value of the Nth transaction as the Nth data to be encrypted.
  • Step 404 The client generates an Nth state character string, and determines the Nth key and Nth index position information according to the Nth state character string and the search token of the index parameter.
  • Step 405 The client uses the Nth key to encrypt the Nth data to be encrypted into an Nth ciphertext, and establishes a unique mapping relationship between the Nth index position information and the Nth ciphertext.
  • the client refers to a client host running client front-end software.
  • the count of N is for a certain event and the specific parameter value of an index parameter of the event.
  • an optional implementation manner of encrypting the Nth ciphertext is as follows:
  • the client terminal concatenates the string of the N-1th status string and the transaction hash value of the Nth transaction as the Nth data to be encrypted; calculates according to the preset bit
  • the bit operation result of the Nth data to be encrypted and the Nth key is used as the Nth ciphertext.
  • the preset bit operation is an exclusive OR bit operation.
  • step 404 An optional implementation manner of step 404 is as follows:
  • the client uses the result of mapping the Nth state string and the search token of the index parameter according to the first preset hash algorithm as the Nth key; the client uses the Nth key; The state string and the search token of the index parameter are mapped according to the second preset hash algorithm as the Nth index position information; the first hash algorithm and the second hash algorithm are different The hash algorithm.
  • Step 501 The index server obtains the search token and the Nth status string of the index parameter from the client.
  • the index parameter is a keyword used to search the transaction log determined from the transaction information of the transaction; the Nth status string is generated when the user initiates the Nth transaction on the client terminal; N is Positive integer.
  • Step 502 The index server obtains the Nth index position information of the index parameter according to the search token of the index parameter and the Nth status character string.
  • the Nth index position information is uniquely mapped to the Nth ciphertext; the Nth ciphertext is a ciphertext encrypted by the client on the transaction hash value of the Nth transaction.
  • Step 503 The index server obtains the Nth ciphertext uniquely mapped by the Nth index position information according to the Nth index position information.
  • Step 504 The index server generates an Nth key according to the search token and the Nth state character string.
  • the index server decrypts the Nth ciphertext into Nth data to be encrypted according to the Nth key.
  • Step 505 The index server extracts the transaction hash value of the Nth transaction according to the Nth to-be-encrypted data, so that the search of the transaction hash value of the Nth transaction is completed.
  • search token the Nth state character string, the Nth index position information, the Nth ciphertext, the Nth key, and the Nth data to be encrypted in the foregoing 501 to 505.
  • steps 401 to 404 corresponds to steps 401 to 404.
  • step 505 you can continue to search for the transaction hash value of the N-1th transaction.
  • the specific implementation is as follows:
  • the index server extracts the N-1th status character string according to the Nth to-be-encrypted data; the index server obtains the N-1th status character string according to the search token of the index parameter and the N-1th status character string The N-1th index position information of the index parameter; the index server obtains the N-1th ciphertext uniquely mapped to the N-1th index position information according to the N-1th index position information; The index server decrypts the N-1th ciphertext into the N-1th data to be encrypted according to the search token and the N-1th status character string; the index server decrypts the N-1th data to be encrypted according to the N-1th status string; The data is encrypted, and the transaction hash value of the N-1th transaction is extracted, so that the search of the transaction hash value of the N-1th transaction is completed.
  • step 504 an optional implementation manner is: the Nth ciphertext is a bit operation result of the data to be encrypted and the Nth key according to a preset bit operation; step 504 can be performed as follows:
  • the index server uses the bit operation result of the Nth ciphertext and the Nth key as the Nth data to be encrypted according to the preset bit operation.
  • the storage process of the transaction hash value is as follows. It should be noted that the following process is a process for an index parameter of an event:
  • Step 401 can be specifically divided into the following first and second steps:
  • Step 1 Use the indexed parameter in the event as the keyword w.
  • a transfer event is defined in the smart contract, event transfer (address indexed from, address indexed to, uint value).
  • event transfer (address indexed from, address indexed to, uint value).
  • Step 2 The user obtains the transaction hash value of the transaction.
  • a transaction hash value of the transaction will be returned, which can be captured by the callback function.
  • ECDSA elliptic curve digital signature
  • the transaction is first encoded with a recursive length prefix (RLP), and then the transaction hash value is calculated on the encoded data.
  • RLP recursive length prefix
  • Step 3 The user checks whether there is a record about w in the local storage, and step 402 is executed.
  • Step 402 is divided into two situations:
  • the first type If there is no record about w, make sure that the index parameter appears for the first time, and use the preset special symbol ⁇ (representing the first occurrence of the keyword) as the N-1 state string ( Figure 3 St c ).
  • the second type if there is a record about w and it is determined that the index parameter does not appear for the first time, the randomly generated character string is used as the N-1th state character string.
  • Step 4 Perform step 403.
  • Step 5 Perform step 404 to step 405.
  • u H 1 (t w ⁇ st c+1 )
  • u is the N- th index position information
  • st c+1 is the N-th state string
  • H 1 is the first hash algorithm
  • Nth key key H 2 (t w ⁇ st c+1 )
  • a preset bit operation such as an exclusive OR bit operation
  • H 1 and H 2 must be two different hash functions, for example, H1 is the SHA256 hash function, and H2 is the MD5 hash function.
  • Step 6 The user stores the N-th state string st c+1 corresponding to the index parameter w into the user's storage structure, and stores (u, e) in the index server.
  • the storage of the index server is shown in Figure 3, which represents an indexing situation where an index parameter takes a specific parameter value (such as "0x1111...FFFFCCCC"), where each node represents a log containing the parameter value. Since the log is stored in the transaction receipt, each node in this application saves a transaction hash value hash(tx) corresponding to the log.
  • the search process of the transaction hash value is as follows. It should be noted that the following process is a process for an index parameter of an event:
  • the first step the user checks whether there is a record about w in the local storage, if not, it means that there is no log about the index parameter, and it returns empty directly.
  • Step 2 If there is a record about w, go to step 501.
  • st c is the latest status string of w.
  • the search token t w F(k,w) is calculated using the long-term key, where F is a pseudo-random function.
  • the client submits t w and st c to the index server;
  • Step 3 Perform step 502 to step 503.
  • Step 4 Perform step 504 to step 505.
  • Step 5 Obtain the log corresponding to the parameter value of the index parameter.
  • R is the set of all transaction hash values that meet the conditions.
  • the user After receiving R, the user takes each transaction hash value in R as input, and uses the corresponding function such as (web3.eth.getTransactionReceipt) to obtain the receipt of the transaction, and then obtain the specific log.
  • the corresponding function such as (web3.eth.getTransactionReceipt) to obtain the receipt of the transaction, and then obtain the specific log.
  • this application provides a transaction hash value storage device in the blockchain, including: an obtaining module 601, configured to obtain the transaction hash value and the transaction hash value of the Nth transaction initiated by the user on the client terminal.
  • the index parameter of the Nth transaction is a keyword determined from the transaction information of the transaction for the transaction log search; the N-1th status string corresponding to the index parameter is obtained;
  • the N-1 status string is generated for the N-1th transaction;
  • N is a positive integer;
  • the encryption module 602 is used to combine the N-1th status string with the transaction hash value of the Nth transaction As the Nth data to be encrypted; generate an Nth state string, and determine the Nth key and Nth index position information according to the Nth state string and the search token of the index parameter; use the Nth secret
  • the key encrypts the Nth data to be encrypted into an Nth ciphertext, and establishes a unique mapping relationship between the Nth index position information and the Nth ciphertext.
  • the encryption module 602 is specifically configured to: combine the N-1th state string and the transaction hash value of the Nth transaction as the Nth Data to be encrypted; according to a preset bit operation, the bit operation result of the Nth data to be encrypted and the Nth key is used as the Nth ciphertext.
  • the encryption module 602 is specifically configured to: use the Nth state string and the search token of the index parameter as the result of mapping the first preset hash algorithm as the first N key; the Nth state string and the search token of the index parameter are mapped according to the second preset hash algorithm as the Nth index position information; the first hash algorithm and The second hash algorithm is a different hash algorithm.
  • this application provides a transaction hash value storage device in the blockchain, including: an obtaining module 701, configured to obtain a search token and an Nth state string of an index parameter from a client; the index parameter It is the key word used to search the transaction log that is determined from the transaction information of the transaction; the Nth status string is generated when the user initiates the Nth transaction on the client terminal; N is a positive integer; according to The search token of the index parameter and the Nth state string to obtain the Nth index position information of the index parameter; the Nth index position information is uniquely mapped to the Nth ciphertext; the Nth ciphertext Is the ciphertext encrypted by the client on the transaction hash value of the Nth transaction; obtains the Nth ciphertext uniquely mapped by the Nth index position information according to the Nth index position information; decrypts
  • the module 702 is configured to generate an Nth key according to the search token and the Nth state character string; decrypt the Nth ciphertext into the Nth data to be encrypted
  • the acquisition module 701 is further configured to: extract the N-1th status string according to the Nth data to be encrypted; according to the search token of the index parameter and the The N-1th status string, the N-1th index position information of the index parameter is acquired; according to the N-1th index position information, the N-1th uniquely mapped to the N-1th index position information is acquired Ciphertext; the decryption module 702 is also used to: decrypt the N-1th ciphertext into the N-1th data to be encrypted according to the search token and the N-1th state character string; For the N-1th data to be encrypted, the transaction hash value of the N-1th transaction is extracted, so that the search of the transaction hash value of the N-1th transaction is completed.
  • the Nth ciphertext is a bit operation result of the data to be encrypted and the Nth key according to a preset bit operation; the index server calculates the data according to the Nth key.
  • Decrypting the Nth ciphertext into the Nth to-be-encrypted data the index server operates according to the preset bit and uses the bit operation result of the Nth ciphertext and the Nth key as the Nth to-be-encrypted data Encrypt data.
  • An embodiment of the application provides a computer device, including a program or instruction, when the program or instruction is executed, it is used to execute a transaction hash value storage or search method in a blockchain provided by the embodiment of the application and Any optional method.
  • An embodiment of the application provides a storage medium, including a program or instruction, when the program or instruction is executed, it is used to execute a transaction hash value storage or search method in a blockchain provided by the embodiment of the application and Any optional method.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种区块链中的交易哈希值存储和搜索方法及装置,其中方法为:客户端获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数;所述客户端获取所述索引参数对应的第N-1状态字符串;所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据;所述客户端根据第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息;所述客户端使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。上述方法应用于金融科技(Fintech)时,上述方法中交易哈希值的存储更加安全,同时存储时保留了可搜索性。

Description

一种区块链中的交易哈希值存储和搜索方法及装置
相关申请的交叉引用
本申请要求在2019年10月08日提交中国专利局、申请号为201910949539.4、申请名称为“一种区块链中的交易哈希值存储和搜索方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及金融科技(Fintech)领域和区块链(Blockchain)领域,尤其涉及一种区块链中的交易哈希值存储和搜索方法及装置。
背景技术
随着计算机技术的发展,越来越多的技术(大数据、分布式、区块链(Blockchain)、人工智能等)应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变。目前,金融科技的区块链领域中,常涉及到交易的搜索。每笔交易在执行完毕后,都会产生唯一标识该笔交易的交易哈希值。目前,搜索用户的交易日志的一般方式是根据用户的交易哈希值来搜索,因此用户的交易哈希值的存储安全至关重要。
现有技术中主要用两种方式存储交易哈希值,第一种是明文存储用户的交易哈希值,显然这种方式容易造成交易哈希值泄露;第二种是将用户的交易哈希值加密后,将交易哈希值存储为密文,但这样以来,便不能在密文上根据索引参数对交易哈希值进行搜索。因此,现有技术不能既满***易哈希值的存储安全性,又能按照索引参数搜索到相应的交易哈希值,这是一个亟待解决的问题。
发明内容
本申请实施例提供一种区块链中的交易哈希值存储和搜索方法及装置,解决了现有技术中不能既满***易哈希值的存储安全性,又能按照索引参数搜索到相应的交易哈希值的问题。
第一方面,本申请实施例提供一种区块链中的交易哈希值存储方法:客户端获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;N为正整数;所述客户端获取所述索引参数对应的第N-1状态字符串;所述第N-1状态字符串是针对第N-1次 交易生成的;所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据;所述客户端生成第N状态字符串,并根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息;所述客户端使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。
上述方法中,客户端获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数对应的第N-1状态字符串后,再根据第N状态字符串和索引参数的搜索令牌,确定第N密钥和第N索引位置信息;并使用所述第N密钥将所述第N待加密数据加密为第N密文,由于第N-1状态字符串是针对第N-1次交易生成的,也就是说,对于每个N,第N密文都是需要第N-1状态字符串的参与,这种环环相扣的方式生成的明文保密性较高;另外,由于建立所述第N索引位置信息和所述第N密文的唯一映射关系,可以通过第N索引位置信息搜索到第N密文,因此,上述方法中交易哈希值的存储更加安全,同时存储时保留了可搜索性。
一种可选实施方式中,所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据,包括:所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据;所述客户端使用所述第N密钥将所述第N待加密数据加密为第N密文,包括:按照预设位运算,将所述第N待加密数据与所述第N密钥的位运算结果,作为所述第N密文。
上述方法中,所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据,并通过预设位运算得到第N密文,从而简单、高效的方法对第N待加密数据进行加密。
一种可选实施方式中,所述客户端根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息,包括:所述客户端将所述第N状态字符串和所述索引参数的搜索令牌按照第一预设哈希算法映射的结果,作为所述第N密钥;所述客户端将所述第N状态字符串和所述索引参数的搜索令牌按照第二预设哈希算法映射的结果,作为所述第N索引位置信息;所述第一哈希算法和所述第二哈希算法为不同的哈希算法。
上述方法中,客户端根据所述第N状态字符串和所述索引参数的搜索令牌,通过不同的第一哈希算法和第二哈希算法,分别确定第N密钥和第N索引位置信息,从而既与第N状态字符串和索引参数的搜索令牌建立了映射关系,又通过不同的哈希算法增强了保密性。
第二方面,本申请提供一种区块链中的交易哈希值搜索方法,包括:索引服务器获取来自客户端的索引参数的搜索令牌和第N状态字符串;所述索引参数是从交易的交易信息 中确定出用于进行交易日志搜索的关键词;N为正整数;所述第N状态字符串是用户在所述客户端上发起的第N次交易时生成的;所述索引服务器根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息;所述第N索引位置信息与第N密文唯一映射;所述第N密文是所述客户端对所述第N次交易的交易哈希值加密的密文;所述索引服务器根据所述第N索引位置信息,获取所述第N索引位置信息唯一映射的所述第N密文;所述索引服务器根据所述搜索令牌和所述第N状态字符串,生成第N密钥;所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据;所述索引服务器根据所述第N待加密数据,提取出所述第N次交易时的交易哈希值,使得完成所述第N次交易时的交易哈希值的搜索。
上述方式下,索引服务器获取来自客户端的索引参数的搜索令牌和第N状态字符串,并根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息,由于所述第N索引位置信息与第N密文唯一映射,因此可以根据第N索引位置信息搜索到第N密文,并通过搜索令牌和所述第N状态字符串生成第N密钥,再用第N密钥将所述第N密文解密为第N待加密数据,并提取出所述第N次交易时的交易哈希值,从而实现了对第N次交易时的交易哈希值的搜索。
一种可选实施方式中,所述索引服务器根据所述第N待加密数据,提取出所述第N-1状态字符串;所述索引服务器根据所述索引参数的搜索令牌和所述第N-1状态字符串,获取所述索引参数的第N-1索引位置信息;所述索引服务器根据所述第N-1索引位置信息,获取所述第N-1索引位置信息唯一映射的第N-1密文;所述索引服务器根据所述搜索令牌和所述第N-1状态字符串,将所述第N-1密文解密为第N-1待加密数据;所述索引服务器根据所述第N-1待加密数据,提取出第N-1次交易时的交易哈希值,使得完成所述第N-1次交易时的交易哈希值的搜索。
上述方式下,所述索引服务器根据所述第N待加密数据,提取出所述第N-1状态字符串,并获取所述索引参数的第N-1索引位置信息,获取所述第N-1索引位置信息唯一映射的第N-1密文,也就是说,索引服务器可以在对第N待加密数据解密后,再基于第N待加密数据获取第N-1密文,并提取出第N-1次交易时的交易哈希值,使得完成所述第N-1次交易时的交易哈希值的搜索。
一种可选实施方式中,所述第N密文是所述待加密数据与所述第N密钥按照预设位运算的位运算结果;所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据:所述索引服务器按照所述预设位运算,将所述第N密文与所述第N密钥的位运算结果,作为所述第N待加密数据。
上述方式下,由于所述第N密文是所述待加密数据与所述第N密钥按照预设位运算的位运算结果,所述索引服务器按照所述预设位运算再将第N密文解密,即将所述第N密文与所述第N密钥的位运算结果,作为所述第N待加密数据。
第三方面,本申请提供一种区块链中的交易哈希值存储装置,包括:获取模块,用于获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;获取所述索引参数对应的第N-1状态字符串;所述第N-1状态字符串是针对第N-1次交易生成的;N为正整数;加密模块,用于将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据;生成第N状态字符串,并根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息;使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。
一种可选实施方式中,所述加密模块具体用于:将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据;按照预设位运算,将所述第N待加密数据与所述第N密钥的位运算结果,作为所述第N密文。
一种可选实施方式中,所述加密模块具体用于:将所述第N状态字符串和所述索引参数的搜索令牌按照第一预设哈希算法映射的结果,作为所述第N密钥;将所述第N状态字符串和所述索引参数的搜索令牌按照第二预设哈希算法映射的结果,作为所述第N索引位置信息;所述第一哈希算法和所述第二哈希算法为不同的哈希算法。
上述第三方面及第三方面各个实施例的有益效果,可以参考上述第一方面及第一方面各个实施例的有益效果,这里不再赘述。
第四方面,本申请提供一种区块链中的交易哈希值存储装置,包括:获取模块,用于获取来自客户端的索引参数的搜索令牌和第N状态字符串;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;所述第N状态字符串是用户在所述客户端上发起的第N次交易时生成的;N为正整数;根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息;所述第N索引位置信息与第N密文唯一映射;所述第N密文是所述客户端对所述第N次交易的交易哈希值加密的密文;根据所述第N索引位置信息,获取所述第N索引位置信息唯一映射的所述第N密文;解密模块,用于根据所述搜索令牌和所述第N状态字符串,生成第N密钥;根据所述第N密钥将所述第N密文解密为第N待加密数据;根据所述第N待加密数据,提取出所述第N次交易时的交易哈希值,使得完成所述第N次交易时的交易哈希值的搜索。
一种可选实施方式中,所述获取模块还用于:根据所述第N待加密数据,提取出所述 第N-1状态字符串;根据所述索引参数的搜索令牌和所述第N-1状态字符串,获取所述索引参数的第N-1索引位置信息;根据所述第N-1索引位置信息,获取所述第N-1索引位置信息唯一映射的第N-1密文;所述解密模块还用于:根据所述搜索令牌和所述第N-1状态字符串,将所述第N-1密文解密为第N-1待加密数据;根据所述第N-1待加密数据,提取出第N-1次交易时的交易哈希值,使得完成所述第N-1次交易时的交易哈希值的搜索。
一种可选实施方式中,所述第N密文是所述待加密数据与所述第N密钥按照预设位运算的位运算结果;所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据:所述索引服务器按照所述预设位运算,将所述第N密文与所述第N密钥的位运算结果,作为所述第N待加密数据。
上述第四方面及第四方面各个实施例的有益效果,可以参考上述第二方面及第二方面各个实施例的有益效果,这里不再赘述。
第五方面,本申请实施例提供一种计算机设备,包括程序或指令,当所述程序或指令被执行时,用以执行上述第一方面及第一方面各个实施例或者第二方面及第二方面各个实施例的方法。
第六方面,本申请实施例提供一种存储介质,包括程序或指令,当所述程序或指令被执行时,用以执行上述第一方面及第一方面各个实施例或者第二方面及第二方面各个实施例的方法。
附图说明
图1为区块链的结构示意图;
图2为事件调用并生成日志的流程示意图;
图3为本申请实施例提供的一种交易哈希值的存储和搜索方法的过程示意图;
图4为本申请实施例提供的一种交易哈希值的存储方法的步骤流程示意图;
图5为本申请实施例提供的一种交易哈希值的搜索方法的步骤流程示意图;
图6为本申请实施例提供的一种交易哈希值的存储装置的结构示意图;
图7为本申请实施例提供的一种交易哈希值的搜索装置的结构示意图。
具体实施方式
为了更好的理解上述技术方案,下面将结合说明书附图及具体的实施方式对上述技术方案进行详细的说明,应当理解本申请实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本申请实施例以 及实施例中的技术特征可以相互结合。
下面首先解释本申请实施例中出现的名词。
区块链:如图1所示,区块链是由一系列区块组成的一条链,每个块上除了记录本块的数据还会记录上一块的哈希(Hash)值,通过这种方式组成一条链。区块链的核心理念有两个,一个是密码学技术,另一个是去中心化思想,基于这两个理念做到区块链上的历史信息无法被篡改。
智能合约:智能合约是一种旨在以信息化方式传播、验证或执行合同的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。智能合约具体形式为部署在区块链上,完成特定功能的代码。
日志:日志是以太坊定义的一种特殊的数据,日志与智能合约关联,是交易收据的一部分。包含某个特定日志的交易是唯一的,以太坊中的交易一般使用其交易哈希值表示。日志由客户端在执行交易时生成,可以在区块链存储中检索到它们。只要某个区块可以访问,其相关的日志就可以访问。但在合约中,并不能直接访问日志和事件数据(即便是创建日志的合约),一般只能通过交易哈希值来访问日志。日志包括主题(topic)和数据(data)两部分,其中topic部分用于快速查找,而data部分用于存储原始日志。
事件:事件是以太坊虚拟机在日志机制的基础上提供的一个接口,通过触发事件可以生成一条日志并将其写入到区块链中。在智能合约开发中,事件机制通常被用来记录用户的操作记录。如定义一个转账事件event transfer(address indexed from,address indexed to,uint value),当该事件被触发时,参数from、to和value将会生成一条日志,该条日志将被写入到区块链。应用程序可以通过以太坊客户端的远程过程调用(remote procedure call,RPC)接口监听或调用事件,如图2所示。
事件的参数:在定义一个事件时,需要指定该事件的参数。参数分为两种,一种是被indexed修饰的,另外一种没有被indexed修饰。这两种参数的区别在于前者将被存储在日志的topic字段,而后者将会被存储在日志的data字段中。日志的topic字段可以用作搜索,而data字段不可以用作搜索。如定义一个转账事件event transfer(address indexed from,address indexed to,uint value),当该事件被触发时,参数from、to和value将会被写入到区块链的日志中。用户可以通过from或to过滤日志,如“搜索from等于地址A的所有记录(相当于搜索地址A的转出记录)”,而不能使用value进行过滤。
哈希函数:哈希函数又被称为散列函数,是把任意长度的输入通过散列算法变换成固定长度的输出,该输出就是散列值。这种转换是一种压缩映射,也就是,散列值的空间通常远小于输入的空间,不同的输入可能会散列成相同的输出,所以不可能从散列值来确定 唯一的输入值。哈希函数可以被形式化地定义为:H:(0,1) x→(0,1) n。其中x为任意长度,而n为固定长度。
伪随机函数:伪随机函数是一种生成随机字符串的方式。和哈希函数不同,伪随机函数的输入中包括一个密钥k和消息m,k是被秘密保存的。伪随机函数的输出由k和m共同决定。伪随机函数可以形式化的定义为F:(0,1) λ×(0,1) x→(0,1) n。其中λ为密钥k的长度,x为消息m的长度,n为输出的长度。在本专利中,伪随机是利用哈希函数实现,即将密钥k和消息m拼接在一起作为函数的输入,F(k,m)=H(k∥m)。在本申请实施例中,∥表示连接,k∥m表示将k与m连接的结果。
搜索令牌:搜索令牌是搜索关键词的一种变形。在搜索时,为了保证所搜索关键词的机密性,用户需要首先对关键词进行处理。生成搜索令牌的过程需要用户密钥的参与,以保证攻击者不能伪造。搜索令牌不会泄露原来的关键词的任何信息,在可搜索加密中,通常使用伪随机函数生成搜索关键词所对应的搜索令牌。如要搜索的关键词为w,用户密钥为k,则搜索令牌为F(k,w)。
在金融机构(银行机构、保险机构或证券机构)在进行业务(如银行的贷款业务、存款业务等)运转过程中,常涉及到交易的搜索。每笔交易在执行完毕后,都会产生唯一标识该笔交易的交易哈希值。目前,搜索用户的交易日志的一般方式是根据用户的交易哈希值来搜索,因此用户的交易哈希值的存储安全至关重要。
现有技术中主要用两种方式存储交易哈希值,第一种是明文存储用户的交易哈希值,显然这种方式容易造成交易哈希值泄露;第二种是将用户的交易哈希值加密后,将交易哈希值存储为密文,但这样以来,便不能在密文上根据索引参数对交易哈希值进行搜索。因此,现有技术不能既满***易哈希值的存储安全性,又能按照索引参数搜索到相应的交易哈希值,这种情况也会导致任务调度信号传输延迟过长。这种情况不符合银行等金融机构的需求,无法保证金融机构各项业务的高效运转。
基于以上分析,本发明针对现有的事件机制,设计了一种区块链中支持交易哈希值的存储和搜索的方案。本方案确保在用户与区块链交互的整个过程中,传输的数据都是密文的。另外,用户可以同时对topic字段和data字段中的数据进行搜索。
本方案使用的一种具备前向安全性质的可搜索加密存储方案。如图3所示,每一个关键词都对应一个状态链。状态链中的一个节点就对应一个包含该关键词的文件,每一个节点都使用状态st唯一标识。在更新阶段,客户端首先产生出新的状态st c+1,然后根据关键词w、关键词w的搜索令牌t w、文件名ind、操作类型op(包括增加和删除两种情况)等信息生成新的节点,并将该节点添加到状态链中。在搜索时,只需要知道t w和st c+1,就可 以得到最后一个节点,从而遍历得到该状态链上的所有的节点。
在本申请中,文件名对应于交易哈希值,关键词对应于用户定义的事件中被indexed修饰的参数。如定义一个转账事件event transfer(address indexed from,address indexed to,uint value)。想要搜索from=“0x1234..”的日志时,只需要搜索关键词w=“0x1234…”的所有交易哈希值,再从这些交易收据中取出对应的日志即可。另外,在本申请中,只有一种操作类型,即op一定为增加。
该方案主要包括三个主体:
区块链:任意一种具有事件机制的区块链,用于分布式存储数据。
用户:产生数据并以触发事件的形式写入到数据库中,检索满足某种条件的事件。需要注意的是,本发明中用户被要求有一定的存储能力,用于存储一些与关键词相关的信息。根据应用场景的不同,用户的存储形式也不同:如在客户机/服务器(Client/Server,C/S)架构的应用中可以使用服务器中;在浏览器/服务器结构(Browser/Server,B/S)架构的应用中可以使用浏览器储存在用户本地终端上的数据(cookie)等。
索引服务器:当用户的存储能力不足时,可以将索引位置信息外包给一个可信的服务器。在搜索时,首先由索引服务器搜索到满足条件的交易哈希值,之后用户根据交易哈希值查询到具体的日志。
在进行交易哈希值的存储或搜索之前,需要做***初始化。下面详细描述了***初始化的过程:
用户确定长期密钥k。
长期密钥本质上是一个二进制字符串。该密钥的长度与***参数λ有关,如λ=1024时,k为长度为1024的二进制串。该长期密钥需要用户妥善保管,将会被用作生成关键词对应的搜索令牌。
用户初始化本地存储结构。
举例来说,该存储结构是一个键-值(map)结构的数据结构,其中键(key)为关键词,值(value)为该关键词对应的最新状态。
下面结合图4和图5,详细介绍本申请实施例提供的一种交易哈希值的存储和搜索方法的步骤流程示意图。
本申请实施例提供的一种交易哈希值的存储方法的步骤如下:
步骤401:客户端获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数。
所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;N为正 整数。
步骤402:所述客户端获取所述索引参数对应的第N-1状态字符串。
所述第N-1状态字符串是针对第N-1次交易生成的。
步骤403:所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据。
步骤404:所述客户端生成第N状态字符串,并根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息。
步骤405:所述客户端使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。
步骤401中,客户端指运行客户端前端软件的客户端主机。第N次交易中,N的计数是针对某一个事件及该事件的一个索引参数的具体参数值的。举例来说,第N次交易可以为转账事件在“from=A”的条件下的第N次触发对应的交易。当需要根据索引参数搜索交易日志时,可以为索引参数赋具体的值来搜索,举例来说,按照“form=A”搜索转账事件。
上述步骤401~步骤405中,加密为第N密文的一种可选实施方式如下:
所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据;按照预设位运算,将所述第N待加密数据与所述第N密钥的位运算结果,作为所述第N密文。举例来说,预设位运算为异或位运算。
步骤404的一种可选实施方式如下:
所述客户端将所述第N状态字符串和所述索引参数的搜索令牌按照第一预设哈希算法映射的结果,作为所述第N密钥;所述客户端将所述第N状态字符串和所述索引参数的搜索令牌按照第二预设哈希算法映射的结果,作为所述第N索引位置信息;所述第一哈希算法和所述第二哈希算法为不同的哈希算法。
相应地,本申请实施例提供的一种交易哈希值的搜索方法的步骤如下:
步骤501:索引服务器获取来自客户端的索引参数的搜索令牌和第N状态字符串。
所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;所述第N状态字符串是用户在所述客户端上发起的第N次交易时生成的;N为正整数。
步骤502:所述索引服务器根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息。
所述第N索引位置信息与第N密文唯一映射;所述第N密文是所述客户端对所述第N次交易的交易哈希值加密的密文。
步骤503:所述索引服务器根据所述第N索引位置信息,获取所述第N索引位置信息 唯一映射的所述第N密文。
步骤504:所述索引服务器根据所述搜索令牌和所述第N状态字符串,生成第N密钥。
所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据。
步骤505:所述索引服务器根据所述第N待加密数据,提取出所述第N次交易时的交易哈希值,使得完成所述第N次交易时的交易哈希值的搜索。
需要说明的是,上述501~505中的搜索令牌、第N状态字符串、第N索引位置信息、第N密文、第N密钥和第N待加密数据。与步骤401~步骤404中的相对应。
步骤505之后,还可以继续搜索第N-1次交易时的交易哈希值,具体实施方式如下:
所述索引服务器根据所述第N待加密数据,提取出所述第N-1状态字符串;所述索引服务器根据所述索引参数的搜索令牌和所述第N-1状态字符串,获取所述索引参数的第N-1索引位置信息;所述索引服务器根据所述第N-1索引位置信息,获取所述第N-1索引位置信息唯一映射的第N-1密文;所述索引服务器根据所述搜索令牌和所述第N-1状态字符串,将所述第N-1密文解密为第N-1待加密数据;所述索引服务器根据所述第N-1待加密数据,提取出第N-1次交易时的交易哈希值,使得完成所述第N-1次交易时的交易哈希值的搜索。
步骤504中,一种可选实施方式为:所述第N密文是所述待加密数据与所述第N密钥按照预设位运算的位运算结果;步骤504可以按以下步骤执行:
所述索引服务器按照所述预设位运算,将所述第N密文与所述第N密钥的位运算结果,作为所述第N待加密数据。
下面通过具体例子,进一步说明本申请实施例提供的一种交易哈希值的存储和搜索方法。
当事件触发时,交易哈希值的存储过程如下。需要说明的是,以下过程是针对一个事件的一个索引参数的过程:
步骤401具体可以分为以下的第一步和第二步:
第一步:将该事件中以indexed修饰的参数作为关键词w。
具体来说,可以使用伪随机函数F,将长期密钥和关键词作为参数,计算其搜索令牌tw=F(k,w)。
例如在智能合约中定义了一个转账事件,event transfer(address indexed from,address indexed to,uint value)。当触发转账事件时,emit transfer("0x1111…ffffcccc","0x50…sd5adb20",100),即地址"0x1111…ffffcccc"向地址"0x50…sd5adb20"转账100eth。
由于参数from和to被indexed修饰,表示用户希望将来能够以这两个参数作为关键词 进行搜索(如过滤出所有地址为"0x1111…FFFFCCCC"的转账记录)。对两个索引参数的每一个参数都执行上述第一步:用户生成两个搜索令牌t w=F(k,"0x1111…ffffcccc")和t w=F(k,"0x50…sd5adb20")。
第二步:用户获得交易的交易哈希值。
具体来说,在用户通过调用函数发起交易之后,会返回一个交易的交易哈希值,可以利用回调函数捕捉到该哈希值。该哈希值也可以手动计算出来,假设交易tx=[nonce,gasPrice,gas,to,value,data,v,r,s],其中nonce为随机数,gasPrice为当前gas的价格,gas为该交易可使用的最大gas数量限制,to为接收方地址(在本申请的场景中,可以是一个合约地址),value为交易发送的以太币数量,data为交易的数据,v,r和s可以代表椭圆曲线数字签名算法(elliptic curve digital signature,ECDSA)签名。在计算交易的哈希值时,首先对交易进行递归长度前缀(recursive length prefix,RLP)编码,然后对编码后的数据计算交易哈希值。举例来说,通过keccak256计算交易哈希值,即交易的哈希值简单表示为:hash(tx)=keccak256(rlp.encode(tx)),hash(tx)为2048比特的字符串。
第三步:用户检查本地存储中是否有关于w的记录,执行步骤402。
步骤402分两种情况:
第一种:如果没有关于w的记录,确定该索引参数是第一次出现,将预设的特殊符号⊥(代表该关键词第一次出现)作为第N-1状态字符串(图3中的st c)。
第二种:如果有关于w的记录,确定该索引参数不是第一次出现,则将随机生成的字符串作为第N-1状态字符串。
状态字符串的长度可以通过***参数λ设置,如λ=1024时,状态字符串是长度为1024的二进制串。
第四步:执行步骤403。
举例来说,将第N-1状态字符串与交易哈希值拼接得到第N待加密数据,即p=(⊥∥hash(tx));或者将st c和交易的哈希值拼接得到第N待加密数据,即p=(st c∥hash)。
第五步:执行步骤404~步骤405。
举例来说,u=H 1(t w∥st c+1),u为第N索引位置信息,st c+1为第N状态字符串,H 1为第一哈希算法。
计算第N密钥key=H 2(t w∥st c+1),使用预设位运算,如异或位运算待加密数据加密得到第N密文e(即
Figure PCTCN2020116236-appb-000001
长度不足时用0补齐)。这里的H 2为第二哈希算法。
H 1和H 2必须是两个不同的哈希函数,如H1为SHA256哈希函数,而H2为MD5哈希 函数。
第六步:用户将索引参数w对应的第N状态字符串st c+1存入用户的存储结构中,将(u,e)存储在索引服务器中。此时索引服务器的存储如图3所示,该图表示一个索引参数取一个具体参数值(如"0x1111…FFFFCCCC")的索引情况,其中每一个节点代表一个包含该参数值的日志。由于日志存储在交易的收据中,在本申请中每一个节点都保存一个该日志对应的交易哈希值hash(tx)。
交易哈希值的搜索过程如下。需要说明的是,以下过程是针对一个事件的一个索引参数的过程:
第一步:用户检查本地存储中是否有关于w的记录,如果没有,说明不存在关于该索引参数的日志,直接返回空。
第二步:如果有关于w的记录,则执行步骤501。
具体来说,取出某个状态字符串,如st c。特殊地,st c为w最新的状态字符串。利用长期密钥计算搜索令牌t w=F(k,w),其中F是伪随机函数。客户端将t w和st c提交给索引服务器;
第三步:执行步骤502~步骤503。
举例来说,索引服务器在收到(tw,stc)后,通过u=H 1(t w∥st c-1)获得第N索引位置信息。取出关于stc的记录密文e。
第四步:执行步骤504~步骤505。
对e进行解密,即
Figure PCTCN2020116236-appb-000002
H 2(t w∥st c)为第N密钥;p为第N待加密数据。其中p=(stc-1,hash(tx));hash(tx)即为满足条件的事件所生成的日志所在的交易的哈希值,将其存储在结果R中。
第五步:获取索引参数的参数值对应的日志。
索引服务器利用stc-1计算下一个位置u=H 1(t w∥st c-1),取出相对应的密文。如果有,则继续循环操作步骤三,并更新R,最后将搜索结果R返回,R就是所有满足条件的交易哈希值的集合。
用户在收到R之后,分别将R中的每个交易哈希值作为输入,使用相应的函数如(web3.eth.getTransactionReceipt)函数获得该交易的收据,进而获得具体的日志。
如图6,本申请提供一种区块链中的交易哈希值存储装置,包括:获取模块601,用于获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;获取所述索引参数对应的第N-1状态字符串;所述第N-1状态字符串是针对第N-1次交易生成的;N 为正整数;加密模块602,用于将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据;生成第N状态字符串,并根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息;使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。
一种可选实施方式中,所述加密模块602具体用于:将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据;按照预设位运算,将所述第N待加密数据与所述第N密钥的位运算结果,作为所述第N密文。
一种可选实施方式中,所述加密模块602具体用于:将所述第N状态字符串和所述索引参数的搜索令牌按照第一预设哈希算法映射的结果,作为所述第N密钥;将所述第N状态字符串和所述索引参数的搜索令牌按照第二预设哈希算法映射的结果,作为所述第N索引位置信息;所述第一哈希算法和所述第二哈希算法为不同的哈希算法。
如图7,本申请提供一种区块链中的交易哈希值存储装置,包括:获取模块701,用于获取来自客户端的索引参数的搜索令牌和第N状态字符串;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;所述第N状态字符串是用户在所述客户端上发起的第N次交易时生成的;N为正整数;根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息;所述第N索引位置信息与第N密文唯一映射;所述第N密文是所述客户端对所述第N次交易的交易哈希值加密的密文;根据所述第N索引位置信息,获取所述第N索引位置信息唯一映射的所述第N密文;解密模块702,用于根据所述搜索令牌和所述第N状态字符串,生成第N密钥;根据所述第N密钥将所述第N密文解密为第N待加密数据;根据所述第N待加密数据,提取出所述第N次交易时的交易哈希值,使得完成所述第N次交易时的交易哈希值的搜索。
一种可选实施方式中,所述获取模块701还用于:根据所述第N待加密数据,提取出所述第N-1状态字符串;根据所述索引参数的搜索令牌和所述第N-1状态字符串,获取所述索引参数的第N-1索引位置信息;根据所述第N-1索引位置信息,获取所述第N-1索引位置信息唯一映射的第N-1密文;所述解密模块702还用于:根据所述搜索令牌和所述第N-1状态字符串,将所述第N-1密文解密为第N-1待加密数据;根据所述第N-1待加密数据,提取出第N-1次交易时的交易哈希值,使得完成所述第N-1次交易时的交易哈希值的搜索。
一种可选实施方式中,所述第N密文是所述待加密数据与所述第N密钥按照预设位运算的位运算结果;所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据:所述索引服务器按照所述预设位运算,将所述第N密文与所述第N密钥的位运算结 果,作为所述第N待加密数据。
本申请实施例提供一种计算机设备,包括程序或指令,当所述程序或指令被执行时,用以执行本申请实施例提供的一种区块链中的交易哈希值存储或搜索方法及任一可选方法。
本申请实施例提供一种存储介质,包括程序或指令,当所述程序或指令被执行时,用以执行本申请实施例提供的一种区块链中的交易哈希值存储或搜索方法及任一可选方法。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。

Claims (12)

  1. 一种区块链中的交易哈希值存储方法,其特征在于,包括:
    客户端获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;N为正整数;
    所述客户端获取所述索引参数对应的第N-1状态字符串;所述第N-1状态字符串是针对第N-1次交易生成的;
    所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据;
    所述客户端生成第N状态字符串,并根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息;
    所述客户端使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。
  2. 如权利要求1所述的方法,其特征在于,
    所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据,包括:
    所述客户端将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据;
    所述客户端使用所述第N密钥将所述第N待加密数据加密为第N密文,包括:
    按照预设位运算,将所述第N待加密数据与所述第N密钥的位运算结果,作为所述第N密文。
  3. 如权利要求1或2所述的方法,其特征在于,所述客户端根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息,包括:
    所述客户端将所述第N状态字符串和所述索引参数的搜索令牌按照第一预设哈希算法映射的结果,作为所述第N密钥;
    所述客户端将所述第N状态字符串和所述索引参数的搜索令牌按照第二预设哈希算法映射的结果,作为所述第N索引位置信息;所述第一哈希算法和所述第二哈希算法为不同的哈希算法。
  4. 一种区块链中的交易哈希值搜索方法,其特征在于,包括:
    索引服务器获取来自客户端的索引参数的搜索令牌和第N状态字符串;所述索引参数 是从交易的交易信息中确定出用于进行交易日志搜索的关键词;所述第N状态字符串是用户在所述客户端上发起的第N次交易时生成的;N为正整数;
    所述索引服务器根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息;所述第N索引位置信息与第N密文唯一映射;所述第N密文是所述客户端对所述第N次交易的交易哈希值加密的密文;
    所述索引服务器根据所述第N索引位置信息,获取所述第N索引位置信息唯一映射的所述第N密文;
    所述索引服务器根据所述搜索令牌和所述第N状态字符串,生成第N密钥;所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据;
    所述索引服务器根据所述第N待加密数据,提取出所述第N次交易时的交易哈希值,使得完成所述第N次交易时的交易哈希值的搜索。
  5. 如权利要求4所述的方法,其特征在于,还包括:
    所述索引服务器根据所述第N待加密数据,提取出所述第N-1状态字符串;
    所述索引服务器根据所述索引参数的搜索令牌和所述第N-1状态字符串,获取所述索引参数的第N-1索引位置信息;
    所述索引服务器根据所述第N-1索引位置信息,获取所述第N-1索引位置信息唯一映射的第N-1密文;
    所述索引服务器根据所述搜索令牌和所述第N-1状态字符串,将所述第N-1密文解密为第N-1待加密数据;
    所述索引服务器根据所述第N-1待加密数据,提取出第N-1次交易时的交易哈希值,使得完成所述第N-1次交易时的交易哈希值的搜索。
  6. 如权利要求4或5所述的方法,其特征在于,所述第N密文是所述待加密数据与所述第N密钥按照预设位运算的位运算结果;所述索引服务器根据所述第N密钥将所述第N密文解密为第N待加密数据,包括:
    所述索引服务器按照所述预设位运算,将所述第N密文与所述第N密钥的位运算结果,作为所述第N待加密数据。
  7. 一种区块链中的交易哈希值存储装置,其特征在于,包括:
    获取模块,用于获取用户在所述客户端上发起的第N次交易的交易哈希值和所述第N次交易的索引参数;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;获取所述索引参数对应的第N-1状态字符串;所述第N-1状态字符串是针对第N-1次交易生成的;N为正整数;
    加密模块,用于将所述第N-1状态字符串和所述第N次交易的交易哈希值作为第N待加密数据;生成第N状态字符串,并根据所述第N状态字符串和所述索引参数的搜索令牌确定第N密钥和第N索引位置信息;使用所述第N密钥将所述第N待加密数据加密为第N密文,并建立所述第N索引位置信息和所述第N密文的唯一映射关系。
  8. 如权利要求7所述的装置,其特征在于,所述加密模块具体用于:
    将所述第N-1状态字符串和所述第N次交易的交易哈希值拼接后的字符串,作为所述第N待加密数据;按照预设位运算,将所述第N待加密数据与所述第N密钥的位运算结果,作为所述第N密文。
  9. 如权利要求7或8所述的装置,其特征在于,所述加密模块具体用于:
    将所述第N状态字符串和所述索引参数的搜索令牌按照第一预设哈希算法映射的结果,作为所述第N密钥;将所述第N状态字符串和所述索引参数的搜索令牌按照第二预设哈希算法映射的结果,作为所述第N索引位置信息;所述第一哈希算法和所述第二哈希算法为不同的哈希算法。
  10. 一种区块链中的交易哈希值搜索装置,其特征在于,包括:
    获取模块,用于获取来自客户端的索引参数的搜索令牌和第N状态字符串;所述索引参数是从交易的交易信息中确定出用于进行交易日志搜索的关键词;所述第N状态字符串是用户在所述客户端上发起的第N次交易时生成的;N为正整数;根据所述索引参数的搜索令牌和所述第N状态字符串,获取所述索引参数的第N索引位置信息;所述第N索引位置信息与第N密文唯一映射;所述第N密文是所述客户端对所述第N次交易的交易哈希值加密的密文;根据所述第N索引位置信息,获取所述第N索引位置信息唯一映射的所述第N密文;
    解密模块,用于根据所述搜索令牌和所述第N状态字符串,生成第N密钥;根据所述第N密钥将所述第N密文解密为第N待加密数据;根据所述第N待加密数据,提取出所述第N次交易时的交易哈希值,使得完成所述第N次交易时的交易哈希值的搜索。
  11. 一种计算机设备,其特征在于,包括程序或指令,当所述程序或指令被执行时,如权利要求1至3或4至6中任意一项所述的方法被执行。
  12. 一种存储介质,其特征在于,包括程序或指令,当所述程序或指令被执行时,如权利要求1至3中或4至6任意一项所述的方法被执行。
PCT/CN2020/116236 2019-10-08 2020-09-18 一种区块链中的交易哈希值存储和搜索方法及装置 WO2021068726A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910949539.4A CN110689349B (zh) 2019-10-08 2019-10-08 一种区块链中的交易哈希值存储和搜索方法及装置
CN201910949539.4 2019-10-08

Publications (1)

Publication Number Publication Date
WO2021068726A1 true WO2021068726A1 (zh) 2021-04-15

Family

ID=69111740

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/116236 WO2021068726A1 (zh) 2019-10-08 2020-09-18 一种区块链中的交易哈希值存储和搜索方法及装置

Country Status (2)

Country Link
CN (1) CN110689349B (zh)
WO (1) WO2021068726A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113468571A (zh) * 2021-07-15 2021-10-01 湖北央中巨石信息技术有限公司 基于区块链的溯源方法
CN114491613A (zh) * 2021-11-11 2022-05-13 北京航空航天大学 高效可搜索的代理隐私集合求交方法及装置
CN114710357A (zh) * 2022-04-12 2022-07-05 河北大学 一种可编辑区块链中支持分块验证的动态可搜索加密方法
CN114726865A (zh) * 2022-03-29 2022-07-08 杭州安恒信息技术股份有限公司 数据质押方法、***、电子装置和存储介质
CN117077179A (zh) * 2023-10-11 2023-11-17 ***紫金(江苏)创新研究院有限公司 基于差分隐私排序的可搜索加密方法、装置、设备及介质
CN117574413A (zh) * 2024-01-17 2024-02-20 杭州易靓好车互联网科技有限公司 一种车辆交易客户信息动态加密防护方法
CN118394714A (zh) * 2024-06-26 2024-07-26 湖南交通物流信息服务有限公司 一种加密文件索引快速构建与存储方法

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110689349B (zh) * 2019-10-08 2023-07-11 深圳前海微众银行股份有限公司 一种区块链中的交易哈希值存储和搜索方法及装置
CN111526047B (zh) * 2020-04-15 2022-11-08 杭州溪塔科技有限公司 一种基于区块链的消息队列设计方法及装置
CN114116367B (zh) * 2020-08-25 2022-11-01 荣耀终端有限公司 一种生成日志的方法及电子设备
CN112711648B (zh) * 2020-12-23 2024-07-02 航天信息股份有限公司 一种数据库字符串密文存储方法、电子设备和介质
CN112765271B (zh) * 2020-12-31 2023-02-07 杭州趣链科技有限公司 区块链交易索引的存储方法、装置、计算机设备及介质
CN115225258B (zh) * 2022-09-19 2023-01-06 中电科新型智慧城市研究院有限公司 一种基于区块链的跨域可信数据的安全管理方法及***

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108389059A (zh) * 2018-02-26 2018-08-10 成都大学 基于权属的数字版权作品保护、交易和发行方法及***
CN108573741A (zh) * 2017-12-25 2018-09-25 北京金山云网络技术有限公司 业务数据记录方法、装置、设备和存储介质
EP3480762A1 (en) * 2017-11-03 2019-05-08 Mastercard International Incorporated Systems and methods for authenticating a user based on biometric and device data
CN110245489A (zh) * 2019-05-20 2019-09-17 阿里巴巴集团控股有限公司 基于明文日志的收据存储方法、节点和***
CN110689349A (zh) * 2019-10-08 2020-01-14 深圳前海微众银行股份有限公司 一种区块链中的交易哈希值存储和搜索方法及装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9355271B2 (en) * 2013-10-18 2016-05-31 Robert Bosch Gmbh System and method for dynamic, non-interactive, and parallelizable searchable symmetric encryption
JP6208586B2 (ja) * 2014-01-16 2017-10-04 株式会社日立製作所 検索可能暗号処理システムおよび検索可能暗号処理方法
CN106610995B (zh) * 2015-10-23 2020-07-07 华为技术有限公司 一种创建密文索引的方法、装置及***
US9946720B1 (en) * 2015-12-04 2018-04-17 Ionu Security, Inc. Searching data files using a key map
CN109218010B (zh) * 2017-07-04 2021-11-30 阿波罗智能技术(北京)有限公司 数据加密方法和装置、数据解密方法和装置
US10565192B2 (en) * 2017-08-01 2020-02-18 International Business Machines Corporation Optimizing queries and other retrieve operations in a blockchain
FR3079324B1 (fr) * 2018-03-22 2020-04-10 Sagemcom Energy & Telecom Sas Procedes et systeme de gestion de donnees permettant un controle temporel des donnees
CN109936457B (zh) * 2019-02-20 2022-04-26 深圳前海微众银行股份有限公司 区块链多方见证方法、装置、设备及计算机可读存储介质
CN109815723A (zh) * 2019-02-28 2019-05-28 东北大学 一种基于后缀树的可搜索加密***及方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3480762A1 (en) * 2017-11-03 2019-05-08 Mastercard International Incorporated Systems and methods for authenticating a user based on biometric and device data
CN108573741A (zh) * 2017-12-25 2018-09-25 北京金山云网络技术有限公司 业务数据记录方法、装置、设备和存储介质
CN108389059A (zh) * 2018-02-26 2018-08-10 成都大学 基于权属的数字版权作品保护、交易和发行方法及***
CN110245489A (zh) * 2019-05-20 2019-09-17 阿里巴巴集团控股有限公司 基于明文日志的收据存储方法、节点和***
CN110689349A (zh) * 2019-10-08 2020-01-14 深圳前海微众银行股份有限公司 一种区块链中的交易哈希值存储和搜索方法及装置

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113468571A (zh) * 2021-07-15 2021-10-01 湖北央中巨石信息技术有限公司 基于区块链的溯源方法
CN113468571B (zh) * 2021-07-15 2023-05-12 湖北央中巨石信息技术有限公司 基于区块链的溯源方法
CN114491613A (zh) * 2021-11-11 2022-05-13 北京航空航天大学 高效可搜索的代理隐私集合求交方法及装置
CN114491613B (zh) * 2021-11-11 2024-04-16 北京航空航天大学 高效可搜索的代理隐私集合求交方法及装置
CN114726865A (zh) * 2022-03-29 2022-07-08 杭州安恒信息技术股份有限公司 数据质押方法、***、电子装置和存储介质
CN114726865B (zh) * 2022-03-29 2024-05-31 杭州安恒信息技术股份有限公司 数据质押方法、***、电子装置和存储介质
CN114710357A (zh) * 2022-04-12 2022-07-05 河北大学 一种可编辑区块链中支持分块验证的动态可搜索加密方法
CN117077179A (zh) * 2023-10-11 2023-11-17 ***紫金(江苏)创新研究院有限公司 基于差分隐私排序的可搜索加密方法、装置、设备及介质
CN117077179B (zh) * 2023-10-11 2024-01-02 ***紫金(江苏)创新研究院有限公司 基于差分隐私排序的可搜索加密方法、装置、设备及介质
CN117574413A (zh) * 2024-01-17 2024-02-20 杭州易靓好车互联网科技有限公司 一种车辆交易客户信息动态加密防护方法
CN117574413B (zh) * 2024-01-17 2024-04-05 杭州易靓好车互联网科技有限公司 一种车辆交易客户信息动态加密防护方法
CN118394714A (zh) * 2024-06-26 2024-07-26 湖南交通物流信息服务有限公司 一种加密文件索引快速构建与存储方法

Also Published As

Publication number Publication date
CN110689349B (zh) 2023-07-11
CN110689349A (zh) 2020-01-14

Similar Documents

Publication Publication Date Title
WO2021068726A1 (zh) 一种区块链中的交易哈希值存储和搜索方法及装置
US10880077B2 (en) Processing blockchain data based on smart contract operations executed in a trusted execution environment
US10860710B2 (en) Processing and storing blockchain data under a trusted execution environment
AU2018367363B2 (en) Processing data queries in a logically sharded data store
US8533489B2 (en) Searchable symmetric encryption with dynamic updating
EP3776250B1 (en) Performing map iterations in blockchain-based system
WO2019179539A2 (en) Shared blockchain data storage
US11546348B2 (en) Data service system
WO2020224489A1 (zh) 基于区块链的银行数据共享方法及相关设备
US11251969B2 (en) Performing map iterations in a blockchain-based system
CN112131227A (zh) 一种基于联盟链的数据查询方法及装置
US11314885B2 (en) Cryptographic data entry blockchain data structure
CN116089976A (zh) 关系型数据库的管理方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20873970

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 16.08.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20873970

Country of ref document: EP

Kind code of ref document: A1