►
From YouTube: libp2p in Nim - Tanguy
Description
This talk was given at IPFS Camp 2022 in Lisbon, Portugal.
A
A
But
when
we
started
to
build
this,
this
application
in
2017,
we
quickly
realized
that
we
were
lacking
a
lot
of
infrastructure
to
be
able
to
build.
It
is
hard,
as
we
all
know,
and
so
we
started
a
whole
branch
of
status,
which
is
focused
on
what
we
call
the
infrastructure
projects,
and
so
we
have
a
few
projects
like
this,
like
waku,
which
is
our
messaging
layer
on
which
status
is
built.
We
have
codex,
which
is
a
storage
layer.
A
A
So
we
love
Nim
and
Status.
We
have
a
sorry
you
cannot
create,
but
we
have
about
50,
full-time
name,
devs
and
70
public
people,
and
when
I
say
this,
you
probably
have
two
questions.
The
first
one
is
what
is
name
name
is
a
programming
language,
and
the
second
question
is
wendim,
so
I'll
try
to
reply
to
this
question
in
this
talk.
A
So
Nim
is
one
of
these
better
C
attempts.
C
is
still
the
best
sorry,
but
that
I
compare
here
with
the
rest
and
go
so
actually
as
well
all
started
around
the
same
time.
So
Russ
was
started
in
2006,
going
2009
and
was
in
2008
sorry
a
name
in
2008.,
but
there
are
very
different
features
and
goals
and
everything
so
I
would
say.
This
is
my
opinion.
That
rascular
feature
is
a
safety
with
no
runtime
garbage
collection.
But
that's
my
opinion.
Go
its
concurrency
right.
A
You
can
do
crazy
stuff
with
go
routines
and
everything,
and
then
it's
a
bitter
there,
because
it's
good
is
just
to
be
nice
to
use
overall,
like
it's
not
like
one
strong
point
or
something.
It's
like
try
to
have
a
balanced
language
that
you
can
use
for
anything.
Basically,
the
last
difference
between
these
three
languages
is
this.
This
is
the
main
breaker
for
each
language,
and
this
is
a
2019
Revenue
I
couldn't
find
the
status
on
Wikipedia,
sorry,
but
so
yeah,
because
we
have
each
language,
has
very
different
budgets.
A
Version
one
in
2019,
which
is
a
bit
late
compared
to
the
other,
and
what
does
it
mean
is
that
the
neem
Community
is
a
lot
smaller
compared
to
the
language.
So
this
is
the
number
of
repository
on
GitHub
for
each
language.
You
cannot
see
here
yeah
it's
in
here,
yes,
yeah
here,
so
go
as
over
a
million
public
Repository
8000.,
and
it
does
have
some
impacts
on
our
day-to-day
life
that
the
life
of
Hazard
to
engineer.
A
A
Thankfully,
and
neem
has
a
very,
very
powerful
cffi.
So
sorry,
if
you
cannot
read,
but
this
this
is
like
wrapping
printf
in
name,
it's
only
one
line
of
code,
so
we
don't
have
to
build
everything
from
scratch,
but
it's
still
a
lot
of
work
to
build
the
stacks
we
need,
and
the
second
impact
is
that
because
less
people
use
name
your
not
likely
to
eat
compiler
bugs
just
because
you're
not
likely
to
to
use
a
specific
feature
set,
which
is
not
very
well
supported.
A
Yet
so
I'm
going
to
ask
you
to
focus
on
the
next
slide
very
hard
forget
the
bad
things
about
name
is
perfect.
Thank
you
so
yeah.
So
if
we
go
to
Wikipedia
the
different,
the
goal
of
the
name
is
to
be
efficient,
expressive
and
elegant
written
in
French,
because
it's
elegant,
so
efficient
means
performance.
We
want
a
very
good
performance
when
you
build
something
with
Nim
expressively
means
it's
easy
to
read
easy
to
write,
easy
to
understand
and
elegant.
A
It's
a
bit
more
vague,
but
it's
raised
to
have
a
feature
set
which
makes
sense
in
itself
and
it's
nice
to
use
overall.
A
So
I'll,
do
you
a
neem
crash
course,
so
you
can
understand
the
the
following
slides.
So
this
is
a
very
simple
example:
I'm
collecting
some
variables
you
can
see
that
we
use
a
python-ish
syntax.
Each
send
each
variable
will
have
a
type
which
is
static,
so
it's
statically
typed.
A
This
is
how
you
could
procedures
or
functions,
so
we
have
multiple
ways
to
return
the
value.
In
name
we
either
going
to
use
the
last
equation
of
the
function
as
a
as
a
written
value.
We
can
return
explicitly.
We
have
the
results
variable
which
is
created
automatically
for
the
compiler
and
if
you
assign
something
it
will
be
returned
at
the
end
of
the
function
so
putting
everything
together.
We
have
this
simple
example.
A
You
can
also
see
that
we
have
multiple
ways
to
code,
a
function
in
name,
so
you
can
either
call
it
like
regularly
or
you
can
do
first
parameter
dot
function,
name,
Dot
and
then
the
other
parameters
or
you
can
remove
the
parenthesis,
and
so
obviously
a
go
in
this
case
is
also
a
regular
name
procedure.
It's
not
like
python,
where
they
have
to
make
a
new
version
to
remove
parenthesis
or
other
parenthesis
whatever
so
yeah,
and
this
is
just
invalid
template,
but
I
won't
go
into
into
it
now.
A
So
how
does
it
looks
in
practice
to
use
name
in
P2P?
Well,
you
need
internet
first
of
all,
I'm
just
gonna.
So
this
is
a
very
simple.
It's
like
the
hello
world
of
ap2p,
it's
pinging,
someone
getting
the
Ping
and
yeah,
so
I'll
go
into
a
bit
more
details.
So
we
start
by
importing
lip
to
B
the
Ping
protocol
and
conus
chronoscisor
is
framework
status.
A
Then
we
create
a
procedure
which
is
going
to
take
a
string
return.
The
feature
Refrigeration,
this
procedurization,
obviously
I
create
a
switch
I,
create
a
protocol.
I
start
my
switch
I
dial
the
pair
with
the
pin
protocol
then
assign
the
PIN
to
the
result,
variable
and
close
everything
down
so
again.
I
think
this
is
pretty
simple.
To
read.
Right
I
mean
that
there's
no
weird
magic
going
on.
Actually
these
areas
but
whatever,
and
so
this
is
how
you
use
it.
A
You
can
just
call
wait
for
give
some
random
apfs
nodes
as
a
parameter,
and
then
you
can
create
a
description,
as
is
that
connection
faster
too.
My
definition
is
fast,
is
less
than
one
second
and
very,
very
nice,
and
so
yeah,
that's
again
very
simple,
but
actually,
if
we
look
a
bit
deeper
at
this
example,
it's
already
using
all
the
name,
meta
programming
features.
So
one
of
the
clear
features
of
deep
is
all
the
meta
programming
features
which
are
very
powerful.
A
So,
first
of
all
we
are
generics.
Obviously,
if
you
look
at
the
return
type,
you
can
see
it's
a
feature
of
iteration.
If
we
look
at
the
definition
definition
of
a
feature,
it
can
take
any
type
and
will
work,
and
then
we
can
create
a
generic
procedure
which
is
going
to
depend
on
the
type
you
give
it
to.
A
So
if
you
look
at
this
line,
the
50
seconds,
bigger
than
one
actually
Nim
bigger
than
is
a
template.
It's
like
a
synthetic
sugar
for
X,
bigger
than
y
becomes
Y
is
monogenics,
and
we
have
a
few
templates
like
this
in
the
standard
Library,
which
makes
it
a
lot
easier
to
build
new
types,
because
you
don't
have
to
Define
every
operation
on
your
type.
A
It's
actually
part
of
the
standard,
Library
name,
but
actually
for
this
very
very
specific
example.
We
have
an
even
better
way
to
do
it
in
him.
You
just
use
const,
so
a
constant
variable
will
actually
be
compiled
at
sorry
completed
at
compare
time.
So
this
procedure,
factorial,
will
be
run
inside
the
neem
compiler
VM
and
it's
gonna.
Do
it
a
couple
times
so
the
factorial
function
will
never
be
executed
in
this
case
at
one
time.
So
it's
perfect
for
performances.
A
If
we
look
again
in
this
code,
you
can
see
that
the
gaping
procedure
is
async
and
this
little
Paramus
and
guessing
is
actually
on
my
current
name
too.
So
we
can
look
at
the
source
code.
It
looks
like
regular
name
source
code,
but
this
macro
will
be
executed
at
one
part
time.
It
can
take
any
code
as
a
parameter.
So
in
this
case
it
will
take
a
full
procedure
and
transform
it.
However,
it
wants
so
we
can
remove
lines
and
lines
like
it
can
do
anything.
A
A
But
they
are
very
powerful.
We
have
to
use
them
with
a
great
care
because
you
can
easily
make
very
rich
stuff
with
them,
but
to
Essence.
They
think
about
how
we
use
it
for
everything
procedures,
so
thousands
of
time
in
our
code
base,
and
so
it's
very
useful-
to
have
them
outside
of
the
compiler
and
inside
the
Library.
Instead,
fmt.
A
A
Another
example
is
CarX,
which
is
a
neem,
HTML
library,
and
so
there's
this
Builder
build
HTML
macro
to
which
you
can
give
a
tree.
So
like
looking
like
HTML
right.
If
you
have
deals,
you
have
headers
and
it's
going
to
transform
this
whatever
you
give
it
to
him
into
actual
name
God,
which
looks
like
those
and
everything.
So
this
is
again
what
we
call
the
design
system
languages,
something
like
that
I
think,
and
so
it's
very
useful.
A
So
yeah
this
was
the
simple
pin
example
in
ep2p,
which
I
think
highlights
a
lot
of
nice
things
about
Nim,
but
I
know
you
don't
care
about
any
of
what
I
just
should
you
just
want
to
know
if
it's
fast
right
have
you
seen
this
yeah
like
the
best
you
want
to
be
like
the
best
I'll
wait
for
the
best.
Did
you
see
the
speed
of
this
bus?
It's
a
so
you
want
to
be
like
the
best.
So
isn't.
Invest
yes.
A
So
this
is
unreadable
for
review
I'm,
sorry,
but
it's
a
comparison
done
by
megalabs
of
sorry
Italian
consensus,
clients,
and
so
we
have
one
name
in
go
university
in
Java
and
JavaScript
I
think
I
got
them
all
and
so
on
the
left
you'll
find
the
memory
usage.
We
are
the
green
lines.
We
are
at
the
very
button,
which
is
where
you
want
to
be
and
on
the
right
you
have
the
CPU
usage
where
we
are
not
at
the
very
button,
but
almost
about
histogenistic
one
is
even
better
in
wcpu.
A
What
do
you
know
so
yeah,
very
good
performances?
Obviously,
and
yes,
that's
all
I
have
to
say
about
performance
right,
I
mean
I,
wanted
to
say
one
other
thing.
The
neighbors
team
worked
a
lot
to
get
this
result.
It's
not
just
you
use
name
and
by
default
you
will
get
crazy
results,
but
it
shows
that
you
can
get
close
to
C
performances
using
Nim,
because
actually
neem
compares
to
C.
So
yeah
you
can
do
anything
you
can
do
with
C.
A
You
can
do
it
in
neem2,
so
this
was
my
selling
session
for
Nim,
okay,
Android
and
now
I'm
going
to
sell
the
name
Liberty
instead,
so
nearly
b2p,
we
started
it
about
two
years
ago.
Now
we
have
three
people
working
on
it
full
time.
A
I
mean
it's
a
little
bit
of
implementation,
like
any
other
using
the
same
specs.
One
difference
with
other
implementation
is
that
others
were
started
from
ethereum,
specifically
I.
Think
most
of
the
implementation
were
built
for
ipfs,
and
so
we
were
since
the
very
beginning,
very
focused
on
safety,
because,
obviously
in
a
term,
if
you
have
a
security
issue,
you
can
lose
thousands
or
tens
of
thousands
of
dollars.
So
we
are
very
careful
with
safety
from
the
very
beginning,
so
yeah
V1.
A
Obviously
it
means
that
we
have
ins,
we
already
add
a
stable
car
because
of
the
safety
things
I
talked
about,
but
now
hopefully
the
API
will
stay
stable
as
long
as
possible,
so
yeah
very
happy
to
to
do
this.
We
have
a
website
where
you
can
find
some
examples
on
how
to
use
it.
Like
get
you
started,
it
starts
with
a
simple
ping
like
I
showed
earlier
and
actually
the
last
project
as
a
tutorial
is
a
full
video
game
which
looks
a
bit
like
this
I'm
playing
against
myself
here.
A
So
it's
not
really
intense
but
yeah.
So
it's
a
full
Tron
video
game
using
lip2p.
It's
going
to
use
Discovery
to
discover
peers
gossip
sub
to
find
the
to
the
matchmaking
and
then
the
direct
connection
with
a
custom
protocol
to
to
to
do
the
actual
game,
and
it's
only
150
line
of
code.
So
it's
very
very
short,
which
again
shows
a
Lim
is
a
short
and
nice
to
read
and
everything
so
yeah.
This
is
the
last
tutorial.
A
But
it's
not
very
interesting,
so
I'll
just
show
you
what
we
are
missing.
So
we
heard
a
lot
about
quick
and
everything
quick.
We
actually
have
an
implementation
in
name
that
we
did.
It's
only
missing
encryption,
which,
in
my
opinion,
is
not
very
important,
but
apparently
we
cannot
ship
without
encryption.
So
it's
not
not
finished
yet
because
we
don't
have
quick,
we
didn't
build
the
cat
ght
yet
because
doing
DHT
over
TCP
is
against
my
religion.
A
Unfortunately,
with
RTC,
as
you
see
in
the
beginning,
we
also
have
to
build
a
full
stack,
which
is
indeed
built
with
many
many
boring
lfcs.
So
it's
going
to
take
a
bit
of
time
and
finally,
this
utr
that
you
just
heard
about
we
have
the
whole
of
them,
but
the
whole
event
punch
in
stock
except
this
bit,
which
is
the
most
important
one
so
yeah.
This
is
I,
guess
a
big
feature
which
are
currently
missing
in
P2P,
but
we
are
working
to
get
them
as
soon
as
possible.
A
In
I
will
actually
have
a
roadmap,
which
is
the
number
issue
777
easy
to
remember,
which
is
a
bit
longer
and
go
into
a
bit
more
details,
but
yeah
I'll
just
show
the
big
highlights,
I
guess.
So
we
want
to
work
on
this
episode.
We
use
it.
We
use
it
a
lot
as
part
of
ethereum
status,
so
we
want
to
make
sure
it's
as
optimized
as
possible.
There
is
some
work
to
on
Lighthouse
form
Lighthouse
to
improve
it.
A
We
joined
that
effort
and
also
try
to
to
do
other
things,
dot
hotspot
to
enable
you
to
use
torah's
transport,
which
can
help
in
some
applications
to
give
you
better
privacy,
currency
c
minings,
as
I
said,
name
compares
to
C,
so
it's
the
best
kind
of
binding
you
can
have,
but
we
have
to
work
a
bit
into
how
to
do
async
in
C
and
everything.
A
So
today
you
can
use
jst,
P2P
or
a
restm
can
also
be
compared
to
other,
but
nimmers
can
also
compare
it
to
JavaScript
natively.
So
it's
something
we
need
to
look
into
Bluetooth
transport.
It's
something
very
far
out
that
we
would
like
to
get
I.
Think
Bertie
already
did
something
like
that
for
the
goalie
P2P,
but
yeah.
We
would
like
to
work
more
on
it
and
get
it
in
the
specs
hopefully,
but
this
is
like
very
far
out.
A
So
thank
you
on
the
left.
You'll
find
uhp
Ripple
or
you
can
just
search
for
GitHub.
There
should
be
only
one
of
them
I'm
also
on
the
Falcon
slack
or
you
can
find
my
email
here.
If
you
want
to
ask
me
anything,
I'll
just
know.