A computer-implemented method for processing blockchain data under a trusted execution environment, TEE, the method comprising: receiving, by a blockchain node, a request to execute one or more software instructions in the TEE executing on the blockchain node; determining, by a virtual machine in the TEE, data associated with one or more blockchain accounts to execute the one or more software instructions based on the request; traversing, by the virtual machine, a global state of a blockchain stored in the TEE to locate the data, wherein the global state includes a mapping between addresses and states of a plurality of blockchain accounts of the blockchain, and the plurality of blockchain accounts include externally owned accounts and contract accounts, wherein each of the contract accounts includes a storage root, wherein the externally owned accounts are controlled by private keys and are not associated with code, and wherein the contract accounts are controlled by their contract code; executing, by the virtual machine, the one or more software instructions based on the data, wherein the global state of the blockchain stored in the TEE is updated during execution of the one or more software instructions to produce an updated global state; storing the updated global state in an overlay database in a cache which is included in the TEE or can be accessed by the TEE through direct memory access; encrypting the updated global state to generate an encrypted updated global state in the cache; and in response to encrypting the updated global state to generate the encrypted updated global state, syncing the encrypted updated global state from the cache to a key value pair database, wherein the key value pair database is separate from the TEE. receiving, by a blockchain node, a request to execute one or more software instructions in the TEE executing on the blockchain node; determining, by a virtual machine in the TEE, data associated with one or more blockchain accounts to execute the one or more software instructions based on the request; traversing, by the virtual machine, a global state of a blockchain stored in the TEE to locate the data, wherein the global state includes a mapping between addresses and states of a plurality of blockchain accounts of the blockchain, and the plurality of blockchain accounts include externally owned accounts and contract accounts, wherein each of the contract accounts includes a storage root, wherein the externally owned accounts are controlled by private keys and are not associated with code, and wherein the contract accounts are controlled by their contract code; executing, by the virtual machine, the one or more software instructions based on the data, wherein the global state of the blockchain stored in the TEE is updated during execution of the one or more software instructions to produce an updated global state; storing the updated global state in an overlay database in a cache which is included in the TEE or can be accessed by the TEE through direct memory access; encrypting the updated global state to generate an encrypted updated global state in the cache; and in response to encrypting the updated global state to generate the encrypted updated global state, syncing the encrypted updated global state from the cache to a key value pair database, wherein the key value pair database is separate from the TEE.