What is Saturn
Run a Node
Use Saturn Network
Fetch From Saturn
There are three way you can fetch from Saturn.
In order to fetch files directly into your browser from the Saturn network, you will need to add the Saturn Browser Client to your website.
When you request a CID from the the Saturn network, it serves a CAR file back to your browser. The Saturn Browser Client is a service worker that intercepts responses to your browser to do some checks on the client side. It incrementally verifies the CAR file to make sure you are receiving the correct file. Then it converts the CAR file bytes in flat file bytes so that your browser can interpret them. The reason why Saturn serves CAR files is because they are verifiable, which is a requirement when retrieving content in a trustless manner from community hosted Saturn Nodes.
Adding the Browser Client to your website
To install the service worker, you will need to take the following two steps.
- Add the following script tag to the
<script async src="https://saturn.tech/widget.js">
- Host the service worker file from the root path of your website's domain. For example, if your website is https://example.com, host the service worker file at https://example.com/saturn-sw.js. The service worker file can be found at https://saturn.tech/saturn-sw.js
In order to retrieve from Saturn from a server, the Saturn team is working on a client library called Caboose. Caboose chooses which Saturn L1 node to contact, makes the request and then incrementally verifies the response. This codebase will soon be ready for use in your applications.
If you do not wish to verify the responses from Saturn on your client, and instead trust the server to provide the correct files, then you can opt for a slower and more expensive gateway retrieval. Certain gateways are now using Saturn under the hood such as ipfs.io and dweb.link. See this page for a list of IPFS Gateways and their capabilities.