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

is there poseidon solidity contract? #164

Open
yanyanho opened this issue Aug 25, 2020 · 2 comments
Open

is there poseidon solidity contract? #164

yanyanho opened this issue Aug 25, 2020 · 2 comments

Comments

@yanyanho
Copy link

No description provided.

@yanyanho
Copy link
Author

I find that :
inputs = [3, 0]
python_result = poseidon(inputs)
print(python_result)

the result is 254bit? is it a bug?

@HarryR
Copy link
Owner

HarryR commented Aug 30, 2020

Hi.

the code to generate Poseidon EVM contract is at: https://github.com/HarryR/ethsnarks/blob/master/ethsnarks/poseidon/contract.py - it emits raw EVM bytecode rather than Solidity, but could be modified to emit Solidity with mostly inline assembly like the MiMC contract generator does.

The Poseidon hash inputs and outputs are in the zkSNARK scalar field, so not 256bit integers, or the altbn curve field, but the order of the curve (L, which is a ~254 bit prime).

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

2 participants