►
From YouTube: PSS-creating a devp2p protocol
Description
In this presentation from Day 2 of the #SwarmOrangeSummit, swarm member Louis Holbrook presents the PSS - Postal Services over Swarm. In this video he explains PSS is a way of relaying messaging using a Swarm node. Giving an overview of how a node functions as a relay and ends the talk with a live setting up of a relay node
A
And
what
is
this
so
PSS
is
a
way
of
relaying
messages
using
swarm
nodes
so
using
the
same
logic
in
the
same
Kadhim,
lia
routing
as
we
do
when
we
disperse
chunks
into
the
network.
We
can
also
use
the
same
logic
to
just
send
messages
which
are
kind
of
temporal
data
entities
using
the
same
kind
of
routing
logic
and
I.
Guess,
as
we
all
know
already,
this
routing
works
by
comparing
how
many
bits
in
the
start
of
an
address
is.
A
Similar
to
another,
so
this
is
the
way
the
chunks
find
their
way
in
the
network.
You
have
a
chunk
address,
you
have
a
node
address,
they
have
the
same
amount
of
bytes
and
to
figure
out
how
close
they
are
to
each
other.
You
compare
how
many
bytes
do
they
have
in
common
in
the
start
right,
so
this
kind
of
shows
this
logic.
Obviously
the
addresses
are
a
little
bit
longer
than
this.
A
So
what
you
do
when
you
want
to
send
the
TSS
message?
Suze,
you
define
address
that
you
want
to
send
to
and
you
send
it
off
a
network
and
it
will
relay
and
finds
the
node
that
has
the
add
list
of
matches,
but
since
we're
all
paranoid
and
sometimes
want
to
hide
our
steps,
it's
also
possible
to
define
a
partial
address
to
send
to
so,
which
means
that
you,
instead
of
sending
to
one
kind
of
send
to
a
neighborhood.
A
If
we're
super
paranoid,
then
we
could
just
omit
the
address
altogether
and
the
effect
of
that
being
that
we
send
our
message
to
absolutely
everyone.
In
the
network
now
this
is
not
so
efficient,
but
you
know
if
you're
paranoid,
then
you're
paranoid
and
that's
probably
more
important
when
you
send
a
PSS
message
on
a
network,
all
the
nodes
cache
the
message
as
well.
A
Actually
you
do,
and
with
chunks
as
well,
you
know
primarily
for
the
purpose
of
quicker
retrieval
of
chunks,
so
that
you
don't
have
to
go
all
the
way
to
the
closest
ones.
The
ones
on
the
way
will
save
the
chunks
so
that,
if
another
request
comes
along
in
a
certain
period
of
time,
they
could,
just
you
know,
beat
the
source
to
it
and
get
paid
for
we're
sending
it
and
the
request
doesn't
have
to
go
so
far
in
PSS.
Rather,
this
is
used
to
remember
what
message
has
been
sent
through
you
before.
A
A
A
There
is
asymmetric
encryption.
There
is
symmetric
encryption
you
can
use
and
then,
as
we
see
here
all
these,
oh
well
they're
supposed
to
be
gray,
question
marks
all
over
these
clueless
notes
here
didn't
make
it
through
the
VTA.
Maybe
if
I
had
HDMI
but
I
don't
and
of
course,
let's
say
that
several
nodes
share
key,
which
is,
for
example,
the
example
in
whoo.
When
use
symmetric
keys,
several
notes
can
be
the
recipient,
they
can
all
decrypt,
so
they
are
the
recipient.
A
Inside
of
PSS,
you
register
you
have
to
register,
who
you're
talking
to
kind
of
create
an
address
book
and
the
way
you
do
this
is
you
register
the
keys
that
you
want
to
use
for
peer
to
each
key
is
a
topic,
so
it's
kind
of
a
filter
that
indicates
what
messages
might
be
of
interest
to
you
and
what
messages
might
not
and
then
to
each
topic.
You
can
attach
an
address
or
part
of
an
address
or
an
emptyness.
A
So
on
this
way
you
can
you
know
for
one
key,
that
is
one
recipient,
define
many
different
topics,
and
maybe
you
have
one
open
topic,
one
partially
secret
topic,
one
super
secret
topic
and
the
same
peer
can
have
different
addresses
registered
to
it
internally.
Also,
when
you
get
a
message
with
a
certain
topic,
it
is
passed
to
a
certain
handler
handler
code,
which
you
asked
the
developer
plugin,
which
will
kick
in
when
you
get
a
message
to
this
topic.
That's
successfully
decrypted,
so
you
get
a
message.
A
You
decrypt
it
and
what's
just
supposed
to
mean
yeah,
you
decrypt
it
then
you
know
from
which
key
you
decrypted
the
with
who
is
the
originator
of
a
message
then,
on
the
other
hand,
you've
matched
the
topic.
You
pick
the
handler
code
and
then
you
do
your
magic
right
here
when
you
use.
This
is
for
asymmetric
encryption,
so
obviously
for
asymmetric
encryption.
You
know
by
the
key
who
is
this
is
with
symmetric.
A
A
A
We
have
the
topics
which
are
4,
bytes
kind
of
a
convenience
function
to
generate
the
topic,
then
for
sending
an
isometric
message.
You
would
first
want
to
register
the
public
key
of
the
P
R,
which
is
done
here
with
this
address
topic,
blah
blah
the
showed
earlier,
and
this
send
asymmetrically
to
the
key.
The
key
is
now
registered
in
the
right
and
the
message
payload
kind
of
similarly
there's
was
supposed
to
be
okay.
There
was
supposed
to
be
also
how
to
set
the
symmetric
key
and
how
to
send
symmetrically
the
message.
A
I,
don't
know
why
this
slide
didn't
make
it
it
didn't
and
for
getting
the
incoming
messages.
You
would
subscribe
to
the
stream
of
the
message
using
the
the
RPC
subscription
built
into
the
theorem
node,
and
you
select
a
certain
topic
for
which
to
get
the
messages.
So
now
this
is
kind
of
the
manual
labor
way
of
doing
things,
but
PSS
can
also
be
used
to
mount
protocols,
that
is
to
say
autonomous
communication
between
machines.
That
kind
of
happens
just
happens
where
you
don't
do
this
whole
manual
back
and
forth,
and
and.
A
A
A
A
So
these
protocols
and
stuff
that
happens
in
the
node
is
defined
as
a
service.
So
what
is
a
service
exactly?
What
does
it
mean?
Well,
it
means
that
you
know
you
get
done
stuff
that
you
might
want
to
others
to
do
you
don't
want
to
do
yourself,
but
in
the
specific
meaning
of
theorem
node.
It
means
that
you
define
an
API
or
collection
of
API
calls
you
define
protocols,
one
or
more
and
you'd
find
two
functions.
One
called
start,
one
call
stop
and
you
could
just
guess
what
they
do.
A
Now
TSS
is
a
little
bit
different,
because
PSS
is
actually
a
sub
service,
so
to
speak
virtually
of
swarm,
so
it's
you
know
dependent
for,
among
other
things
of
the
academia
service
and
swarm
to
do
the
message,
routing
and
stuff.
So
this
means
that
we
can't
really
mount
this
as
a
service
directly
on
you
know
we
have
to
go,
be
vs
form
to
do
it
and
obviously,
instead
of
then
calling
all
of
these
independently
in
the
node,
you
would
first
bake
this
API
sin
to
storm,
and
then
the
protocols
and
the
start
so
that
this.
A
So
how
does
this
fit
together
then,
if
we
want
to
because
we
really
want
to?
We
have
this
super
nice
protocol
code
right
that
we're
running
already
on
a
dev
p2p
node,
and
we
really
don't
want
to
change
this
code.
We
just
want
to
take
it
as
is
and
use
it
SP
on
the
PS
s
layer
instead.
So
how
do
we
kind
of
make
that
magic
happen?
So
the
individual
services
they're
all
nice
and
super
well
coded?
How
do
we
do
this?
Well,
so
take
a
deep
breath.
A
A
Now
this
is
maybe
a
little
bit
hypothetical
and
and
virtual.
So
maybe
we
should
try
to
dive
into
some
code
and
see
how
this
would
be
put
together,
and
you
know
how
it
is
when
you,
when
you're
banging
your
head
against,
you
know
a
bunch
of
bugs
and
no
matter
how
much
chemicals
and
squating
you
apply
bugs
seem
to
be
still
crawling
out
of
the
woodwork.
So
sometimes
you
need
a
break
right
and
some
people
go
for
runs
actually
I
do
sometimes
too,
but
sometimes
you
just
want
to
make
something
simple.
A
You
know,
you
know,
put
the
work
aside,
make
something
simple,
so
you
actually
still
can
have
the
belief
of
accomplishing
something
in
code.
So
I
did
a
while
ago,
a
couple
of
weeks
ago
and
I
said
it
well,
I've
never
really
made
a
proof-of-work
minor
before
so.
I
kind
of
you
know
started
doing
that,
and
after
doing
that,
I
realized
hey.
This
might
be
a
pretty
good,
interesting
and
totally
useless.
Protocol
example
for
the
swarm
summit,
so
I
ended
up
making
this
protocol.
That
has
some
worker
notes
and
some
mutrah
notes.
A
The
moocher
notes
don't
want
to
work,
but
they
send
hashes
and
a
difficulty
to
the
worker
notes.
The
worker
node
does
its
job
and
sends
it
back,
and
this
is
kind
of
eminent
autonomous
people,
and
it's
also
what
I
wanted
to
do.
I
guess
is
to
have
some
sort
of
protocol
example
that
have
a
certain
level
of
complexity,
because
these
kind
of
ping
pong
or
very
very
simple
examples,
don't
really
tend
to
show
you
how
to
do
things
in
the
real
world.
A
It
was
p2p
protocol,
complex,
I,
think
and
how
to
start
how
to
start
describing
this
well,
and
we
could
of
course
go
and
just
quickly
take
a
look
at
this
minor
code.
There
is
just
a
small
you
give
it
you
give
it
bytes
slice,
you
give
it
a
difficulty,
it
does
to
work
if
it
times
out
or
within
a
certain
period
of
time,
if
it
doesn't
achieve
to
do
it
in
the
circuit
air
time
it
gives
up.
That's
basically
it
so.
A
A
So
this
is
kind
of
the
chorus
service
object,
describing
well
travelers
of
what
we're
offering
to
people.
We
have
some
worker
related
parens,
which
is
how
many
jobs
will
we
take?
How
many
jobs
do
have
currently?
What's
the
max
difficulty
we
want
to
accept,
and
how
is
how
much
time
do
you
want
to
spend
per
job?
Then
we
have
the
moochers.
Well,
I
mean
they
don't
need
many
parents,
because
just
sending
jobs
away
right.
So
we
have
a
way
of
storing.
Some
of
the
dates
are
the
results
and
the
requests
we
sent
so
yeah.
A
So
what
the
protocol
really
is
in
this
sense
right
the
protocol
object
and-
and
if
it's
just
a
collection
of
messages
which
are
structures,
data
structures
that
you
register
with
the
protocol
back-end
and
then
a
serious
handlers
to
these
messages.
That's
basically
what
it
is
and
defines
what
you
can
send
to
each
other,
so
the
message
types
we
have
and
this
protocol
is
skills,
which
means
what
difficulty
can
we
handle
and
what
does
the
large
the
size
of
data
that
we
like
to
to
offer
to
do
if
we'd
send
difficulty
zero?
A
We
don't
have
any
scale
are
mean
we're
a
moocher
right.
Then
we
have
the
request.
So
this
is
a
request
for
a
mining
job,
so
an
ID,
so
we
can
find
it
later
correlate
it
later.
The
data
you
want
to
mined
in
the
difficulty
and
the
result
is
the
ID
which
matches
the
request,
of
course,
nonce,
which
is
the
nonce.
You
have
to
have
concatenate
to
the
data
to
get
to
get
the
hash.
A
That
reflects
the
difficulty
and
the
hash
itself,
and
then
we
have
a
type
called
status
message,
which
is
just
you
know,
handles
different
states
of
the
protocol.
So
to
speak,
these
states
being
status
thanks
a
bunch
which
is
kind
of
an
AK
thing
for
for
received
which
to
request
your
sense
when
it
received
the
job
states
especi.
If
the
worker
can't
do
has
too
many
concurrent
jobs
status,
are
you
kidding
if
the
difficulties
too
high
and
state
just
gave
up
if
time
out
if
the
timeout
was
hit
for
the
sir
for
the
specific
job?
A
So
it's
just
interesting
because
that's
where
my
notes
end
actually,
but
let's
see
where
we
handle
these
messages,
so
then
we
have
analogous
to
all
the
analogous
to
all
the
message
types.
We
have
request
functions
that
actually
match
the
names
of
the
message.
Types.
Isn't
that
practical.
So
we
have
the
skill
skill
handler,
which
just
basically
adds
to
all
the
workers
or
all
the
all,
the
notes
that
we
know
out
there
which
difficulty
they
have
so
we
can
figure
out.
A
Who
can
we
send
work
to
then
we
have,
as
a
note
kind
of
like
a
worker
address
book
request
handler.
So
somebody
sends
us
a
request.
This
is
what
just
invoked
we
check.
Do
we
have
too
many
current
job
than
with
an
busy?
It's
the
difficulty
too
high,
and
then
we
say
difficulty
too
high
and
and
if
not,
then
we
try
to
mine
and
if
that
goes
successfully
we
send,
but
that
doesn't
help
go
successfully.
A
A
If
I
take
this
data
append
the
nonce
and
hash
it
does,
it
actually
match
the
difficulty
threshold
and
if
it
does
always
good,
we
send
status
thanks
a
bunch
to
the
node
and
unchosen
gratitude,
and
this
is
the
handler
for
the
different
statuses,
so
state
routes
thanks
a
bunch
we'll
get
into
that
a
bit
later
and
what
it
actually
means
status
for
busy
status.
Are
you
kidding?
Status
came
up,
so
that's
basically,
now
we
have
a
driver
file
running
this
stuff.
A
So
and
let's
see
now,
how
so
most
of
this
code
is
about
driving
the
simulation
framework
to
just
bring
up
a
bunch
of
notes,
start
to
the
protocol
and
then
today
do
their
magic
and
then,
after
some
time
it
just
brings
down
the
notes
and
everything
Hanks
and
the
the
worker
note.
There
is
only
one
in
this
case
we'll
you
know,
try
to
send
back,
but
oh
there's
nobody
to
send
back
to
and
what
happens
then.
I,
don't
think.
But
what's
interesting
is
how
do
we
define
the
service
right
so.
A
Yeah,
so
all
of
this
stuff
follow
this
explain
later
as
a
surprise,
nice
surprise
to
tying
everything
in
together,
but
yeah
this.
So
this
section
is
just
creating
the
service
itself
and
then
registering
that
service
with
the
node,
so
that
the
node
will
start
the
service
when
we,
when
we
run
now
what
I
showed
you
now
is
code
for
registering
this
protocol
on
the
dev
p2p
part,
not
the
PSS
part,
because
that
kind
of
a
simple
thing,
but
it's
also
to
illustrate
that
later
on.
A
How
easy
is
it
to
port
this
code
on
to
the
PSS
notes?
Okay,
so,
let's
run
it
so
can
just
write
it
like
this
I
think
yeah.
So
here
we
see
basically
result.
This
is
the
node
that
sent.
This
is
the
job
ID.
This
is
the
data.
This
is
the
difficulty.
This
is
the
nonce,
and
this
is
the
resulting
hat
and
with
nice,
a
collection
of
zeros
in
the
end
most
of
them
I
mean
we
can
also
take
a
look
at
what
goes
on
behind
the
scenes.
A
If
this
makes
any
sense
to
you,
while
it
flies
by
probably
doesn't
so
so
far
so
good
as
long
as
you
believe
me
that
this
is
not
a
trick
and-
and
you
know
it's
actually
doing
something
now
by
the
way
I
just
want
to
say
you
know,
I,
don't
expect
you
to
to
remember
this
code
after
the
talk.
So
of
course,
it's
available
on
this
big
internet
web
2
thing
I
think
even
terrible
afterwards,
you
can
have
a
look
at
it.
A
So
what
do
we
have
to
do
differently
for
PFS
now,
instead
of
so
before,
hang
on
I
can
do
this.
Can
I
yeah
so
before
we
had
the
demo
service
directly
right
that
we
registered
in
the
node
as
a
service?
Now,
here
it's
a
bit
different.
Now
we're
registering
the
swarm
service,
as
we
saw
before
because
of
the
cor
could
call
dependencies
right
and
let's
move
this
because
it's
too
big
kind
of
basically
the
same
thing
is
going
on.
A
Although
now
we
need
a
bit
a
few
more
parameters,
because
we
have
to
initialize
the
swarm
the
swarm
service
instead,
it
needs.
You
know
some
different
parameters
that
we
need
to
pass.
We
start
that
as
a
service
the
swarm
and
then
afterwards
we
register
this
protocol
as
a
PSS
protocol
for
call
and
in
a
method
that
the
BCC
service
exposes.
A
So
let's
take
a
look
at
what's
in
this
BCC
service
thing,
I'm
sure
you've
seen
all
of
this
before.
If
you
had
a
look
at
the
delicious
and
ever-changing
swarm,
slash,
swarm,
dot,
go
file
and
the
go
aetherium
repo.
You
have
seen
probably
most
of
this
before
so
it's
creating
a
private
key,
creating
the
Kadhim
lea.
A
Creating
the
local
store
yeah,
we
put
our
chunks
in
and
resource
handling,
which
will
be
a
delicious
team
later.
So,
let's
just
wait
for
that
for
now,
syncing
and
streaming,
which
is
spreading
the
chunks
around
and
then
the
PSF
service,
which
is
basically,
we
take
the
condemned,
Lea
and
put
it
in
there
and
some
other
parameters.
If
we
need
and
register
the
private
key
with
it,
and
then
we
start
the
BCC
protocol
itself
here
now.
What
does
this
register
PSS
protocol
do?
Well,
basically,
and
so
there
is
an
optional
module
in
the
PSS
folder.
A
You
can
choose
actually
to
compile
to
not
compile
it
into
the
code,
but
let's
say
for
argument's
sake
that
we
did,
and
this
defines
a
few
more
functions
that
you
could
use,
so
the
first
would
be
register
protocol,
which
is
what
takes
the
PSS
instance.
You
take
a
topic,
you
remember
the
thing
with
the
topics.
Well,
we
use
them
for
protocol
as
well.
Isn't
that
practical
aspect
witches
describe
certain
parameters
of
the
protocol,
namely
the
message
types
and
a
couple
of
other
things,
and
this.
A
And
then
we
have,
then
we
have
yeah.
This
is
for
just
this
control
stroke
for
really
that
we
add
the
PSS
service
to
a
map,
so
we
may
relate
to
know
how
to
retrieve
it.
It's
just
just
for
this
structure
so
and
then
extremely
important
is
that
we
register
the
handler
function
of
this
protocol
to
the
topic
in
PSS,
so
that
when
we
get
a
message
on
the
protocol,
some
code
will
actually
execute.
A
And
I
don't
know
if
you
believe
me,
but
this
is
kind
of
pretty
much
all
we
need
to
do
so.
As
you
see
we,
don't
we
don't
really
change
the
protocol
or
the
underlying
code
here
at
all.
It's
just
kind
of
how
we
wrap
it
in
time
together
that
so
that's
and
now
here
we
see
now.
This
is
the
call
for
when
we
start
the
swarm
node
api's
is
the
call
that
the
node
does
on
all
the
services
to
expose
api's.
A
So
this
is,
if
you
have
a
service
in
the
Goa
theorem
note,
this
will
be
called
for
all
services
right,
so
we
create
the
PSS
API.
We
append
the
bzip
eyes
and
the
PSS
service.
So
remember
what
I
told
this
map
where
we
you
know,
keep
these
sub
services
of
DFS.
Well,
they're
also
all
started
here
right.
So
here
we
have
the
dependency
node
swarm
and
then
all
of
this
stuff
is
executed.
You
know
in
here
article
order
and
pretty
much
the
same.
For
start.
We
have
VSS
service,
this
demo
service.
A
We
have
it
started
here,
it
stopped,
but
what
we
don't
have
we
don't
start
the
protocols
or
we
don't
execute
the
protocols
function
here
we
execute
only
the
PSS
protocols
function
because
the
PSS
protocols,
the
demo
protocol
of
the
demo
service,
is
registered
as
a
sub
protocol
of
PSS.
Not
of
swarm.
So
remember
this
messy
thing
with
the
arrows.
Do
you
remember
cool?
So
this
is
exactly
that
right.
This
is
at
the
bottom
and
those
two
others
ones.
Api
start
and
stop
are
I
further
up.
A
Guess
you're
pretty
dizzy.
Looking
at
this
start,
so
let's
just
run
it
so
now
we're
running
the
exactly
same
thing.
Basically,
but
it's
using
PSS
and
as
we
see
wow,
looks
pretty
good
to
me.
I,
don't
know
I,
don't
know
if
you
guys
can
calculate
this
in
their
head.
I
can't,
but
let's
trust
the
code
and
yeah
just
to
try
to
prove
to
you.
A
There
should
be
some
PSS,
okay,
let's
just
say
for
argument's
sake,
don't
you
believe
me.
I
probably
went
on
too
long
anyway
and
I
think
that
basically
wraps
it
up
kind
of
there
was
a
thing
with
this
yeah.
So
obviously,
this
code
builds
on
the
cutting-edge
development
branch
of
swarm.
That
being
still
the
branch
swarm
network
rewrite,
if
you
use
that.
A
This
is
where
you
can
find
these
code
examples,
but
also
some
other
code
examples,
some
more
basic,
even
a
more
basic
tutorial
of
general
node
service,
dev,
p2p
programming
and
the
serum
stuff,
and
also
a
couple
other
small
things.
A
low
level
EVM,
hacks
and
stuff
are
in
there
I
think,
and
this
is
how
to
contact
me,
but
I'm,
not
I'm,
not
that
social,
but
you
can
still
talk
to
me
here.
I
know
it
won't
run
away
or
or
punch
me
in
the
face
or
anything
like
that.
I
think.
That's
it.