A method for obtaining a number for a transaction-accessed variable in parallel in a blockchain executed by a plurality of threads in a blockchain node device, wherein each thread is related to a transaction, comprising: calculating a hash value m corresponding to a variable name of a first variable accessed in a first transaction, the hash value m being a value in pre-determined M values; performing the following atomic operation on an m th bit in a bitmap in a shared memory: reading a current first value of the m th bit, setting the m th 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 m th element in a mapping array in the shared memory based on the first number, the mapping array including a total of M elements, wherein the shared memory further stores a version number variable and a version number array, the version number array includes M elements, the first transaction is a transaction in a first batch of transactions, and the method further comprises: before the first batch of transactions are processed, setting a value of the version number variable to be unequal to a value of each element in the version number array; and after the setting the value of the m th element in the mapping array based on the first number, modifying a value of an m th element in the version number array to be equal to a value of the version number variable, and wherein the setting the value of the version number variable to be unequal to the value of each element in the version number array includes setting the value of the version number variable to meet a pre-determined relationship with the value of each element in the version number array; and the modifying the value of the m th element in the version number array to be equal to the value of the version number variable includes modifying the value of the m th element in the version number array based on the pre-determined relationship. calculating a hash value m corresponding to a variable name of a first variable accessed in a first transaction, the hash value m being a value in pre-determined M values; performing the following atomic operation on an m th bit in a bitmap in a shared memory: reading a current first value of the m th bit, setting the m th bit to 1, and returning the first value, the bitmap having M bits, and initial values of the M bits being 0; reading a current first value of the m th bit, setting the m th 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 m th element in a mapping array in the shared memory based on the first number, the mapping array including a total of M elements, wherein the shared memory further stores a version number variable and a version number array, the version number array includes M elements, the first transaction is a transaction in a first batch of transactions, and the method further comprises: before the first batch of transactions are processed, setting a value of the version number variable to be unequal to a value of each element in the version number array; and after the setting the value of the m th element in the mapping array based on the first number, modifying a value of an m th element in the version number array to be equal to a value of the version number variable, and wherein the setting the value of the version number variable to be unequal to the value of each element in the version number array includes setting the value of the version number variable to meet a pre-determined relationship with the value of each element in the version number array; and the modifying the value of the m th element in the version number array to be equal to the value of the version number variable includes modifying the value of the m th element in the version number array based on the pre-determined relationship. before the first batch of transactions are processed, setting a value of the version number variable to be unequal to a value of each element in the version number array; and after the setting the value of the m th element in the mapping array based on the first number, modifying a value of an m th element in the version number array to be equal to a value of the version number variable, and wherein the setting the value of the version number variable to be unequal to the value of each element in the version number array includes setting the value of the version number variable to meet a pre-determined relationship with the value of each element in the version number array; and the modifying the value of the m th element in the version number array to be equal to the value of the version number variable includes modifying the value of the m th element in the version number array based on the pre-determined relationship.