The document discusses various web3 file storage options including IPFS, Filecoin, and Arweave, focusing on their decentralized nature and use cases for large data storage. It details the gas costs associated with data storage on Ethereum and explains how IPFS and Filecoin enable decentralized, tamper-resistant data retrieval while highlighting the benefits of Arweave for permanent data storage. Additionally, it covers practical implementations such as smart contracts integrated with IPFS for managing unique digital tokens.
LET’S CONVERT ITTO DOLLARS
AND CENTS
1 KB of data storage on Etherium: 788,268-73,032 = 715,236 Gas
Units
715,236 Gas Units = 715,236 Gwei (assuming that we set 1Gwei for
gas price)
1Gwei = 0.00001908 USD (as of 1/11/2020)
1KB Of storage: $0.00001908 * 715,236 = $ 13.64670288
(1/11/2020)
MERKLE TREE
• Everyleaf node is labelled with the
hash of a data block.
• Every non-leaf node is labelled with
the cryptographic hash of the labels
of its child nodes
12.
MERKLE DIERECT ACCYCLIC
GRAPH(DAG)
DAG data structure similar to a Merkle tree but
not so strict:
1. DAG does not need to be balanced
2. Non-leaf nodes are allowed to contain data
Merkle DAG enables uniquely identified,
tamper-resistant and permanently stored
data shared by network nodes.
DAG creates a foundation for Distributed
Hash Table
13.
IPFS PROPERTIES
With theDistributed Hash Table, nodes can store & share data
without central coordination
IPFS is Persistent Data Structure (nothing can be deleted)
Uploaded content is not guaranteed to persist on the network (all
participating nodes should consider participation a voluntary service)
14.
HOW TO STOREAND ACCESS FILES
ON IPFS?
Command line interface https://dist.ipfs.io/#go-ipfs
API https://docs.ipfs.io/reference/api/http/
Libraries for different languages, for example, NPM module for JavaScript:
https://www.npmjs.com/package/ipfs-api
Web Gateway, for example:
https://ipfs.io/ipfs/Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu
Direct support from the browser, for example:
ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wi
ki/Vincent_van_Gogh.html
IPFS Desktop application
FILECOIN Filecoin (⨎)is an open-source, public
cryptocurrency and digital payment
system intended to be a blockchain-based
cooperative digital storage and data
retrieval method.
The blockchain is based on both proof-
of-replication and proof-of-spacetime.
Filecoin aims to store data in a
decentralized manner, which is resistant
to problems that occur in centralized
storage. Due to Filecoin's decentralized
nature, it protects the integrity of data's
location making it easily retrievable and
hard to censor.
FILECOIN BENEFITS ANDUSE
CASES
A Storage Platform for NFTs (OpenSea)
Resilient to sensorship
Dependable Storage
Variable data
No need for API to store data for every provider
OpenSource
19.
LOTUS
Lotus is thereference
implementation for the Filecoin
network
lotus client import 5gb-filecoin-payload.bin
lotus client deal
lotus wallet list
lotus client retrieve --miner f07709
mAVWg5AIgFw51hfKzfy8nRsKHlMtT8/DPBJhn1f9eFyOS
eldlAiE output-file
20.
ARWEAVE CLAIMS
“Arweave enablesyou to store
documents and applications
forever”
“On top of the Arweave network lives the permaweb: a global, community-
owned web that anyone can contribute to or get paid to maintain”
“No more 404s. No more stealth edits. No more web apps that decline in
quality.”
ARDRIVE
ArDrive is basedon a one-time fee
for permanent use, and the storage
price is about $20 for 1G data
ArDrive is the storage client of Arweave
28.
SOME OF THEAPPLICATIONS TO
EXPLORE
Weavemail https://ubehghhbg2r5xglof2hplra2w44gehwxgyi5cqiy
eqo2q6yk7kha.arweave.net/oEhzHOE2o9uZbi6O9cQat
zhiHtc2EdFBGCQdqHsK-o4
Forum https://5vbgactgfkjm.arweave.net/3SMZ1RW2xGTBdTi
UznKrkTJTHtYtBs27wm0q2H58Jck#/forum/About%20t
he%20Forum
ArDrive https://ardrive.io/
MORE INFORMATION ABBOUT
ARWEAVEAND PERMAWEB
https://docs.arweave.org/info/
https://techcrunch.com/2019/11/05/how-arweave-permaweb-
works/
https://docs.arweave.org/info/mining/mining-guide
PUBLISHING TO IPFS
•How to publish files to
the IPFS node
• How to read objects
from IPFS node
41.
PUBLISH A FILE
leybzon@instance-1:~/go/bin$cd ~
leybzon@instance-1:~$ vi test.html
leybzon@instance-1:~$ ./go/bin/ipfs add -w test.html
added QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1zk
test.html
added QmeoBZA3ywRT5wEa6RBuHxF4qaKAK8qSxuxWCr4BpPzT2r 7 B
/ 7 B
[=========================================]
100.00%
42.
CHECK THAT THEFILE WAS
PUBLISHED LOCALLY
leybzon@instance-1:~/go/bin$ ./go/bin/ipfs object get
QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP5CcT1
zk{"Links":[],"Data":"u0008u0002u0012u0007testnnnu0018u0007"}u0
012u0007testnnnu0018u0007"}
43.
START IPFS DAEMON
leybzon@instance-2:~/go/bin$~/go/bin/ipfs daemon
Initializing daemon...go-ipfs version: 0.5.0-dev-049d3b0Repo version: 7
System version: amd64/linuxGolang version: go1.13.4
Swarm listening on /ip4/10.128.0.5/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/10.128.0.5/tcp/4001
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
44.
USE INFURA GATEWAYTO GET THE
OBJECT
leybzon@instance-1:~/go/bin$ curl
“https://ipfs.infura.io:5001/api/v0/cat?arg=QmTBJ2SCD5Jpkqu3eM6utx4yfviwHBNKGqFgfbP
5CcT1zk”
test
45.
SMART CONTRACT +
IPFS
•How to use IPFS objects in
Smart Contracts
• Creating ERC721 Smart
Contract
• Minting tokens connected
to IPFS objects
46.
ERC-721 NFT CONNECTEDTO DATA
IPFS
NFT Tokens are
Unique
Irreplaceable
Non-
interchngable
ERC721Full ERC721Mintable
ERC721
ERC721Enumerabl
e
ERC721Metadata
MyNFT
mint1()
mintUniqueTokenT
#12 https://en.wikipedia.org/wiki/Merkle_tree
every leaf node is labelled with the hash of a data block, and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes
#13 https://en.wikipedia.org/wiki/Merkle_tree
every leaf node is labelled with the hash of a data block, and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes
Image from https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSG4yZSyyw91ZphCLwGfIu2cyP3bD2GEu8uy2FQXX1vvFEvkQqn&s
#35 https://console.cloud.google.com/
https://console.cloud.google.com/compute/instances?project=pbs-network-test&instancessize=50
“Create Instance”
Select Ubuntu as boot disk