Ready to get started using web3.storage? Get up and running in minutes by following this quickstart guide. In this guide, we'll walk through the following steps:
- Install the CLI.
- Create a Space to upload your files and register it with web3.storage.
- Upload a file.
- Get your uploaded file using your browser or curl.
18 or higher and npm version
7 or higher to complete this guide. Check your local versions like this:
node --version && npm --version > v18.17.1 > 7.18.1
Install the CLI from npm using your command line:
npm install -g @web3-storage/w3cli
You need to create a web3.storage account associated with an email address and set it up so you can start uploading to a Space. The Space is created locally and associated with a private key, and is then registered with web3.storage and associated with your email address. But don't worry about keeping track of the Space's private key! web3.storage's email authorization system allows this private key to be treated as a throwaway key.
w3 login [email protected]in the command line using your email address. This will sent an email to your inbox with a link for validation.
- Once you click on the validation link, you'll be taken to a webpage where you can select a plan (like our Starter tier).
- Create a new Space for storing your data and register it:
w3 space create Documents # pick a good name!
You can now upload a file or directory using the command line:
$ w3 up lets-go.txt 1 file 0.6KB ⁂ Stored 1 file ⁂ https://w3s.link/ipfs/bafybeib4ht2a53pttgipw6mgckqqhmgkifnmh2glzsju2c6ait5ibnkow4
The CLI content-addresses your files, packs them into 1 or more CAR files, and uploads them to web3.storage for indexing and inclusion in Filecoin storage deals. It will show an http gateway URL that includes the content CID (content identifier) of your upload e.g:
w3 will wrap files in a folder, so that their filename is preserved. They can then be accessed directly by adding their name in the URL path:
Your upload is now available over the public IPFS network using the content CID of your upload. The easiest way to fetch it is using the the link that
w3 up provided to the w3s.link gateway. w3s.link is optimized for content uploaded to web3.storage.
curl -L 'https://w3s.link/ipfs/bafybeib4ht2a53pttgipw6mgckqqhmgkifnmh2glzsju2c6ait5ibnkow4/lets-go.txt' ___. ________ __ __ _ __ ____ \_ |__ \_____ \ _______/ |_ ____ _______ _____ ____ ____ \ \/ \/ /_/ __ \ | __ \ _(__ < / ___/\ __\ / _ \ \_ __ \\__ \ / ___\ _/ __ \ \ / \ ___/ | \_\ \ / \ \___ \ | | ( <_> ) | | \/ / __ \_ / /_/ >\ ___/ \/\_/ \___ > |___ //______ / /\/____ > |__| \____/ |__| (____ / \___ / \___ > \/ \/ \/ \/ \/ \/ /_____/ \/
You can also fetch your content p2p style over bitswap with an IPFS implementation like
ipfs cat bafybeib4ht2a53pttgipw6mgckqqhmgkifnmh2glzsju2c6ait5ibnkow4/lets-go.txt ___. ________ __ __ _ __ ____ \_ |__ \_____ \ _______/ |_ ____ _______ _____ ____ ____ \ \/ \/ /_/ __ \ | __ \ _(__ < / ___/\ __\ / _ \ \_ __ \\__ \ / ___\ _/ __ \ \ / \ ___/ | \_\ \ / \ \___ \ | | ( <_> ) | | \/ / __ \_ / /_/ >\ ___/ \/\_/ \___ > |___ //______ / /\/____ > |__| \____/ |__| (____ / \___ / \___ > \/ \/ \/ \/ \/ \/ /_____/ \/
Congratulations! You've just covered the basics of web3.storage. To learn more, take a look at these useful resources:
- Read more about the power of UCANs and IPFS, and learn about the various options to integrate web3.storage with your application.
- Try out our image gallery example to see how easy it is to take advantage of these decentralized protocols using web3.storage.
- Visit the reference API section for more details on what else you can do with the web3.storage client and how to integrate it into your own projects.