An Update on Integrating Zcash on Ethereum

4month ago (01-21) admin Zcash Column 1734℃


Members of the Ethereum R&D team and the Zcash Company are collaborating on a research project addressing the combination of programmability and privacy in blockchains. This joint post is being concurrently posted on the Ethereum blog, and is coauthored by Ariel Gabizon (Zcash) and Christian Reitwiessner (Ethereum).

Ethereum’s flexible smart contract interface enables a large variety of applications, many of which have probably not yet been conceived. The possibilities grow considerably when adding the capacity for privacy.

Imagine, for example, an election or auction conducted on the blockchain via a smart contract, such that the result can be verified by any observer of the blockchain, but the individual votes or bids are not revealed. Another setting is that of selective disclosure; for example, providing users the ability to prove they are in a certain city without disclosing their exact location.

The key to adding such capabilities to Ethereum is zero-knowledge succinct non-interactive arguments of knowledge (zk-SNARKs) - precisely the cryptographic engine underlying Zcash.

One of the goals of the Zcash company, codenamed Project Alchemy, is to enable a direct decentralized exchange between Ethereum and Zcash. Connecting these two blockchains and teams, one focusing on programmability, and the other on privacy, seems the natural way to bring to life applications requiring both.

As part of the Zcash/Ethereum-collaborative effort, Ariel Gabizon from Zcash visited Christian Reitwiessner from the Ethereum hub at Berlin a few weeks ago. The highlight of the visit is a proof of concept implementation of a zk-SNARK verifier written in Solidity, based on pre-compiled Ethereum contracts implemented for the Ethereum C++ client. This complements Baby ZoE where a zk-SNARK precompiled contract was written for Parity - the Ethereum Rust client. The difference is that we only added tiny cryptographic primitives (elliptic curve multiplication, addition and pairing) and did the rest in Solidity. This allows for a much greater flexibility and enables using a variety of zk-SNARK constructions without requiring a hard fork (see more details later on). We tested this code by successfully verifying a real privacy-preserving Zcash transaction, on a testnet of the Ethereum blockchain. The verification took only 42 milliseconds, which shows that such precompiled contracts can be added and the gas costs for using them can be made to be quite affordable.

WHAT CAN BE DONE WITH SUCH A SYSTEM

The Zcash system can be reused on Ethereum to create shielded custom tokens. Such tokens already allow many applications like voting (more on that later) or a simple auction where buyers do not learn the others’ bids.

If you want to try compiling the proof of concept, you can use the following commands. If you need help, hop on to https://gitter.im/ethereum/privacy-tech

~~~~~~~~~~~~~~~~~~~ Code Start ~~~~~~~~~~~~~~~~~~~~

 

git clone https://github.com/scipr-lab/libsnark.git

cd libsnark
sudo PREFIX=/usr/local make NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 CURVE=ALT_BN128 \
FEATUREFLAGS="-DBINARY_OUTPUT=1 -DMONTGOMERY_OUTPUT=1 -DNO_PT_COMPRESSION=1" \
lib install
cd ..
git clone --recursive -b snark https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum
./scripts/install_deps.sh && cmake . -DEVMJIT=0 -DETHASHCL=0 && make eth
cd ..
git clone --recursive -b snarks https://github.com/ethereum/solidity.git
cd solidity
./scripts/install_deps.sh && cmake . && make soltest
cd ..
./cpp-ethereum/eth/eth --test -d /tmp/test
# And on a second terminal:
./solidity/test/soltest -t "*/snark" -- --ipcpath /tmp/test/geth.ipc --show-messages

 

~~~~~~~~~~~~~~~~~~~ Code End ~~~~~~~~~~~~~~~~~~~~
We also discussed various aspects of integrating zk-SNARKs into the Ethereum blockchain, on which we now expand.

DECIDING WHAT PRECOMPILED CONTRACTS TO DEFINE

Recall that a SNARK is a short proof of some property, and what is needed for adding the privacy features to the Ethereum blockchain is that clients have the ability to verify such a proof.

In all recent constructions, the verification procedure consists solely of operations on elliptic curves. Specifically, the verifier requires scalar multiplication and addition on an elliptic curve group; but also, a heavier operation called a bilinear pairing.

As mentioned here, implementing these operations directly in EVM is too costly. Thus, we want to implement pre-compiled contracts that perform these operations. Now, the question we debated was - what level of generality these pre-compiled contracts should aim for.

The security level of the SNARK corresponds to the parameters of the curve. Roughly, the larger the curve order is, and the larger something called the embedding degree is, the more secure the SNARK based on this curve. On the other hand, naturally, the larger these quantities are, the more costly the operations on the corresponding curve. Thus, a contract designer using SNARKs may wish to choose these parameters according to their own desired efficiency/security tradeoff. This is one argument for implementing a pre-compiled contract with a high level of generality, where the contract designer can choose from a large family of curves. We indeed began by shooting for a high level of generality - where the description of the curve is given as part of the input to the contract. In such a case, a smart contract would be able, for example, to perform addition in any elliptic curve group.

A complication with this approach is assigning gas cost to the operation - you must assess, merely from the description of the curve, and with no access to a specific implementation, how expensive a group operation on that curve would be (in the worst case). A somewhat less general approach is to allow all curves from a given family. We noticed that when working with the Barreto-Naehrig (BN) family of curves, one can assess roughly how expensive the pairing operation will be given the curve parameters, as all such curves support a specific kind of optimal Ate pairing. Here's a sketch of how such a precompile would work and how the gas cost would be computed.

We learned a lot from this debate, but ultimately, decided to "keep it simple" for this proof of concept; and to implement contracts for operations on the specific curve currently used by Zcash. We did this by using wrappers of the corresponding functions in the libsnark library, also used by Zcash. We note that we could have simply used a wrapper for the entire SNARK verification function currently used by Zcash - as was done in the above mentioned Baby ZoE project. However, the advantage of explicitly defining elliptic curve operations is enabling using a wide variety of SNARK constructions, which, again, all have a verifier working by some combination of the three mentioned elliptic curve operations.

REUSING THE ZCASH SETUP FOR NEW ANONYMOUS TOKENS AND OTHER APPLICATIONS

As you might have heard, using SNARKs requires a complex setup phase in which the so-called public parameters of the system are constructed. The fact that these public parameters need to be generated in a secure way every time we want to use a SNARK for a particular circuit significantly hinders the usability of SNARKs. (Simplifying this setup phase is an important goal that we gave some thought too but didn’t have any success in so far).

On the other hand, the good news is that someone desiring to issue a token supporting privacy-preserving transactions can simply reuse the public parameters that have already been securely generated by Zcash. The reason for this is that the Zcash circuit which is used to verify privacy-preserving transactions is not inherently tied to one currency or blockchain. Rather, one of its explicit inputs is the root of a Merkle tree that contains all the valid notes of the currency; and so, this input can be changed according to the currency one wishes to work with. Moreover, if it is rather easy to start a new anonymous token, you can already accomplish many tasks that do not look like tokens on a first glance. For example, suppose we wish to conduct an anonymous election to choose a preferred option amongst two. We can issue an anonymous custom token for the vote, and send one coin to each voting party. Since there is no “mining”, it will not be possible to generate tokens in any other way. Now each such party sends their coin to one of two addresses according to their vote. The address with a larger final balance corresponds to the election result.

OTHER APPLICATIONS

A non-token-based system that is rather simple to build allows for “selective disclosure”: You can, for example, constantly post an encrypted message containing your physical location to the blockchain (perhaps with other people’s signatures to prevent spoofing). If you use a different key for each message, you can reveal your location only at a certain time by revealing the key. With zk-SNARKs, though, you can prove that you were in a certain area without revealing where exactly you have been: Inside the zk-SNARK, you decrypt your location and show that it is inside the area. Because of the zero-knowledge property, everyone can verify that fact but nobody can retrieve your actual location.

THE WORK AHEAD

Truly achieving the mentioned functionalities - creating anonymous tokens and verifying Zcash transactions on the Ethereum blockchain, will require implementing other elements used by Zcash in Solidity. For the first, we must have an implementation of tasks performed by nodes on the Zcash network such as updating the note commitment tree. For the second, we need an implementation of the equihash proof of work algorithm used by Zcash in Solidity. Otherwise, transactions can be verified as valid in themselves, but we do not know whether the used notes existed on the Zcash blockchain or whether the transaction was actually sent to the Zcash blockchain. Fortunately, such an implementation was written; however, its efficiency needs to be improved in order to be used in practical applications.

 

Author:Ariel Gabizon and Christian Reitwiessner

Source: z.cash/blog/zcash-eth.html

Manager

Follow Us Here Thanks !

Recommended Articles :

56 comment

  1. avatar
    -49#

    Thank you for any other wonderful article. Where else may anybody get that type of information in such an ideal means of writing? I have a presentation subsequent week, and I’m at the search for such information.

    corburt erilio at2017-03-31 23:42 Comment
  2. avatar
    -48#

    Hurrah, that’s what I was searching for, what a
    stuff! present here at this web site, thanks admin of this website.

    manicure at2017-04-07 20:23 Comment
  3. avatar
    -47#

    I just want to mention I am new to blogging and site-building and seriously loved this page. More than likely I’m going to bookmark your website . You amazingly have awesome articles and reviews. Kudos for sharing with us your blog site.

    hop over to these guys at2017-04-17 00:27 Comment
  4. avatar
    -46#

    Please let me know if you’re looking for a article author for your blog. You have some really great articles and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some content for your blog in exchange for a link back to mine. Please shoot me an email if interested. Cheers!

    what are essential oils at2017-04-22 12:39 Comment
  5. avatar
    -45#

    Hi folks here, just turned out to be alert to your web page through Search engines like google, and realized that it’s truly interesting. I will take pleasure in if you maintain this.

    check at2017-04-22 21:21 Comment
  6. avatar
    -44#

    The URL is needed to figure out the security zone, which is needed to ascertain the condition of the ActiveScripting setting. Completely ad-free, this website is quite easy to navigate and enables you to locate what you need fast. It’s a website that will permit you to really observe plenty of svg files created by very talented people at an affordable price. Everyone can join and add to the undertaking. This facility is known as SVG fonts.

    Lasonya Wilker at2017-04-23 04:23 Comment
  7. avatar
    -43#

    I just need to tell you that I am new to having a blog and absolutely loved your write-up. Very possible I am going to remember your blog post . You indeed have outstanding article materials. Acknowledge it for share-out with us your own site post

    review at2017-04-23 08:02 Comment
  8. avatar
    -42#

    Remarkably compelling details you’ll have stated, thanks a lot for setting up.

    visit the website at2017-04-23 12:32 Comment
  9. avatar
    -41#

    It is usually ideal day to construct some preparations for the extended term. I have go through this blog post and if I could, I desire to suggest to you you number of enlightening ideas.

    original site at2017-04-23 16:31 Comment
  10. avatar
    -40#

    I just hope to share it with you that I am new to blogging and very much liked your article. More than likely I am inclined to remember your blog post . You absolutely have impressive article material. Like it for share-out with us your blog report

    more info here at2017-04-24 01:49 Comment
  11. avatar
    -39#

    Greetings there, just turned out to be alert to your blog through Google, and realized that it is truly educational. I will like should you persist this approach.

    read here at2017-04-24 06:47 Comment
  12. avatar
    -38#

    I failed to observe any sort of odor at all also when first opening that.

    bed frame reviews at2017-04-24 11:40 Comment
  13. avatar
    -37#

    I like what you guys are up too. Such clever work and reporting! Carry on the excellent works guys I have incorporated you guys to my blogroll. I think it will improve the value of my site :)

    hotel at2017-04-24 21:42 Comment
  14. avatar
    -36#

    Excellent read, I just passed this onto a friend who was doing a little research on that. And he just bought me lunch as I found it for him smile Thus let me rephrase that: Thank you for lunch!

    holistic medicine at2017-04-24 21:45 Comment
  15. avatar
    -35#

    I wish to express my passion for your kindness in support of folks who actually need help on this particular question. Your very own commitment to getting the message around turned out to be pretty significant and have continually permitted those just like me to achieve their endeavors. Your personal warm and helpful guide implies a whole lot a person like me and further more to my mates. Warm regards; from all of us.

    home at2017-04-24 21:46 Comment
  16. avatar
    -34#

    Keep functioning ,impressive job!

    business management at2017-04-24 21:55 Comment
  17. avatar
    -33#

    Incredibly enlightening highlights that you have remarked, thanks so much for adding.

    recommended you read at2017-04-25 08:39 Comment
  18. avatar
    -32#

    What i don’t understood is actually how you’re no longer really a lot more smartly-preferred than you might be now. You are very intelligent. You understand thus considerably in terms of this topic, produced me personally believe it from so many varied angles. Its like women and men are not involved unless it is something to do with Lady gaga! Your personal stuffs nice. All the time handle it up!

    Business Product and Supplies at2017-04-26 01:41 Comment
  19. avatar
    -31#

    Good site! I truly love how it is easy on my eyes and the data are well written. I am wondering how I could be notified when a new post has been made. I have subscribed to your feed which must do the trick! Have a great day!

    Travel International at2017-04-26 04:41 Comment
  20. avatar
    -30#

    Wonderful matterss, so thankful I bough that. Quite worth the funds as well as thus pleasant, would suggest to others.

    euro top mattress at2017-04-26 09:02 Comment
  21. avatar
    -29#

    Quite enlightening data you’ll have mentioned, thank you for publishing.

    i was reading this at2017-04-26 11:34 Comment
  22. avatar
    -28#

    I merely hope to reveal to you that I am new to writing and undeniably enjoyed your article. Probably I am prone to store your blog post . You undoubtedly have extraordinary article blog posts. Be Thankful For it for share-out with us your very own domain write-up

    view it now at2017-04-26 14:37 Comment
  23. avatar
    -27#

    Ashton Kutcher and Demi Moore have already spoken out against the idea, saying that they’d rather not encourage anymore people to stalk celebrities. So, the first thing to do is to decide the purpose of your ad.

    Tractor Workshop Manuals at2017-04-26 15:17 Comment
  24. avatar
    -26#

    Hello here, just became aware about your blogging site through Search engines like google, and have found that it’s truly informative. I’ll truly appreciate should you decide persist such.

    company website at2017-04-26 17:59 Comment
  25. avatar
    -25#

    A lot of thanks for your entire effort on this web site. My daughter take interest in getting into investigation and it’s really easy to see why. Most people learn all relating to the powerful method you produce very useful secrets by means of the blog and in addition foster contribution from visitors on the subject matter so my daughter is certainly studying so much. Take advantage of the remaining portion of the year. You’re conducting a brilliant job.

    Computer Parts at2017-04-26 23:41 Comment
  26. avatar
    -24#

    great publish, very informative. I’m wondering why the opposite experts of this sector don’t understand this. You must proceed your writing. I am sure, you have a great readers’ base already!

    Car Industry at2017-04-26 23:50 Comment
  27. avatar
    -23#

    I simply hope to inform you you that I am new to blog posting and utterly adored your article. Probably I am inclined to save your blog post . You undoubtedly have impressive article materials. Delight In it for expressing with us your current internet information

    read more at2017-04-27 03:43 Comment
  28. avatar
    -22#

    Pretty helpful knowledge that you have stated, a big heads up for posting.

    look these up at2017-04-27 07:13 Comment
  29. avatar
    -21#

    I’ve been absent for a while, but now I remember why I used to love this site. Thank you, I will try and check back more often. How frequently you update your site?

    public health at2017-04-28 00:21 Comment
  30. avatar
    -20#

    fantastic issues altogether, you just won a logo new reader. What could you recommend in regards to your submit that you made a few days in the past? Any certain?

    kitchen ideas at2017-04-28 00:22 Comment
  31. avatar
    -19#

    I have been checking out many of your articles and i can state nice stuff. I will surely bookmark your site.

    kitchen remodel ideas at2017-04-28 00:24 Comment
  32. avatar
    -18#

    hello!,I love your writing very a lot! share we communicate more approximately your post on AOL? I need an expert in this space to resolve my problem. May be that’s you! Looking forward to see you.

    bathroom remodel ideas at2017-04-28 00:30 Comment
  33. avatar
    -17#

    Thank you for sharing excellent informations. Your website is so cool. I’m impressed by the details that you¡¦ve on this blog. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for extra articles. You, my friend, ROCK! I found just the info I already searched all over the place and just couldn’t come across. What an ideal website.

    cheap air at2017-04-28 00:32 Comment
  34. avatar
    -16#

    The Best place for HTV, Glitter HTV and Cricut Blades!

    Odessa Tobiasson at2017-04-28 08:33 Comment
  35. avatar
    -15#

    I have not checked in here for some time since I thought it was getting boring, but the last several posts are great quality so I guess I will add you back to my everyday bloglist. You deserve it my friend :)

    Travel Guides at2017-04-28 11:07 Comment
  36. avatar
    -14#

    Thank you for another great post. Where else could anyone get that type of information in such a perfect manner of writing? I have a presentation subsequent week, and I am on the search for such information.

    Travel Guides at2017-04-28 12:46 Comment
  37. avatar
    -13#

    Cozy, as well as inexpensive for someone which requires a matress between agency and soft many thanks !! I will certainly obtain coming from brentwood once more!

    good mattress prices at2017-04-28 15:59 Comment
  38. avatar
    -12#

    I simply wanted to appreciate you again. I’m not certain the things I could possibly have handled without the entire information shared by you over such question. Entirely was the frightful problem in my view, however , discovering a new specialised technique you dealt with it forced me to leap with joy. I will be grateful for your guidance and as well , pray you realize what a powerful job you happen to be carrying out training men and women with the aid of your blog post. I know that you have never encountered any of us.

    Business at2017-04-28 18:24 Comment
  39. avatar
    -11#

    Excellent post. I was checking continuously this blog and I am impressed! Extremely useful information specifically the last part :) I care for such information a lot. I was seeking this particular info for a very long time. Thank you and best of luck.

    Cheap Auto Insurance at2017-04-28 19:07 Comment
  40. avatar
    -10#

    I have been exploring for a little for any high quality articles or blog posts in this kind of house . Exploring in Yahoo I eventually stumbled upon this site. Studying this info So i am glad to show that I’ve an incredibly good uncanny feeling I discovered exactly what I needed. I such a lot surely will make sure to don¡¦t omit this web site and provides it a glance regularly.

    Auto Financing at2017-04-28 19:42 Comment
  41. avatar
    -9#

    I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thanks again!

    Business at2017-04-28 21:37 Comment
  42. avatar
    -8#

    It is most suitable time to produce some desires for the extended term. I have read this article and if I can possibly, I desire to suggest you couple of helpful ideas.

    seo portland at2017-04-28 22:47 Comment
  43. avatar
    -7#

    Nice blog right here! Also your web site a lot up very fast! What host are you the usage of? Can I am getting your associate hyperlink on your host? I desire my web site loaded up as quickly as yours lol

    Discount Auto at2017-04-28 23:07 Comment
  44. avatar
    -6#

    Wonderful goods from you, man. I’ve understand your stuff previous to and you’re just too excellent. I actually like what you’ve acquired here, really like what you’re stating and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I can’t wait to read far more from you. This is really a tremendous site.

    Travel World at2017-04-29 00:19 Comment
  45. avatar
    -5#

    Good web site! I truly love how it is easy on my eyes and the data are well written. I am wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a great day!

    Recreational Vehicle at2017-04-29 01:29 Comment
  46. avatar
    -4#

    I am constantly looking online for posts that can help me. Thx!

    Custom Car at2017-04-29 02:31 Comment
  47. avatar
    -3#

    He made a 2 part mattress off timber and these beds operated completely.

    hop over to here at2017-04-30 16:02 Comment
  48. avatar
    -2#

    As I web-site possessor I believe the content matter here is rattling wonderful , appreciate it for your hard work. You should keep it up forever! Good Luck.

    Marital Education at2017-04-30 18:46 Comment
  49. avatar
    -1#

    I like the helpful info you provide in your articles. I will bookmark your blog and check again here frequently. I am quite certain I will learn a lot of new stuff right here! Good luck for the next!

    Entertainment Today at2017-04-30 18:51 Comment
  50. avatar
    0#

    I have been browsing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all website owners and bloggers made good content as you did, the internet will be a lot more useful than ever before.

    Exploration Careers Information at2017-05-01 03:30 Comment
  51. avatar
    -49#

    Beneficial Extent Or Floors Size Prom Dresses

    simplylinen.co.uk at2017-05-01 04:31 Comment
  52. avatar
    -48#

    Great write-up, I¡¦m normal visitor of one¡¦s web site, maintain up the excellent operate, and It’s going to be a regular visitor for a long time.

    Business Information Data Financial at2017-05-01 04:37 Comment
  53. avatar
    -47#

    Very nice post. I just stumbled upon your weblog and wished to say that I have really enjoyed browsing your blog posts. After all I will be subscribing to your rss feed and I hope you write again soon!

    Top Professional Careers at2017-05-01 09:40 Comment