Smart contracts 2.0: Trustless Contracts

TRST Labs
4 min readAug 31, 2021

Current smart contracts enable decentralized applications, where data is immutable and users can trust the data to be real and uncensored. Most smart contracts are deployed on Ethereum. Decentralized finance and NFTs are types of contracts that showcase that for finance and art respectively, centralized middle-men are redundant in connecting users. Still, smart contracts are far from perfect as current smart contracts on major blockchains are inefficient, fully public, data is stored indefinitely.

Right now, developers cannot guarantee any kind of privacy when interacting with their contracts. Anyone can view user inputs. Users lose funds because smart contracts have no predefined end date. Stakeholders may not develop enough trust to interact with the contract as the data is public and the contract end date is unknown. Yet, so far no easy way exists to build contracts with private user inputs, deterministic outcomes and time-dependent actions to cope with these problems. In order to truly build trustable contracts, developers need to program contracts that handle data privately and have time-dependent actions.

Solution

Trustless Contracts on Trust Price Protocol are secure, private and self-deleting CosmWasm smart contracts, with support for functions that execute over time. With these contracts, users can trust that their input is handled privately and know when the contract ends and what happens when the contract ends.

  • Encrypted inputs ensure privacy of all users
  • Time-dependent functions enable automatic outcomes
  • Self-ending contracts give confidence to all stakeholders

New trustless services are now possible, like auto-ending private auctions. CosmWasm smart contracts are present in major Cosmos-based blockchains like Terra, Crypto.com, Secret Network and Irisnet, and allow for developers to easily create smart contracts in the same way across different blockchains. For example, if a developer learns to program on Terra, creating Trustless Contracts on Trust Price Protocol is as simple as ABC. A developer can reuse the code, enjoy private computing or add time-dependent functions. Cryptocurrencies like Terra’s stablecoin UST can be transferred onto any Trustless Contract address*, making the switch a breeze. If you’re unfamiliar with CosmWasm, there are many tutorials out there.

Use cases

  • Trustless data aggregation (input data remains private, result is calculated and public)
  • Private auctions (end at a predefined time, biddings remain private)
  • Independent price generation (price estimates remain private, result is calculated and public)
  • Conditional transfer contracts (automatic transfer a certain date and time when it meets certain conditions)
  • Private content sharing (only accounts with permission/payment can view contents)

….And anything in-between and beyond

How does it work?

We combine two major recent innovations, secure enclave computing and a blockchain (Proof of Stake). Secure enclave computing enables computing with private data, whereas the blockchain adds decentralization and verifiability. Secure enclave computing is a recent breakthrough in tech. A secure enclave is an isolated core of a chip that is dedicated to handle fully encrypted data. Only allowed applications with a specific key are able to access this data. All Trustless Contract function calls get executed on a secure enclave on each node on the blockchain. The result is valid only when it is verified on more than 66% of the nodes.

What makes Trustless Contracts truly unique is that these contracts are stored for a set period of time. When storing a code of a contract, developers can set a contract duration. A maximum is set to 30 days, so users can trust the contract contents are handled within this maximum period. The countdown starts when the contract gets initiated. If set at initiation, a last function is called before deletion. This greatly benefits the users and stakeholders, as it is already predefined what happens, and users can trust that their data is deleted from the blockchain. Also, a contract never gets deleted with funds stored, in such a case, the funds go to the initiator of the contract.

Towards a better future

…where all people do not have to deal with information asymmetry. Trustless contracts enable trustless and verifiable handling of sensitive information. More people will trade and transfer on blockchains when data remains private and outcomes are trustable. By using Trustless Contracts on Trust Price Protocol, anything can be transferred in a trustless and secure way.

*Inter-blockchain communication is functional but not enabled yet at the time of writing.

--

--

TRST Labs

A smart contract hub build on the Cosmos SDK, with secure execution and automatic functions.