Member-only story
The World of Web 3 Is a Whole Lot Closer
ZKPs in a Browser!
With data breaches on the rise, many dream of a world where we could trust things without giving away our sensitive data. For this, one of the core elements of a private and trusted world is to use Zero Knowledge Proofs (ZKPs). But, the world of blockchain and the Web can be seperate, due to security and performance. The major change is with the use of WebAssembly, and which gives us the opportunity to run native code within a browser, and for it to be run on the client’s machine. This includes an integration with Rust and C. With this, we can now expose complex software libraries without the need to translate to code into JavaScript.
So, as a Rust programmer, just image building your code in Rust, then simply creating a bridge within HTML to call the code. So, let’s implement a ZKP with WebAssembly, and which uses Rust coding to implement the ZKP.
ZK-WASM
ZK-WASM integrates a Zero Knowledge Proofs (ZKP) in Rust, into WebAssembly (WASM) [1]. A bridge between the Rust executable code It provides a JavaScript bridge within an HTML file to interact with the ZK-WASM functionalities.
To build the WASM file, we first install wasm-pack with:
cargo install wasm-pack