0

Is Gas required to sign a message using ethereum?

1

No.

Signing is just a mathematical operation, which can be done on- or offline, and which happens to the transaction before it's broadcast to the network. It's not something that happens in the EVM, so doesn't require gas.

Messages are usually signed by clients, but all they're doing is calling a function is some library to do some maths. So this is effectively something that could be done by hand, if you were that way inclined.

Once the signed transaction is broadcast, then doing the reverse - i.e. recovering the sender address from a signed transaction - does cost gas, and is where the value of 21000 comes from.

See: Where does the number 21000 come from for the base gas consumption in Ethereum?

21000 gas is charged for any transaction as a "base fee". This covers the cost of an elliptic curve operation to recover the sender address from the signature as well as the disk and bandwidth space of storing the transaction.

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.