Blockchain Data Processing Learning
Key Glossary
Term Definition Blockchain A data structure that records transactions in a secure and immutable manner. Each block contains multiple transaction records and is linked to the previous block through a cryptographic hash. Smart Contract A program executed on the blockchain. A smart contract contains a set of predefined rules according to which the parties to the contract agree to interact. Trusted Execution Environment (TEE) A secure area in hardware that is isolated from the main operating system and is used to ensure the confidentiality and integrity of code execution and data loading. Software Guard Extensions (SGX) A hardware-based TEE provided by Intel Corporation. Enclave A protected memory area in SGX that is used to isolate and protect code and data. Virtual Machine A software program that executes program instructions in a specific programming language or binary format. Global State The state of a blockchain network at a specific point in time, usually stored as a Merkle Patricia Tree (MPT). Merkle Patricia Tree (MPT) A data structure used to store key-value pairs, often used to store the global state of a blockchain. Account State The state of a blockchain account at a specific point in time, including information such as account balance and number of transactions. Storage Root The root node hash value of the Merkle Patricia tree that stores the hash of the contract account storage content.
Short Answer Quiz
What is blockchain and how does it ensure the immutability of transactions?
What is a smart contract? Please give examples of application scenarios for smart contracts.
What is TEE and what role does it play in blockchain data processing?
How does SGX implement TEE? Please briefly explain how it works.
How does a virtual machine running in TEE process smart contracts?
What is the global state of a blockchain? In what data structure is it usually stored?
What are the advantages of MPT in storing the global state of a blockchain?
What is account state? What information does it contain?
What is the storage root? How is it associated with the contract account?
What are the advantages of storing the global state of a blockchain in a TEE?
Short Answer Questions
A blockchain is a data structure that stores transaction records in chronological order, with each block linked to the previous block by a cryptographic hash. This chain structure ensures that any changes to previous transaction records will cause the hash value to mismatch, thus guaranteeing the immutability of transactions.
Smart contracts are programs stored on the blockchain and automatically executed under certain conditions. For example, smart contracts can be used to automate the payment process in the supply chain, automatically triggering payment when the goods arrive at the designated location.
TEE is a secure area in the hardware that is isolated from the main operating system and is used to protect the confidentiality and integrity of code execution and data loading. In blockchain data processing, TEE can provide a trusted operating environment for the execution of smart contracts and ensure the security and privacy of data processing.
SGX implements TEE by creating an isolated area called "enclave" in the CPU. The enclave has an independent memory space and protects the code and data inside it from external access through hardware mechanisms, even the operating system.
The virtual machine running in the TEE can receive calls from external applications and execute smart contracts in the secure environment of the TEE. The virtual machine can access the blockchain data inside the TEE and update the state of the blockchain according to the logic of the smart contract.
The global state of the blockchain refers to the state of the blockchain network at a specific point in time, including information such as the balances of all accounts and transaction history. It is usually stored in a Merkle Patricia Tree (MPT) data structure.
MPT is an efficient key-value pair storage structure that can quickly retrieve and update data, and the integrity of the data can be verified through the Merkle root hash value. These characteristics make MPT very suitable for storing the global state of the blockchain.
Account state refers to the state of a blockchain account at a specific point in time, which contains information such as the account's balance, number of transactions (nonce), code hash value (codeHash), and storage root (storageRoot).
The storage root is the root node hash value of a Merkle Patricia tree that stores the storage content of the contract account. Each contract account has a unique storage root to identify its storage content.
Storing the global state of the blockchain in TEE can improve the security and privacy of data processing. Because TEE provides an isolated execution environment, it can prevent malware or unauthorized visitors from stealing or tampering with blockchain data.