►
Description
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
Thank
you
so
much
for
being
here
and
taking
the
time
to
talk
to
us
about
the
rpc
interface
for
near
protocol.
This
has
been
a
kind
of
one
of
these
very
mysterious
parts
of
the
platform.
We
don't
spend
a
lot
of
time
talking
about
it.
A
B
B
So,
let's,
let's
start.
A
Let's
talk
about,
you
know
this,
this
kind
of
one
of
the
questions
that
we
have
in
the
document
here
that
we're
tracking,
how
can
I
find
out
which
contracts
are
deployed?
How
can
I
find
out
which
contracts
are
deployed.
B
Yeah,
so,
first
of
all,
I
just
want
to
briefly
mention
that
the
contracts
are
the
accounts
in
here
that
has
code
wisdom
code
uploaded
to
the
network.
B
B
B
You
essentially
specify
that
your
request
type
is
view
account
specify
the
time
frame
that
you
are
interested
in.
Usually
you
on
to
be
on
the
safe
side
of
things
you
prefer
to
be
and
pull
the
latest
data.
That
is
final.
You
can
read
more
about
other
options
like
other
finality
states
or
how
to
specify
the
specific
block,
hash
or
hate
to
create
the
historical
data.
But
with
this
example,
you
can
see
how
to
query
the
latest.
B
B
Balance,
it's
a
liquid
balance,
locked
the
balance
that
the
the
account
can
have
natively
staked
and
the
most
important
part
here
is
a
code
hash,
so
code
hash
is
essentially
a
a
checksum
of
the
uploaded
contract
in
base
58
encoding.
B
It
is
unusual
and
we
essentially
consider
it
to
provide
more
expected,
hex
encoded
hashes,
but
overall
right
now
it
is
base
58
and
when
you
see
all
ones
here,
it
essentially
means
that
there
is
no
code,
it
is
32
0
bytes,
which
are
when,
when
you
encode
them
in
base
58
gives
us
this
representation.
B
So
this
is.
This
is
an
indicator
that
there
is
nothing
no
code
deployed
to
this
account.
Other
info
here
just
for
fyi,
is
that
the
storage
usage
is
the
amount
of
bytes.
This
account
reserves
for
itself.
B
When
you
don't
have
code
deployed
to
the
account,
and
this
number
is
only
used
to
store
the
amounts,
the
account
id
and
that's
pretty
much
it
and
just
heads
up
here
as
well.
This
field
is
duplicated
soft
duplicated.
We
prefer
to
keep
backwards
compatible.
That's
why
it's
not
deleted,
and
this
information
is
the
one
that
you
could
refer
to.
B
As
a
like
the
reference
when
this
data,
when
this
response
was
essentially
generated
because
you
have
independent
nodes,
peer-to-peer
some
nodes
could
be
outdated
and
you
can
essentially
end
up
creating
final
latest
state
for
that
node.
But
you,
you
can't
be
sure
that
it's
up
to
date,
this
reference
here
serves
you
the
purpose
to
be
on
the
safe
page.
You
can
estimate
how
like
outdated.
The
data
is,
or
it
is
not
so.
A
Okay,
so
it
sounds
like
there's
a
couple
of
things
that
you've
covered
here.
So
the
first
thing
that
you
said
is
that
accounts
and
contracts
have
this
one-to-one
relationship
near
has
accounts
that
have
friendly
names,
human
readable
names
you
may
or
may
not
deploy
a
contract
to
an
account.
If
there's
no
contract
deployed
to
an
account
code,
hashes
all
once
that's
the
default.
When
you
deploy
a
contract
to
an
account,
then
the
code
hash
will
change
to
be
something
like
the
checksum
or
the
checksum
of
the
contract
binary
code.
Actually
so.
B
A
B
A
The
part
there
there's
some
of
this
metadata
that
some
people
may
recognize
this
when
they're
using
near
cli.
They
basically
get
this
metadata
back.
This
response
back
about
the
account
it's
basically
a
pass-through
from
from
the
rpc
api
and
and
then
the
last
thing
that
you
said
about
block
height
and
block
hash.
Is
that
because
we're
asking
for
final
finale
final,
the
block
height
and
block
hash
of
this
data?
We
can
assume-
and
this
is
a
question
I'm
asking
you-
we
can.
B
A
This
is
the
the
the
that
any
any
node
which
is
tracking
this
shard
any
any
node
in
the
network,
and
you
interrogate
this
this
block
height
or
this
block
hash
has
basically
come
to
consensus
about
this
account
state
yep.
That
is
what
you're
saying
yeah.
B
A
B
Yeah,
and
and
also
like
when
the
network
progresses.
B
B
If,
if
you
care
about
the
latest,
you
need
to
double
check
that
you
are
on
the
on
the
same
page,
with
the
tip
of
the
network.
A
B
B
Yeah,
you
would
probably
want
to
check
the
status
very
first,
probably
the
very
first.
B
What
you
want
to
learn
is
the
latest
block
heat
and
make
sure
that
the
latest
block
time
is
somewhat
recent.
According
to
your
expectations,
you
can
also
check
if
it
if
the
node
is
syncing.
If
it's,
if
it's
false,
it's
mean
that
the
node
is
reasonably
up
to
date,
it
could
be
just
a
few
blocks
behind
and
just
because
of
the
latency
across
the
network.
B
But
if
it's,
if
it's
not
too
too
outdated,
the
flag
will
be
false,
and
this
will
help
you
to
understand
that
this
latest
blockade
is
essentially
quite
recent.
You
can
pair
this
latest
blockade
with
the
one
that
you
receive
from
the
query
account
response,
and
this
way
you
can
read
about
the.
A
Okay,
so
so
this
this
is,
I
think,
a
key,
a
key
point
that
you're
making.
Let
me
see
if
I
can
restate
it
with
any
one
of
these
rpc
endpoints,
not
just
this
first,
one
that
we
happen
to
start
with
the
block
height
is
included
in
the
response
typically,
and
I
would
assume
it's
just
sort
of
part
of
the
response
I
I.
A
Lock
height
but
it
seems
reasonable,
so
even
if
the
finality
is
set
to
final
because
there's
other
parameters
or
other
values
for
the
for
the
parameter
finality
there
right.
A
So
if
I
assume
functionality
is
set
to
final,
when
I
make
my
query,
I
there
is
a
there
is
a
chance.
I
don't
know
if
it's
a
good
chance
or
not,
but
a
chance
that
I'm
getting
back
very
the
most
recent
data,
but
there's
also
a
non-zero
chance
that
the
data
is
actually
outdated
and
so
the
the
the
there's
a
requirement
here
that
I
query
again
to
maybe
a
more
general
endpoint.
The
status
end
point
you're,
saying
and
from
this
status
end
point
make
sure
that
the
node
is
not
syncing
the
reply
in
the
status.
A
Otherwise,
if
it's
syncing
it,
it
also
might
be
out
of
date.
So
syncing
should
be
false
in
that
reply
and
then
compare
the
block
heights
and
maybe
the
time
stamps
of
the
status
to
get
a
sense
of
actually
how
recent
this
data
is.
So
this
is
how
you
would
think
about
it
when
you're
pulling
this
data
back
right
and
we
know
that
blocks
are
produced
once
a
second,
and
so,
if
it's
more
than
a
few
seconds
out
of
sync,
it's
entirely
possible
that
something
else
has
happened
on
that
account
to
change
its
state.
B
I
just
want
to
clarify
if
the
account
is
not
under
heavy
updates,
it
does
not
get
a
lot
of
traffic.
Usually
the
the
changes
would
be
invisible
and
like
that,
it's
rare
when
something
would
go
wrong.
I
just
wanted
to
make
sure
that
we
are
understanding
that
the
implications
of
why
it
is
here
why
it
is
it
could
be
useful
and
what
it
could
indicate
that
something
is
not
working
fine,
so
you
could.
B
When
you
have
a
system
in
built
that
is
constantly
querying
the
status
page
in
background
and
saves
this
like
well,
the
latest
is
this:
you
just
have
it
in
your
program
and
the
rest
of
the
program
is
querying.
Various
endpoints
like
viewing
accounts,
viewing
some
other
data
and
it
instead
of
just
requesting
all
the
time
like.
I
do
one
query
and
then
make
a
credit
to
status.
I
I
even
I
would
suggest
probably
to
have
it
in
status,
checks
in
background
sitting,
checking
what
is
the
latest
and
then
you
can.
B
Whenever
you
credit
the
view
account,
you
can
immediately
write
in
your
program.
Compare
with
the
latest
okay.
I
I
recently
requested
status
page
and
now
I
just
see
that
well,
this
blockade
has
been
reasonably
up
to
date,
so
yeah.
A
B
B
A
Just
have
have
this
continually
progressing
and
just
verify
your
queries
against
this
cached.
You
know
sort
of
tracer
of
the
tip
of
the
network
that
you've
made
right.
That
makes
perfect
sense,
yeah.
B
A
So
yeah,
so
so
the
way
I
was
thinking
about
this
is
if,
if,
if
I
want
to
ask
a
question,
you
know
how
do
I
know
which
contract
is
deployed
on
a
specific
account?
I
might
be,
for
example,
working
against
a
staking
pool
about
to
send
my
money.
You
know
to
stake
my
money
in
this
tokens
in
this
staking
pool,
and
I
want
to
know
like.
Is
it
actually
the
correct
version
of
this
thing?
Is
it?
A
Is
it
the
one
that
I
expect,
or
maybe
it's
a
dao
that
I'm
working
with,
and
I
want
to
make
sure
that
it's
it's
the
dow
that
you
know
that
I
can
see
locally
the
source
code
that
I
can
see
locally
is
actually
deployed
in
this
particular
account
before
I,
you
know,
send
a
proposal
to
the
dao,
so
this
kind
of
reasoning
about
the
integrity
of
the
contract.
That's
been
deployed
on
chain
being
able
to
verify
that
it's
what
I'm
looking
at
in
the
source
code
that
I
have
locally.
A
I
want
to
sort
of
factor
out
the
idea
of
like
deterministic
compiles
like
if
you
compile
the
contract
on
your
machine
or
I
compile
it
on
my
machine.
It
produces
the
same
code
hash,
I'm
not
sure
if
that's
currently
even
the
case.
But
let's
say
that
were
the
case,
then
the
question
it's
it
seems
like
it
would
be
one
of
the
most
common
questions.
Actually
that
you
would
ask
about
a
system
like
this
is
the
code.
That's
currently
running
the
code
that
I'm
looking
at
and
so.
B
A
Where
this
this
question
comes
from,
but
that's
the
single
account
question
we
can
expand
it
and
say:
do
these
two
accounts
have
the
same
contract
on
them
and
the
answer
is
easy
if
they
share
the
same
code
hash.
The
answer
is
yes
and
you're
done
at
that
point.
B
A
Nothing
more
complicated
to
think
about,
and
if
I
ask,
for
example,
which
which
accounts
have
this
contract
on
them
across
all
accounts
in
the
system,
the
rpc
interface,
maybe
isn't
the
right
way
to
ask
that
right.
You.
B
Were
saying
yeah,
let
me
answer
when
the
one
by
one,
so
there
is
still
a
lot
of
ongoing
work
in
terms
of
like
defining
the
interfaces
of
the
contracts
or
learning.
What
exactly
is
the
code,
so
I
will
start
attacking
this
problem
with,
from
the
technical
point
of
view,
what
what
is
currently,
what
is
the
state?
So
currently,
you
can
upload
any
wasm
code
to
the
network.
B
B
Your
storage
usage
will
increase
your
code,
hash
will
be
updated
and
that's
pretty
much
it.
There
is
no
hard
requirements
as
to
provide
certain
methods.
You
can
apply
the
code
which
has
no
methods.
You
can
apply
some
code
which
does
not
compile
it's
not
a
valid
version
binary.
You
still
can
upload
it.
B
B
B
This
is
implemented
for
rust,
sdk.
We
have
a
docker
image
with
all
the
environment,
fixed
to
to
the
point
that
if
you
upload
download
the
same
docker
file,
you
will
try
to
compile
the
same
code.
You
will
receive
the
same
binary,
so
it
is
reproducible
now,
but
and
the
idea
was,
our
idea
was
to
keep
track
of
our
core
contracts
when
we
recompile
them.
We
record
this
binary.
B
There
is
currently
no
implementation,
it's
still
under
construction,
but
this
is
the
reasonable
way
to
think
about
this
problem,
and
another
approach
to
to
this
problem
is
to
target
from
different
angle
instead
of
defining
exactly.
This
is
a
binary,
and
this
binary
represents
that
code.
You
could
build
into
your
code
a
special
method
which
you
can
query
so,
for
example,
the
the
the
method
would
be
like
get
contract
info,
so
it
would
be
sitting
right
in
the
contract.
B
It
would
be
just
a
function
and,
given
the
nature
of
near
protocol,
you
can
make
a
view
function
calls
they
are
free
of
charge.
You
don't
need
to
pay
for
them.
It's
not
a
transaction.
You
cannot
do
any
mutation
inside
the
function
inside
the
function.
You
are
calling,
but
you
can
return
certain
values
you
can
read
and
in
this
particular
case
that
I'm
trying
to
explain
you
can
you
can
return,
always
a
constant
set
of
fields
saying
well.
I
am
a
contract.
B
Lockup
I'm
a
lock-up
contract,
I'm
I
have
a
version
1.0.
I
have
these
methods.
I
comply
with
this
nap
standard
and
that
way
you
could
build
a
convention
to
provide
your
like
contracts
out
there.
If,
if
we
build
a
convention
and
have
such
a
method
on
every
contract,
that
would
be
the
way
to
get
some
idea
what
the
contract
is
capable
of
doing.
B
B
B
A
A
You
went
on
then
to
say
maybe
an
improvement
or
an
enhancement
of
this
answering
this
question
would
be
to
actually
discover
what
code
is
running
or
what
the
contract
is.
You
could
interrogate
the
account
and
ask
you
know
by
sending
a
function
call
here,
as
you
have
on
the
screen.
Tell
me
about
yourself
some
sort
of
a
reflection
api,
or
maybe
it's.
B
A
Exact
name,
abstract,
binary
interface,
api
or
some
json
blob.
That
represents
the
interface
somehow
or
maybe,
as
you
said,
even
simply
just
a
string
message
that
represents
the
specification
that
it
adheres
to
or
the
url
of
the
nep
that
it
adheres
to
anything
like
that.
It's
still
not
quite
clear
what
the
best
way
to
implement
something
like
that
is
there's
ongoing
discussions
but-
and
you
know,
there's
there's
no
at
this
point-
there's
no
wrong
way
to
implement
that.
A
B
B
For
example,
I
have
an
idea
that
they
contract
could
be
a
lockup
contract.
I
would
open
it
on
our
repo
scroll
down
to
interfaces
section
and
come
on
yeah.
So
here
is
the
list
of
like
owner
methods.
They
usually
are
protected
for
owner
usage,
staking
methods
and
then
I'm
scrolling
down
to
view
methods
so
any
or
anything
that
starts
with
get
is
usually
the
case.
B
B
B
Yeah,
so
it's
I
mean
sort
of
a
workaround
right
now,
given
that
we
don't
have
a
spec
special
way
to
create
a
exact
exactly
what
what
the
contract
is,
and
this
way
you
can
build
your
knowledge
just
just
poking
around.
You
can
also
query.
A
This
might
be
a
bit
confusing,
but
but
the
account
named
near
is
actually
has
the
lock-up
account
or
the
lock-up
contract
deployed
to
it.
A
B
Separate
repo,
by
the
way,
it's
not
very
well
documented
in
terms
of
like
I
just
described
that
you
could
look
up
so,
let's,
let's
use
another
way
just
to
I
will
walk
you
through.
I
usually
open
the
open,
the
libras
implementation.
A
B
Contract
implementation-
I
ignore
those
that
are
payable
because
they
are
not
going
to
work
very
well
for
me,
you
can
still
actually
call
this
method
as
a
view
method.
It
will
just
fail,
it
will
say
that.
Well,
it
does
not
work
in
view
call
context,
but
it
still
will
give
you
an
idea
that
the
the
method
is
essentially
there,
so
the
method
exists,
but
you
can
scroll
down
and
see.
Well,
there
is
a
get
key
balance.
B
For
example,
method.
You
can
call
it
it's,
it's
definitely
not
changing
the
state
and
that's
why
vuequal
will
succeed.
A
A
A
B
It's
always
borrowed
yeah,
yeah
or
or,
as
I
said
before,
you
can
try
with
get.
B
By
conventionally
also
prefix
them
with
get
yeah
and
as
as
you
mentioned,
the
mirror
account
is
essentially
a
contract
with
this
link
drop
on
it,
and
there
are
plenty
of
useful
methods
like
create
account
and
create
account
and
claim,
and
you
can
see
that
there
are
quite
a
few,
create
account
calls
and
there
is
send
call
so
by
looking
into
explorer.
B
A
Sure,
if
it
cracks
like
a
duck,
it's
a
duck,
if
it,
if
it
adheres
to
the
interface,
then
it's
close
enough
to
that
contract.
It
may
not
be
exactly
that
contract
yeah,
okay.
So
so
I
think
that
makes
sense.
I
I
don't
know
if
we've
covered
sort
of
the
the
other
piece
of
this,
so
so
right
now
we've
covered.
How
do
I
discover
something
meaningful
about
the
contract
deployed
to
an
account
and
it's
the
code?
Hash
is
the
answer.
That's
the
fingerprint!
The.
B
A
The
hash
of
of
the
binary
of
the
contract
effort's
been
compiled
so
that
that's
useful.
If
I
want
to
compare
two
accounts
to
see
if
they
have
the
same
contract,
I
just
compare
the
code
hash,
there's
other
things
that
we've
discussed
here
in
in
terms
of
you
know
how
I
can
check
the
interface
test.
It
poke
edit
to
see
if
it's
behaving
the
same
way.
A
What
if
we
kind
of
zoom
out
with
a
different
framing
of
the
question,
unless
there's
more
to
say
about
this,
what,
if
we
zoom
out
and
say
how
do
I
ask
or
answer
the
question,
what
contracts
have
been
deployed
on
this
account
throughout
history?
So
I
have
an
account
I
want
to
know.
Has
this
account
always
had
the
same
contract
or
has
the
contract
changed
over
time.
B
You
kind
of
do
it
like
in
a
single
call.
What
I
could
suggest
is
to
use
this
block
id
and
instead
of
creating
the
latest
data
of
view,
account
you
query
certain
block
height.
You
essentially
have
the
monotonically
increasing
block
height
over
the
time,
and
you
can
start
with
the
quitting
the
latest
check.
If.
A
A
Big
changes,
if
the,
if
the
account
version,
if
the
contract
on
an
account
changed
once
or
twice
in
history,
I
might
be
able
to
kind
of
use
something
like
this
kind
of
get
blame.
You
know
approach
to
trying
to
figure
out.
Where
did
it
change
in
the
block
height
history?
But
if,
if
it's,
if
it's
an
account
that
sort
of
changes
you
know
periodically
or
just
for
a
moment
that
changes
back,
I
wouldn't
be
able
to
detect
this
actually
very,
very
well.
A
B
B
If
you
need
to
build
some
high
level
view,
you
essentially
are
required
to
build
a
service
that
will
go
through
every
single
block
in
the
history
and
collect
the
data
that
you
are
interested
in.
One
approach
is
to
use
our
indexer
framework
it's
implemented
in
rust.
It
essentially
builds
on
top
of
the
regular
near
node,
and
it
it
serves
all
the
data
in
memory
about
the
historical.
B
B
B
That's
why
we
decided
to
decouple
it
and
the
indica
framework
is
just
another
piece
of
software
and
you
it's
it's
easily
integrated
and
after
that,
you
you
are
free
to
do
whatever
you
want
with
the
data
and
index
it
in
a
way
that
you
it
makes
sense
to
you.