You are viewing a single comment's thread from:

RE: Ethereum "Gas" - How it Works

in #ethereum7 years ago

Gas is a measurement of computational work. Each instruction in the Ethereum Virtual Machine has an associated gas cost. For example, the opcode ADD has a gas cost of 3, and all it does is add two numbers. MUL costs 5 gas, and multiplies two numbers. These are pretty cheap, but an instruction like STORAGEADD costs 20,000 gas because it permanently stores a 256-bit word on the blockchain. It's not so computationally hard, but the memory consumed is substantial when you consider that these 256 bits must be stored on every full node mining.

Gas price could be thought of as "the amount invested in the transaction", but I don't think it's very useful to think of it that way. The main reason is because it's not really an investment. It has a binary outcome, either the transaction goes through and you pay, or it doesn't and you don't. There's no risk involved, so I don't think it's very comparable to an investment.

The exception to this would be when a transaction not being mined has an associated cost. A good example of this would be when you're trying to get into an ICO that is selling out quickly. If you don't specify a high enough gas price, your transaction might not go through quick enough and you lose your investment opportunity. That means there's an opportunity cost to your transaction, and in this scenario the gas price you specify is more like an investment in the transaction.

Sort:  

Yep exactly what i had in mind.