Introducing Polylang: TypeScript for Miden VM

Polygon Labs
October 2, 2023
Polygon Solutions
Image source: Dribbble

Developers interested in Polygon Miden can now use a TypeScript-based language to experiment with Miden VM, the virtual machine powering Polygon Miden. Polylang is an expressive, easy-to-use language that will be familiar to the millions of programmers that already use TypeScript. 

As covered in our deep dives on the rollup’s architecture, Polygon Miden is a novel ZK rollup designed for parallel execution and enhanced privacy. The public testnet for Polygon Miden is expected to launch in the coming months. 

Miden VM

As opposed to using a zkEVM to execute programs, which is designed for bytecode parity with the Ethereum Virtual Machine, Polygon Miden uses a zkVM. 

The purpose of Miden VM (and zkVMs, in general) is to abstract away the complexity of ZK. Essentially, Miden VM allows devs to write programs that can be correctly executed in the rollup without having to first get a degree in cryptography. 

(For more on the zkVM model, check out the ZK Whiteboard Sessions with Polygon Miden co-founder Bobbin Threadbare and grtje.) 

But until now, devs still needed to learn the Miden Assembly Language, which remains fairly exotic and complex. In the Miden VM Playground, you can see what basic instructions look like in Miden Assembly.

Polylang strips away this complexity and translates code directly to the Miden Assembly Compiler. 

Why Polylang?

Polylang is a high-level language that feels like TypeScript, built on top of Miden VM, bridging the gap between Miden zkVM and the syntax developers are used to.

When researchers first began applying ZK cryptography to blockchain technology, they had to write each individual arithmetic circuit needed to generate a proof. This circuit-based approach meant devs needed to be math, coding, and hardware experts to execute a program in a ZK environment. 

The zkVM approach abstracts away the math requirement. Instead of the circuit method where each circuit represents one thing, zkVMs (and zkEVMs) function like a computer’s CPU. With a zkVM, one circuit takes in and executes an entire program. 

The remaining challenge for making ZK more dev-friendly is language-based. But there's a catch. There’s a tradeoff  between abstracting away complexity and capturing the unique properties of ZK. Other ZK rollup projects have developed high-level languages—like Cairo, for Starknet, and Noir, for Aztec—optimized to compile down to the specific proof system and proving implementation. 

This is where Polylang comes in. 

Polylang copies the more widely used TypeScript framework—itself a subset of JavaScript. This means that devs that know JavaScript already know Polylang. So what can you use Polylang for today? 

Polylang for Polybase and Miden VM 

Polylang was developed by the team at Polybase, which is using ZK to build better web3 infrastructure, including a forthcoming MEV-resistant, privacy-preserving L2. 

Polylang compiles to STARK proofs, the proof system used by Polygon Miden. While Polylang is currently used in Polybase DB, a decentralized data storage platform, the use-case extends to building DEXs, marketplaces, and other on-chain applications where privacy is a design priority. 

If you’re a developer interested in building on Polygon Miden, join the Discord and connect directly with researchers in the Polygon Miden Channel. 

Website | Twitter | Developer Twitter | Forum | Telegram | Reddit | Discord | Instagram | Facebook | LinkedIn