[Ethereum] How Ethereum confirm the transaction

confirmationscryptographytransactions

Am I right, that Ethereum do it the same way as Bitcoin (Bitcoin dev guide), and the only difference is that the Ethereum use it's own OP_CODES?

UPD I mean, what is the Ethereum's alternative for <Sig> <PubKey> OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG ?

Best Answer

Instead of the chain of ownership and UTXOs used in Bitcoin to identify which transactions are correctly formed and which are not, Ethereum uses an account model, and transactions are sent with ECDSA signatures that verify against that account. The 'state' of each account is kept track of, and the transactions are checked to see both that the signature verifies, and the state change triggered as a result of the transaction is valid (eg I can't send you 8000 ETH if I only have 10).

From the Ethereum Docs:

Transactions contain:

  • the recipient of the message,
  • a signature identifying the sender and proving their intention to send the message via the blockchain to the recipient,
  • VALUE field - The amount of wei to transfer from the sender to the recipient,
  • an optional data field, which can contain the message sent to a contract,
  • a STARTGAS value, representing the maximum number of computational steps the transaction execution is allowed to take,
  • a GASPRICE value, representing the fee the sender is willing to pay for gas. One unit of gas corresponds to the execution of one atomic instruction, i.e., a computational step.

If you wanted to verify signatures, this comment from axic might be the type of thing you were looking for:

Check out https://github.com/ethereumjs/helpeth

It has similar features:

signMessage <message>

verifySig <hash> <sig>

verifySigParams <hash> <r> <s> <v>