Gas is a very important concept. It is a measure for the amount of computational work. That could be storing a value in storage, expanding the size of memory or executing an arithmetic operation.


We need gas because the resources for doing computational work are limited. So in order to avoid a DDOS attack for example a user needs to spend some gas to run his program.

Gas has to be paid in ETH. If you run out of gas while executing your bytecode your execution stops.