πΈ I created the world's most unstoppable website using Decentralized Storage.
After T-Cash got banned, I wanted to answer the following:
"How can I make a website as resilient as a smart contract?"
Here is how we did it π
And if you'd like, we go over how to do this on the ChainDev YouTube channel!
My editing is getting too clean.
Anyways...
π€ We took the following approach:
- Step 1: Create a simple static website
- Step 2: Host the data using multiple different dStorage (decentralized storage) solutions
- Step 3: Create a single canonical location that shows where each website is on each dStorage platform
πΌοΈ Step 1
We could have used a static site generator or raw HTML/JS/CSS, but we decided to use @nextjs to show that it works with more complicated frameworks.
And we created a minimal site that points to @LilyPad_Web3.
Feast your eyes on its unstoppableness.
π¦ Step 2: Host it; Attempt ETH
And we created a minimal site that points to @LilyPad_Web3, a discord for helping people join web3.
Feast your eyes on its unstoppableness.
- Do we dump the files and folders into string variables in a smart contract?
- Do we do something with NFTs?
- Is there a better way?
A data URL is where all the data for your site is encoded in the URL, and your browser decodes it. Here is an example, stick this into your address bar!
You'll see this, and it doesn't need to read from any centralized server! How perfect!
π We can do this with HTML as well, however, if your site is large enough, your data URL will also get quite large...
Our site's data URI is so big, it won't even register as a link on a markdown file in GitHub.
πΈ So saving this on-chain was going to get... expensive. Even after switching to @arbitrum as an L2 solution, that massive hunk of data would have cost around $200 to store on-chain.
So, we decided not to do that, but to just store SOMETHING on-chain, as a crude workaround, we NFT'd a crappy SVG of the site and stored it on-chain.
Storing data on Arweave might be the easiest for EVM devs to understand. You deploy data in a transaction, which is saved to the blockchain forever.
This explains why the blockchain is 113 TBs and counting.
I ended up having to do some website flattening (I should have tried the data URI method), but I was able to use Arkb (a sort of @AlchemyPlatform for Arweave node-as-a-service) to push a transaction (after buying some Arweave token to pay the node ops) with my site.
If you hit the link at the "Data" section, it'll bring you to a gateway to help view the data stored on-chain, and it's indeed our site!
𧱠A note on scaling
My first thought when I saw the architecture of Arweave was "holy shit, there is no way that will scale. It's over 100TB in less than 4ish years?"
Going through the Arweave docs and speaking with @samecwilliams I calmed down a little, as they have some clever mechanics so you don't need the whole chain to run a node, and the group has done a lot of research into Moore's Law (data gets cheaper over time).
@Sia__Foundation and @Filecoin groups, however, don't share this sentiment. In comparison, Arweave ensures data persistence by adding to their chain (Blockchain-based data persistence) these two turn storing data into a marketplace (contract-based data persistence).
π’ Sia (And Skynet)
Sia doesn't store all the data on-chain, instead, the blockchain facilitates agreements between "hosts" and "renters", and the blockchain stores the agreement's details.
- Sia Node: Hosts contracts
- Sia Renter: Asks nodes to store their data
- Sia Hosts: Store data
So, we looked to ask some renters to host our website!
After buying some Siacoin (to pay the hosts and node ops), I went to spin up a Sia node myself, and WOW was it one of the easiest blockchains I've ever synced.
Sia comes with a UI for its blockchain and get this... The whole chain is only 40 GBs big. π€―
This makes sense, as the chain itself only holds the contracts.
So, we uploaded our website to sia (via our own node!) and boom! But... wait why can't others see it?
π The Sia blockchain is built with data privacy in mind and encrypts and splits your data before siding it out to hosts, so they can't see what they are hosting. This means the hosts can't cherry-pick what kinds of data they are hosting, since they have no idea!
But, this means, only the one with the private key can see this data, so how can others see our site? Well... They can't read it off Sia.
This is where @SkynetLabs would have come in, but they shut down recently.
π€ Skynet (not the killer robots) was aimed to be a decentralized node-as-a-service for Sia. You can still run a portal that helps people via Sia data, but the data has to be stored with whoever runs the Skynet portal, and is centralized.
To test it, I uploaded my site to a Skynet portal (@lumeweb3), which was easy... but yes, centralized.
If we wanted an internal website like an intranet, Sia would be a great option.
π΅ Filecoin (& IPFS)
Filecoin is similar in theory to Sia:
- Contract-based data persistence
- Encrypted Data
- Challenges hosts (Storage Providers on Filecoin) to make sure they have the data
The Filecoin chain is much bigger than the Sia chain, as it's focused more on being an "arctic storage" for data, like a "cold-wallet" but for data.
I did run a Filecoin node myself, but found it much easier to use a centralized 3rd party to help me store the data (thanks @Web3Storage).
Filecoin has the same issue Sia has with all the data being encrypted (which is normally a good thing, just not if you want to host a public site). So I figured there would be an IPFS integration.
IPFS is a peer-to-peer network that is LOVELY for sharing files in a distributed way. You upload a piece of data and get a hash that anyone else with an IPFS node can get the data for. Except, data only stays as long as people optionally keep (pin) the data.
There is no incentive like Sia, Arweave, or Filecoin for them to keep the data.
I was thinking Filecoin was the solution, but Filecoin doesn't have a mechanism to incentivize people to KEEP pinning stuff to IPFS.
π Dear Filecoin product managers/devs,
Please add an option to have the Filecoin nodes incentivized to pin their data to IPFS.
Thank You
I still uploaded my site to my own IPFS node as well, you can see that here.
And the last step, was to use @ensdomains to record all the different dStorage platforms and hashes my site was on, so anyone can reference the contract to see the redundant locations.
@ensdomains I registered unstoppablefrog.eth, so if you have an IPFS-compatible browser, you can go there to see the data.
1. You have zero talent. You will think you are "good at things," but you are not. Anyone can GET good at anything, but you have to work hard to get there. Others will be better than you at the start. That's ok.
2. Consistency is a hell of a drug.
In order to get good at something, you must fall in love with the process and work at it every day. Something that seems impossible will become possible if you work at it every day.
3. Radical Candor is challenging your peers while being empathetic.
This constructive discourse is how we push each other to be better, and it is the nicest thing you can do for someone. You will always want to complement people, but sometimes, that is harmful if not true.
This course is for anyone and everyone who wants to:
- Make web3 safer
- Become a top 1% smart contract dev (avg. salary $150k)
- Become a solo auditor
- Get hired at a security firm (avg. salary $125k)
- Become a bug hunter (up to million-dollar payouts)
Imagine being able to send ETH to your friend cross chains without anyone knowing:
- what token
- to whom the tx goes
- from whom
And also encrypt a message telling them βIβm old enough to get into the barβ
I just had a crazy interview with Mind Network, highlights here π
1. Mind Lake
Using Zero Knowledge Proofs and Fully Homomorphic Encryption (will explain soon) you can store data in a zero knowledge fashion into their Mind Lake network.
- medical information
- financial info
- personal info
- if youβre old enough to slam a pint of beer
For those in the back, zero knowledge proofs have the ability to answer the validity of a statement without giving out additional information.
For example, telling a bouncer at a bar youβre old enough to drink without telling them exactly how old you are.