Luke Tchang
3 min readJun 9, 2021

--

Secure enclaves allowing for smart contracts as true first-class actors:

I was just browsing through the docs for Secret Network, a network built on Cosmos SDK that uses secure enclaves to allow for private smart contracts (i.e. private computation and state). I know, Intel SGX has been far from perfect, but it seems that the idea of running a blockchain with all nodes utilizing trusted execution environments (TEEs) has some genuinely profound implications.

Because secure enclaves contain their own secret keys only accessible within the enclave, by extension, this allows smart contracts to have their own secret keys, since a secret key stored as contract state can be encrypted using the enclave’s secret key and therefore stored such that it too is hidden in all contexts except for inside the enclave. Secret Network, in fact, does just this and assigns each smart contract its own unique secret key. On public blockchains, storing a secret key in a contract was never possible for obvious reasons 🤪 with the case of Secret Network and the ability for contracts to own signing keys, for the first time now, contracts can truly act as first-class entities that can attest to on-chain actions without the assistance of off-chain actors.

One example that highlights this capability came to mind during my time working on the Optics bridge at Celo. The main goal of the bridge was to perform trust-less data replication across chains. The core problem, however, was ensuring that data replicated on a destination chain was actually enqueued on the origin chain in the first place. The design of Optics emerged precisely from this issue and uses a bonded updater to attest that messages were in fact put on the origin chain (with the updater being slashed if it attests to data that was never actually put on the origin chain).

The ability for a contract to act as a signer with its own secret key would greatly simplify the design though, as we would be able to scrap the bonded updater entirely and could just trust the origin chain contract to sign messages with its own key. If the origin contract signed the message, it was undisputedly enqueued on the origin chain.

More generally, smart contracts can now act as autonomous actors that can attest to on-chain actions. If some contract Y, for example, wants to only take an action on some data if that data was first processed by contract X, normally, there would be no way for contract Y to verify whether or not the data passed through X unless X actually calls Y (contracts cannot search through event logs, which is how normal applications would check). With secret contracts, the described behavior is now possible since Y can verify that X signed the data.

The ability for contracts to act as signers opens up new ways for contracts to interact with each other as more active entities without the help of off-chain actors. I’d be interested in seeing what new patterns of interaction emerge as the result of signing capabilities and perhaps other capabilities yet to be realized in the context of secure enclave-based blockchains.

--

--