Updated blog post 1a1ee48b
Steve Simkins · 2024-10-27 23:08 1 file(s) · +4 −4
src/content/post/how-sp1-precompiles-revolutionized-zkvm-performance.mdx +4 −4
17 17
	aspectRatio={9 / 16}
18 18
/>
19 19
20 -
In the last few years the terms "zk" or "zero knowledge proofs" have been buzzing and for good reasons. It's a relatively new piece of tech in cryptography that allows someone to prove something without revealing the information itself, which has massive implications for not only the blockchain space but for privacy and trusted code. While zk's are powerful, they also come at a cost. The majority of real-world use zero knowledge proofs are computationally expensive and inefficient, and in order to truly scale and make a difference, the cost needs to come down. This is where [Succinct](https://succinct.xyz/) comes in, a company that specializes in zkVM technology and makes it accessible to developers. Not only has Succinct built [SP1](https://blog.succinct.xyz/sp1-is-live/), an zkVM that allows you to write zero knowledge proofs in Rust, but they have also revolutionized efficiency with Precompiles.
20 +
In the last few years the terms "zk" or "zero knowledge proofs" have been buzzing and for good reason. It's a relatively new piece of tech in cryptography that allows someone to prove something without revealing the information itself, which has massive implications for not only the blockchain space but for privacy and trusted code. While zk's are powerful, they also come at a cost. The majority of real-world use zero knowledge proofs are computationally expensive and inefficient, and in order to truly scale and make a difference, the cost needs to come down. This is where [Succinct](https://succinct.xyz/) comes in, a company that specializes in zkVM technology and makes it accessible to developers. Not only has Succinct built [SP1](https://blog.succinct.xyz/sp1-is-live/), an zkVM that allows you to write zero knowledge proofs in Rust, but they have also revolutionized efficiency with Precompiles.
21 21
22 22
## What are Precompiles?
23 23
24 -
When it comes to writing zero knowledge proofs, there are generally many cryptographic operations and methods that become repetitive, especially when being used for blockchains. These include arithmetics like elliptic curves or hashes which are accessed in Rust through crates. While building SP1, Succinct realized that there could be improvements made if the execution of these programs happened through the RISC-V instruction used to make proofs. This created a balance between the ease of writing proofs in Rust but still having some of the benefits of custom circuits. The result was a series of patched crates of popular libraries that dramatically changed the speed and efficiency of zero knowledge proof calculation.
24 +
When it comes to writing zero knowledge proofs, there are generally many cryptographic operations and methods that become repetitive, especially when being used for blockchains. These include arithmetics like elliptic curves or hashes which are accessed in Rust through crates. While building SP1, Succinct realized that improvements could be made if the execution of these programs happened through the RISC-V instruction used to make proofs. This created a balance between the ease of writing proofs in Rust but still having some of the benefits of custom circuits. The result was a series of patched crates of popular libraries that dramatically changed the speed and efficiency of zero knowledge proof calculation.
25 25
26 26
Instead of just taking my word for it, I'll show you how to spin up a quick SP1 project and we'll build proofs both with and without the precompile patches!
27 27
194 194
}
195 195
```
196 196
197 -
This will look for arguments during `cargo run` to determin if it should only run an execution or if it should generate a proof. Executions are great for testing the code and will take less time and computation power than proofs. Once we have the arguments we can create an instance of the `ProverClient` to run our program and get the committed values back. Now lets try it out with the following command, making sure we have run `cd ../script` first to be in this directory instead of program:
197 +
This will look for arguments during `cargo run` to determine if it should only run an execution or if it should generate a proof. Executions are great for testing the code and will take less time and computation power than proofs. Once we have the arguments we can create an instance of the `ProverClient` to run our program and get the committed values back. Now let's try it out with the following command, making sure we have run `cd ../script` first to be in this directory instead of program:
198 198
199 199
```
200 200
cargo run --release -- --execute
259 259
260 260
## Wrapping Up
261 261
262 -
While there has been many advances in zk technology, there is still much work to do for larger adoption. Writing zero knowledge proofs shouldn't take enormous amounts of time in low-level languages like assembly, and that's exactly why Succinct is making it easier with SP1. Even today there are dozens of teams using SP1 in production to help scale blockchains, rollups, bridges, and more. It's not hard to imagine a future where zkVMs are used in sectors beyond Web3, as there are many needs in our modern infrastructure for verifiable code, and Succinct will be there paving the way.
262 +
While there have been many advances in zk technology, there is still much work to do for larger adoption. Writing zero knowledge proofs shouldn't take enormous amounts of time in low-level languages like assembly, and that's exactly why Succinct is making it easier with SP1. Even today there are dozens of teams using SP1 in production to help scale blockchains, rollups, bridges, and more. It's not hard to imagine a future where zkVMs are used in sectors beyond Web3, as there are many needs in our modern infrastructure for verifiable code, and Succinct will be there paving the way.