Full Speed With WASM

Our epoch 6 mining contest winner Joel asked us during his video interview why the TEA interface was so barebones. Miners like Joel are early adopters and willing to put up with a minimalist design as long as the functions work. But wouldn’t end consumers want something that looks more like the modern web? Actually the TEA Project has created two separate interface channels, one for miners and one for consumers.

The TEA Browser Wallet is Built for Miners

The rather modest TEA browser wallet is:

  • Built for miners and not end users.
  • Built to be used on the Desktop (not mobile friendly) v

The design choices for the TEA browser wallet are more functional than aesthetic. We designed it for the desktop since miners will also likely administer their mining machines from the same computer since sys admin tasks are not often done from mobile devices. It’s important that miners have an interace to administer their mining nodes and hosted TApps which is exactly what they get with the current TEA browser wallet.

TApps are Built for Consumers

The TApps fulfill the TEA Project’s promise of rich dApps running at full cloud speed. TApps are consumer facing, with a well-designed UI and should in almost all cases be mobile friendly. A TApp itself can be separated into two parts:

  • The front-end that faces the user, generally a combination of HTML, CSS, and JS technologies.
  • The back-end which actually executes the dApp’s logic.

Note that there is actually a third part, a database layer which you can read about here.

But these two layers are enough for us to focus on right now.

The front-end tech of HTML, CSS, and JavaScript (JS) support a rich user experience that makes the comfortable to use for consumers. But how do we ensure that our TApps will run full-speed on the TEA network?

Certainly our two-layer blockchain solution is a major reason our decentralized apps can run full speed. It’s such a load off of all our layer-2 nodes to not have to worry about Byzantine faults thanks to the trust verification coming from our layer-1 blockchain.

WASM is the Execution Layer for TApps

WebAssembly (WASM) is the language which binaries are compiled to if they want to run as TApps on the TEA network. WASM is traditionally run as bytecode directly in the user’s browser. As you can see from the following graphic, the TEA Project actually runs WASM binaries in TEA mining nodes and not in the browser itself:

And although TApps WASM code runs on decentralized mining computers instead of browsers, many of the same advantages WASM has in a browser scenario also carries over to the TEA Project’s distributed server model:

  • WASM is high performance — it’s built to be as close to native machine code as possible while still remaining platform independent.
  • WASM was built to facilitate small binaries as it needs to be run over the internet to devices with potentially slow internet connections. This is a great fit for the space-constrained blockchain world.
  • WASM was developed so that code can be deployed in any browser with the same result. Contrary to the EVM it was not developed towards a very specific use case, this has the benefit of a lot of tooling being available and large companies putting a lot of resources into furthering WASM development.
  • WASM is platform independent, and efficiently maps to all kinds of CPU architectures.
  • WASM executes within a sandboxed environment that’s separate from the host runtime. WASM also uses fault isolation techniques in order to prevent common security breach attempts like buffer overflow attacks.

WASM’s high performance, security, and flexibility as a compilation target supporting many different programming languages makes it an ideal piece of the TEA Project’s tech stack. If you’re interested in reading more about how WebAssembly makes the TEA network even more secure, read the next article in our WASM series on How WASM Makes TEA’s Blockchain More Secure.