Thanks to the introduction of EIP 198, RSA signature verification is now feasible in Ethereum.
How much gas is required for such a verification?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityThanks to the introduction of EIP 198, RSA signature verification is now feasible in Ethereum.
How much gas is required for such a verification?
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 to5580
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.