ethsnarks icon indicating copy to clipboard operation
ethsnarks copied to clipboard

is there poseidon solidity contract?

Open yanyanho opened this issue 4 years ago • 2 comments

yanyanho avatar Aug 25 '20 06:08 yanyanho

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

the result is 254bit? is it a bug?

yanyanho avatar Aug 30 '20 11:08 yanyanho

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).

HarryR avatar Aug 30 '20 16:08 HarryR