> For the complete documentation index, see [llms.txt](https://docs.skypirl.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skypirl.tech/faq/learn/advanced/webassembly-wasm.md).

# WebAssembly (Wasm)

WebAssembly is used in Polkadot and Substrate as the compilation target for the runtime.

### What is WebAssembly?[​](https://wiki.polkadot.network/docs/learn-wasm#what-is-webassembly) <a href="#what-is-webassembly" id="what-is-webassembly"></a>

WebAssembly, shortened to simply *Wasm*, is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.

### Why WebAssembly?[​](https://wiki.polkadot.network/docs/learn-wasm#why-webassembly) <a href="#why-webassembly" id="why-webassembly"></a>

WebAssembly is a platform agnostic binary format, meaning that it will run the same instructions across whatever machine it is operating on. Blockchains need determinacy in order to have reliable state transition updates across all nodes in the peer-to-peer network without forcing every peer to run the same exact hardware. Wasm is a nice fit for reliability among the possibly diverse set of machines. Wasm is both efficient and fast. The efficiency means that it can be uploaded onto the chain as a blob of code without causing too much state bloat while keeping its ability to execute at near-native speeds.

#### Forkless Upgrades[​](https://wiki.polkadot.network/docs/learn-wasm#forkless-upgrades) <a href="#forkless-upgrades" id="forkless-upgrades"></a>

By using Wasm in Substrate, the framework powering Polkadot, Kusama, and many connecting chains, the chains are given the ability to upgrade their runtime logic without hard forking. Hard forking is a standard method of upgrading a blockchain that is slow, inefficient, and error prone due to the levels of offline coordination required, and thus, the propensity to bundle many upgrades into one large-scale event. By deploying Wasm on-chain and having nodes auto-enact the new logic at a certain block height, upgrades can be small, isolated, and very specific.

### Resources[​](https://wiki.polkadot.network/docs/learn-wasm#resources) <a href="#resources" id="resources"></a>

* [WebAssembly.org](https://webassembly.org/) - WebAssembly homepage that contains a link to the spec.
* [Wasmi](https://github.com/paritytech/Wasmi) - WebAssembly interpreter written in Rust.
* [Parity Wasm](https://github.com/paritytech/parity-Wasm) - WebAssembly serialization/deserialization in Rust.
* [Wasm utils](https://github.com/paritytech/Wasm-utils) - Collection of Wasm utilities used in Parity and Wasm contract development.


---

# 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://docs.skypirl.tech/faq/learn/advanced/webassembly-wasm.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.
