Skip to content

Optimize publicKey method by precomputing G powers - #8

Open
k06a wants to merge 1 commit into
jbaylina:masterfrom
1Address:feature/optimize-publicKey
Open

Optimize publicKey method by precomputing G powers#8
k06a wants to merge 1 commit into
jbaylina:masterfrom
1Address:feature/optimize-publicKey

Conversation

@k06a

@k06a k06a commented Mar 4, 2018

Copy link
Copy Markdown

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

k06a commented Aug 7, 2018

Copy link
Copy Markdown
Author

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