Skip to main content

Creating CDN Resources

What are CDN Resources?

In Media Network, a CDN Resource refers to an on-chain record created by the user. It is a JSON-encrypted object that includes details about an origin server, such as its URL, path, and port. Additionally, it may contain user-defined metadata like a label, and advanced settings such as cache expiration time and other custom headers.

Transitioning from creation to utilization, these CDN Resources serve as the basis for negotiations with service providers. The encrypted data is securely recorded on the blockchain within the Media Protocol's Resources contract, ensuring the information is tamper-proof and persistently accessible.

Managing these resources is streamlined through the Media Network interface, offering users a seamless experience. Each resource you create is encrypted with a unique password, generated by the client, then encrypted with the public keys of the client, and also with the public keys of the providers once the resource is assigned to them. This ensures that only the client and the providers can decrypt the resource.

Learn more

Media Protocol's Resources Contract Technical Reference click here.

Creating resources

Prerequisites

  • You must be connected to the Media Network website with a wallet.
  • Have enough native balance in your wallet to cover the transaction fees of the chosen network.

Example Case

Suppose you've deployed your blog to Vercel at this example URL: https://next-blog-starter.vercel.app/ and are ready to decentralize its hosting.

In this case, you'd enter https://next-blog-starter.vercel.app/ in the Origin URL field, then click the Add Resource button, which will require you to sign a transaction on your selected blockchain.

Upon confirmation of the transaction, the new resource is ready and now you can select offers from the CDN Marketplace to attach the resource to one or more CDN providers.

After assigning your resource to a provider, new endpoint(s) for your resource are generated on their end. You can use these new URL(s) from your provider(s) to access your blog.

You can also access all your assets at any path of your origin from the new endpoint, which will look similar to this: https://<1_2_3>.<Provider.com>/path/to/file.jpg.


Step by Step Guide

Path: /client/cdn-resources

Client DashboardClient Dashboard

On this section you can create CDN Resources on your selected blockchain for further utilization within the Media Network.

Completing the form

Resource Label: A vanity name for identifying the resource.

Origin URL: IP address or domain. (can include PATH)

Protocol: http or https.

Custom Port: The origin custom port. Ports 80 for http and 443 for https are set by default.

Completing the formCompleting the form

Submitting the form

Once all the data is entered, we can click on "Add Resource," which will open the connected wallet and will require you to provide your public encryption key and to have enough native balance to pay for the transaction.

Submitting the formSubmitting the form

Resources List

In the same URL (/client/cdn-resources), on the left side on Desktop and in a general view on Mobile, all the resources we create will be displayed.

First ResourceFirst Resource

If you click on the "Resource Label", it will expand to show the "Resource Origin" and the current deals (what we will see later) for that specific resource. Additionally, by clicking on the icon with three dots, you can access all available settings.

Resource Settings

  • Overview: Configure the basic settings for your CDN resource, such as its label, origin and path, protocol, and custom port if necessary.
Overview TabOverview Tab
  • Advanced: Modify your CDN resource's advanced settings, including expiration time, custom headers or delete resource.
Advanced TabAdvanced Tab
  • Cache: Initiate the removal of cached content from your providers.
Cache TabCache Tab
  • Providers: Monitor the current status of deals.
Providers TabProviders Tab

This image represents a capture of a resource that has been assigned deals.

If your resource is new, it will not have any deals assigned to it yet, as you still need to explore the market to find a provider with a suitable CDN offer for your Resource. You can see this process on the CDN Marketplace.