What is “Ethereum gas” and why should you care?

What is “Ethereum gas” and why should you care?

Hi it’s Keir Finlow-Bates here – so today I
thought I’d talk a bit about Ethereum
gas and the background to this is that
the breakthrough that Vitalik Buterin
came up with for Ethereum was
the idea of enhancing the scripts that
Bitcoin supports to not just be a state
machine and a stack machine, but to
actually be a Turing-complete computing
machine, and in plain terms the scripting
in Bitcoin that allows you to create all
sorts of new kinds of transactions is
fairly limited; it’s kind of a linear
process where it’s: do this, do that, do
that, and at the end if it comes out “true”
the transaction is valid, whereas
Ethereum has a proper programming
language in it, and that means you can
encode functions and loops and all sorts
of wonderful programming concepts, so you
can do a lot lot more. But there’s a
problem in that the simple system that
Bitcoin uses is guaranteed to end – when
you have a linear finite number of steps
that have to be followed you know that
they’re going to complete, but if you
have a program that has all sorts of
conditionals and loops it can get stuck
in an eternal loop. For example in
programming a very simple program that
will never stop is: “while 1=1:
print ‘it’s still running'” – that’ll just
print “it’s still running” over and over
and over again, and of course if you’re
running a big distributed decentralized
computer you don’t want all the nodes to
get stuck into an endless loop,
because that’ll freeze the whole system.
And the solution that Vitalik came up
with is the concept of “gas” namely that
in order to run your program on the
Ethereum blockchain you have to pay for
the privilege,
you basically load up your smart
contract program with ether, and there is a
cost associated with each computing
instruction that is executed, and if your
program gets stuck in an endless loop
then it will very quickly exhaust all
its funds, effectively run out of gas, and
it stops. So that’s one way of overcoming
the halting problem in Turing-complete
programming languages, and it works very
neatly. Does however have one side effect,
which is that as the cost or rather as
the value of Ether goes up the cost of
running your program on the Ethereum
blockchain will rise and also it means
that when you’re writing a program for
Etherium you have to be very careful
about how efficiently you’re coding it,
because you are paying to run it, and
have a procedure and it’s burning a
certain amount of gas
and you can make it more
efficient, then
you’ll be saving yourself real money. So
there you go, that’s a quick summary of
the first big breakthrough in Ethereum
was, namely the concept of gas and how it
Hope that made sense to you. Ask any
questions in the comments below, and I’ll
see you in the next video soon.
Bye for now!

One comment

  1. Keir, you make a point at 2.25 that may turn out to be the most critical vulnerability in the whole brave new world of public blockchains and decentralised economies. That is, as the utility of a blockchain increases so does the value of it's tokens (or gas) or cryptocurrency. Therefore there is a success (self) limiting part in the system. And to date all public blockchains are built on validation mechanisms that require cost to gain consensus (to reward the consenting node). So they require tokens (or gas) to run. But the expense to run a smart contract increases as the popularity of the blockchain increases. A dilemma I can't get around. By the way – I believe we will work this out…and your posts and knowledge are the best in this field.

Add a Comment

Your email address will not be published. Required fields are marked *