3

I want to be able to verify signatures created by smart meters. Unfortunately, their signature algorithm doesn't use curve ALT_BN_128 but BrainpoolP256r1. I wrote this verification algorithm that requires an inversion, an addition of two curve points, and two scalar multiplications of curve points. The problem is especially the gas cost of the latter.

I wrote a contract for these operations where the scalar multiplication is implemented via a simple double-and-add algorithm. Unfortunately, a scalar multiplication using this method costs between 84'000 and 19'000'000 gas. Originally, I didn't want to write my own contract for that but the only Solidity implementation I was able to find was ECops.sol by orbs-network (https://github.com/orbs-network/elliptic-curve-solidity/blob/master/ECops.sol). Scalar multiplication using this contract is much cheaper (about 623'000 gas), but then there's the minor disadvantage that the results are wrong.

Is there a better solidity implementation out there where I can just plug the right curve parameters in?

I have asked this question on ethresear.ch but have yet to receive any answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.