Method and apparatus for obtaining number for transaction-accessed variable in blockchain in parallel
Abstract:
Implementations of the present specification provide a method and an apparatus for obtaining a number for a transaction-accessed variable in parallel in a blockchain. The method includes: for a first variable in a first transaction, calculating a hash value m corresponding to a variable name of the first variable, the hash value m being a value in pre-determined M values; performing the following atomic operation on an mth bit in a bitmap in a shared memory: reading a current first value of the mth bit, setting the mth bit to 1, and returning the first value, the bitmap having M bits, and initial values of the M bits being 0; in response to the first value being 0, obtaining a first number uniquely corresponding to the first variable, the first number being a value in pre-determined N values, and N being less than M; and setting a value of an mth element in a mapping array in the shared memory based on the first number, the mapping array including a total of M elements.
Information query
Patent Agency Ranking
0/0