►
From YouTube: NEAR Certified Demo | Episode 4.4 -- Promises
Description
This demonstration was presented by the author(s) after just 1 week of working with the NEAR platform as part of the NEAR Certified Developer program.
You can find the source code to this demo here:
https://github.com/Learn-NEAR/NCD-04--promises
---
Follow the latest from NEAR Protocol on:
Website: https://near.org/
Discord: https://near.chat/
Blog: https://near.org/blog/
Twitter: https://twitter.com/NEARProtocol
GitHub: https://github.com/near https://github.com/nearprotocol
#Blockchain #FutureIsNEAR #NEAR #nearprotocol
A
Okay,
so
the
idea
of
the
application
is
the
following:
the
world
is
full
of
promises
which
people
constantly
making
each
other,
and
sometimes
this
promise
is
fulfilled,
sometimes
rejected,
but
majority
of
them
is
just
lost
and
this
project
tries
to
solve
the
issue
by
tracking
promises,
so
person
can
make
any
promises
and
other
guys
can
vote
on
the
progress.
A
Now
I
have
three
browsers
opened
because
I'm
going
to
use
three
different
accounts
to
demonstrate
how
it
works.
Ui
is
extra
ugly,
because
you
know
this
is
just
edema.
A
A
A
So
if
we
take
a
look
at
this
user
or
this
user,
they
can
see
that
elder
or
b
testnet
made
the
promise
with
a
name
to
be
good
and
let's
vote
this
one
will
vote
yes,
this
one
will
vote
no
and
eventually
this
user
can
see
that
he
is
not
so
good
he's
like
50
persons,
good
yeah,
also
it's
possible
to
make
a
private
promise
like,
for
example,
I
promise
to
be
brave
and
I'm
gonna
promise
this
only
to
brave
your
test
net,
it's
possible
to
specify
at
least
here,
but
for
simplicity.
A
And
nothing
happening
because
this
is
demo
time.
No,
it
works.
So,
as
you
can
see
this
one
do
not
see
this
particular
promise,
because
this
is
not
graveyard
and
bravia
can
see
that
elder
ruby
made
a
promise
exclusively
to
him.
Well,
he
do
not
know
that
this
is
exclusively
to
him,
but
he
knows
that
this
is
a
non-public
promise
and
that
the
number
of
participants
is
one.
A
So
he
can
guess
that
this
is
private
to
him
again,
it's
possible
to
vote
and
the
system
is
built
in
such
a
way
that
only
last
vote
is
taken
into
account.
So
you
can
vote
as
many
times
as
you
like
I
mean
I
can
press
like?
Yes,
yes,
yes,
yes,
yes,
but
votes
count
still
will
be
like
one
yes,
but
it
also
allows
to
change
the
the
vote,
because
one
of
use
cases
I
kept
in
mind
is
tracking
promises
which
made
by
politicians.
A
So
let's
say
during
election
times
they
promised
this,
but
after
a
year
who
knows
how
will
it
go?
So
that
is
why
system
allows
to
revolt.
So
that's
it
from
the
ui
perspective.
From
the
code
perspective,
it's
pretty
simple.
We
have
just
class
promise
which
have
counters
for
yes
and
now,
which
have
time
stamp,
which
have
map
of
votes
where
the
key
is
address
of
a
particular
account
which
prevents
the
same
account
from
voting
infinite
number
of
times.
A
It
also
have
some
kind
of
permissions
which
required
to
implement
private
private
private
promises
handling.
A
In
fact,
I
separated
viewers
from
voters,
but
ui
do
not
present
this
for
simplicity
again,
but
the
idea
was
that
probably
all
the
world
might
be
interested
in
observing
how
this
particular
voting
happening,
but
only
a
few
people
allowed
to
vote
anyway.
This
is
the
implementation
details,
not
very
interesting.
A
Here
we
have
get
promises,
function
which
accept
parameter.
I
named
it
target.
Maybe
a
room
name
doesn't
really
matter,
but
the
idea
is
that
the
function
allows
to
provide
promises
for
account
which
made
these
promises
or,
for
other
guys
so
five
minutes.
A
Sorry,
what
I'm
just
saying
five
minutes
left
sorry
interrupt.
Yeah,
no
problem!
I
will
keep
it
short
so
independently
on
what
account
is
calling
this
function?
It
can
ask
promises
for
myself
or
for
others.
Promises
for
myself
is
the
promises
which
this
account
created.
Promises
for
others,
his
promises,
which
other
guys
made
or
promises
where
this
particular
account
is
belongs
to
viewers.
So
he
can.
He
can
actually
view
other
promises,
even
non-public.
A
Also,
it's
possible
to
vote.
Of
course.
Here
we
have
some
checks
like.
I
promise
of
course
needs
to
be
valid
and
so
on.
A
A
Yeah
we,
we
also
have
two
functions
for
creation
promises,
because
originally
I
made
it
in
very
simple
way.
So
originally
there
was
only
function,
make
promise
to
keep
it
simple.
I
decided,
and
and
also
to
not
break
anything.
Just
before
the
edema,
I
decided
to
introduce
another
function
for
handling
private
promises
handling.
A
It
allows
to
specify
two
extra
parameters:
list
of
viewers
and
list
of
voters,
and
of
course,
if
voter
is
not
among
viewers,
it
gets
added
to
viewers
list
by
smart
contract
itself,
because
it
doesn't
really
make
sense
to
allow
people
to
vote
without
allowing
them
to
view,
at
least
from
my
perspective
and
finally,
the
function
just
for
debug,
allowing
to
clear
all
the
promises.
A
Tests
like
disallow
to
make
promise
on
behalf
yeah.
I
also
forgot
to
mention
that
nearly
each
function
have
a
check
where
predecessor
and.
A
A
Passing
actually
that's
it
from
me
will
not
sorry
what
what
did
happen
just
yeah,
because
I
executed
it
on
wrong
folder.
Just
a
second.
A
I
will
use
the
time
left
for
describing
potential
improvements.
I
spent
some
time
trying
to
figure
out
how
to
implement
private
voting.
It
turned
out
to
be
not
trivial
at
all,
but
I
have
some
ideas.
For
example,
service,
like
tornado
cache,
can
be
used
for
inspiration
where,
let's
say
each
each
voting
person
would
get
some.