Blockchain technology is currently being used in a large number of application scenarios besides the cryptocurrency exchange one, mainly thanks to the introduction of smart contracts, which allow to implement applications that are executed on the blockchain (Decentralised applications). Smart contracts' code and data are visible by all the participants to the blockchain, thus preventing the adoption of blockchain technology in those application scenarios where data privacy is required. To address this problem, Zero Knowledge Succint Non-interactive Argument of Knowledge (zkSNARK) proofs have been proposed, which allow smart contracts to verify a known condition on secret data without revealing it. To integrate the zkSNARK technology in their smart contracts, developers can take advantage of two popular libraries: Circom and Zokrates. However, when choosing which of the two to adopt, developers should take into account the cost in terms of gas and storage space of the resulting code. To this aim, this paper contributes by performing an experimental comparison of the two libraries. In particular, three well know problems requiring data privacy have been selected, the smart contract implementing the corresponding privacy preserving verification of a known condition on secret data have been produced exploiting the two libraries, and the related performance in terms of smart contracts deployment and execution costs and storage space required for the zkSNARK data (circuits, proofs and keys) have been measured, compared, and discussed.
zkSNARKs Libraries for Blockchains: a Comparative Study
Tortola D.;Russo G. G.;Ricci L.
2024-01-01
Abstract
Blockchain technology is currently being used in a large number of application scenarios besides the cryptocurrency exchange one, mainly thanks to the introduction of smart contracts, which allow to implement applications that are executed on the blockchain (Decentralised applications). Smart contracts' code and data are visible by all the participants to the blockchain, thus preventing the adoption of blockchain technology in those application scenarios where data privacy is required. To address this problem, Zero Knowledge Succint Non-interactive Argument of Knowledge (zkSNARK) proofs have been proposed, which allow smart contracts to verify a known condition on secret data without revealing it. To integrate the zkSNARK technology in their smart contracts, developers can take advantage of two popular libraries: Circom and Zokrates. However, when choosing which of the two to adopt, developers should take into account the cost in terms of gas and storage space of the resulting code. To this aim, this paper contributes by performing an experimental comparison of the two libraries. In particular, three well know problems requiring data privacy have been selected, the smart contract implementing the corresponding privacy preserving verification of a known condition on secret data have been produced exploiting the two libraries, and the related performance in terms of smart contracts deployment and execution costs and storage space required for the zkSNARK data (circuits, proofs and keys) have been measured, compared, and discussed.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.