Developing on Skynet

The resources can get you started developing with Skynet.

Why Develop on Skynet?

Skynet offers several advantages to developers:

  • Developers don't have to manage or pay for any infrastructure

  • Once deployed, applications are independent and need no further caretaking by the developer

  • Application data is user-controlled, available across applications, so your application can utilize pre-existing user information instead of starting from scratch.

  • You'll be able to monetize your application without the use of advertising

Our proper "Developer's Guide" is still being worked on. In the meantime, here is a quick overview along with links to various resources. If you haven't already, read through the Getting Started section to better understand how Skynet works.

Getting Started

To get started, create a folder with an index.html file in it and all css and javascript linked with relative paths. Visit http://siasky.net/, select "Do you want to upload an entire directory?" then upload the directory.

This works for static sites, along with client-side rendered Single Page Applications. Check out our Skynet Workshop for a more in-depth walkthrough.

Using create-react-app? Add "homepage": "." to your package.json before you build, then just upload your build folder!

skynet-js [email protected] with MySky and DACs

We just release major new features and breaking changes in our skynet-js SDK. As we get the documentation together for the new features and breaking changes, you can start learning using these resources.

MySky and DAC iframe relationship to Host App

Tools and Resources

Official Documentation and SDKs

SDKs marked with * above are not fully implemented – only skynet-js implements SkyDB and is our recommended SDK for the time being.

Guides and Walkthroughs

Deployment Tooling

  • skynet-cli – Great tool for uploading directories from the command line.

  • Deploy to Skynet Github Action – Github action that deploys a directory to Skynet and comments on pull request with a skylink url. See Automated deployments on Skynet for using with Handshake.

  • Upload2Cloud – Windows Explorer integration for sending files and directories to Skynet. Python script available.

  • Vue CLI Deployment Plugin – Vue UI based tool for site upload with auto Namebase/Handshake updates

  • SkyDeploy – Command-Line Tool for easily deploying web apps on Skynet and setting the skyns records to point your HNS domain to the new version

Community SDKs & Initiatives

  • py-skydb – Python Wrapper that you can use to interact with SkyDB portals

  • Skynet SDK for Dart – Use Sia Skynet and SkyDB in your Dart and Flutter projects

  • Skystandards – a proposal for data standards to be adopted in Skynet applications in such a way that users can share and use their data in different Skynet apps

Is Skynet the right platform for my website/app?

If your website is structured to be client-side, then hosting it on Skynet is straightforward. If not, it is likely your website will need to reconsider some parts of its architecture to be fully-functional on Skynet.

So, if you use Create React App or Gatsby, deploying to Skynet is as easy as uploading the folder of your production build. If you use a server-side backend like ExpressJS or a CMS like Django or Wordpress, these parts of your website cannot be run on Skynet. You can, however, host your html, css and javascript code on Skynet with your server API elsewhere, but that's not really a decentralized application and isn't what we'd call a skapp.

If you're considering developing on Skynet, take a look at the Getting Started section to learn some basics or reach out on our Discord server in the #skynet or #app-dev channels.

Best Practices

Many of these will be incorporated into our Developer Guide, but in the meantime, some things to keep in mind:

  • For skapps, it's best to use and link URLs that are a subdomain of the portal domain. That means either using an HNS name as a subdomain like <skapp>.hns.siasky.net or a Base32-encoded subdomain.

  • If linking to code on Skynet, you should use immutable skylinks when possible so that later updates don't risk breaking your code.

  • To be a proper "skapp," your application shouldn't be relying on external, centralized services to function. This means external requests to APIs for on-network storage or computation that would make your skapp's data not interoperable with other skapps.

  • Do not hardcode a specific portal domain into your code! This can be helpful for local development, but be sure to remove this before deploying to Skynet, so that the code isn't forced to use a portal other than the one it is being served from.