Fireship · @fireship
I built a decentralized chat dapp // GUN web3 Tutorial
Uploaded August 31, 2021 · Length 10:47
Summary
Building a decentralized chat app using GUN web3 technology, similar to YouTube super chat, with user authentication and group chat functionality.
- decentralized chat app
- gun web3 tutorial
- user authentication
- group chat
- web3 development
- blockchain alternative
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
i recently built a chat app that can
- 0:01
handle thousands of messages per second
- 0:03
scales around the world and cost me
- 0:05
nothing to run but the real weird thing
- 0:07
about it is that the data and
- 0:08
infrastructure is not controlled by a
- 0:10
big tech company instead it's
- 0:12
decentralized across the entire user
- 0:14
base using web technologies in fact you
- 0:16
can chat with me right now on the live
- 0:18
demo by going to gunchatdap.web.app
- 0:21
again that's
- 0:22
gunchatdap.web.app and i'm trusting you
- 0:24
not to hack it to pieces this time in
- 0:26
today's video we'll build a
- 0:27
decentralized chat app or dap if you
- 0:29
prefer similar to youtube super chat
- 0:32
using a library called gun js in the
- 0:34
process you'll learn about the benefits
- 0:36
of building a decentralized app along
- 0:38
with the weird trade-offs and challenges
- 0:40
for the front end ui we'll use svelt a
- 0:42
javascript library that's not sponsored
- 0:44
by big tech if you're new here like and
- 0:45
subscribe and you'll find the full
- 0:47
source code on github then i want to
- 0:48
give a shout out to mark nadal the
- 0:50
creator of gun js who donated a bunch of
- 0:53
his time to answer all my questions and
- 0:54
help make this video happen before we
- 0:56
jump into the code let's first answer
- 0:58
the question of how does this thing
- 1:00
actually work i made a short video about
- 1:02
gun js a few weeks ago and you guys had
- 1:04
a ton of questions about it at a high
- 1:06
level gun js is a decentralized graph
- 1:08
database a normal database would store
- 1:10
all of your data in a hard disk
- 1:12
somewhere in the cloud it may be sharded
- 1:14
across multiple machines but for all
- 1:15
intents and purposes you can imagine
- 1:17
your entire data set on a single disk
- 1:19
gun on the other hand stores a small
- 1:21
subset of data on each user based on the
- 1:24
actual data that they consume in the
- 1:26
application when a user makes a query
- 1:28
for some data it will search across the
- 1:30
network for other users that have that
- 1:31
data and sync it up using technologies
- 1:34
like webrtc so you can think of the
- 1:36
entire database as the union of all
- 1:38
peers on the network the idea is very
- 1:40
similar to a blockchain ledger where no
- 1:42
one individual has control of the entire
- 1:44
network but it's important to point out
- 1:46
that this is not blockchain technology
- 1:48
which tends to be too slow and just
- 1:50
unnecessary to build something like a
- 1:52
super chat however it does rely heavily
- 1:54
on cryptography to implement things like
- 1:56
user authentication when you create a
- 1:58
new user account a cryptographically


