A smart contract is a computer program that resides on the Ethereum blockchain and gets executed automatically when predetermined conditions are met. Depending on the complexity, every transaction that modifies a smart contract’s state consumes a certain amount of gas (the unit of cost in the Ethereum blockchain). As a result of this, it becomes infeasible to use smart contracts for computationally intensive applications such as image recognition and zero-knowledge proofs. In this paper, we refer to such contracts as computationally intensive smart contracts (CICs).
Recent studies have explored alternative solutions to eliminate the cost and make CIC execution scalable. Proposed solutions to this end either replicate the CIC’s execution across a small subset of nodes or require a Trusted Execution Environment (TEE), which engenders greater trust. An alternative to the aforementioned methods is to outsource the CIC computation to a third party that does the computation and generates a proof of correctness for the same, that can be verified in polynomial time. Using this approach, the client can verify the returned computation’s correctness in a much more efficient manner than re-executing it. Our work falls into verifiable computation category where we propose a solution that is scalable, avoids duplicating computations, and does not require tamper-resistant hardware or trusted execution environments.
Ii Related Work
Trusted Hardware: TEE has been adopted to alleviate scalability and confidentiality obstructions of smart contracts in [6, 3, 27]. However, recent studies have identified several attack on SGX — we avoid the impact as we do not need SGX[17, 19, 25, 18, 28, 20, 16]. Replicated Computation: Outsourcing CIC execution to a set of delegators has been proposed by ; however, this model suffers from the large overhead of replicated computation and lacks support for randomized computations, which we address in our work. Verifiable Computation: Interactive proofs (IPs)  and probabilistically checkable proofs (PCPs)  laid the foundations of provable verifiable computation which has been studied in [15, 8, 24, 14, 5, 13, 12, 4]. Despite promising asymptotics, these proof systems are highly impractical and may take inordinately long to verify instances with small input sizes . Another line of work applies the above theoretical foundations to practice on cloud computing settings studied in [22, 23, 26]; however, they are far from being scalable for general-purpose computation. Adoption of zk-SNARKs to verify smart contracts was proposed by ; however, their solution requires that the application code be written in a domain-specific language that they designed. This differs from our work as our work supports computations that are written in a high-level language.
The components of our framework are as follows: a client (Alice) who wishes to outsource a computationally intensive job, a worker (Bob) who does the computation for the client in exchange for some monetary reward, a miner (Charlie) to validate the transactions, and Broker contract, a smart contract which acts as an intermediary between the client and the worker.
Client’s Operations: Alice writes the details of the smart contract to be executed to her publicly accessible server Step 1 in Figure 1. The details contain the inputs needed for execution, the fee given to a worker, the collateral the worker needs to deposit to register for this job, and the maximum time she is willing to allot for the computation result to be delivered to her. She posts this job creation request to the blockchain by interacting with the Broker Contract in Step 2. This request contains the URL of her server, which has all the aforementioned details.
Worker’s Operations: If Bob is interested in executing the computation, he goes to the specified server URL to check whether he has enough resources to complete the computation within the requested time interval in Step 3 and registers for the job by depositing the required collateral to Broker Contract in Step 4. He retrieves the inputs needed for the computation from Alice’s server in Step 5. He performs the computation locally in Step 6, generates proof of correctness, and uploads them to his server in Step 7. He then submits the URL to Broker Contract for the verification by calling getPaid() function in Step 8 to get compensated for his work which internally starts the proof-verification mechanism.
Miner’s Operations: Charlie picks up the transaction posted by Bob, executes the Broker Contract, and retrieves the result and proof from Bob’s server in Step 9. The Broker Contract checks whether the proof was posted within a specified time limit, verifies the proof and result, and posts them to Alice’s server. Broker Contract outputs a transaction paying Bob his fee and refunding his collateral if the verifications are successful in Step 10. However, Alice gets refunded her fee and also gets Bob’s collateral if the verifications fail.
|Computation||Input||KeyGen (s)||ProofGen (s)||Verify (ms)|
The mean and standard deviation for computationally intensive applications
Iv Results And Evaluation
The proposed framework’s performance has been evaluated on four computationally intensive applications as in .
Matrix Multiplication takes two matrices as an input, and , and computes . Image Matching takes a () sized image kernel and computes the point in an image where the minimum difference happens between the image and the kernel. Multi-Variate polynomial evaluation takes a polynomial of degree , containing coefficients, and evaluates it over () variables taken as inputs. Floyd-Warshall algorithm takes an matrix representing the adjacency matrix of an -vertex graph. It computes the shortest paths among all the vertices.
According to our calculations, the gas required to implement these applications in smart contracts is infeasible given the current block gas limit of 12 million , e.g., 142 million gas units for image matching.
Evaluation: The above applications were written in C and first transformed into an arithmetic circuit. Next, the Pinocchio compiler is used to generate Quadratic Arithmetic Program (QAP), evaluation and verification keys . In our experiments, the key generation phase is completed by the client and given to the worker along with the QAP. On receiving these parameters, the worker executes the code and posts the proof to the server he controls.
Our experimental results, detailed in Table I, show that our framework provides quick proof verification, for different sizes of input parameters for all applications. The framework also maintains a constant proof size of 288 bytes in all cases. As expected, we have noticed an increase in the proof generation time with an increase in the application parameters’ size. This growth was linear for all except image matching, which was super linear due to an increase in the number of multiplication gates and equality comparisons in the equivalent arithmetic table.
We proposed a novel framework for execution and the verification of the CICs by offloading them to a computationally powerful entity using an incentive mechanism. Unlike other proposed solutions, our work prevents replicated computation, eliminates the need for TEEs, and supports computations with random results.
-  (1998) Probabilistic checking of proofs: a new characterization of np. Journal of the ACM (JACM) 45 (1), pp. 70–122. Cited by: §II.
-  (2012) From extractable collision resistance to succinct non-interactive arguments of knowledge, and back again. In Proceedings of the 3rd Innovations in Theoretical Computer Science Conference, ITCS ’12, New York, NY, USA, pp. 326–349. External Links: Cited by: §II.
-  (2018) Ekiden: a platform for confidentiality-preserving, trustworthy, and performant smart contract execution. arXiv preprint arXiv:1804.05141. Cited by: §II.
-  (2010) Improved delegation of computation using fully homomorphic encryption. In Advances in Cryptology - CRYPTO, pp. 483–501. Cited by: §II.
-  (2012) Practical verified computation with streaming interactive proofs. In Innovations in Theoretical Computer Science ITCS, pp. 90–112. Cited by: §II.
-  (2019) FastKitten: practical smart contracts on bitcoin. In 28th USENIX Security Symposium (USENIX Security 19), pp. 801–818. Cited by: §II.
-  (2018) YODA: enabling computationally intensive contracts on blockchains with byzantine and selfish nodes. arXiv preprint arXiv:1811.03265. Cited by: §II.
-  (2005) Searching for high-value rare events with uncheatable grid computing. In Applied Cryptography and Network Security, Third International Conference, ACNS, pp. 122–137. Cited by: §II.
-  (2018) ZoKrates - scalable privacy-preserving off-chain computations. 2018 IEEE International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), pp. 1084–1091. Cited by: §II.
-  (2020 (accessed December 16, 2020)) Ethereum stats. External Links: Cited by: §IV.
-  (1996) Interactive proofs and the hardness of approximating cliques. Journal of the ACM (JACM) 43 (2), pp. 268–292. Cited by: §II.
-  (2010) Non-interactive verifiable computing: outsourcing computation to untrusted workers. In Advances in Cryptology - CRYPTO, T. Rabin (Ed.), pp. 465–482. Cited by: §II.
Delegating computation: interactive proofs for muggles.
Proceedings of the 40th Annual ACM Symposium on Theory of Computing STOC, pp. 113–122. Cited by: §II.
-  (2001) Uncheatable distributed computations. In Topics in Cryptology - CT-RSA 2001, The Cryptographer’s Track at RSA Conference 2001, San Francisco, CA, USA, April 8-12, 2001, Proceedings, pp. 425–440. Cited by: §II.
-  (2001) Secure distributed computing in a commercial environment. In Financial Cryptography, 5th International Conference, FC 2001, Grand Cayman, British West Indies, February 19-22, 2002, Proceedings, pp. 279–294. Cited by: §II.
-  (2017) Cache attacks on Intel SGX. In Proceedings of the 10th European Workshop on Systems Security, pp. 1–6. Cited by: §II.
-  (2017) High-resolution side channels for untrusted operating systems. In 2017 USENIX Annual Technical Conference (USENIX ATC) 17, pp. 299–312. Cited by: §II.
-  (2017) Inferring fine-grained control flow inside SGX enclaves with branch shadowing. In 26th USENIX Security Symposium (USENIX Security 17), pp. 557–574. Cited by: §II.
-  (2017) Cachezoom: How SGX amplifies the power of cache attacks. In International Conference on Cryptographic Hardware and Embedded Systems, pp. 69–90. Cited by: §II.
-  (2020) A Survey of Published Attacks on Intel SGX. Technical report Cited by: §II.
-  (2013) Pinocchio: nearly practical verifiable computation. In 2013 IEEE Symposium on Security and Privacy, pp. 238–252. Cited by: §II, §IV, §IV.
-  (2012) Making argument systems for outsourced computation practical (sometimes). In 19th Annual Network and Distributed System Security Symposium, NDSS, Cited by: §II.
-  (2012) Taking proof-based verified computation a few steps closer to practicality. In Proceedings of the 21th USENIX Security Symposium, pp. 253–268. Cited by: §II.
-  (2005) Query execution assurance for outsourced databases. In Proceedings of the 31st International Conference on Very Large Data Bases VLDB, pp. 601–612. Cited by: §II.
-  (2017) Telling your secrets without page faults: stealthy page table-based attacks on enclaved execution. In 26th USENIX Security Symposium (USENIX Security 17), pp. 1041–1056. Cited by: §II.
-  (2013) A hybrid architecture for interactive verifiable computation. In IEEE Symposium on Security and Privacy, SP, pp. 223–237. Cited by: §II.
-  (2020) ACE: asynchronous and concurrent execution of complex smart contracts. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, CCS ’20, New York, NY, USA, pp. 587–600. External Links: Cited by: §II.
-  (2015) Controlled-channel attacks: deterministic side channels for untrusted operating systems. In 2015 IEEE Symposium on Security and Privacy, pp. 640–656. Cited by: §II.