3

In the case of an 'invalid' transaction whereby the state transition of the execution is deemed to conflict in some way and reverts, the transaction itself is actually valid; gas is consumed, tx included in the block with the affected gas payment deduction.

The intrinsic gas of 21000 exists here as the baseline cost for a transaction (the cost for verifying the ECDSA signature over the transaction) and is the minimum amount charged in any transaction. If the transaction is not valid due to an incorrect signature (malformed or else), the miner rejects the transaction completely, it does not enter the tx pool and is not propagated through the network.

However in this case of an invalid transaction signature, the miner has to attempt to verify the transaction and regardless of failure or success, the computation is spent. Could someone not flood the network with malformed transactions, the miner none the wiser, and force wastage of computational resources on verifying fake signatures?

If that is the case is the verification step of a miner to deem a transaction valid/invalid a sunken cost?

If this is expected, why even charge the intrinsic gas other than to recoup previously wasted (network-wide) computational resources at an arbitrary rate of 21000 gas per successful tx?

Or have I misunderstood the computation that the miners perform prior to adding transactions to the tx pool?

0

For invalid signatures you have two cases:

  • Cannot obtain a valid sender address

    In this case nodes cannot charge anyone. Nodes may ban or block IPs sending this transactions but not much more can be done. This checks should be cheap, no need to execute a ECDSA addresss recovery algorithm.

  • Valid sender address but not enough balance

    Nodes will queue these transactions as pending and wait until the sender has enough balance. After some time they might be replaced by new transactions.

None of these case involves transaction execution because there's none to charge for it.

| improve this answer | |
  • This doesn't really answer the question. You've simply listed the failure modes for signature verification; and what you've said is wrong. Here is the function in the geth codebase that does recovery over the signature to check the validity. So yes, nodes do ECDSA checks before allowing tx execution. The 21000 intrinsic gas is supposed to pay for this. In fact as shown in the link, many other checks are also done. Would appreciate if you could explain the presence of intrinsic gas. – Shiri Oct 23 at 10:51
  • @Shiri I said nothing wrong. The first case for example applies when transaction is wrongly RLP encoded, or signature (r,s,v) don't follow spec, ie r or s are zeros, or v is invalid, in those cases no ECDSA recovery is neccesary. In the second case to obtain an address a ECDSA signer recovery should to be performed. – Ismael Oct 23 at 13:59

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.