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

Optimize publicKey method by precomputing G powers #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k06a
Copy link

@k06a k06a commented Mar 4, 2018

Contract deployed to ROPSTEN network was initialized with 6 calls of prepare(50), took up to 4M gas each: https://ropsten.etherscan.io/address/0xe2ceefb2b9010864f9b103d78dc5eac3d32c64b0

Random case: 0xdb5ea2d092201b3e85426f80d6fd6c2cf25120c4c2f7afa5cdb56638cdb56638

- 779K gas
+ 483K gas

Average case: 0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

- 782K gas
+ 487K gas

Worst case: 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

- 998K gas
+ 891K gas

@k06a
Copy link
Author

k06a commented Aug 7, 2018

Vitalik Buterin found a way to abuse ecrecover to perform ecmul to get 25x gas profit on this operation: https://ethresear.ch/t/you-can-kinda-abuse-ecrecover-to-do-ecmul-in-secp256k1-today/2384

Implemented this trick in the fork: https://github.com/1Address/ecsol

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

Successfully merging this pull request may close these issues.

1 participant