Abstract
Non-interactive zero-knowledge proof or argument (NIZK) systems are widely used in many
security sensitive applications to enhance computation integrity, privacy and scalability.
In such systems, a prover wants to convince one or more verifiers that the result of a
public function is correctly computed without revealing the (potential) private input,
such as the witness. In this work, we introduce a new notion, called scriptable SNARK,
where the prover and verifier(s) can specify the function (or language instance) to be
proven via a script. We formalize this notion in UC framework and provide a generic
trusted hardware based solution. We then instantiate our solution in both SGX and
Trustzone with Lua script engine. The system can be easily used by typical programmers
without any cryptographic background. The benchmark result shows that our solution is
better than all the known SNARK proof systems w.r.t. prover’s running time (1000 times
faster), verifier’s running time, and the proof size. In addition, we also give a
lightweight scriptable SNARK protocol for hardware with limited state, e.g.,
Introduction
Collaboration is one of the main driving forces for the sustainable advancement of our civilization, growing from small-size tributes, to cities, and then to large-scale states. Being a part of the modern society, we are interacting with hundreds of known/unknown entities either physically or remotely. The main motivation of this work is to introduce new concepts and frameworks to enable more effective collaborations. One potential candidate tool is a well-known cryptographic primitive—zero knowledge (ZK) proof/argument system. In a ZK system, two players, the prover and the verifier, are involved; on one hand, the prover who holds a valid witness of an NP statement, is able to convince the verifier that the statement is true without revealing the corresponding witness; on the other hand, if the prover does not know any valid witness of the statement, then he cannot convince the verifier. ZK systems can be used to enable trustworthy collaborations: all players in a protocol are required to prove the correctness of their behaviors in the protocol execution. However, to enable effective collaborations, desired properties are expected, and we will elaborate them below.
Our design goals
In a large-scale collaboration network, it is infeasible for a party to prove the correctness of its computation to all other parties one by one. The first property we need from ZK systems, is (1) non-interactiveness in the sense that the prover only needs to prove the correctness of the computation once, and the prover then can send the same proof to all other parties i.e., the verifiers. From now on, we use NIZK to denote non-interactive ZK systems. The second desirable property we need is (2) succinctness, given the fact that the bottleneck for large-scale collaboration is the capacity of the underlying peer-to-peer network communication. Furthermore, as already mentioned, we note that in a typical application scenario a single prover will prove the same statement to many verifiers. In this unbalanced setting, a desirable NIZK proof system should have the property of (3) lightning fast verification time.
Up to now, those properties have already been achieved by a number of existing NIZK proof systems, such as zk-SNARK [7,23,52], zk-STARK [4], etc. However, these NIZK systems have not been widely used in practice yet. A significant barrier is the that the computation of prover is very heavy. The state-of-the-art NIZK systems needs hours to prove large statement even on a powerful PC (32 cores and 512 GB RAM [4]), let alone portable devices such as smartphones, tablets, and IoT devices. We aim to develop a NIZK system with the property of (4) lightweight prover.
To enable wide adoption of NIZK in the real world, the design must be (5) deployment friendly. The underlying cryptographic machinery should be transparent to the developers, and the protocol can be operated without cryptographic background. Unfortunately, all existing NIZK proof systems for universal language require re-compilation of both prover and verifier’s executable binary files for every new language instance.
Our approach
We propose a new primitive, called scriptable SNARK, with the goal of achieving all desirable properties above. This new primitive allows the developers to specify the language instance or computation to be verified via a script without any re-compilation. Similar to NIZK proof systems for universal language, a scriptable SNARK system can support multiple language instances, depending on the script language design and the script engine execution environment. Different from existing SNARK systems for universal language, our scriptable SNARK is very easy to use; for a new language instance, the players can easily define the scripts and no further compilation is required.
We study our scriptable SNARK in the UC framework [13,14]: we define an ideal functionality for scriptable SNARK, and then give two efficient realizations in the trusted hardware model. To the best of our knowledge, there is no UC-secure SNARK protocol proposed in the literature. The main reason is that the extractable soundness property of SNARKs in the CRS/RO model require unfalsifiable assumptions [24], such as the knowledge assumption, which is not UC-friendly. Kosba et al. [37] has made an attempt on constructing composable NIZK systems, but their protocol is not succinct. To bypass this impossibility result, our protocols utilize a stronger setup assumption, trusted hardware model.
Defining scriptable SNARK. We introduce a new notion called scriptable SNARK. Unlike the conventional SNARK, the scriptable SNARK allows the users to specify the relation to be proven via a script. More precisely, the prover only can prove a certain relation in the conventional SNARK, while the prover is allowed to prove any script execution as long as the script is supported.
Formally, we assume both the prover and the verifiers have agreed on the
function/script, denoted as
An NP language
Constructing scriptable SNARKs. We then present a generic scriptable
SNARK construction in the trusted hardware model. Trusted hardware can enable an isolated
and trusted computation environment where security sensitive data can be stored and
processed with confidentiality and integrity guarantees. Most existing trusted hardware
based applications, e.g., [22] emphasize on the
confidentiality aspect, while the security of our construction mainly relies on the
computational integrity guaranteed by trusted hardware. The main idea is as follows.
Recall that in a NIZK proof, the prover and the verifier have common input
Compared with [
60
]. The construction proposed in the
preliminary version [60] requires the trusted
hardware to have large enough state that at least linearly depends in the size of the
statement
A new construction for lightweight trusted hardware. Note that, in our
previous approach, the prover needs to send the entire circuit
Although there are a number of works in the literature studying how to speed up secure computing via trusted hardware, such as Intel SGX, we emphasize that this problem has not been solved by previous works. The closest related work is sealed-glass proof introduced by Tramer et al. [53], where the authors try to explore some use cases even if the isolated execution environment has unbounded leakage, i.e., arbitrary side-channels. We note that, their primitive is interactive, thus not scalable; in their protocol, for each verification, the trusted hardware must be interacted with. Our primitive is non-interactive, and in our construction, the verifier can verify the proof without interacting with the trusted hardware. There are also many theoretical differences between interactive ZK and non-interactive ZK, such as the minimum assumptions needed to realize the primitive; therefore, this work is not covered by [53]. Most importantly, ours is the first work to investigate scriptable SNARK, which is developer-friendly.
Implementation
We implement our scriptable SNARK proof system on two most popular trusted hardware
platforms: Intel SGX and Arm TrustZone. The main component is the
With regard to scriptability, in practice, it is a challenge for a third party to verify
the consistency between an executable binary and its software specification. That is, the
binary contains no bug, no trapdoor, and it is not subverted. Even it is possible, it
dramatically increases the verifier’s complexity. On the other hand, it is implausible to
assume a trusted third party that is available to generate a certified binary for each
language instance. To address this issue, we decide to adopt a scripting language, called
Lua. Lua is a lightweight script language. We implemented modified Lua script engine for
both Intel SGX enclave computation environment and the TrustZone environment. At a high
level, we let the Intel server and/or the setup authority server to prepare and sign a Lua
engine enclave/binary. The signed Lua engine is published as a common reference string
(CRS). In addition, the hardware is initialized with a signing key, and it corresponding
public key is also published as a part of the CRS. The modified Lua engine takes input as
a script
Recall that scriptable SNARK proofs are typically deployed in a one-to-many scenario, where the prover only needs to invoke the trusted hardware once and many verifiers can check the validity of the proof; however, currently, the remote attestation of Intel’s SGX requires the verifier to interact with the Intel Attestation Service (IAS) server. If each verifier needs to query the Intel IAS server to check the proof, the overall performance is limited by the throughput of Intel’s IAS. Moreover, the validity of a NIZK proof should be consistent over time, i.e., if a NIZK proof is verifiable at this moment, the same proof should remain verifiable in the future. Unfortunately, this would not be the case if we invoke the Intel IAS in the verification process; certifying an old quote (say, generated 1 year ago) is never the design goal of Intel’s remote attestation. This is because the quote needs to contain a non-revoked proof for each item on the signature revocation list, and the proof is no longer verifiable once the revocation list is updated at the Intel side. That means a quote is only valid until the next revocation list update. To resolve this issue, in our design, after generating the quote, the prover immediately queries the Intel IAS server for the attestation verification report on behave of a verifier. Since the attestation verification report is signed by Intel, given Intel’s public key, anyone can verify the validity of the attached signature. This tweak also makes the verification process non-interactive.
We also implement our scriptable SNARK proof system based on trusted hardware with
limited state. We simulate the hardware functionality
Asymptotic efficiency comparison of different SNARK proof/argument systems.
is the circuit size;
is the witness size;
is the problem instance size;
s is the number of copies of the subcircuits; d is
the width of the subcircuits. DL stands for discrete logarithm assumption, CRHF stands
for collision-resistant hash functions, SIS stands for shortest integer solution
assumption, KE stands for knowledge-of-exponent assumption, HW stands for trusted
hardware model, and AGM stands for algebraic group model
Asymptotic efficiency comparison of different SNARK proof/argument systems.
Performance. The performance of our scriptable SNARK system is
theoretically and experimentally evaluated and compared with the other NIZK proof systems.
Table 1 illustrates the asymptotic efficiency comparison
measured by the circuit size.
In terms of the actual experimental performance. The prover’s running time for evaluating
a Boolean circuit consisting of
Finally, we discuss applications of our scriptable SNARK. We note that, many applications have been previously investigated. However, it is very challenging to deploy them in practice due to the performance barrier.
Sound and scalable blockchain. As discussed at the very beginning of the Introduction, lots of heated discussions are taking place in blockchain community, with the goal of improving the performance in a sound manner. This consists of two parts. First, we should address the existing issues, since many blockchain scalability proposals have been implemented even the community is aware of the security concerns. In Section 7, we mention a few examples, and showcase how to address these issues via our SNARK. Again, we note that, these issues were not addressed simply due to the missing of fast and SNARK.
Second, we will enable new design paradigm for the interesting “one-to-many” unbalanced computation scenarios. Using our SNARK, typically, a single node as prover, can generate in very short time a proof that will convince all other nodes to accept the validity of the current state of the ledger, without requiring those nodes to naively re-execute the computation, nor to store the entire blockchain’s state, which would be required for such a naive verification.
Privacy preserving smart contracts. The zero-knowledge properties of ZK
proofs has already been intensively used in blockchain projects, with the goal of ensuring
the anonymity and protecting financial privacy. Notably, Succinct Non-interactive
ARguments of Knowledge (zk-SNARK) has been used in Zcash and Ethereum; Bulletproofs has
been used in Monaro. Recently, Ethereum has the plan to explore the feasibility zk-STARK
in its future version of their platform. We note that, it is still not clear if zk-STARK
can be widely adopted in blockchain platforms given the fact that, the current proof size
is
Preliminaries
Trusted execution environment
Trusted execution environment (TEE) refers to a range of technologies that can establish an isolated and trusted environment where security sensitive data can be stored and processed with confidentiality and integrity guarantees. TEE needs to be instantiated on top of a trusted computing base (TCB), which consists of hardware, firmware and/or software. Minimizing the size (attack surface) of TCB with reasonable assumptions is the common goal of this line of research. In practice, TEE can be realized on top of several promising trusted hardware technologies, such as ARM TrustZone and Intel SGX. Although recently a few side-channel attacks, e.g. [42,56], have been explored against those TEE candidates, new designs and fixes are proposed on a monthly basis. Hence, we envision that TEE will be a cheap and acceptable assumption in the near future. In this work, our benchmarks are mainly based on the Intel SGX platform for its readily deployed remote attestation infrastructure; however, our technique can also be implemented on any other TEE solutions.
Intel SGX. Intel Software Guard Extensions (SGX) is a widely used
trusted hardware solution to enable TEE. It provides a hardware enforced isolated
execution environment against malicious OS kernels and supervisor software. The SGX
processor sets aside an exclusive physical memory space, called processor reserved memory
(PRM) to ensure the confidentiality and integrity of enclave’s memory. Each SGX hardware
holds two root keys: root provisioning key and root seal key. The actual attestation keys
are deviated from those root keys via PRF. Intel’s (anonymous) attestation is based on an
anonymous group signature scheme called Intel Enhanced Privacy ID (EPID) [11]. In this work, we are particularly interested in
SGX’s ability to enable attested computation, i.e. any third party can audit an outcome is
computed by a pre-agreed program in a genuine SGX. More specifically, the application
enclave first uses
In practice, the security guarantee of SGX is evolving alone with the discovered side-channel attacks: cache-timing attacks [18], page-fault attacks [59], branch shadowing [39], synchronization bugs [58], foreshadow [56], and SgxPectre [16], etc. Subsequently, some privacy concerns are raised when SGX is involved in the data process. Hereby, we would like to emphasize that unlike most SGX applications, the security of our construction mainly relies on the computational integrity guaranteed by SGX rather than data confidentiality. Namely, the adversary is allowed to learn the enclave’s internal state during computation. As far as the root keys are not leaked, the soundness of our construction still holds. This relaxed assumption is modelled as transparent enclave in the literature [53].
TrustZone. As one of the most widely deployed security architectures to
support TEE, ARM TrustZone separates a processor into two security states, namely the
secure world and the normal world. And the resource (e.g., memory, peripherals) belonging
to the secure world cannot be accessed by the normal world directly. The processor runs in
either the normal world or the secure world at any given time. Switch between the two
worlds is triggered by
NIZK proof/argument systems
Let
Universal composibility
Our model is based on the Universal Composibility (UC) framework [13,14], which lays down a
solid foundation for designing and analyzing protocols secure against attacks in an
arbitrary network execution environment (therefore it is also known as
network aware security model). Roughly speaking, in the UC framework,
protocols are carried out over multiple interconnected machines; to capture attacks, a
network adversary
We say protocol Π UC-secure realizes functionality
In order to conceptually modularize the design of the protocols, the notion of “hybrid
models” is often introduced in the UC framework. A protocol Π is said to be realized “in
the
We say protocol Π UC-secure realizes functionality
The UC model provides strong security guarantees (via polynomial-time security reduction). It also has two appealing features: The property that stand-alone security directly implies security under general concurrent composition (thus protocols only need to be analyzed in a stand-alone fashion), and its support for modular analysis of protocols.
We need the following cryptographic tools to build our protocols.
Digital signature. A digital signature
The security notion required for digital signature is existential unforgeability under chosen message attacks, and we capture it by the following definition.
We say the digital signature For
Here we define the advantage of an adversary
Message authentication code. A message authentication code (MAC) is another cryptographic scheme that used to authenticate the origin and nature of a message. It is similar with digital signature, but uses symmetric encryption. A MAC scheme has the following algorithms:
The security notion required for MAC is the same as digital signature, and we also capture it by the following definition.
We say the digital signature For
Here we define the advantage of an adversary
Collision-resistant hash function. A hash function
We say the hash function
Here we define the advantage of an adversary
In this section, we formally define the scriptable SNARK. Our definition is through an
ideal functionality

The scriptable functionality
Scriptable SNARK ideal functionality. The scriptable SNARK ideal
functionality
The functionality
Remark on succinctness. We say a NIZK proof system is succinct if the size
of the proof

The
In this section, we present our scriptable SNARK construction in the
Common information. Unlike most existing SNARK proof systems, the script
Intuition. Trusted hardware offers two important features: (i) data
confidentiality and (ii) computation integrity. Most existing trusted hardware (TEE) based
applications, e.g., [22] mainly explore the data
confidentiality aspect; whereas, in this project, we emphasize the computation integrity
aspect. Recall that in a NIZK proof, the prover and the verifier have common input
What is the difference between the above SNARK construction and trusted computation in the
Construction. Our scriptable SNARK construction utilizes the

The scriptable SNARK protocol
We aim to achieve constant verification time; light-weight device can perform the
verification. In addition, the verifier is only required to query the
To verify a proof π, the verifier needs to know the public key
Assume signature scheme
To prove the theorem, we construct a simulator
Simulator. The simulator
∘ When the simulated
∘ Upon receiving
Indistinguishability. The indistinguishability is proven through a
series of hybrid worlds
Hybrid
Hybrid
If
The
simulator Therefore, the overall advantage is
The adversary’s view of
Simulator. Similar to Case 1, the simulator
∘ When the simulated
Indistinguishability. The indistinguishability is straightforward. The
proof π generated by the simulator
Simulator. Trivial case. There is nothing needs to extract, as the
trustees do not have input. The simulator
Indistinguishability. The view of
This concludes the proof. □
The hardware functionality
Intuition. Our previous approach is to send the entire circuit
Our solution is to utilize a collision-resistant hash function
To prevent the malicious prover from changing the assignment of wires, take NAND gates as
an example, the prover has to send the description of the NAND gate
The lightweight trusted hardware model. Now we provide our new
functionality

The lightweight trusted hardware functionality
The lightweight scriptable SNARKs construction. Our lightweight scriptable
SNARKs construction utilizes the lightweight hardware functionality
As depicted in Fig. 5, our lightweight scriptable SNARK
protocol
To verify a proof π, the verifier needs to know the public key

A Lightweight Scriptable SNARK Protocol
Security. We show the security of our lightweight scriptable SNARK construction via Thm. 2, below.
Assume the signature scheme
To prove the theorem, we construct a simulator
Simulator. The simulator
∘ The simulated
∘ Upon receiving
Indistinguishability. The indistinguishability is proven through a
series of hybrid worlds
Hybrid
Hybrid
If
The
simulator Therefore, the overall advantage is
Hybrid
If
The
simulator Therefore, the overall advantage
is
Hybrid
If
The
simulator Therefore, the overall advantage is
The adversary’s view of
Simulator. Similar to Case 1, the simulator
∘ The simulated
Indistinguishability. The indistinguishability is straightforward. The
proof π generated by the simulator
Simulator. Trivial case. There is nothing needs to extract, as the
trustees do not have input. The simulator
Indistinguishability. The view of
This concludes the proof. □
implementation
In this section, we realize the

The script engine enclave
Challenges. In both platforms, there are a number of challenges need to be resolved. In terms of SGX, as mentioned in Section 2.1, the remote attestation of Intel SGX currently requires the verifier to contact the Intel IAS server. On the other hand, in a typical SNARK proof system usage case, the prover aims to prove the truth of the statement to a great number of verifiers. If each verifier needs to query the Intel IAS server to check the proof, the overall performance is limited by Intel’s throughput. Moreover, the validity of a SNARK proof should be consistent over time, i.e., if a SNARK proof is verifiable at this moment, the same proof should remain verifiable in the future. Unfortunately, this would not be the case if we invoke the Intel IAS in the verification process; certifying an old quote (say, generated 1 year ago) is never the design goal of Intel’s remote attestation. This is because the quote needs to contain an non-revoked proof for each item on the signature revocation list, and the proof is no longer verifiable once the revocation list is updated at the Intel side. That means a quote is only valid until the next revocation list update. To resolve this issue, in our design, after generating the quote, the prover immediately queries the Intel IAS server for the attestation verification report on behave of a verifier. Since the attestation verification report is signed by Intel, given Intel’s public key, anyone can verify the validity of the attached signature. This tweak also makes the verification process non-interactive.
Secondly, the existing SGX-based proof system, e.g., [53], requires the prover and the verifiers agree on the executable binary (enclave) for the language to be proven. It would make it impossible to build a universal NIZK system in practice. Note that SGX only signs the measure of the enclave, which cannot be directly compared with the corresponding algorithm. Imaging a verifier who is checking a SNARK proof generated some time ago, how would the verifier know the executable binary (enclave) is faithfully compiled? Therefore, SNARK systems, like [53], would need a trusted party to generate an executable binary (enclave) for a given problem instance, and the binary is served as the concrete CRS for the given instance.
In terms of TrustZone, unlike the ecosystem of SGX that is controlled by Intel, the fragmentation of the ARM TrustZone ecosystem may make it hard to have a unique setup standard. To resolve this issue, we need to introduce a trusted setup authority to serve as an attestation server.

Protocol
SGX-based system overview. In our system, the protocol
The enclave also has a GetQEInfo function to receive the target information of QE. It is omitted for simplicity.

SGX based trusted hardware instantiation.
Technically, the private input
The hardware functionality
TrustZone-based system overview. ARM TrustZone is another popular trusted hardware platform that can also be leveraged (as long as a device-unique, asymmetric key pair signed by the device’s vendor exists). ARM TrustZone provides isolated execution by separating the CPU into two different worlds, i.e., normal world and secure world. The code running inside the normal world cannot directly access the resource inside the secure world. Also only the application inside the secure world can access the protected resource.
Specifically, the device-unique key pair can be used to sign the attention blob that
indicates the attestation data originates from the secure world. The attestation data in
this case contains
The Lua script engine design and system architecture is similar to the SGX-based
solution. However, it is more efficient, as the attestation data can be verified without
interacting with the attestation server if the verifier already fetched the public key
Evaluations. Our SGX-based prototype is implemented in C++ using the Intel(R) SGX SDK v2.5 for Linux. Our implementation is built on top of [49], and we added OpenSSL lib functions for common cryptographic primitives, such as SHA256, ECDSA, etc. Since system call is not allowed in enclave, we also simulated a simple file system to support the Lua interpreter. The size of the compiled enclave binary is approximately 3.2 MB.
Up on execution, the prover first creates an instance of the Lua script engine enclave in
the SGX and transfers the target information of QE into the Lua script engine enclave,
which will be used later to generate the report for QE. The prover then produces his proof
by calling specific function interface of the enclave,
After the script execution, the enclave hashes
QuoteBody structure
Reducing proof size. Naively, the prover can send the entire signed attestation verification report as the NIZK proof. The proof size is 731 Bytes (IAS report size) + 256 Bytes (the signature size).
To reduce proof size, we observe that Intel’s signature is signed on top of the hash of
the attestation verification report, so the prover does not need to give the entire report
as a part of the proof as far as the verifier can reproduce the hash of the report.
However, the verifier is interested in some field of in the
We let the prover give the partial hash digest until
In fact, there are 56 bits reserved area, whose default value is 0 in the attributes field. Hence, the size can be further reduced by 56 bits.

Performance comparison of different SNARK proof systems in terms of prover’s running
time, verifier’s running time, and proof size. The complexity is measured by the
number of multiplication gates. Our work and BCCGP are 128 bit security; libSNARK and
SCI are 80-bit security; ligero and zk-STARK are 60-bit security. Our system is tested
on a SGX-equipped processor (I7-8700 @ 3.2GHz and 16 GB RAM, single thread) and hikey
960 TrustZone development board. All the other systems were tested on a server with 32
AMD cores @ 3.2GHz and 512 GB RAM, and the data was reported by [4]. For libSNARK, the hollow marks (libSNARK*) in verifier time
and proof size measure only count the post processing phase; while solid marks also
count CRS generation time. For our SGX based scheme, the prover’s running time
includes network time for intel IAS verification; SGX-a (TZ-a) stands for arithmetic
circuit over ring
Our TrustZone-based prototype is developed on the Hikey 960 development board, which is
powered by Huawei Kirin 960 SoC with 4 ARM Cortex-A73 cores and 4 1.8 GHz ARM Cortex-A53
cores. There are 4 GB DDR4 memory and 32 GB UFS flash on our board. In our experiment, we
choose OPTEE(v3.6) as the OS in the secure world, which is open source and well
maintained. For the normal world OS, we use a Linux distribution, which is developed by
Linaro Security Working Group based on Linux kernel v5.1 and able to corporate with OPTEE.
Then, we implement a Trusted App(TA) for the secure world, which will be managed by OPTEE.
The Client Application(CA) in the normal world can invoke the TA through specific
interface. Lua Intrepreter(v5.3.2) is adopted and modified. The default secure memory size
supported by OPTEE is 16 MB, which restricts the script size. A signing key is stored in
the TrustZone for the experiment. The enclave structure and system design is similar to
the SGX-based solution, except we adopt ECDSA signature over the
Figure 9 shows the performance comparison of different
SNARK proof systems w.r.t. prover’s running time, verifier’s running time, and proof size.
Although our SNARK proof system support RAM model computer program, we implemented circuit
evaluation as Lua script to facilitate comparison. We emphasize that the reported time is
tested using Lua scripts. If the circuit is written in native C, the performance is
approximate 10 times better on both SGX and TrustZone platforms. The complexity is
measured by the number of multiplication gates. We provide ‘SGX-A’ and ‘TZ-A’ as the
benchmark for arithmetic circuit over ring
In this section, we simulate the lightweight trusted hardware functionality

The enclave
Enclave. Unlike the script engine enclave depicted in Fig. 6, the enclave

Protocol
The lightweight SNARK system overview. Here, the protocol
The hardware functionality
Evaluations. Our SGX-based prototype is implemented in C++ using the
Intel(R) SGX SDK v2.11 for Linux. we added OpenSSL lib functions for common cryptographic
primitives, such as SHA256, ECDSA, etc. We instantiate

Performance comparison of different k choices in terms of prover’s running time and verifier’s running time. The complexity is measured by the number of multiplication gates. Our system is tested on a SGX-equipped processor (I7-8700 @ 3.2 GHz and 16 GB RAM, single thread).
Figure 12 shows the performance of our proposal w.r.t.
prover’s running time and verifier’s running time. The complexity is measured by the
number of multiplication gates. From the Fig. 12(a), we
conclude that increasing the value of k at the beginning can
significantly improve the prover time, because the initial performance bottleneck lies in
the overhead of calling the enclave, and increasing the value of k can
reduce the number of calls. As k increases, the curve in Fig. 12(a) flattens out, which means that the performance bottleneck
at this time lies in the computational overhead (e.g. MAC operations) inside the enclave.
We also conclude that the performance of our proposal is competitive. When set
Resolving verifier’s dilemma. The term verifier’s dilemma in the blockchain context was first proposed in [43]. In this section, we first briefly explain what the problem is and then present a solution using our succinct NIZK proof system.
Verifier’s dilemma. In a blockchain system, when a new block is produced, it will be propagated to all the other nodes through the P2P network. In principle, each node needs to independently verify the validity of the block, i.e. in terms of Bitcoin, all the transaction inputs are never spent (e.g., in the UTXO) and the signatures attached to all the transactions are valid. However, in practice, a miner may decide to skip the verification process, for instance, to gain advantages in the proof of work over the other miners – honest miners need to first verify the block, accept it, and then start the proof of work for the next block; whereas, dishonest miners assume that the block is valid, skip the expensive verification, and immediately start to mine the next block.
To resolve the problem, we can let the miner to attach a proof showing the validity of the block. It only takes 1 ms to check the proof; therefore, the disadvantage of honest miners are merely 1 ms, which is negligible compared with the network delay. In our prototype, the statement consists of the root of the Merkle tree commitment (64 levels) of the latest UTXO, denoted as r and the hash of the block, denoted as h. The prover wants to convince the verifiers the followings are true:
The content of the block that can hash to h;
For each transaction input, there exist a path of length 64 can be hashed (SHA256) to r;
The ECDSA signature of each transaction is valid w.r.t. the corresponding public key.
Performance. Table 3 shows the prover’s running time to prove the validity of a Bitcoin block with 3700 transactions. For SGX platform, It takes 91 ms to create the enclave, and the VerifySign function running time is 2.2 s. It then takes 32 ms for the QE to sign a quote; it takes approximately 675 ms4
The connection time with IAS varies, depending on the region and country. The experiment is tested on a Linode cloud server at Fremont, California, US.
Proving validity of a Bitcoin block (3700 Txs)
Fast NIPoPoW. Proof-of-Work (PoW) is one of the most popular consensus mechanism to realize an open permissionless blockchain, e.g., Bitcoin and Ethereum. To determine “longest” chain, the nodes need to verify the entire linearly-growing chain of PoWs. Therefore, verify the amount of computation involved in a chain could be an expensive task for a long chain (e.g., the blockchain of Bitcoin consists of 575000 blocks,) if the nodes only store the genesis block. In practice, checkpoints are used to mitigate this issue.
Non-Interactive Proofs of Proof-of-Work (NIPoPoWs) is a primitive introduced by [36]. It is a short proof that contains the following information,
the total difficulty of all blocks in a chain,
if a given block is on that chain.
The verifiers can check the validity of the proof without downloading all the block headers.
NIPoPoWs enables lightweight wallets with simplified payment verification (SPV). The SPV clients can request multiple NIPoPoWs from the full nodes (i.e., the nodes store the whole blockchain). As long as one of those full nodes is honest, the SPV clients can know if a given block is on the longest chain.
NIPoPoWs also can be used to build a cross-chain solution. Because the miners that run a blockchain do not monitor other blockchain networks, this can be done with short proofs. If a blockchain supports smart contracts, e.g., Ethereum, a contract can be written to validate a NIPoPoW to check that something happened on another blockchain and react to it. For instance, a payment made on a blockchain system, that supports NIPoPows, could cause a payment to be released by an Ethereum smart contract.
In the protocol in [36], the miners run an
In our SNARK proof system, the miner generate a proof by parsing the blockchain to SGX. The
algorithm to generate the proof take
Proving chain difficulty for 575000 bitcoin blocks
Privacy preserving smart contract. The smart contract systems over decentralized cryptocurrencies allow making safe transactions between distrustful parties without trusted third parties. However, most of the existing systems lack transaction privacy. All the information of the smart contracts are exposed on the blockchain.
Privacy preserving smart contract is introduced in [35,38]. Cryptographic primitives, e.g.,
zero-knowledge proofs, have been used to preserve the privacy of smart contracts. A privacy
preserving smart contract consist of two parts A
private portion which takes in clients’ input data (e.g., in two-party coin tossing)
as well as currency units (e.g., in an auction). The private portion is executed to
determine the payout distribution amongst the clients. A
public portion (e.g., the smart contract’s program) that does not touch private data
or money.
After the smart contracts are executed, everyone can
verify the execution of the smart contract without knowing any the private portion.
Privacy preserving smart contract can be used for several real-life application, such as insurance, auctions, digital identity and records management. For example, in a unique bid auction smart contract, the clients bid some money to win a prize. The winner is the client with the lowest unique bid. In this case, privacy preserving smart contract is needed so that all the bidding information cannot be revealed.
Nevertheless, the smart contracts in [35,38] is not effective enough. It takes a few minutes to run the cryptographic computation. Later, there are several papers provide different methods to improve the performance of privacy preserving smart contract. In [17,61] a trusted execution environment/hardware is combined with a blockchain to address the performance issues. Here, the time to verify an execution of a smart contract can be hundreds of milliseconds.
Our SNARK proof system can also be combined with a blockchain to improve the performance of privacy preserving smart contract. When clients wants to execute a smart contract, they parse the public and private portion to the SGX to generate an execution proof. Then, the miners can verify the proof without knowing the private portion. We expect the miners can verify the proof within 1.5 ms.
Universal SNARK. Now we briefly describe several different practical approaches for universal SNARK (i.e., can be applied to general computations and languages in NP). We note that our description here are based on a large body of existing results, and unfortunately we cannot cover the entire body research in this line. We mainly compare the performance related properties, including prover scalability, verifier scalability, setup/initialization scalability, and communication scalability. Additionally, we also compare the underlying setup assumptions and computational assumptions. We note that, in the existing approaches, each setup only support one language instance. Meanwhile, our scriptable SNARK can support multiple language instances in a single setup.
There are multiple approaches to scalable SNARK. The first approach is based on homomorphic public-key cryptography, by Ishai et al. [32] and Groth [28]. Then Gennaro et. al [23] introduced an extremely efficient instantiation, based on Quadratic Span Programs, which later been implemented in Pinocchio [48]; see also [5,7,19,52]. Note that, this technique has been used in Zcash.
We note that, the homomorphic public-key cryptography based approach can be combined with other techniques to improve the performance. For example, Valiant, [55] suggested to reduce prover space consumption via knowledge extraction assumptions; This combined method can inherit most of the properties from the underlying proof system. We note that our scriptable SNARK system is more efficient.
The second approach is based on the hardness of the DLP, originally proposed by Groth [29] and then implemented in [9,12]. Note that, the communication complexity in the DLP approach is logarithmic. However, the verifier complexity in this approach is not scalable.
The third approach is based on efficient Interactive Proofs (IP) [27,50].
The line of realizations can be found in [62] and [57].
Note that, the verifier in this approach is not scalable.
The fourth approach is via the so-called “MPC in the head”, originally suggested by Ishai et al. [33] and then implemented in ZKBoo [25], and in Ligero [1].
“MPC in the head” based systems have a non-scalable verifier; in addition, communication complexity is non-scalable.
Not all the existing works can be classified like paragraphs above. Bootle et al. propose a scheme that based on ideal linear commitment (ILC) model where a prover can commit to vectors by sending them to a channel, and a verifier can query the channel on linear combinations of the committed vectors [10]. Baum et al. introduce the first lattice based protocol with sublinear communication costs [2]. A recent proposal called STARK [4], attempts to simultaneously minimize proof size and verifier computation. However, their proof sizes are not small. In [30,44], an updatable and universal reference string is used. The main goals of this approach is to address risks surrounding setups and many other security challenges in practice. It does not improve the efficiency.
Another method to achieve universal setup is using universal circuit [40,41]. In [5,7], a TinyRAM architecture is used to describe universal computations as simple programs. A universal circuit is built based on a specific universal language (i.e., a set of tuples, where each tuple consists of a TinyRAM program, an input string, and a time-bound to run the program). Unfortunately, this approach incur a large overhead on the prover computation.
NIZK in the UC framework. Groth et al. proposed the first UC-secure NIZK argument for any NP language in the presence of an adaptive adversary [31]. In [31], the simulator is allowed to generate the encryption key/decryption key pair, and encrypts message that relates to the witness. Thus the simulator has the chance of extracting the witness. Since then, a lot of research work has been done to construct the UC-secure NIZK protocol, such as [15]. Kosba et al. has even made an attempt on building a framework for UC-secure NIZK proofs [37]. However, to the best of our knowledge, all of these protocols do not achieve succinctness.
Trusted hardware. Many previous works have proposed using trusted hardware to build cryptographic algorithms and systems, including protection of cryptographic keys [45], functional encryption [22], digital rights management [21], map-reduce jobs [46,54], machine learning [47], data analysis [51], and protecting unmodified Windows applications [3]. Of course, people have used trusted hardware to build NIZK proof system. More precisely, Tramer et al. introduced sealed-glass proof in [53], where the authors try to explore some use cases even if the isolated execution environment has unbounded leakage, i.e., arbitrary side-channels. We note that there are two main difference between their work and ours: interactiveness and scriptability. In particular, their primitive is interactive, thus not scalable; in their protocol, for each verification, the trusted hardware must be interacted with. Our primitive is non-interactive, and in our construction, the verifier can verify the proof without interacting with the trusted hardware. Most importantly, ours is the first work to investigate scriptable SNARK, which is developer-friendly.
Conclusion
In this work, we introduce a new notion called scriptable SNARK proof system. We formally model this notion in the UC framework. We then propose a generic scriptable SNARK solution based on trusted hardware. We also instantiated our scheme in both Intel SGX and Arm TrustZone. To the best of our knowledge, the proposed scriptable SNARK is better than all the existing succinct SNARK proof systems w.r.t. the prover running time (1000 times faster for Lua script, 10000 times faster for Native C), the verifier’s running time (10 times faster), and the proof size (10 times smaller). In addition, we also propose a scriptable SNARK solution based on lightweight trusted hardware. Most importantly, our SNARK proof system can be readily deployed and used by any developers without the need of cryptographic background.
