Blockchains in Trusted Execution Environments (TEEs)

Nadeem Bhati
4 min readDec 29, 2019

--

A smart contract on a blockchain cannot keep a secret. Its data is replicated on all nodes. As a remedy to this problem, it is suggested to pair Blockchains with Trusted Execution Environments for executing applications that demand privacy.

Image Credits: Intel Corporation

While Blockchain needs no introduction, let’s go over what a TEE means.

A trusted execution environment (TEE) is a secure area of a main processor. It guarantees code and data loaded inside to be protected concerning confidentiality and integrity. A TEE as an isolated execution environment provides security features such as isolated execution, integrity of applications executing with the TEE, along with confidentiality of their assets. In general terms, the TEE offers an execution space that provides a higher level of security than a rich operating system (OS) and more functionality than a ‘secure element’ (SE).

So why is a TEE ‘trusted’? In a TEE, the ‘Trust’ requires that all TEE related assets, code, the underlying Trusted OS and its support code, have been installed and started through a methodology that requires its initial state to be as expected by the designers, verifying all signatures.

Public Blockchains in TEEs

In this section, we discuss blockchains following proof-of-work (PoW), proof-of-stake (PoS) and delegated-proof-of-stake (DPoS) consensus algorithms.

Bitcoin-based public blockchains do not reach consensus with finality. Here, the consensus mechanism is based on a randomized protocol in which, a node selected through a probabilistic scheme appends a block to the chain, which is termed as probabilistic finality. This probabilistic scheme is difficult to bias and forms the basis for the above-mentioned consensus algorithms. The blocks created are propagated to all nodes using a peer-to-peer gossip protocol which guarantees efficiency but not consistency.

It is important to note here that smart contracts executed inside a TEE could be exposed to rollback attacks due to a contract’s stateless nature. A rollback attack is possible in a TEE due to lack of essential support system to protect persistent application state. However, in blockchains with non-final consensus protocols, the contract execution must handle rollbacks by design. This implies that TEEs for securing blockchain execution cannot be directly used for such blockchains; this approach works only when the consensus decisions are final.

Permissioned Blockchains in TEEs

In this section, we discuss Hyperledger Fabric with TEE, Visa’s LucidiTEE, and Hyperledger Avalon.

Permissioned Blockchain such as Hyperledger Fabric inherently different from Public Blockchains. Because Fabric’s design relies on deterministic consensus algorithms, any block a peer validates as generated by the ordering service is guaranteed to be final and correct. This makes Permissioned blockchains a better match for TEEs.

Many strides have been made in successfully running Permissioned Blockchains in a Trusted Execution Environment. This includes Visa’s LucidiTEE which is introduced as “the first system to enable multiple parties to jointly compute on large-scale private data, while guaranteeing policy-compliance even when the input providers are offl­ine, and fairness to all output recipients.”

Visa’s solution records what computations have taken place in each processor’s safe partition, or enclave, on the ledger, without storing the input or output data. This allows history-based policies to be enforced, where rules on data computation depend on the prior use of that data. Plus, an ‘exchange protocol’ ensures fair delivery of the outputs; if the output is sent to one recipient, then it is sent to all recipients.

Hyperledger Avalon/Image Credits: Hyperledger Foundation

Hyperledger Avalon (formerly, Trusted Compute Framework) announced in Oct 2019, is said to be the most broadly sponsored projects till date. It is an interesting intersection between Hyperledger, Enterprise Ethereum Alliance and Cloud service provider ecosystems. Trusted computing includes a variety of techniques to ensure that computation was done correctly and secretly. Hyperledger Avalon will realize these as different Worker types and include TEE (Trusted Execution Environments like Intel® SGX), MPC (multi-party compute), and ZK (zero-knowledge proofs).

If Blockchain in TEEs is the answer, then what is the question?

We understand that despite the nice features offered by TEE and blockchain, neither is ideal. The current blockchain systems suffer from serious practical limitations, e.g. poor performance, high energy consumption and lack of confidentiality. On the other hand, TEE is imperfect in its specification and implementation, and in isolation does not offer satisfactory availability guarantees.

The combination of these two technologies provides a robust, tamperproof architecture that reaches unprecedented levels of security for applications that just cannot take a chance. As we observed, research is underway and ample support is available to those who wish to pursue it and contribute to the ongoing projects.

Source: https://arxiv.org/pdf/1805.08541.pdf, https://github.com/hyperledger/avalon, https://eprint.iacr.org/2019/178.pdf

If you found this article interesting, please let me know. There are a lot of implementation ideas, research findings, and analysis outside the scope of this article which I might include in a future one.

--

--