A computer-implemented method for processing blockchain data in a trusted execution environment, TEE, executing on a computing device communicably coupled to a blockchain network, the method comprising: receiving a plurality of blocks from a blockchain node in the blockchain network; for each of the plurality of blocks: determining a first number of blockchain nodes that store a first dataset and a second number of blockchain nodes that store a second dataset, wherein the first dataset comprises one of a plurality of datasets divided from an error correction coding, ECC, encoded version of the block and the second data set comprises redundant bits of the ECC for error correction, and calculating a priority value of the each block based on the first number and the second number wherein the priority value is calculated as the first number minus the first number divided by a difference between the first number and the second number; and re-encoding at least a portion of the plurality of blocks using ECC to generate a plurality of encoded blocks according to the priority of value of the plurality of blocks, wherein the lower the priority value the higher the re-encoding priority of the block, and wherein a code rate of the at least a portion of the plurality of encoded blocks equals a minimum number of honest blockchain nodes required by the blockchain network divided by a total number of blockchain nodes of the blockchain network. receiving a plurality of blocks from a blockchain node in the blockchain network; for each of the plurality of blocks: determining a first number of blockchain nodes that store a first dataset and a second number of blockchain nodes that store a second dataset, wherein the first dataset comprises one of a plurality of datasets divided from an error correction coding, ECC, encoded version of the block and the second data set comprises redundant bits of the ECC for error correction, and calculating a priority value of the each block based on the first number and the second number wherein the priority value is calculated as the first number minus the first number divided by a difference between the first number and the second number; and determining a first number of blockchain nodes that store a first dataset and a second number of blockchain nodes that store a second dataset, wherein the first dataset comprises one of a plurality of datasets divided from an error correction coding, ECC, encoded version of the block and the second data set comprises redundant bits of the ECC for error correction, and calculating a priority value of the each block based on the first number and the second number wherein the priority value is calculated as the first number minus the first number divided by a difference between the first number and the second number; and re-encoding at least a portion of the plurality of blocks using ECC to generate a plurality of encoded blocks according to the priority of value of the plurality of blocks, wherein the lower the priority value the higher the re-encoding priority of the block, and wherein a code rate of the at least a portion of the plurality of encoded blocks equals a minimum number of honest blockchain nodes required by the blockchain network divided by a total number of blockchain nodes of the blockchain network.