gitcoinco / skunkworks

experimental laboratory
63 stars 35 forks source link

ZKRollup ERC-20 Token #91

Open owocki opened 5 years ago

owocki commented 5 years ago

What

I would like to see a ZK Rollup based ERC20 replacement.

Rationale

ERC20 is the most successful standard in the Ethereum ecosystem.

After watching Vitalik's talk about Scalable Blockchains as Data Layers / ZK Rollups, I am increasingly convinced that in an ETH2.0 world, the "Ethereum Mainnet" will become a minimalistic data layer.

By combining the two, we get to

Acceptance Criteria

barryWhiteHat commented 5 years ago

Here is a spec for something closer to a multi token exchange. You can probably rip out the atomic swaps and multitokens and then you will have a nice place to start building this https://github.com/barryWhiteHat/roll_up_token

owocki commented 5 years ago

@barryWhiteHat very cool! is this something you're going to build / do you think that the rollup multi-token subsumes the need for what i specify?

barryWhiteHat commented 5 years ago

Yes, we are working on an implementation of this and a few similar things.

It is possible that a erc20 based upon rollup would also be useful. But at the moment i think multitoken exchange should be a prioritized.

owocki commented 5 years ago

It is possible that a erc20 based upon rollup would also be useful. But at the moment i think multitoken exchange should be a prioritized.

hey @barryWhiteHat i might bounty this for https://gitcoin.co/hackathon/ethhack2019 soon. do you have a spec for the multi token exchange? id love to work together on this.

barryWhiteHat commented 5 years ago

sure that sounds good. https://github.com/barryWhiteHat/roll_up_token

I am happy to be part of this.

zillerium commented 5 years ago

I started a repo - deployed two simplecoins - contracts - https://rinkeby.etherscan.io/address/0x8685469d41604448073f64e70c1eda19c328eff9 and https://rinkeby.etherscan.io/address/0x7a56864d2d489fa0ea807884c0df893314c1deb2 github - https://github.com/zillerium/openzeppelin-solidity/

Next step - add a UI with ERC20 functions.

barryWhiteHat commented 5 years ago

Cool. What language are you thinking of writing the snark circuit in?

zillerium commented 5 years ago

Cool. What language are you thinking of writing the snark circuit in?

I did not decide that. I am doing this alone, so progress is a little slow as I also have a lot of other work to do. I am doing the layer 1 now. About the snark circuit, I am generally experienced in most languages, so I will check into what looks the easiest. I am guessing C++ is the most common one to use for this type of use case.

barryWhiteHat commented 5 years ago

So here are your options from high to low level

ZoKrates (like python) Circom (like vhdl) bellman (rust) ethsnarks (cpp)

zillerium commented 5 years ago

Just completed the ERC20 layer 1 at https://quelm.co/. Github updated. Moving onto layer2. A few people showed an interest now. So far we have mainly discussed the challenge with bertux helping out.

vyomshm commented 5 years ago

@barryWhiteHat Which option would be best in terms of gas costs of verification?

zillerium commented 5 years ago

So here are your options from high to low level

ZoKrates (like python) Circom (like vhdl) bellman (rust) ethsnarks (cpp)

I just tested with ZoKrates and Circom and chose circom to implement zkrollup. I researched Bellman and ethsnarks but could not find out too many details. Circom has a good tutorial and I found the material easy to follow. I also produced my first verifer now and pushed into github.

barryWhiteHat commented 5 years ago

@barryWhiteHat Which option would be best in terms of gas costs of verification?

All cost the same.

I just tested with ZoKrates and Circom and chose circom to implement zkrollup. I researched Bellman and ethsnarks but could not find out too many details. Circom has a good tutorial and I found the material easy to follow. I also produced my first verifer now and pushed into github.

barryWhiteHat commented 5 years ago

I was going to encorage you to use ZoKrates. Because there is already an implementation in circom in progress. I know they are working on a tutorial at the moment but am unsure when it will be ready. @stefandeml do you have an idea of when this will be ready?

zillerium commented 5 years ago

@barryWhiteHat - I had this issue - any ideas please - https://github.com/barryWhiteHat/roll_up/issues/43

barryWhiteHat commented 5 years ago

Well firstly this is POC. If you want a cpp version of rollup you could try https://github.com/Ethsnarks/ethsnarks-snasma

If you are free tomorrow we could have a call to sync. What time zone are you?

zillerium commented 5 years ago

Well firstly this is POC. If you want a cpp version of rollup you could try https://github.com/Ethsnarks/ethsnarks-snasma

If you are free tomorrow we could have a call to sync. What time zone are you?

UK. I have it running now. Trying to test. I had a lot of installation errors.

barryWhiteHat commented 5 years ago

Whats the best way to message you ? Telegram , gitter , email?

zillerium commented 5 years ago

Whats the best way to message you ? Telegram , gitter , email?

My telegram is trevoro. I mostly use whatsapp - I can send my number via telegram to you. On a tech point, I am getting a lot of modulenotfound, is this related to the CMake file? I had at first errors there, and I made some changes but the imports are not working in rollup. Below is an example. I already made numerous corrections to other modulesnotfound. trevor@prkap:~/rollup/roll_up/build/src/CMakeFiles/roll_up_wrapper.dir$ python3 ~/rollup/roll_up/tests/test.py Traceback (most recent call last): File "/home/trevor/rollup/roll_up/tests/test.py", line 26, in from contract_deploy import contract_deploy, verify ModuleNotFoundError: No module named 'contract_deploy'

owocki commented 5 years ago

@zillerium very excited to see the progress / action here :)

barryWhiteHat commented 5 years ago

@zillerium I msged you on telegram. DOn't know if i got the right address.

zillerium commented 5 years ago

@barryWhiteHat - I lifted your email address from github, and I assume it is at the protonmail.com address? I emailed that address anyway. I also just replied to your Telegram message. Are you in the USA?

zillerium commented 5 years ago

Just a general update. I had some help from Bertrand and we have Zokrates running but the verifier does not run on the blockchain due to gas limits. We also confirmed that Zokrates needs a trusted setup which is a problem to solve generally in a decentralised solution.

owocki commented 5 years ago

@zillerium thanks for letting me know. could you prepare a submission sometime soon? the hackathon closes on 4/30 (which is today)

zillerium commented 5 years ago

@zillerium thanks for letting me know. could you prepare a submission sometime soon? the hackathon closes on 4/30 (which is today)

I add a doc file - https://github.com/zillerium/openzeppelin-solidity/blob/master/zkrollup.md

owocki commented 5 years ago

@zillerium thanks for the MD file. checking it out now. is there instructions anywhere on how to run locally? or a docker container..

failing that, if there was a basic web UI that allowed me to play with the functions that'd really help me grok it

@barryWhiteHat any chance you'd be willing to help me with the hackathon judging here and let me know what you think of zills submission? my email is kevin@gitcoin.co

zillerium commented 5 years ago

@zillerium thanks for the MD file. checking it out now. is there instructions anywhere on how to run locally? or a docker container..

failing that, if there was a basic web UI that allowed me to play with the functions that'd really help me grok it

@barryWhiteHat any chance you'd be willing to help me with the hackathon judging here and let me know what you think of zills submission? my email is kevin@gitcoin.co

@owocki the url https://quelm.co has layer 1 implemented (eg getBalance on 0x9e9F67A80C3BDe2da709c1a9f7a2824F7B183f3D). It uses Metamask. Layer 2 was in-work when the hackathon ended. We did run Zokrates locally but the gas limit problem stopped us producing a product.

owocki commented 5 years ago

thanks; will check it out. do i use it on rinkeby (or some other network)?

any thinking on how to get around the gas limit issue? maybe we could use testRPC and set the block gas limit higher?

zillerium commented 5 years ago

thanks; will check it out. do i use it on rinkeby (or some other network)?

any thinking on how to get around the gas limit issue? maybe we could use testRPC and set the block gas limit higher?

Yes Rinkeby. About the gas limit issue, I posted an issue at the Zokrates github but no one replied. I will probably work more on the zk-snarks issues and I have a workshop at the weekend on Zokrates. So I expect these issues will work themselves. The verifier should have a fixed gas requirement so the error defies the spec.