benediamond / anonymous-zether

A private payment system for Ethereum-based blockchains, with no trusted setup.
Other
16 stars 9 forks source link

Enhancement to protocol to support fees ? #1

Closed jennilee78 closed 4 years ago

jennilee78 commented 4 years ago

Hi, I would like to appreciate your hard work for Anonymous Zether Protocol. I am studying and trying to understand anon zether for a use-case and would like your comments(help). The use-case is a marketplace where items could be traded by sending anon zether from one user to another. However, the marketplace itself needs a fee (flat per transaction). At this moment, your implementation is ignoring (or has not implemented) the fee structure and as such is unsuitable for marketplace idea and probably main-net block-chain protocols. Please note, fees is also a requirement to enable anon zether on a block-chain (or as a native token). So it is definitely a design requirement.

AFAIK, Fees needs to be open, verifiable, un-cheatable.

I am exploring different ideas but would like your comments on the best method to implement such a functionality without lowering security. Any idea or points or support code from your side would be very helpful. ( since you are the expert).

Basically, its an enhancement to the protocol to support fees. It can be enabled by default in the protocol with 0 as default fees. unless someone wants to use fees.

Thanks for your help from the bottom of my heart.

benediamond commented 4 years ago

hi @jennilee78, many thanks for your interest and for raising the issue. it's a good question.

can you checkout the branch fees, which I just pushed? in this branch, I write up a first pass for a fees-based system. in this system, the sender must specify a "beneficiary", who will receive the fee. the fee is configurable, and must be chosen on deployment. https://github.com/benediamond/anonymous-zether/blob/df81cfba9ca1ee61e4fece451e01547e4a47dbb5/packages/protocol/contracts/Utils.sol#L113-L115

please let me know if you are able to run the code, and if you have any questions.

benediamond commented 4 years ago

some detail: the sender decides how much to send, say value. the zero-knowledge proof proves that the sender's balance is >= value + fee. value + fee are deduced from the sender's balance. the recipient receives value, and the beneficiary (i.e., miner) receives fee. fee is public, and value is kept private. the sender's and recipient's identities are kept private; the miner's identity is not kept private.

jennilee78 commented 4 years ago

Thanks for the help. It is running fine. I understood the code. :) Probably the fees can be enabled by default in the protocol with 0 as default fees. unless someone wants to use fees. Once again, Thanks for your help from the bottom of my heart :+1:

benediamond commented 4 years ago

You make a good point. I will make a few more fixes and then merge the branch into master.