Town Crier

AbstractSmart contracts are programs that execute autonomously on blockchains. Their key envisioned uses (e.g. financial instruments) require them to consume data from outside the blockchain (e.g. stock quotes). Trustworthy data feeds that support a broad range of data requests will thus be critical to smart contract ecosystems. We present an authenticated data feed system called Town Crier (TC). TC acts as a bridge between smart contracts and existing web sites, which are already commonly trusted for non-blockchain applications. It combines a blockchain front end with a trusted hardware back end to scrape HTTPS-enabled websites and serve source-authenticated data to relying smart contracts. TC also supports confidentiality. It enables private data requests with encrypted parameters. Additionally, in a generalization that executes smart-contract logic within TC, the system permits secure use of user credentials to scrape access-controlled online data sources. We describe TC’s design principles and architecture and report on an implementation that uses Intel’s recently introduced Software Guard Extensions (SGX) to furnish data to the Ethereum smart contract system. We formally model TC and define and prove its basic security properties in the Universal Composability (UC) framework. Our results include definitions and techniques of general interest relating to resource consumption (Ethereum’s “gas” fee system) and TCB minimization. We also report on experiments with three example applications. We plan to launch TC soon as an online public service.
Year2016
Link to the paperhttps://www.town-crier.org/files/2016/168.pdf
Relevance scoreRelevant
Quality score5
LabelsWeb2 to Web3 data transfer

Town Crier is an authenticated data feed system, which is able to act as a bridge between websites (Web2) and smart contracts (Web3). Furthermore, Town Crier is mentioned as one of the two mechanisms which CanDID—one of the key DID solutions analyzed in our research—can leverage in order to function, along with DECO.

Note that Town Crier is dependent on a proprietary technology—namely, Intel’s Software Guard Extensions (SGX).

We dive into the technical details of Town Crier below.


Town Crier

Components

Procedure

  1. CUC_U requests a datagram by calling CTCC_{TC}, with enough gas.
  1. CTCC_{TC} deliver the request to Off-Chain server, RR receives the request, id, and parameter.
    • CTCC_{TC} will generate an id for every request.
    • CTCC_{TC} will send the parameters to Off-Chain server and store SHA3-256(requestType||timestamp||paramArray), and recheck when it receives the response to prevent from RR tampering parameters.
    • Town Crier supports private datagram requests by encrypting the parameters with the public key of Town Crier.
  1. RR calls progenclprog_{encl} from Enclave, and transfers HTTPS traffic to Enclave. Enclave processes the data, and returns to CTCC_{TC}.
    • Enclave will generate a signature of progenclprog_{encl} with SGX private key when initialized, which is hardcoded in SGX.
    • progenclprog_{encl} needs to use same signature scheme with Ethereum.
    • Enclave does not have direct access to host network functionality, thus RR acts as a network interface.
    • Enclave performs all cryptographic operations internally.
  1. CTCC_{TC} return data to CUC_U.
    • Signature verified by Ethereum client with hardcoded public key in CTCC_{TC} 
      Since Ethereum itself already verifies signatures on transactions (i.e., users interact with Ethereum through an authenticated channel), we can piggyback verification of TOffT_{Off} signatures on top of the existing transaction signature verification mechanism. Simply put, the TOffT_{Off} creates WTCW_{TC} with a fresh public key pkOffpk_{Off} whose secret is known only to TOffT_{Off}. To make this idea work fully, the public key pkOffpk_{Off} must be hardcoded into TOnT_{On}. A client creating or relying on a contract that uses TOnT_{On} is responsible for ensuring that this hardcoded pkOffpk_{Off} has an appropriate SGXSGX attestation before interacting with TOnT_{On}.

Attack-Resistant Mechanism

Potential Risks