►
From YouTube: Workshop: Introduction to smart contract programming - Christian Reitwiessner - at GSC
Description
Workshop: Introduction to smart contract programming - Christian Reitwiessner.
We will start with an introductory talk and then write smart contracts, interact with them and in general have fun with blockchains!
Please try to install the Metamask browser plugin (http://metamask.io/) before the workshop and perhaps try to get some Rinkeby testnet ether: https://www.rinkeby.io/#faucet
Many thanks again to the Game Science Center (GSC) who hosted this event in Berlin.
A
B
Okay,
thanks
everyone
for
coming
to
this
Meetup
lots
of
people
here,
I
see
that's
really
nice
I
hope
I
mean
that
tables
look
really
packed
so
I
hope,
there's
not
the
same
same
amount
of
people
waiting
outside
yeah.
So
that's!
This
is
the
first
time
we
are
in
the
game
science
center
here
and
looks
like
a
really
nice
venue
and
I
want
to
thank
the
game.
Science
Center
for
hosting
the
meetup
here
and
Leah
wants
to
say
some
words
about
what
this
place
actually
is.
A
D
A
You
fun,
while
coding
and
learning
solidity,
so
the
workshop
will
end
route
about
9:30
and
afterwards
we
will
open
up
the
bar.
An
exhibition
for
you
so
feel
free
to
have
a
beer
and
mingle
at
the
bar
and
also
if
you
are
planning
events
like
networking,
livestream
and
eSports
events,
then
you
can
talk
to
me
afterwards
at
the
bar
and
we
can
make
plans
so
have
fun.
B
B
B
B
Okay,
as
I
already
said,
please
try
to
install
the
meter
mask
browser
plugin.
This
is
so
that's
not
the
best
way
to
access
a
blockchain,
because
it's
fully
centralized,
but
it's
a
very,
very
convenient
way
to
try
out
aetherium
and
to
have
everything
running
just
in
the
browser,
without
the
need
to
install
anything.
Apart
from
the
plug-in,
of
course,.
B
B
And
then
there
are
these
companies
who
used
to
do
iced
tea
and
then
they've
changed
their
name
and
introduced
blockchain
into
their
name
and
the
stock
price
increases
I
think
threefold
over
ten
or
so
something
like
that
yeah
and
in
the
end
you
think
you're.
Perhaps
this
blockchain
thing
is
something
for
me,
so
you
asked
some
experts
and
if
they
are
real
experts,
then
in
95
percent
of
all
cases
will
turn
out
that
you
actually
don't
need
a
blockchain.
B
There
is
something
that
is
called
proof
of
stake,
which
can
hopefully
replace
proof
of
work
very
soon
and
most
token
sales
are
scams,
but
they're.
So
a
token
sale
is
actually
an
interesting
way
to
fund
a
product.
If
it's
done
right,
so
you
shouldn't
be
allowed
to
just
walk
away
with
the
money,
and
you
can
build
a
token
sale
such
that
this
is.
This
is
technically
not
possible
and
there,
of
course,
some
use.
B
Some
good
use
cases
for
block
chains
in
general,
and
let
me
just
show
you
two
example:
use
cases
of
block
chains
worth
using
a
block
chain
actually
makes
this
makes
a
lot
of
sense,
and
then
we
will
start
with
writing
some
very
simple
smart
contracts,
and
one
of
these
use
cases
is
the
swarm
system.
It's
a
decentralized
file
system,
so
basically
a
way
to
store
your
data
in
the
cloud
where
the
cloud
just
doesn't
mean
Amazon's
compute
form
but
hard
disks
donated
by
users
of
the
system.
B
And
it
uses
a
BitTorrent
like
system
to
distribute
the
data
and
but
the
you
can't
use
BitTorrent
right
away
for
distributing
data
because
it
has
so.
You
can't
use
it
right
away
for
a
general
file
source
system
because
it
has
some
flaws,
and
these
are
unpopular.
Files
are
deleted
after
some
time,
so
only
popular
content
stays
available
and.
B
E
B
Yes,
so
impotent
people
send
each
other
files
and
usually
only
want
to
have
a
file.
You
have
no
incentive
or
you
have
no
gain
in
sending
other
people
some
files,
it's
part
of
the
protocol,
so
people
do
it
and
that's
why
it
works,
but
yeah
for
general
file
storage
system.
Again.
Why
should
you
send
someone
some
other
persons
backups
or
their
own
backups,
and
the
blockchain
can
solve
these
two
problems?
It
can
pay
people
for
storing
files.
B
So
people
also
pay
each
other
for
providing
elements,
and
that
can
be
solved
by
a
blockchain
and
in
general,
coming
up
with
these
rules,
who
pays
whom
in
which
situations
and
whose
deposits
get
destroyed
and
so
on.
This
is
called
crypto
economics
or
in
more
general
mathematical
branch
is
called
mechanism
design
and
then
another
thing
that
can
be
nice
is
off
with
block
chains
is
removing
the
problem
of
you
having
to
trust
so-called
certificate
authorities
when
you
browse
the
web,
and
so
this
works
whenever
you
access
a
website
that
is
encrypted.
B
Encryption
solves
two
issues
here.
The
first
issue
is
that
you
don't
want
your
data
to
be
publicly
visible
and
the
second
issue
you
want
to
be
sure
that
you're
actually
connected
to
the
correct
website.
This
mostly
works
because
you
enter
the
correct
name,
but
if
someone
is
has
a
tap
on
your
internet
connection,
then
they
can
pretend
to
be
that
person
and
still
intercept
your
data
or
even
modify
it,
and
this
is
currently
solved
by
certain
organizations.
B
I
think
there
are
more
than
hundred
hundreds
of
them
who
kind
of
yeah
signed
certificates
that
claim
that
the
person
you're
currently
communicating
with
is
the
person
behind
a
certain
name,
and
this
is
of
course,
yeah
really
badly
flawed,
because
I
mean
there
are
100
of
these
organizations,
and
any
of
these
organization
can
give
out
such
a
certificate,
and
most
of
them
are
yeah.
They
are
distributed
all
around
the
world
in
various
questionable
regimes,
and
so
on
so
yeah.
B
This
doesn't
look
nice
and
another
problem
is
that
the
main
ownership
itself
is
not
part
of
the
system,
so
you
can
sell.
Such
a
CA
can
issue
a
certificate
and
they
are
obliged
to
check
that
you're,
the
legitimate
owner
of
that
domain,
but
this
is
not
part
of
the
protocol,
so
if
they
don't
do
it,
I
mean
someone
might
notice
at
some
point,
but
they
can
just
skip,
checking
that
and
also
the
way
so
they
yeah
the.
B
In
which
this
check
is
done
on
yeah
dramatically
depends
on
the
specific
certificate
authority
now
yeah
at
any
one.
Everyone
can
easily
create
fake
certificates
on
a
technical
level
and
a
blockchain
based
system
and
yeah.
For
example,
the
etherium
name
system
can
go
the
whole
way,
so
there
you
can
build
a
system
where
the
allocation
of
names
and
the
issuing
of
certificates
is
part
of
the
same
protocol
and
cannot
be
faked
on
a
technical
level.
B
It
stores
ownership
of
a
virtual
thing.
I
mean
it's,
it's
not
yeah
I
mean
what's
the
thing
in
the
sense
that
an
artificial
distribution
of
land
made
by
humans,
so
it's
kind
of
virtual
and
it
is
already
I
mean
it's
already.
A
word
sure
thing
that
is
stored
in
digital
databases
in
tunnels,
and
things
like
that
and
of
course
here
in
Germany.
B
This
is
probably
not
such
a
big
issue,
but
there
are
certainly
countries
where
land
registries
are
prone
to
corruption
and
a
system
where
yeah
this
is
technically
impossible,
might
help
there
and
in
general,
when
so,
coming
back
to
this
flowchart
diagram
of
earlier,
when
our
blockchain
is
useful
and
in
my
opinion,
block
trains
are
useful.
The
application
you're
you're,
you
want
to
add
a
blockchain
to
is
already
digitized,
so
it
doesn't
help
with
yeah
I.
Don't
know
Postal
Services,
where
you
have
to
confirm
that.
B
Physical
thing,
but
language
mysteries,
which
are
already
digital,
can
be
used
here,
where
the
enforcement
of
ownership
is,
of
course
separate
thing,
and
then
yeah
participants
have
to
have
conflicting
goals.
If
you
don't
have
conflicting
good
the
goals,
you
can
use
a
regular
database
because
nobody
has
an
incentive
to
to
commit
fraud
and.
B
Yeah,
even
if
you
have
conflicting
goals,
at
least,
if
all
participants
have
a
specific
third
party
who
they
trust,
then
there's
also
no
sense
in
using
a
blockchain,
because
you
can
use
the
database
controlled
by
that
third
party.
So
these
three
things
I
think
yes,
application
is
digitized.
Participants
have
conflicting
goals
and
there's
no
trusted
third
party
and
then
the
fourth
important
thing
is.
You
have
to
be
aware
that
using
a
blockchain
is
probably
much
more
costly
than
not
using
a
blockchain.
F
B
Yeah
in
general,
if
theorem
is
a
database,
and
the
interesting
thing
about
the
theorem
is
that
it
is
a
database
that
is
not
running
on
a
single
computer,
but
it
is
running
on
thousands
of
computers
all
around
the
globe
and
because
of
that,
it's
yeah,
you
can
say
it's
decentralized.
It's
also
a
transparent
database,
meaning
that
everyone
can
take
a
look
at
the
database.
Everyone
can
take
a
look
at
modifications
of
the
database.
B
It
is
a
manipulation
resistant
which
means
that
if
the
database
does
not
allow
a
certain
modification,
then
it
is
very
very
hard
to
do
such
a
modification.
It
is
also
authenticated,
which
means
that
any
modification
to
the
database,
any
message
sentence
system
is
signed
by.
So
it's
digitally
signed
by
the
sender
of
that
message,
and
it's
publicly
accessible
means
everyone
who
wants
can
use
not
only
read
the
database
but
also
modify
the
database.
B
F
B
B
B
B
Who
has
not
yet
installed
the
meter
mask
browser,
plugin
and
so
I
hope.
The
the
set
up
of
the
tables
here
help
and
I
would
ask
everyone
to
help
each
other,
because
that
way,
I
think
it
works
best.
We
have
some
people
who
walk
around
it
and
help
out,
but
we
have
to
build
on
you
helping
each
other
so
who
so,
who
has
installed
the
plugin
already.
B
We
won't
program
smart
contracts
on
the
actual
aetherium
main
network,
because
that
would
be
too
expensive,
but
instead
we
will
do
it
on
a
test
net,
where
it's
yeah,
that
is
meant
for
testing
and
where
the
currency
ether
has
no
value,
but
still
every
one
of
you
needs
to
get
some
of
these
of
this
test
net
ether,
and
we
will
do
it
on
a
network
called
rim.
Qp,
that's
one
of
the
test,
nuts
and
I.
Think.
B
B
D
B
Someone
else
just
said:
okay
thanks,
so
the
next
step
is
for
you
to
get
ranked
you
be
tested
ether.
Is
everyone
comfortable
with
using
one
of
the
suggested
method
methods
so
I?
Let's
just
close
this
annoying
thing
yeah.
We
somehow
forgot
to
set
up
a
communication
channel
for
this
meter.
Sorry
about
that
he's
just
doing
it.
That's
fine.
B
B
Okay,
that's
an
unfortunately
rather
long
process
in
the
beginning.
This
is
also
a
rather
annoying
process
in
reality,
with
the
actual,
if
you're
a
network,
but
once
were
past
that
it
only
gets
better
so
yeah.
If
you
can't
use
Twitter
or
any
of
the
other
methods
to
get
tested
ether,
please
request
it
by
pasting.
Edna's
address
into
that
thing.
Just
that
work
for
you.
Can
you
edit
it
so
I
posted
that
as
a
comment
below
the
instructions
site.
B
B
So
now
we
can
see
how
that
all
works,
and
so
as
this
is,
as
I
said,
a
collaborative
workshop
people
who
already
have
enough
tests
that
ether
can
try
to
send
some
to
the
other
addresses
here
then
mark
them,
as
already
sent
so
I
will
now
now.
This
is
a
bit
annoying.
I'm,
sorry
I
think
I'll
switch.
My
video
setup
to
mirrored
is
that
fine.
B
B
B
Yes,
sorry
I
can't
increase
the
size
here,
the
neck
lick
submit,
and
now
it
created
the
transaction
and
sent
it.
Why
are
this
centralized
gateway,
but
still
to
be
decentralized?
If
your
network
and
I
can
click
here
to
get
more
details
on
a
so-called
blockchain
Explorer,
which
is
also
a
centralized
thing,
but
still
better
than
nothing?
And
it
says
it's
pending
now.
This
means
the
transaction
has
to
wait
for
a
so-called
minor
to
include
the
transaction
in
the
next
block.
B
B
It
includes
18
transactions
of
17
transactions,
apart
from
the
one
I
included,
it
has
a
hash.
Hashes
are
rather
important
in
blockchains,
but
I
think
we
will
not
be
able
to
cover
them
in
as
a
parent
hash,
which
is
which
is
kind
of
linked
kind
of
a
link
to
the
previous
block-
and
this
is
the
address
of
the
miner.
The
miner
is
awarded
by
yeah
zero
ether
in
the
test
net
and
on
the
real
net.
The
miner
gets
an
actual
reward
for
working
on
yeah
participating
in
this
random
selection,
which
is
a
computation
intensive
process.
B
B
If
you
reduce
the
block
time,
then
it's
much
more
likely
for
this
random
selection
process
to
kind
of
select
to
minus
at
the
same
time,
and
then
they
would
produce
two
parallel
blocks
and
because
of
that,
they
would
be
conflicting
in
the
same
way
as
two
parallel
transactions
from
the
same
person
will
be
conflicting
and
yeah.
This
random
selection
process.
This
mining
in
the
end,
will
find
a
way
to
select
one
of
these
two
parallel
blocks
as
the
canonical
block,
but
this
takes
a
while.
B
So
you
want
to
reduce
or
yeah
increase
the
speed
of
the
the
blockchain
network
to
converge
on
one
of
the
alternatives
and
uncles
is
a
way
to
do
that,
because
yeah
complicated
I
mean
it's
not
too
complicated,
but
perhaps
a
little
bit
too
complicated
for
this
workshop.
So
the
person
who
requests
at
the
test
Anita
did
you
get
it?
B
Good
now
yeah,
let's
so
perhaps
also
take
a
look.
Let's
take
a
look
at
this
dashboard
that
you
see
when
you
go
to
rinkeby
dot
IO.
This
views,
the
current
network.
It
has
the
current
best
block,
so
the
the
block
hide
the
block
time,
which
is
a
diagram
of
how
long
it
takes
from
one
block
to
the
next.
This
is
a
random
process
which
happens
roughly
every
15
seconds.
So
that's
the
reason
for
the
for
the
variation
here
block
propagation
is
a
diagram
that
shows
how
the
newly
created
blocks
are
distributed
inside
the
network.
B
B
B
B
Okay,
so
someone
who
still
does
not
have
testes
and
now
I
think
you
can
handle
that
in
your
your
tables
locally.
Okay,
now,
if
there
is
only
part
of
the
fun,
of
course,
we
can
now
send
around
tests
and
if
there,
which
is
already
nice,
if
it
would
be
really
that
we
could
use
it
to
pay
for
whatever
pizza.
B
But
of
course,
what
we
all
came
here
for
are
smart
contracts
and
because
there's
so
great
support
for
it.
We
will
still
do
a
rather
boring
thing
that
smart
contracts
can
be
used
for,
and
that
is
tokens.
So
this
is
almost
the
same
as
ether,
but
still
there
are
big
differences
because
you
can
create
tokens
with
yeah
you
can.
B
Okay,
where
are
the
instructions
again?
So,
let's
take
a
look
now,
at
this
example.
Contract
I
put
here
this
simple
contract
this
for
now
it's
just
source
code,
but
we
will
create
that
as
a
smart
contract
on
the
blockchain,
and
for
that
we
use
the
IDE
remix,
which
is
a
dreaming
study,
theorem
dorg.
Let
me
reload
that.
B
So
that's
a
development
environment
for
our
solidity,
but
it
also
so
where
it's
really
strong
is
that
it
has
an
integral
integrated
execution
environment.
So
it
can
create
a
virtual
block
chain
that
only
runs
in
your
browser
where
you
can
call
functions
and
test
the
behavior
of
the
smart
contracts.
You
right,
then
you
can
modify
some
part
and
run
it
again,
and
you
can
also
interface
with
the
real
blocks
and
deploy
stuff
either
on
the
test
net
or
on
the
real
network.
B
B
Does
it
load
for
you?
Okay,
then
perhaps
start
refresh
yeah
just
did.
B
So
perhaps
start
by
pasting,
the
simple
contract
source
code
that
you
have
here
into
the
source
code
part
there
is
a
rather
complicated
smart
contract
there
by
default.
You
can
just
erase
that
and
replace
it
by
this
simple
one,
yeah
I
can
explain
some
aspects
just
on
the
source
code,
so
this
first
line
just
tells
the
compiler
or
it
tells
the
compiler,
which
version
you
want
to
have
or
which
it
should
expect,
so
that
they
aren't
surprised
by
any
breaking
changes.
And
then
you
have
this
contract
keyword
and
that's
the
name
for
your
other
contract.
B
You
want
to
create
so
one
one
tiny
complication
we
have
is
that
there's?
No.
There
are
no
two
different
words
for
a
contract,
a
yeah,
a
specific
contract
that
is
deployed
on
the
blockchain
and
the
source
code
correspond
to
that
contract.
Both
it's
called
contract
and
the
source
code
contract,
there's
only
one,
but
you
can
have
multiple
copies
of
them:
multiple
copies
of
the
same
source
code
on
the
on
the
blockchain
in
programming
terms.
That
would
be
distinct.
B
The
distinction
between
class
an
instance,
but
both
is
called
contractive
for
us
so,
and
so
it
has
a
variable
here
called
stored
number.
This
number
is
permanently
stored
on
the
blockchain
and,
if
you
so
un
means
it's
an
unsigned
integer
of
256
bits,
that's
the
default
and
public
means
it
will.
The
compiler
would
would
generate
a
function
for
you
to
read
the
value
that
is
stored
there,
and
then
you
have
a
function
called
name
which
is
public,
which
means
it's
accessible
from
outside.
B
It
is
pure,
which
means
it's
not
allowed
to
modify
the
blockchain
State
and
it
returns
a
string
and
what
it
returns
is
my
github
username,
and
then
you
have
another
function
which
yeah.
Where
now
the
interesting
part
starts,
it's
called
sort
number:
it
takes
a
pair
of
type
ants,
an
integer
again
named
X,
it's
publicly
available,
so
which
means
everyone
can
call
it
and
what
it
does.
Is
it
modifies
the
value
of
the
number
that
is
stored
in
this
slot
here?
B
So
you
can
write
and
you
can
use
that
function
to
store
an
arbitrary
number
inside
the
smart
contract
here
and
because
there's
no
access
control
here.
Everyone
can
call
that
everyone
can
modify
the
number
okay,
let's
see
if
it
oh
yeah,
it's
there.
So
let's
try
to
run
that
you
can
run
that
on
rinkeby,
but.
F
B
B
B
This
selection
at
the
top
is
very
important
because
that
determines
where
the
smart
contract
is
created.
If
you
select
JavaScript
VM,
it
will
create
it
in
a
virtual
blockchain.
Just
in
your
browser,
if
you
select
injected
web
3,
then
it
will
created
on
the
rinkeby
test
net,
and
let's
do
this
just
for
now.
So
if
you
click
create
here,
then
the
meter
mask
plug-in,
will
pop
up
and
will
ask
you
to
confirm
it
it
now.
B
B
Will
show
you
how
it
looks
in
chrome,
yeah,
okay,
so
yeah,
so
the
thing
is
this:
smart
contract
will
now
be
created
at
a
certain
address
in
e
theorem,
so
everything
has
addresses.
We
already
talked
about
addresses
because
you
got
an
address
associated
with
a
public/private
key
pair
and
contracts
also
have
an
address,
and
when
you
want
to
interact
with
a
contract,
you
have
to
know
its
address,
because
that's
where
you
send
your
transaction
to
ok
meter
mask
already
says
it's
confirmed.
If
the
scan
does
not
say
it's
confirmed
yet.
B
F
B
Confirm
so,
and
now
it
says,
contra
created
at
this
address,
and
here
you
can
see
the
yeah,
the
the
contract
byte
code,
so
the
yeah,
if
uses
a
certain
virtual
machine,
called
the
virtual
machine
which
has
a
separate
byte
code
that
is
different
from
all
other
virtual
machines,
and
this
is
its
hexadecimal
representation.
B
This
doesn't
help
us
very
much,
so
that's
the
hexadecimal
view
and
that's
the
bytecode
view,
which
is
similar
to
some
assembly
code.
This
is
really
annoying
to
look
at
and
because
of
that
so,
but
we
actually
know
the
source
code
behind
the
small
contract
there
and
but
ether
scan
doesn't
know
this.
So
there,
the
centralized
component
here
doesn't
know
it.
Only
our
browser
knows
it,
but
there's
a
way
to
tell
it
what
the
source
code
behind
this
contract
is,
and
this
is
always
very
useful
to
use-
and
you
use
this
you
get
to
that.
C
C
F
C
B
B
B
B
So
I'll
do
it
again,
so
click
create
here.
Then
me
Tomas,
pops
up,
I
click,
Submit,
ok,
now,
ok,
the
step
that
was
probably
too
fast
is
how
to
get
to
the
to
the
other
website
here.
So
I
just
sign
the
transaction
and
the
plug
and
disappeared
again,
so
I
I
open
it
up
again
and
then
there's
at
the
words
that
the
top
entry
is
an
entry
that
has
these
three
dots
or
perhaps
is
already
confirmed.
B
Yes,
so
I
didn't
verify
it
yet.
So
the
question
was
whether
so
the
scan
has
a
functionality
where
it
can
find
contracts
with
the
same
source
code
automatically
or
see
me
automatically,
and
the
question
was:
why
is
this
not
working
in
this
case
now
and
the
reason
is
I-
did
not
upload
my
source
code
yet
to
ether
skin,
and
is
that
that's
what
I
think
is
the
reason?
B
Okay,
now
you
click
on
the
contract
address
and
you
see
a
transaction
so
there,
the
creation
transaction
of
the
contract,
you
see
who
created
it.
So,
as
I
said
earlier,
every
transaction,
every
message
in
aetherium
always
has
a
sender.
It's
always
on
Takei
'td
and
you
know
yeah.
Even
the
contract
creation
has
a
kind
of
origin.
B
Okay,
verify
and
publish:
let's
click
on
that.
Okay,
now
we
get
to
a
very
complicated
website
which
will
hopefully
get
simpler
by
a
compiler
feature.
We
hopefully
will
be
able
to
release
soon.
So
what
you
do
is
the
address
should
already
be
correct.
You
paste
your
source
code
into
the
bottom
part
here,
so.
B
We
all
paste
or
the
same
source
code
unless
somebody
modified
the
string
here,
perhaps
perhaps
next
time.
Okay,
we
paste
the
thing
here.
We
so
because
a
single
source
file
can
contain
multiple
contracts.
We
have
to
specify
the
name
here.
Oh
my
named
account,
but
it's
just
a
stupid
example:
don't
read
too
much
into
it
and
then
you
have
to
select
the
compiler.
This
is
most
probably
we've
0
for
23,
plus
something
so
the
compilers
with
nightly
should
not
be
used
for
such
things.
Only
the
one
that
start
yeah.
B
Okay
and
oh
yeah,
optimization
is
the
second
setting
we
need
to
check,
so
we
still
have
to
go
to
settings
yeah.
An
enable
optimization
is
probably
turned
off.
I
think
it
would
also
appear
in
the
address,
probably
optimize
false.
So
if
optimizes
false
here,
then
you
have
to
switch
optimization
from
yes
to
no.
B
So
these
that's
just
whether
the
compiler
should
do
some
optimizations
so
to
make
the
code
faster
and
cheaper
without
check
it.
Changing
its
semantics.
B
And
so
what
we're
doing
here
is
we're,
so
ether
scan
is
checking
whether
the
source
code
we
provide
here,
matches
the
byte
code
stored
on
the
blockchain,
and
it
is
important
that
it's
so
it
is
impossible
to
fake
that.
So
it's!
If
so,
if
I
could
just
change
the
name
of
this
function
here
or
even
worse,
if
I
could
change
this
X
to
2,
then
this
function
would
do
something
else
than
I
thought
and.
B
By
yeah,
due
to
some
reasons,
it's
impossible
to
provide
the
incorrect,
it's
impossible
to
provide
a
different
source
code
here,
but
it's
not
possible
to
recover
the
source
code
from
the
byte
code,
so
the
byte
code
loses
information
because
it's
much
more
compact,
but
it
still
contains
a
hash
of
the
source
code
and
what
they
do
is
they
just
recompile
the
source
code?
We
provide
here
with
the
settings
and
if
the
same,
if
it
results
in
the
same
byte
code,
then
they
say
that
is
the
source
code.
B
Okay,
now
it
worked
so
now.
Just
this
is
a
confirmation
page
now
and
when
we
go
back.
D
B
Yep,
so
when
I
click
on
code,
now
we
have
the
actual
source
code.
Here
it
is
verified,
exact
match.
Everything
is
fine,
and
now
so
one
thing
before
I
get.
The
question
is
now
we
have
a
read
code,
read
contract
tab
where
we
can
interact
with
the
smart
contract,
for
example,
it
calls
the
name
function
for
us
and
displays
the
string
that
it
returns.
These
are
very
yeah
yeah.
This
is
not
a
very
nice
interface
to
interface
with
the
smart
contract.
B
G
G
G
G
G
B
C
B
C
B
People
using
Chrome,
they
will
have
something
here
and
due
to
a
glitch
in
the
connect
between
Firefox
and
the
meter,
mask
plug-in.
We
have
to
do
that
manually
and
what
we
have
to
do
is
we
have
to
paste
the
address
here
into
the
input
box
next
to
the
at
address
button,
and
then
we
click
Add
address
and
that
basically
tells
remix
hey
at
this
specific
address
on
the
blockchain.
There
is
a
contract
of
the
type
that
was
just
selected
here
and
by
that
remix
provides
us
with
an
interface
to
to
interact
with
the
smart
contract.
C
B
B
So
the
question
was
about
the
contract
address
and
what
it
is.
It
has
nothing
to
do
with
the
block.
It
is
just
so
an
address
of
an
account
you
create
that
is
not
a
smart
contract.
Let
us
derive
from
the
public
key
of
your
public
private
key
pair
and
for
smart
contracts.
The
address
is
derived
from
yeah,
basically
from
the
from
the
account
that
created
the
smart
contract,
so
the
account
that
created
the
smart
contract
and
the
nonce
that
is
incremented
with
these
transaction
and
at
that
address,
the
data
is
stored.
B
So
blocks
are
just
there
to
group
transactions
and
order
transactions,
so
they
determine
in
which
order
changes
are
applied
to
the
blockchain
and
addresses
determine
where
data
is
stored,
where
changes
can
be
applied.
So,
of
course,
a
smart
country
is
created
in
a
certain
a
certain
block,
so
it
starts
existing
from
a
certain
block.
But
yet.
B
So
the
bytecode
of
the
smart
conduct
logic
is
stored
in
the
block
now,
so
the
transaction
that
created
the
smart
contract,
which
kind
of
includes
so
the
the
bytecode
of
the
smart
contract,
is
part
of
the
transaction
that
creates
the
smart
contract
and
that
transaction
is
part
of
the
block.
But
you
can't
really
say
that
the
the
final
smart
contract
code
is
stored
in
the
block
that
it
is
sort
in
the
blockchain.
Add
an
address
unrelated
to
blocks.
B
Ok
and
now
so
we
have
this
interface
here
we
can
click
buttons.
Blue
buttons
are
buttons
which
do
not
cause
a
change
in
the
blockchain.
They
just
read
from
the
blockchain
because
of
that
they
are
free
of
charge
and
are
executed
instantly.
So
you
don't
need
to
confirm
the
transaction
with
me
Tomas
and
if
I
click
name,
it
says,
Chris
F
and
stored
number
is
probably
zero.
Yes,
but
as
soon
as
I
click,
a
red
button
and
I
can
give
an
argument
for
the
function
store
number
here.
B
B
B
Okay,
here,
just
out
of
curiosity,
there
are
these
buttons
here,
details
and
debug.
If
you
click
debug,
then
you
will
get
to
the
second
big
feature
of
remix,
which
is
a
debugger.
You
can
run
derp
than
any
transactions
where
they
are
so
yeah
over
the
transaction.
So
it's
not
it's
not
a
debugger
that
executes
and
you
can
stop
it
at
some
point.
It's
more
like
an
execution
inspector,
so
you
can
rerun
and
so
there's
there's
actually
a
slider
which
represents
time
there.
You
can
run
back
and
forth.
G
B
The
question
was
so
yeah
what
I
didn't
tell
much
early,
because
we
use
it
on
the
test.
That
is
when
you
want
some
execution
to
be
performed
where
you
want
to
create
a
smart
contract
when
you,
when
you
want
to
cause
any
permanent
change
in
the
blockchain,
you
have
to
pay
people
for
doing
that,
so
that
the
network
doesn't
run
on
its
own.
B
You
have
to
pay
for
things
to
be
done,
and
this
is
paid
in
a
unit
called
Gas,
Gas,
more
or
less
measures
the
amount
of
computation
required
and
then
there's
the
second
factor
called
the
gas
price.
This
means
how
much
you're
willing
to
pay
per
unit
of
gas-
and
this
is
something
you
set
when
you
create
the
transaction.
It's
not
Brizzy,
millimeter
mask
I
think
it
kind
of
determines
that
on
its
own,
but
in
other
interfaces
you
sometimes
have
a
slider
where
you
can
select
to
either
pay
more
or
pay
less.
B
If
you
pay
more,
then
your
transaction
will
be
included
earlier.
If
you
pay
less
it's
cheaper,
but
it
will
take
longer
for
your
transaction
to
be
included.
It
might
even
happen
that
your
transaction
is
never
included,
that's
kind
of
how
it
support
how
it
works.
Is
it
answer
your
question?
Okay,
so
yeah,
let
me
create
the
smart
contract.
I
will
verify
the
source
code
and
then
I
will
share
the
address
with
you
and
we
will
interact
with
it.
B
So
the
weird
token
has
a
name:
it's
called
weird
token:
it
has
a
symbol
which
is
a
short
version
of
its
name.
It
has
decimals,
which
we
can
ignore,
and
the
most
important
thing
is
this
mapping
called
balances
and
this
kind
of
holds
the
for
every
possible
address.
It
holds
the
amount
of
token
that
is
assigned
to
the
address,
so
this
is
kind
of
the
balance
sheet
of
this
token
system
and
it's
a
total.
It
also
has
a
total
supply,
which
is
the
the
amount,
the
the
overall
amount
of
tokens.
B
So
the
sum
of
all
tokens,
the
sum
of
all
balances.
We
have
a
function,
called
balance
off
the
Texan
address
and
can
be
used
to
read
the
balance
at
that
address
and
we
have
a
function
called
transfer
which
takes
a
to
address
and
a
value
and
yeah.
What
does
the
transfer
function?
Do
it
checks
whether
the
person
that
wants
to
send
to
send
tokens
has
enough
balance
so
has
at
least
a
certain
value.
I
already
said
that
all
transactions
have
a
sender
and
you
can
access
this
Center
using
MSG
dot
sender.
B
So
you
can
perhaps
see
the
transfer
that
has
no
authentication
part,
so
it
doesn't
ask
whether
the
person,
so
whether
someone
is
allowed
to
transfer
tokens
and
the
reason
is
because
every
transaction
is
signed-
it
is
already
authorized
by
the
signer.
So
when
you
send
a
transaction,
you
always
have
to
authorize
so
by
accessing
MST.
That
sender.
This
already
means
that
the
sender
has
authorized
a
transaction.
B
So
the
sender
has
authorized
the
transfer
of
the
tokens
by
invoking
that
function,
and
this
is
something
I
really
like
about
the
theorem,
because
you
don't
have
to
think
about
yeah.
Who
can
do
that
and
do
I
have
to
ask
for
a
password
or
something.
This
is
all
abstracted
away
in
the
in
the
cryptography
below
in
the
small
contract
level.
You
just
ask
for
who
does
this?
Who
wants
to
do
something?
And
if
they
want
to
do
something,
then
of
course
they
yeah.
B
You
can
check
if
they
are
allowed
to
do
that,
but
you
don't
have
to
check
if
they
are
actually
that
person,
so
transfer
works
by
the
person.
Invoking
the
function
asking
to
transfer
a
certain
amount
to
a
certain
address,
so
we
check
that
the
person
has
at
least
that
balance,
and
if
that
is
the
case,
then
we
reduce
that
person
balances
person's
balance
by
that
value
and
we
add
the
same
value
to
the
recipient
and
we
emit
a
func
emitter
yeah.
B
B
B
B
B
It
is
called
from
here
inside
the
request,
token
mathematically
function,
and
that
is
a
public
function.
So
that's
good,
but
it
starts
with
two
required
statements
and
if
the,
if
the,
if
the
argument
inside
the
require
statement
is
false,
then
this
will
cause
the
transaction
to
be
reverted.
So
it
will.
It
will
stop
executing
and
revert
any
effect
it
might
have
had.
B
B
B
Can
someone
explain
why
so
that
the
thing
is
we
don't
do
or
yondu?
We
do
input
checking
here.
If
you
just
leave
this
input
box
empty,
it
will
use
0
as
well.
You
right
yeah!
So
if
you
leave
this
empty
and
just
press
the
red
button
here,
it
will
use
0
for
multiple
of
17
and
what
will
happen
inside
the
small
contract
here
when
multiple
of
17
is
0.
B
Yeah
I
mean
this
module
is
a
bit
complicated.
Perhaps
four
people
are
not
yes,
that
it
checks.
Whether
multiple
of
seventeen
is
a
multiple
of
seventeen,
so
a
and
a
integer
multiple
of
seventeen
so
zero
times,
seventeen
one
times,
seventeen
2
times
17
three
times
seventeen
and
so
on
and
zero
seems
to
be
zero
times
17.
So
this
check
passes
and
the
second
check
is
just
so.
Everything
is
false
by
default.
So
this
reference
is
the
mapping
here,
and
this
is
just
a
means
to
say
that
no
two
numbers
can
be
used
twice.
B
So
the
question
was:
if
two
people
use
the
same
number
at
the
same
time,
but
one
gives
a
higher
gas
price.
That
person
is
more
likely
to
get
the
token
it
depends.
So
it
depends
on
the
miners.
I
think
they
currently
sort
transactions
by
gas
costs,
but
I'm
not
so
it
might
also
be
so.
This
is
a
test
net.
They
are.
Things
might
also
be
a
little
bit
different,
but
you're,
probably
right.
Yes,
so
the
person
that
uses
a
higher
gas
cost
is
more
likely
to
get
the
token
I.
Think.
B
But
also
I
mean
it
really
depends
on
timing,
I
mean
if
the
miner
is
not
aware
of
the
second
transaction
yet
but
the
but
is
aware
of
the
first
transaction
already
then,
and
it's
yeah,
it's
a
so
it's
a
decentralized
network.
So
you
cannot
predict
anything
about
timing.
That's
that's
the
whole
thing
that
blockchain
solved.
B
I
think
I
just
have
to
reload.
So
if
the
scan
will
notice
that
this
is
an
E
or
C
20
token,
as
soon
as
this
event
is
fired,
oh
yeah,
it
already
did
so
it
automatically
recognized
that
it's
a
or
C
20
token.
Oh,
we
click
here
now
we
will
get
more
information
about
the
tokens
yeah.
We
already
have
12
addresses
that
have
tokens
and.
B
B
Let's
see
I
mean
I'm
wondering
whether
we
can
see
which
numbers
were
already
used
and,
of
course
we
can
I
know
it's
not
probably
go
visible.
Yeah
we
can
take
a
look
at
the
I
know.
We
can
take
a
look,
we
have
to
look
at
the
transactions
and
there
we
can
see
which
numbers
are
used,
I
think
yeah.
We
have
to
click
on
the
dragnet.
That's
not
you
convenient
put
yet
here
one
CB
in
hex.
That
is
a
number.
F
B
B
D
B
D
B
You
can
choose
to
use
a
smaller
one
by
putting
the
number
of
bits
after
the
UN,
so
you
into
80,
for
example,
oops,
but
at
there's
no
big
advantage
in
using
smaller
numbers,
because
the
theorem
virtual
machine
has
the
default
data
type
for
the
universe.
Machine
is
256
bit
integers.
Everything
smaller
has
to
add
additional
operations
to
make
it
work
for
the
smaller
size.
It
is
a
it
might
be
an
advantage
in
storage.
Sometimes,
so,
if
you
want
to
store
many
small
numbers,
it
might
be
an
advantage,
but
you
have
to
try.
C
B
B
A
B
Question
is
so
in
the
weird
token,
we
change
the
balances
of
the
sender
and
receiver
and
then
the
we
omit
an
event,
and
the
question
was:
what
is
the
event
for
the
event
is
because
it
makes
it
easier
for
outside
viewers
to
see
what
happens
if
they
want
to
see
so
it
whence
are
stored
at
a
certain
place,
which
is
much
easy
accessible.
If
we
wouldn't
have
events,
everyone
would
have
to
rerun
the
execution
and
basically
look
inside
the
execution
and
see
what
happens
and
with
events.
B
G
B
G
B
G
B
B
B
This
transfer
event,
which
is
also
useful
too,
so
that
you
don't
have
to
search
the
full
blockchain
all
the
time.
That's
all
we
need,
and
if
that's
there
in
the
contract,
then
it
is
a
token
I
mean.
So.
Having
said
that,
of
course,
the
fact
that
we
have
a
function
called
transfer
doesn't
automatically
mean
that
the
transfer
function
also
transfers
tokens
we
can.
B
We
can
put
whatever
you
want
here
inside
the
code,
so
we
can
say
if
it's
a
Sunday,
then
all
transfer,
all
transfer
functions
will
send
token
to
a
special
address
and
if
it's
a
Monday,
half
of
them
are
burned
and
on
all
other
days
we
have
correct
transfers.
We
can
we
can.
We
can
emulate
the
the
the
existing
traditional
banking
system
and
say
transfers
and
Sunday
are
not
allowed.
Nice.
B
B
B
Now
the
contract
stays
the
same
when
yours
exactly
the
same
contract
we,
what
oh,
it's
not
an
exploit,
I
mean
so
request.
Token
mathematically
publishes
one
token
for
every
conceivable
multiple
of
seventeen.
So
so
the
exact
ask
is:
is
there
a
way
to
click
a
red
button
here
in
remix,
so
to
execute
a
state
changing
function
on
some
smart
contract,
which
will
then
award
you
with
more
than
one
term
more
than
one
of
these
weird
tokens
in
return?
B
Yeah,
it's
very
good.
So
we
have
to
write
our
own
smart
contract
that
calls
request
token
mathematically
on
the
token
contract
and,
of
course,
multiple
times
and
yes,
the
difficult
task
is
coming
up
with
smart
with
with
code
that
kind
of
finds
multiples
of
seventeen
in
a
different
way
than
in
the
way,
all
others
in
the
room.
Do
it.
B
B
B
B
Kim,
can
you
encode
it
in
the
checksum
with
correct
checksum?
Why
not?
Okay,
so
yeah
addresses
in
theory,
I'm
have
some
checksum,
which
is
which
uses
upper
and
lower
case
of
hexadecimal
letters,
and
actually
it
yeah.
If
you
click
on
compile
here,
they
just
actually
should
show
how
the
correct
checksum
looks
like
oh.
F
B
And
the
most
important
thing
now
so,
if
we
only
do
it
like
that,
then
of
course
I
know,
this
model
of
17
is
already
taken,
but
more
importantly,
we're
talking
will
generate
a
token,
but
the
token
will
be
assigned
to
this
smart
contract.
So
it
will
not
belong
to
our
account,
but
it
will
belong
to
the
account
of
the
fountain
contract.
B
B
D
B
B
B
B
B
By
the
way,
so
whenever
you
see
tooling
lacking
here
and
you
can
program,
there
are
tons
of
grant
programs
where
you
can
just
apply
with
an
idea,
get
some
money
and
improve
the
ecosystem.
So
the
thing
there
are
at
least
three
different
grant
programs
that
are
happy
to
give
you
money
to
work
on
improving
this
ecosystem.
B
Yeah:
okay,
oh
that's
nice!
So
if
a
scam
now
tells
me
it,
this
transaction
failed
and
the
only
reason
so
I
want
to
know
why
it
failed.
Let's
see
what
I
can
get
some
information
there
yeah.
So
if
this
can
has
a
debugger
assets,
you
can
click
on
tools
and
utilities
here
and
click
on
remix
debugger.
This
will
use
more
or
less
the
same
debugger
we
already
saw.
I
think
it's
an
older
version
right,
Ian.
B
B
B
B
B
B
B
B
D
D
B
B
F
B
B
You
can
just
request
a
very
expensive
operation
to
be
performed,
and
that
would
take
a
long
time
and
time
is
the
important
thing
here,
because
there
is
an
upper
limit
on
how
much
can
be
done
inside
a
single
block
inside
a
single
transaction,
and
if
you
want
to
do
more
so
yeah
there's
just
enough
about
you
can't
do
more
than
a
certain
thing
inside
a
transaction
it.
This
upper
bound,
is
kind
of
flexible.
It
changes
over
time,
but
it's
a
hard
upper
bound.
B
C
C
B
E
B
E
B
E
B
B
B
B
C
C
C
F
B
The
question
is:
if
you
have
a
longer
operation,
how
do
you
split
it
up
into
multiple
transactions
so
that
it
fit
into
fits
into
the
blocks?
I
mean
in
this
case.
It's
it's
trivial,
because
I
mean
it
already.
You
can
already
split
it
up,
but
just
choosing
a
number
and
then
running
it
multiple
times.
But
if
it's
it's,
if
the
result
of
the
first
part
is
important
for
the
second
part,
then
it's
more
tricky
I.
Think
there's
no
generic
pattern,
but.
F
F
F
F
B
G
G
B
G
G
B
Solidity
has
a
very
low-level
language
and
it
has
to
be
extremely
gas
efficient
because
otherwise
you
can't
do
most
of
the
operations
on
the
blockchain
and
because
of
that,
mappings
are
the
yeah
simplest
thing.
You
can
think
of
that
resembles
a
key
value
store.
If
you
also
stole
the
keys
together
with
the
values,
it's
already
much
more
expensive.
That's
why
it's
not
done,
but
you
can
build
your
own
user-defined
data
type
on
top
of
mapping
that
also
stores
the
keys.
G
G
B
Yeah,
it's
not
it's
not
like
a
hash
map
where
you
cope
with
collisions.
It's
a
hash
map
that
use
a
large
hash
value
where
you
hope
that
there
will
never
be
a
collision.
So
if
you
have
a
collision
in
in
the
balances
mapping,
then
the
whole
blockchain
is
screwed
because
it
uses
the
same
hash
function
and
if
that
has
any
collision,
then
its
origin.
Later.