The TEN Experience

Cais Manai
Obscuro Labs
Published in
6 min readJun 9, 2022

One of the most powerful innovations in Obscuro (now known as TEN Protocol) solves a problem more critical than just bringing encryption to Ethereum.

TEN brings encryption to Ethereum with a seamless, frictionless user and developer experience.

In this post, I’ll be showing you, as a user, what you can expect when you interact with TEN. And as a developer, the very minor changes you’ll need to make to get a fully confidential version of your app.

TEN, making encryption easy

Users

The goal was to replicate the same user experience that users get today with Ethereum. This naturally made the two key points of focus, assets held and any associated transactions.

Transactions

latest transactions as viewable on

A quick look at Etherscan will return you the transactions that have taken place on Ethereum. In addition, you can drill into each transaction and see in more detail what has taken place.

A key problem we aimed to solve with TEN was allowing individual users to view all the transactions that they’d initiated and those where they were the recipient.

Users can see the balance of all their assets directly out of MetaMask, but what about the transactions that lead to those assets being there? Payments would be impossible without seeing an itemised breakdown of each balance, as you’d never know where the token came from or the individual amounts.

Thankfully, it’s one we had an elegant solution for. It requires no effort on behalf of the developer nor from the end-user. Instead, TEN handles all of this through the node itself.

You simply use MetaMask, and the nodes will serve up all the relevant asset balances and transaction details that can only be seamlessly, automatically, decrypted by you and you only.

MetaMask

TEN, on day one, will fully support MetaMask. Your experience with TEN will be exactly the same as your experience with Ethereum. All your assets will appear under assets, and any transactions you’re involved with will also appear.

All you need do is install the TEN wallet extension that will sit alongside MetaMask and handle the relevant encryption and decryption.

Flow from MetaMask to Obscuro (now TEN)

This extension does not have access to your signing keys in any way and the code, as with all of TEN, is open source.

The wallet extension ensures that your confidential data is only ever decrypted once it hits your computer and encrypted before it leaves. Both The extension handles all of this, allowing you to continue to use Metamask and any Web 3 apps uninterrupted.

Flow from client app to Obscuro (now TEN) node

Developers

The first thing to understand is that TEN smart contracts run on the Ethereum Virtual Machine. Therefore, your existing Ethereum application will work out of the box on TEN.

So what do I mean by work? Well, from the application's perspective, it’s still running on the EVM, so will continue to do what it did before, except the entire application, including everything within, all inputs, outputs, transactions — everything will now be in an encrypted state.

So if you took your Ethereum application and deployed it directly on TEN, you’ll get an encrypted version of the application.

Great news, right!? Well, yes, but what about the bits of the application that you don’t want private?

We’ll break this down into two primary considerations:

  • Balance requests
  • Events

Transactions we’ll cover in the User experience.

Balance requests

A good example is Uniswap. Let’s decompose some of the primary user features of Uniswap.

  • Add and remove liquidity to and from a liquidity pool
  • Swap tokens

Both of these features require balance lookups. The removal of liquidity requires a balance lookup to determine whether you have liquidity available, and any sort of swap requires a lookup to help ensure you have sufficient tokens available.

We’d like to keep some of these private, such as the amount and who is adding liquidity to a particular pool. But, how about the total amount of liquidity in a pool, i.e. the pool’s balance? The total amount is something we’d like the whole world to know about as it’s essential to the mechanics of DeFi.

Here, a developer needs to think about what parts of the application they want to make public vs private.

Consider the well-known ERC-20 standard and the balanceOf function that returns a known account’s balance.

The way TEN apps handle this is precisely the same. A call to balanceOf will return the balance of the account requested, with one caveat. The balance returned will be returned encrypted using a key linked to whoever is in the from field.

This is a crucial point worth mentioning again — every interaction with TEN always returns data encrypted using a key controlled by the initiator.

An example Ethereum transaction

In the case of a transaction, we know with absolute certainty that whoever is named in the ‘from’ field really is the initiator of the transaction (We can also use origin, which is guaranteed to contain the original initiator in the case of multiple hops).

However, in the case of balanceOf, we don’t get that same guarantee as it’s not a transaction. So TEN apps that wish to keep balances private simply implement balanceOf as follows:

a simple example implementation of a confidential balanceOf.

This simple change guarantees that the balance of the address will only ever be viewable by the account owner, as they’re the only ones that can decrypt the result.

In the case of something we wish to keep public, such as the balance of a Uniswap pool, we simply have code that allows the balance of the requested account to be returned.

a simple example implementation of a publically available balanceOf

What’s happening here is equally simple. The response of balanceOf will still be encrypted with a key belonging to 'from'. However, this implementation allows any account to be looked up.

Events

Events are a vital part of Ethereum apps. Typically, they facilitate communication between the smart contract and the user interface.

Events are emitted by smart contracts and write logs to the blockchain that the user interface can then process.

In addition to user interfaces, applications such as Chainlink rely on events to trigger data requests.

How does support for Public Events work in TEN? We had three options:

  1. Emit events in the same way as the EVM does today, i.e. no encryption and visible to anyone.
  2. Encrypt events with the key of the originator of the transaction (this keeps events private).
  3. Combination of 1 and 2

The first version of TEN will support public events as usual (1). This would allow for user interfaces to largely remain as they are today, except that developers will need to revisit what they’re emitting to maintain confidentiality.

Uniswap event emitted during a Swap

Take the example from Uniswap. Today, all the of the above are emitted during a Swap event. It’s clear that the sender and amounts involved would break confidentiality. So, for the first version of TEN, we ask that developers remove anything that doesn’t meet their use-case encryption needs.

Support will be added for events to be encrypted with the originator’s/sender’s keys such that only they can view the events. This can be combined with public events to allow for basic events such as those needed for Chainlink to be emitted with a link to an encrypted event that contains further information.

Encryption unlocked

Hopefully, you leave this with an understanding of how TEN has unlocked encryption by keeping the user experience the same and requiring minimal changes to existing Ethereum apps from developers.

As we get closer to testnet, you’ll start to see more developer documentation as well as reference samples. If you have not already, do register for testnet.

Find out more

To learn more about TEN, dive into the whitepaper, chat with the community on Discord, and follow us on Twitter.

--

--

Cais Manai
Obscuro Labs

Hi, I’m Cais. You’ll find me writing on blockchain topics. By day, I’m a Product Manager for Ten.