[Music]
hello my name is Connor and I am a
developer at consensus um I've been
working on a uh platform for having
threaded discussions that are difficult
to censor um they are built using
ethereum ipfs and
Whisper and I'm the first part of my
talk I'm going to explain how you could
use this as a a foundation for building
a decentralized Reddit really like an
ecosystem more than like one particular
app um and later I'll give a demo and
explain some more technical details um
so the working title right now is
nonsense like not easy to censor um and
why would we want a decentralized Reddit
so many people here probably uh Venture
into the r Bitcoin sometimes and have
noticed that they generally the
moderators receive a lot of heat for um
questionable uh moderation policies um
and I personally noticed that as the
community grew during the rise of
Bitcoin um that the quality of the
content on the Moder on the site
actually uh suffered more and more due
to the moderators um expressing their
own agendas so this even applies to um
to people who are uh deeply involved in
the Bitcoin space where we're not being
able to voice their their own uh
opinions so uh that that's one reason
but that that same uh thing applies to
pretty much any uh open public uh online
Forum uh you can you can see the same
ways that uh companies or investors or
corporations or uh organizations with
like legal agendas May uh censor certain
voices on on on the internet and uh I
think that that we should change the
Paradigm and and look for ways to have
uh censorship to be hard by default um
so how could you do this on ethereum uh
what I've built uses the the middle
pieces ipfs whisper and ethereum to to
structure a very basic U threaded
discussion system but one of the
benefits of building on a public
blockchain uh Julian alluded to this
earlier in the the game uh panel the
game uh developer panel uh that on
ethereum it's it's unrestricted for any
third party to build services on top of
uh content that is on the blockchain or
on ipfs and and so that is that is one
way I I could definitely see uh a Reddit
type of ecosystem developing serving see
all of these pieces uh permissions
moderation notification search and and
so on are currently done by uh the the
centralized Reddit or Facebook or
Twitter organizations and uh on ethereum
we can actually have competing services
in each of those areas uh offering
different uh services for a uh
discussion platform so the colors mean
just briefly that the blue is like stuff
that has to be on Shain and trustless
and you have to pay for it but the the
purple is a combination of onchain and
or offchain or both and uh ipfs swarm
whisper notifications are offchain
services that could be provided um so
that's that's how I see that evolving
um I I'll go ahead and talk about what
I'm what I built and how um onchain
storage works so there's two ways you
could do this uh one is
with contract structs uh that we all
know and love but the other way is logs
and I'll describe the trade-offs between
those so for onchain storage uh
basically there's two two methods that
are important add and edit when you add
a a post you are designating a parent
that that post will be referenced to as
a child um and a string of data which
could be anything I like I like using
strings there because they could be a
ipfs hash a URL or uh potentially just
raw text so then uh the the that will
create a struct which will be saved in
this array right here um it it just
expands uh with each new post and that
that index of the array is implicitly
the ID of the post which is used in this
mapping of uh post to children and edit
is is a method I wanted to add so um if
you if you submit a post you can you can
edit the content of it if you are the
owner and so that is checked from this
address uh and I'll go through the the
other data types so we have uh two U for
for timestamps for when the post is
created and when it is edited um we also
have a number of children which makes
lookups easy if you're looking up an
array you you would like to know how big
it is um you don't want to look up 10 if
there's only two objects in in the
children uh and then the data type so uh
just to point out something uh I wanted
to cast these to un 32s they're U on the
as environment variables to contracts
and would make sense to store time
stamps as un and I was able to save a
storage slot by doing that but it does
limit me to uh to 90 years so maybe
you'd want to go with un 40s but um
that's worth considering if you're
developer also uh yeah I already
mentioned data strings are very flexible
uh so what's what's the upside of events
why would you use events instead of uh
stru
events are much cheaper they um they
require uh a lot less gas to use they're
pended only logs and uh the the other
upside is that they're very light client
friendly so the the downside of using a
a log though is that they're more
difficult to edit so you with the the
struct for posts it you you store the
owner in one of the fields and the
contract can look that up and verify
that only the the message sender that
equals that owner can actually change
the data but for uh a post event or log
uh the contract doesn't have any way to
read the the data from from past log so
it can't verify uh that the message
sender is equal to the owner of a
particular log so what you can do maybe
to get around this is have an event for
editing and let the front end uh filter
through the the edits to to find the
ones where the owner matches the
original log ID but um that that that
seems a little bit annoying and uh it
just kind of depends I guess on what
your use case is if you're an
application that doesn't want to allow
edits then logs would probably be the
way to go if if you do want to allow
them you you may have to consider the
trade-offs there post count is necessary
here so that each each event would have
its own
ID um right and those are the guas cost
trade-offs for logs versus uh s stores
uh where each log is uh 375 plus 375 per
topic which I think you can go up to
three or four topics and then eight gas
per
bite all right so I'll show you a very
Alpha demo of of what I've built so far
um this is a video so we'll start by
adding a couple of accounts that I
already generated with these seeds that
uh I was able to get using uh cooworker
Christian lonquist Library e Das light
wallet um so this is how you would
create one in the app um but I'll just
go ahead and import an existing one uh
these seeds have been pre-loaded with
some ether I'll add a password to uh to
encrypt them in my browser so I can uh
unencrypt them when I need to sign
transactions and you can see my initials
CK under the accounts um comes from the
the uport Persona schema that's saved an
ipfs I I use that to associate names and
images with ether
addresses so we'll add the the second
account to demonstrate one without a
Persona and you'll see see that in in
the next videos so that is adding an
account um and this is the identity
schema for um the ort uh where we have
name and content URL are really the the
important Fields there but but this is
cool because it's just a a Json so you
could add other schemas for different
use cases and they they could all be
derived from one the same ether address
um so now I'll create a couple
threads right so I'll use my my named
account and write an enter in a thread
name this is going to use a string data
type so I found the exact gas cost per
character count on the right you'll see
that transaction price increases with
each character that I add so this is
going to be half a Cent and I'll make a
random one and a meta one and this
bubble on the left means that the
transaction is pending it hasn't been
received in a block real quick I'll do a
Refresh on the browser just to prove
that I keep that data around associated
with the transaction before it gets
received in Block so um that tends to be
something that users like to do when
they don't understand what's going on
they'll refresh the page and and if I
don't if it's just blank because the the
data is not on chain yet then uh I
wanted to prevented that scenario so
it'll get received and I have uh another
method that that you can use to wrap
components that that use that mechanism
for TR tracking State uh to to determine
based on the current block which which
they'll all they'll receive as it
updates what the the percentage of
confirmation is given some confirm count
so this will this will increment up to
um the height of the div and I'll just
skip through so this is that utility I
mentioned it it it's a way to keep track
of transaction State um you add
transaction hashes and you associate
some data with those hashes and you can
filter through uh that data to match
those transactions to components on your
front end and select to receive any
updates from these St from transactions
that match that filter um so for this
I'm just using pending and received but
the arrows indicate the different
directions that those transitions can
happen um and that's that's been really
helpful so let's do um some chat and
comment
example so we'll go into the random
thread and with the CK account we'll
write some uh yeah so this is 7 cents at
current cost so yeah first post um sign
the transaction and it will do the same
thing and you see uh a picture that's
associated with that account there um
and now we're going to send a whisper
message while that's waiting to get
received in Block because this is much
faster and it's free so some people
might find a use for that um if they if
they don't have any ether or don't want
their message to live forever so I'll
demonstrate how this wizzywig editor can
can throw in some arbitrary
HTML that my front end will uh will
sanitize when it picks it up and I'll
also add um an array of files just one
for this demo but you can add multiple
um you can rename the file name add a
description to the Moon um and so you
actually also sign these whisper
messages with your same uh light wallet
accounts so that signature gets appended
to the payload so the front end can
derive the The Ether address of the
sender otherwise it's it's stored on the
client it's not really usable for for
these types of apps so I switch accounts
I'm going to reply very cool I'm going
to save this and you see how there's a
jenton associated with that because it
doesn't have a Persona and I just saved
the other accounts whisper message into
ipfs and stored that that ipfs hash on
chain and the front end was able to to
figure that out that that this was a
whisper object looks at the signature
deres the sender address and uses CK as
the as the center of that comments even
though even though 3 1 D is the owner of
of that post
object um
so yeah offer a thank you and that's
pretty much the meat of this the the
rest is I'll just go through and show
that you can chat and comment on on any
of these uh onchain posts or whisper
messages but uh yeah so we'll move
on this is a schema of the ipfs content
that I save pretty straightforward just
an HTML string and an array of uh file
descriptions uh and IP Fest hashes and
then on the right is the whisper object
that I've modified a little bit uh with
the signature recovery pram and the hash
uh the topic that I use for whisper is a
hash of the the contract address and the
post ID that you're whispering
to and these are the libraries that I Ed
that that were really helpful for me
obviously web 3 um the the ipfs teams I
know IPS API exposes pretty much every
ipfs command to http so that was really
helpful hooked web 3 provider Tim couter
wrote uh it's a super easy way to sign
transactions in your browser uh E Light
wallet um is what Christian wrote and
that's uh a key store and man key
manager for for signing transactions
those that and hooked web 3 go go really
easily together um and then finally
reflex TX is the transaction manager I
wrote um so that's all if there are any
questions I have uh
few minutes two
minutes yeah we have time for one
question so I think one of the bigger
problems with Reddit and any tread is
the the matter of how do you get
reputation how do you count Karma or in
any sort of system on how do how do you
fight spam while keeping good content to
on the top how do you want how do you
plan to solve that in a system where
without having single single user single
person yeah so I think uh that is a
really hard problem and uh I don't claim
to know the answer but I I think that we
should all anybody interested should
should try to build something like that
and and I'd Advocate using some of these
tools to do so um I'll also be working
on
that unfortunately we do not have any
more time for questions thank you so
much Conor and your decentralized
[Music]