Private Cross-Chain Bridge in Zecrey
In the last medium, we have conducted a detailed demonstration of the definition and common implementation schemes of cross-chain technologies among the current blockchain systems. The current cross-chain solutions are mainly based on the bridge, which is customized to realize the transfer of mainstream cryptocurrency for personal accounts. The complicated implementation enhances its impracticability. Besides, the blockchain transactions, including transfer and swap, are all constrained in the original blockchain and lack cross-chain interoperability, which reveals the bottleneck of current cross-chain assets management. More importantly, the privacy of cross-chain assets is supposed to be handled in a general and efficient manner.
To solve these challenges, Zecrey team creatively proposes a privacy cross-chain protocol for assets management. Zecrey achieves interoperability between different blockchains through a novel cross-chain bridge solution and supports cross-chain privacy assets swap in a secure and decentralized manner. With the aid of ZK-Rollup, Zecrey implements a lightweight, efficient and advanced cross-chain assets management and privacy protection protocol. In this medium, we are going to attain a firm, clear understanding of how Zecrey makes this innovation possible.
Zecrey proposes a privacy protocol that brings cross-chain privacy to digital assets for users from various blockchain projects to break the above challenges encountered by the current blockchain ecology. Specifically, Zecrey achieves a cross-chain privacy protocol with two main targets — implementing a bridge-based infrastructure between any two chains and achieving privacy assets swap between any blockchain networks. The core idea is to use layer-2 for state management and layer-1 for asset security guarantee in a fully decentralized manner. Zecrey functions as a multi-chain management wallet enabled by ZK-Rollup [1].
ZK-Rollups are one of the options being developed for layer 2 construction that increases scalability through mass transfer processing rolled into a single transaction. Where Plasma creates one transaction per transfer, ZK-Rollups bundle hundreds of transfers into a single transaction. The smart contract will deconstruct and verify all of the transfers held in a single transaction.
A “zero knowledge proof” approach is used to present and publicly record the validity of the block on the Ethereum blockchain. ZK reduces computing and storage resources for validating the block by reducing the amount of data held in a transaction; zero knowledge of the entire data is needed.
The ZK-Rollup scheme consists of two types of users: transactors and relayers. Transactors create their transfer and broadcast the transfer to the network. The transfer data consists of an indexed “to” and “from” address, a value to transact, the network fee, and nonce. A shortened 3 byte indexed version of the addresses reduces processing resource needs. The value of the transaction being greater than or less than zero creates a deposit or withdrawal respectively. The smart contract records the data in two Merkle Trees; addresses in one Merkle Tree and transfer amounts in another.
Relayers collect a large amount of transfers to create a rollup. It is the relayers job to generate the SNARK proof. The SNARK proof is a hash that represents the delta of the blockchain state. State refers to “state of being.” SNARK proof compares a snapshot of the blockchain before the transfers to a snapshot of the blockchain after the transfers (i.e. wallet values) and reports only the changes in a verifiable hash to the mainnet.
It is worth noting that anyone can become a relayer so long as they have staked the required bond in the smart contract. This incentivises the relayer not to tamper with or withhold a rollup.
While providing transaction privacy, ZK-Rollup significantly reduces handling fees and improves performance, since less data are contained in each transaction, leading to high throughput and scalability of layer 2. Besides, through ZK-Rollup, blocks will be computed in a parallel computing model which encourages decentralization. We use the PLONK[2] algorithm as our ZK-Rollup algorithm. PLONK is a recent zk-SNARK construction that can do much more than older SNARKs. If combined with Kate polynomial commitments[3], it becomes a universal SNARK, which means that the reference string created in a trusted setup can be reused for any other PLONK circuit of the same size (or less) than the original. The reference string can also be updated, with each update reducing the chance that the setup was compromised by collusion. Other polynomial commitment schemes can turn PLONK into a kind of STARK with no trusted setup at all.
Zecrey integrates transaction states to layer-2 and updates the same final state on each layer-1. The state updates are maintained by ZK-Rollup, resulting in the same level of decentralization and security with layer-1. Besides, Zecrey adopts an account-based model, which provides programmability and flexibility for both users and developers. In order to achieve account-based privacy, Zecrey uses Twisted ElGamal encryption [4] to keep the privacy of the account.
For state management, integrated account state data will be persistent in the database and Zecrey uses Sparse Merkle Tree (SMT) [5] to store the state transfer (ST) result that will also be verified by zk-snarks. After Sender uploads the layer-2 block proof on-chain, smart contracts will verify the proof and modify the on-chain status based on the proof which contains the SMT ST data.
SMT is the core module for state management. The figure below illustrates the structure of layer-2 states. We use two SMT to present the state of accounts and account assets. The depth of the account tree is 32 and the depth of the account assets tree is 17, and we can divide the account assets tree into two different trees: asset tree and liquidity tree, the depth of both of them is 16. It means that we can store at most 2³² accounts and 2¹⁶ assets and liquidity pairs.
The main innovations and strengths of the privacy cross-chain scheme of Zecrey are summarized as follows.
- Zecrey is a general cross-chain privacy protocol based on the account model.
- Zecrey enables one-to-many private transactions, which is a creative move towards transaction performance improvement. Additionally, Zecrey achieves one-click private transfer at the layer-1 level.
- The number of privacy transactions for each user in the same round is no longer restricted, leading to high TPS of the protocol.
- Composite zero-knowledge proofs are utilized to provide high performance for the protocol. Through this technology, the protocol can realize the millisecond-level computing privacy proof on the mobile phone, which reflects the superior practicality of Zecrey.
- Zecrey achieves interoperability between any blockchains through the cross-chain bridge and supports cross-chain privacy assets swap.
- Zecrey is a decentralized asset aggregator for both layer-1 and layer-2, which implements the aggregation of similar assets for users, and can realize the free flow of assets through cross-chain bridges, providing users with intuitive asset management views.
- Through ZK-Rollup, Zecrey can achieve lower handling fees, higher security level, higher TPS, and second-level cross-chain swap.
Reference
[1] https://docs.ethhub.io/ethereum-roadmap/layer-2-scaling/zk-rollups/
[2] Gabizon, A., Williamson, Z.J., Ciobotaru, O.: PLONK : Permutations over Lagrange-bases for Oecumenical Noninteractive arguments of Knowledge. Stanford Blockchain Conference pp. 1–33 (2020), https://eprint.iacr.org/2019/953.pdf
[3] Kate, A., Zaverucha, G.M., Goldberg, I.: Constant-size commitments to polynomials and their applications. Lecture Notes in Computer Science (including subseries 24 Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) 6477 LNCS(Dl), 177–194 (2010)
[4] Chen, Y., Ma, X., Tang, C., Au, M.H.: Pgc: Decentralized confidential payment system with auditability — not full, vol. 12308 LNCS. Springer International Publishing (2020)
[5] Dahlberg R, Pulls T, Peeters R. Efficient sparse merkle trees[C]//Nordic Conference on Secure IT Systems. Springer, Cham, 2016: 199–215.
Zecrey official website: Zecrey
Welcome to join our communities and follow us on twitter:
Medium:https://medium.com/@zecrey
Twitter: https://twitter.com/zecreyprotocol
Telegram: https://t.me/zecrey