5

Thanks to the introduction of EIP 198, RSA signature verification is now feasible in Ethereum.

How much gas is required for such a verification?

Stefano Angieri
  • 153
  • 1
  • 7

1 Answers1

3

You can read about it here: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md

A 4096-bit RSA exponentiation would cost mult_complexity(512) * 4095 / 100 = 22853376 gas in the worst case, though RSA verification in practice usually uses an exponent of 3 or 65537, which would reduce the gas consumption to 5580 or89292, respectively.


According with the first example of the EIP, the function modExp() implemented here and the inputs:

0x03
0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e
0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f

the execution cost was 14248 gas.

alberto
  • 3,343
  • 2
  • 12
  • 21