Lava Cash: Technical Update #1

Lava Cash
2 min readMay 25, 2021

Thank you to everyone who has joined our Telegram channel and supported us, we’ve had lots of interest and we’re working hard on bringing our vision to life.

How Lava Cash works
1) Users generate a secret, hash it, and deposit their SOL along with the hash (commitment) to the smart contract. This commitment is stored in a Merkle tree in the contract’s storage.
2) Users wait for more deposits to enter the contract.
3) Users prove in zero knowledge that their secret is in the Merkle tree and make a withdrawal to a fresh address not linked to their deposit address.

In order to build the Lava Cash privacy contract, we have utilized a Rust library to generate and validate zk-STARK based proofs.

The Solana runtime has plenty of restrictions. We cannot simply port the Rust code and have it work out of the box. We’re working with what has been described in the Solana docs, you can find out more about this here: https://docs.solana.com/developing/on-chain-programs/developing-rust#restrictions

There are a few STARK Rust libraries that we have assessed for compatibility with the Solana runtime. We’ve finally selected the stark library from OpenZKP. We felt as though it would require the fewest number of charges to get it compiled with the Solana runtime (BPF).

Naturally, some fixes are much easier than others. For example, we made some trivial changes to logging as to not use println!. We also stripped out non-essential dependencies on std:time.

Larger changes required the removal of the zkp-map-vec and rayon dependences, this is because Solana does not have access to a file system or parallelism.

For more details and other changes, check our GitHub repos when they go live.

Once we bring stark into accordance with the Solana runtime requirements, we will proceed to publishing. We hope this will usher a wave of new developers who can leverage this code in other interesting Solana contracts that require proving things in zero knowledge.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response