1

I am new to the field of dAPP so this question might looks silly. I learnt that a standard transaction fee is 21000 gas. While designing my application, I am facing such a question:

How much does it take for such a smart contract:

  1. Verify some(saying 4) messages and their corresponding signatures with a given public key.
  2. Verify if a private key can be used to decrypt a particular ciphertext into a particular plaintext.
  3. Verify if two strings(about 1Kb long) are equal.
  4. If any of the verification fails, the money(say 1ETH) goes to account A, otherwise it goes to another account B.

Thanks in advance!

1

You can use this table https://ethgastable.info/ to obtain the gas cost of each opcode. For example the opcode used to verify signatures ECRECOVER cost 3000 gas.

In practice to use ECRECOVER you will need some extra operations, like copying data, etc. The get the exact costs you will have to program the contract and evaluate.

You do not want to store or verify a private key in a contract because every action is public and anyone with a full node has access to it.

  • I get it. However in my application it is ok to make the private key public. Does Ethereum somehow support AES or do I have to build an AES cipher from ground? – Ruiyu Zhu Aug 19 '18 at 17:56
  • The EVM doesn't support AES natively (or any other encryption algorithm). You can try implementing AES in solidity but complex algorithm might use too much gas. – Ismael Aug 20 '18 at 18:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.