Inspiration

We took a lot of inspiration from the work on money streaming through smart contracts done by Sablier

This ability to be paid in real-time makes this a powerful tool, however it has the downside of revealing what you're being paid to anyone who knows your address. This is obviously not ideal in a situation where your salary is being streamed to you. Everyone you transact with will know how much you earn

AZTEC Protocol adds ZK-based privacy to Ethereum transactions so that the values are completely confidential. Using this we can make it so only you and your employer would know how much you are being paid!

What it does

Quachtli modifies Sablier to work with private zkAssets (built on top of AZTEC notes) rather than standard ERC20 tokens.

This required a substantial change in architecture to deal with the fact that the contract's balance and withdrawal amounts can't be used in the smart contract.

Why "Quachtli"?

We wanted a punny name which combined Aztecs and the concept of streaming. While doing some googling we found out about Quachtli, the form of Aztec money standardized lengths of cotton cloth. This seemed somewhat similar to the idea of AZTEC's "notes" so became a temporary name until we could think of something better.

Based on how everyone butchered it's pronunciation (including us!) we should have changed it but this came second to trying to get withdrawals implemented so Quachtli just stuck.

How we built it

We started from the Sablier contracts and stripped back its methods to just the ones possible/relevant using ZK transactions. We then gradually rebuilt these methods to take advantage of AZTEC Protocol in order to verify the required proofs provided by the user in order to ensure the money can only be redeemed from the contract under the proper conditions.

We also built a small frontend in React which allows users to deposit DAI in exchange for zkDAI, create streams and monitor any streams they are involved in.

What we learned

We went into this project never having used AZTEC's SDK at all so we definitely learned a lot over the weekend:

how verification of AZTEC proofs are integrated into smart contracts

how integration of AZTEC into smart contracts looks i.e. how smart contracts must not only verify proofs but how the proofs fit together in order to avoid attacks.

how to generate proofs using aztec.js

Challenges we faced

Building with AZTEC notes is a very different experience to standard Ethereum assets due to the UTXO model. This took a pretty different mindset to normal development.

The major challenge we faced was the fact that as a very new and changing technology, the AZTEC protocol docs aren't fully complete with several of the more advanced functions we needed having little or no documentation.

Luckily the AZTEC team were present at ETHLondon and were amazing at helping us; pointing us towards relevant projects they had built for us to reverse engineer and sitting down with us to debug our proof generation code.

What's next for Quachtli

We're going to be merging in the fixes to withdrawals we made on Sunday soon to build a complete proof of concept of ZK streaming. We'll then be releasing it with a new frontend as an example application built on top of AZTEC Protocol.