Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circuit transfer fees #10

Open
barryWhiteHat opened this issue Mar 28, 2019 · 3 comments
Open

circuit transfer fees #10

barryWhiteHat opened this issue Mar 28, 2019 · 3 comments
Assignees
Labels
circuit zksnark circuit issues

Comments

@barryWhiteHat
Copy link
Collaborator

Allow fees to be taken based upon the transfer. The operator create teh fee tree and passes it as a public input from the smart contract

  1. Add a fee value to the signtuare

  2. Subtract sig.amount from the sender leaf

  3. Add sig.amount - sig.fee to the recipient leaf (be careful about overflows)

  4. For each transaction the operator maintins a fee tree. With 8 layer.

  5. Orginally each leaf is zero.

  6. The oeprator can either add a leaf to that tree that represents a single fee in a token.
    or

  7. add fee to the balance of a leaf in that tree as long as it has the same token type.

  8. This is passed as a public input to the snark.

  9. Confirm that the final fee tree == the public input fee tree

  10. Add smart contract functionality to allow the operator to withdraw these funds.

@barryWhiteHat barryWhiteHat added the circuit zksnark circuit issues label Mar 28, 2019
@barryWhiteHat
Copy link
Collaborator Author

Lets replace the fee tree with #8 where we can store the fee and the token.

@therealyingtong
Copy link
Collaborator

it seems to make more sense to only allow one token type. otherwise we would need a fee leaf for each token type.

@barryWhiteHat
Copy link
Collaborator Author

So what i was thinking was to include hte fee in the transfer digest and use the smart contract to pay that fee to each operator. We can also use a snark to merge these together to save gas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
circuit zksnark circuit issues
Projects
None yet
Development

No branches or pull requests

2 participants