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

Deposit coins to smart contract into snark side chain #2

Open
barryWhiteHat opened this issue Mar 27, 2019 · 2 comments
Open

Deposit coins to smart contract into snark side chain #2

barryWhiteHat opened this issue Mar 27, 2019 · 2 comments
Assignees

Comments

@barryWhiteHat
Copy link
Collaborator

Deposit coins from EVM into snark side chain.

  1. Send coins to the evm
  2. Validate token amount and type.
  3. Batch these coins into deposit merkle tree
  4. Create a function for the operator to call to add this batch into the que.
@tspoff
Copy link
Collaborator

tspoff commented Mar 27, 2019

Hey Barry, I have some questions on step 3 & 4:

  1. Do we want separate deposit Merkle trees for each token type? Do we need a Merkle tree on-chain or would a simple list of ‘pending deposits’ suffice with the Merkle trees only generated by Operator?

  2. So if I'm understanding correctly the operator does a “getPendingDeposits” operation to take the current 'pending deposits' from the EVM to the side chain.

It gets them off Ethereum and adds them to the deposits Merkle tree on the sidechain, and then clears the 'pending deposits' list on-chain.

I don't believe we need to store a permanent record of each individual deposit on-chain (we will just emit events) because we don't need to know how much each user deposited after it's added to sidechain. Now sidechain logic / the SNARKS are used to tell you how much money you have.

@barryWhiteHat
Copy link
Collaborator Author

Do we want separate deposit Merkle trees for each token type? Do we need a Merkle tree on-chain or would a simple list of ‘pending deposits’ suffice with the Merkle trees only generated by Operator?

No they should all go in the same tree.

So if I'm understanding correctly the operator does a “getPendingDeposits” operation to take the current 'pending deposits' from the EVM to the side chain.

That is correct.

I don't believe we need to store a permanent record of each individual deposit on-chain (we will just emit events) because we don't need to know how much each user deposited after it's added to sidechain. Now sidechain logic / the SNARKS are used to tell you how much money you have.

Agree

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

No branches or pull requests

3 participants