> For the complete documentation index, see [llms.txt](https://devs.truebit.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devs.truebit.io/developing-truebit-tasks/how-to-create-function-tasks/key-concepts/webassembly.md).

# WebAssembly

### **What is WebAssembly?**

[WebAssembly](https://webassembly.org/) (**WASM) is a compilation target that allows to run high-performance code written in compiled languages like C, C++, and Rust to run in a platform-independent way through a sandboxed interpreter.**

The [WebAssembly System Interface ](https://wasi.dev/)(WASI) is the system interface for WebAssembly. It allows to call specific operating system-related services to be called from inside the execution sandbox. WebAssembly programs can **access filesystem data,** **environment variables**, and **program arguments** through this interface. Truebit is compatible with WASM programs that use the WASI version known as 'Snapshot 1'.

#### Limitations

* All ingress/egress networking is disabled – you won't be able to pull data/code/weights/etc from an external source. WASM jobs can access the data by reading from the filesystem.
* There is no multi-threading as WASI Snapshot 1 does not expose any interface for it.

#### Why Do We Use It?

Truebit uses WebAssembly as a foundational technology to ensure security, compatibility, and high-performance execution for its verification protocol.

1. **Portability**: WebAssembly code can run unmodified on various platforms, ensuring compatibility across different systems.
2. **Performance**: WebAssembly's speed is essential for the efficient execution of Truebit's complex verification tasks.
3. **Language Flexibility**: Developers contributing to Truebit can write code in [multiple languages](/developing-truebit-tasks/how-to-create-function-tasks/supported-languages.md), thanks to WebAssembly's language-agnostic nature.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devs.truebit.io/developing-truebit-tasks/how-to-create-function-tasks/key-concepts/webassembly.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
