Aztec's DeFi Bridge

A walkthrough of the upcoming updates to Aztec 2.0

A Simple DeFi Example

ZK Money

DeFi Bridge

\(v^{\text{in}}_1 = 1\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(v^{\text{in}}_2 = 0.5\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(v^{\text{out}}_1 = 4500\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(v^{\text{out}}_2 = 0.15\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

DeFi Bridge

\(v^{\text{in}}_1 = 1\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(v^{\text{in}}_2 = 0.5\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(v^{\text{out}}_1 = 4500\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(v^{\text{out}}_2 = 0.15\)

\(A = \texttt{0xF5C...17}\)

\(n = 15, s = \texttt{0x8C...2}\)

\(d = 1.5\)

\(n_d = 4\)

\(P = H(A, n, s)\)

\(\texttt{DeFi Deposit}\)

\(\texttt{DeFi Claim}\)

\(\texttt{Claim Note}\)

DeFi Bridge

\(v_1 = 0.4\)

\(v_2 = 0.8\)

\(d_1 = 1.2\)

\(v_3 = 1\)

\(v_4 = 0.1\)

\(d_2 = 1.1\)

\(v_5 = 0.05\)

\(v_6 = 0.15\)

\(d_3 = 0.2\)

\(v_7 = 0.3\)

\(v_8 = 0.1\)

\(d_4 = 0.4\)

\(v_9 = 0.2\)

\(v_{10} = 0.6\)

\(d_5 = 0.8\)

\(d_{\text{in}} = 3.7\)

\(n_d = 4\)

\(\texttt{in}\)

\(\texttt{out}\)

\(v_{\text{out}, 1} = 11,100\)

\(v_{\text{out}, 2} =  0.37\)

\(+\)

\(\texttt{DeFi Interaction Note}\)

\(v_1 = 3600\)

\(v_2 = 0.12\)

\(v_3 = 3300\)

\(v_4 = 0.11\)

\(v_5 = 600\)

\(v_6 = 0.02\)

\(v_7 = 1200\)

\(v_8 = 0.04\)

\(v_9 = 2400\)

\(v_{10} = 0.08\)

Collateralised Loans

\(v_1 = 0.4\)

\(v_2 = 0.6\)

\(d = 1\)

\(b_{\text{id}}=b_1\)

\(\texttt{Block }k\)

\(d = 1\)

\(b_{\text{id}}=b_1\)

\(\texttt{in}\)

\(\texttt{out}\)

\(\longleftrightarrow\)

\(v_1 = 3000\)

\(v_2 = 3000\)

\(\text{id} = (01 \ \| \ \underbrace{n_d}_{\substack{30}})\)

\(d_{\text{in}} = 5\)

\(n_d = 4\)

\(v_{\text{DAI}} = 15\text{K}, v_{\text{debtETH}} =  5\)

\(\texttt{is\_loan} = 1\)

\(\texttt{Block }\ge (k+1)\)

\(\texttt{Getting Loan against collateral}\)

Collateralised Loans

\(\texttt{Block }(k+1000)\)

\(\texttt{in}\)

\(\texttt{out}\)

\(\longleftrightarrow\)

\(v_1 = 3000\)

\(v_2 = 3000\)

\(\text{id} = (01 \ \| \ n_d)\)

\(v_{\text{ETH}} = 2.7, \ v_{\text{Aave}} =  0.6\)

\(\texttt{is\_loan} = 0\)

\(\texttt{Block }\ge (k+1001)\)

\(\texttt{Loan repayment}\)

\(v_1 = 0.9\)

\(v_2 = 0.2\)

\(d = 3000\)

\(b_{\text{id}}=(n_d \ \| \ b_2)\)

\(d = 3000\)

\(b_{\text{id}}=(n_d \ \| \ b_2)\)

\(n_d\)

\(\% \text{ pa}\)

\(4\)

\(10\)

\(7\)

\(6.7\)

\(\vdots\)

\(\vdots\)

\(d_{\text{in}} = 9000\)

\(n'_d = 19\)

Collateralised Loans

\(\texttt{Loan repayment in Installments}\)

\(v_4 = 2000\)

\(\text{id} = (01 \ \| \ n_d)\)

\(v_3 = 1000\)

\(\text{id} = (01 \ \| \ n_d)\)

\(v_2 = 1000\)

\(v_1 = 0.3\)

\(v_2 = 0.067\)

\(v_5 = 2000\)

\(v_{\text{ETH}} = 1, \ v_{\text{Aave}} =  0.8\)

\(d = 3000\)

\(b_{\text{id}}=(n_d \ \| \ b_2)\)

\(d_{\text{in}} = 4000\)

\(n'_d = 25\)

\(v_1 = 0.5\)

\(v_2 = 0.4\)

\(v_{\text{ETH}} = 2.7, \ v_{\text{Aave}} =  0.6\)

\(d_{\text{in}} = 9000\)

\(n'_d = 19\)

\(d = 1000\)

\(b_{\text{id}}=(n_d \ \| \ b_2)\)

\(v_1 = 3000\)

\(\text{id} = (01 \ \| \ n_d)\)

Features

\(a_3 = 1\)

\(a_4 = 0.2\)

\(d_2 = 1.1\)

\(f_c = 0.05\)

\(a_1 = 0.4\)

\(a_2 = 0.8\)

\(a_1' = 1\)

\(a_2' = 0.2\)

\(d_3 = 0.2\)

\(d_3 = 3.7\)

\(a_{\text{out}, 1} = 11100\)

\(a_{\text{out}, 2} =  0.37\)

\(a_3' = 600\)

\(a_4' = 0.02\)

\(S_1\)

\(S_2\)

\(S_1'\)

\(S_2'\)

\(\texttt{Account Proof}\)

\(\texttt{Join-split Proof}\)

\(\texttt{Defi deposit Proof}\)

\(\texttt{Defi claim Proof}\)

  • Rollup circuit must support 4 types of proofs, i.e. individual proof structures must be consistent
  • Supports defi interactions for upto \(2^{30}\) assets
  • A defi bridge is identified by its

\(\texttt{bridge\_id} = \bigg( \underbrace{\text{id}_{\text{out}, 2}}_{30} \ \| \ \underbrace{\text{id}_{\text{out}, 1}}_{30} \ \| \ \underbrace{\text{id}_{\text{in}}}_{30} \ \| \ \underbrace{n_{\text{in}}}_{2} \ \| \ \underbrace{\texttt{0xCF68...9E}}_{160} \bigg)\)

  • Defi deposit sums to be accumulated
  • Defi claim proofs to be generated individually
  • Fee across defi deposit and claim is split
    • Here, \(f_{\text{d}} = 0.05, f_{\text{c}} = 0.05\) (\(f_c\) added to claim note)

Challenges

  • Although elegant, the defi bridge design brings some new challenges:
    • Max two output assets allowed per defi protocol 
    • Max number of defi interactions per rollup is \(4\), remember every swap in Uniswap would be a unique defi interaction
    • New bridge contracts for each defi protocol
    • Increased circuit complexity (increased chances of bugs)
    • User interface concerns due to asynchronous processing
    • Censoring of claim proof processing

Summary

  • In this part, we covered:
    • Informal overview of Aztec's planned defi bridge
    • How private and cheap transactions in defi would work
    • Challenges of defi bridge
  • In future, we might cover: 
    • How lookup tables work in practice
    • How range constraints work
    • How Shplonk commitment scheme works
    • How fixed gate scalar multiplication in StdComposer work
    • How new Plonk version works

Aztec's DeFi Bridge

By Suyash Bagad

Aztec's DeFi Bridge

A very short presentation explaining how defi-bridge in Aztec works.

  • 155