DEV Community

Cover image for Monetize Your Content with the UDL
K for Fullstack Frontend

Posted on

Monetize Your Content with the UDL

Monetizing content online isn’t easy; companies give you a simple entry to get content on their platform but want a piece of your revenue, and sometimes they don’t even allow the type of content for various reasons. On the other hand, decentralized technology offers freedom from big corporations, but besides NFTs, it wasn’t simple to use for content monetization.

The Universal Data License (UDL) is about to change this! It’s a license and protocol specification that merges legal permissions and requirements with metadata of your content on Arweave. This way, content consumers know what they’re allowed to do with your content, if they need to pay you, and how to send you the money.

This tutorial will explain how to upload your media to Arweave and mark it with the correct UDL tags so people can pay you.

What is the UDL?

The UDL is a license that defines metadata, called “tags”, for content uploaded to a public permissionless blockchain network like Arweave. The license links these tags to different permissions, requirements, and payment information. You must use the tags correctly to attach your content with well-defined legal usage rights. The tags are programmatically accessible, allowing app creators to automate payments when using your content.

If you want to learn more about the UDL, check out my previous article!

How to Use the UDL to Monetize Your Content?

The UDL goes into effect when you mark your Arweave upload transactions with specific tags defined by the ANS-105 specification and the UDL itself.

Putting Your Content Under the UDL

First, you must add the "License" tag with the ID of the UDL transaction as value. This ensures the default permissions of the UDL (copy, display, make public) apply to the data you uploaded with that transaction. The distribution, commercial use, and creation of derivative work from your content is forbidden.

The following example contains the transaction ID for version 0.1 of the UDL:

{
  name: "License", 
  value: "yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8"
}
Enter fullscreen mode Exit fullscreen mode

When using the Arweave SDK for JavaScript, adding the "License" tag would look like this:

const tx = await arweave.createTransaction(
  {
    data: "Hello, world!",
    tags: [
      {
        name: "License",
        value: "yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8",
      },
    ],
  },
  key,
)
Enter fullscreen mode Exit fullscreen mode

Requiring Payment for Your Content

Next comes monetization. You need to add at least a "License-Fee" tag for this. The value has to start with "One-Time-" for a single payment, or "Monthly-" for a recurring payment, and end with the number of tokens you want for your work.

If you want a one-time payment of 5 tokens, you would add this tag:

{ name: "License-Fee", value: "One-Time-5" }
Enter fullscreen mode Exit fullscreen mode

For a recurring payment of 1 token, you would add this tag:

{ name: "License-Fee", value: "Monthly-1" }
Enter fullscreen mode Exit fullscreen mode

The default payment token is $U, but you can use the "Currency" tag to specify different tokens for payment.

The following tag will define the $AR token for payment:

{ name: "Currency", value: "AR" }
Enter fullscreen mode Exit fullscreen mode

You can also require currencies outside the Arweave network:

{ name: "Currency", value: "MATIC" }
Enter fullscreen mode Exit fullscreen mode

The default payment address you used to sign your transaction works because the default currency is also on the Arweave network. So, remember to add a "Payment-Addess" tag with an address compatible with your chosen currency.

Using an EVM-compatible address would look like this:

{
  name: "Payment-Address", 
  value: "0xE754B87d6efB5Ec4d5D3Fa02c12907e89Edb7731" 
}
Enter fullscreen mode Exit fullscreen mode

Paying Multiple Addresses

If multiple people should receive parts of the payment, you have to attach a profit-sharing token (PST) contract to the transaction. This contract manages shares of each person that should receive payments.

You can use the "Payment-Mode" tag to define how the tokens should be paid to each shareholder address in the PST contract. If this tag is missing, the payment goes to the address specified in the Payment-Address tag. If the payment address is also missing, the fee goes to the address that signed the transaction and uploaded the data.

This tag would distribute the payments randomly between the shareholder addresses, weighted by the fraction of their shares. It’s good for many small amounts to save transaction fees.

{ name: "Payment-Mode", value: "Random-Distribution" }
Enter fullscreen mode Exit fullscreen mode

This tag would require calculating the shares upfront and sending a payment transaction to each shareholder. It’s good when there are just a few big payments.

{ name: "Payment-Mode", value: "Global-Distribution" }
Enter fullscreen mode Exit fullscreen mode

Allowing Derivations and Requiring Profit Shares

If you want to allow people to use your content to create new works, you can use the "Derivation" tag. This is a nice way to collaborate with other creators and profit from their works by requiring you to put your name out or even getting part of the money they make by building on your content.

To grant someone permission but require them to credit you, add the following tag:

{ name: "Derivation", value: "Allowed-With-Credit" }
Enter fullscreen mode Exit fullscreen mode

To ensure the derivation uses the same license terms as the original work, add this tag:

{ name: "Derivation", value: "Allowed-With-License-Passthrough" }
Enter fullscreen mode Exit fullscreen mode

If you want to have a piece of the money the derivation makes, this tag is the way to go:

{ name: "Derivation", value: "Allowed-With-RevenueShare-25%" }
Enter fullscreen mode Exit fullscreen mode

You can change the percentage of course.

How to Upload UDL Licensed Content to Arweave?

The Bundlr Network is the easiest and fastest way to get your content on Arweave. Its SDK works directly in the browser, you can pay for uploads in your favorite crypto token, and uploads under 100 KB are free. So, let’s check out an example file upload with the UDL tags in JavaScript.

Installing Dependencies

To use Bundlr in your web app, you need to install it and its dependencies via NPM:

$ npm i ethers@^5.7.2 @bundlr-network/client@^0.11.0 filereader-stream@^2.0.0
Enter fullscreen mode Exit fullscreen mode

Ethers.js is just used to create a random wallet to sign the Bundlr upload, not for any payments.

Initializing the Bundlr Client

Next, you need to initialize the Bundlr client. For this, you must import the packages, create an anonymous address for signing the upload transaction, and use Node2 of the Bundlr Network because it allows free uploads.

import fileReaderStream from "filereader-stream"
import { Wallet } from "ethers"
import { WebBundlr } from "@bundlr-network/client"

const anonymousSigner = Wallet.createRandom()
const bundlr = new WebBundlr('https://node2.bundlr.network', 'ethereum', {
  getSigner: () => anonymousSigner,
})
Enter fullscreen mode Exit fullscreen mode

Uploading a File with UDL Tags

Now, we need to upload the file and use the correct tags. A basic upload function could look like this:

async function uploadUdlFile(file) {
  await bundlr.ready()
  const tx = await bundlr.upload(fileReaderStream(file), {
    tags: [
      { name: "Content-Type", value: file.type },
      {
        name: "License",
        value: "yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8",
      },
      { name: "License-Fee", value: "One-Time-1" },
      {
        name: "Payment-Address", 
        value: "COeA0-z-xyvgLFpmd-7wkdF1L2in1pNg2YT0CoG8BL9" 
      }      
    ],
  })
  return tx
}
Enter fullscreen mode Exit fullscreen mode

The file argument is a File object from a file input, and the fileReaderStream will convert it to a format supported by the Bundlr client.

Each file uploaded with this function will be tagged with the UDL license transaction ID and require a one-time payment of 1 $U token from each content consumer to the address value in the "Payment-Address" tag. Derivatives and commercial use are prohibited.

Filtering Transactions with UDL Tags

The exciting part for DApp developers is now to actually find the content that uses the UDL. For this, you can use the GraphQL API provided by Arweave gateways.

Popular endpoints are:

To filter transacitions by UDL, use the following query:

query {
  transactions(
    tags: [
      {
        name: "License"
        values: ["yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8"]
      }
    ]
  ) {
    edges {
      node {
        id
        tags {
          name
          value
        }
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The result will look something like this:

{
  "data": {
    "transactions": {
      "edges": [
        {
          "node": {
            "id": "NscTg8uL5I12QSf8_WmTKxsiH4LTknOwjw9cIsfnVTg",
            "tags": [
              {
                "name": "Content-Type",
                "value": "audio/mpeg"
              },
              {
                "name": "Title",
                "value": "lavender (demo)"
              },
              {
                "name": "Description",
                "value": "A beat I made in the days of the 2020 lockdown"
              },
              {
                "name": "License",
                "value": "yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8"
              },
              {
                "name": "Payment-Mode",
                "value": "Global-Distribution"
              }
            ]
          }
        },
        .
        . 
        .
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The id field contains the transaction ID. You can request the data that was uploaded with the transaction via a gateway, just append it to the root endpoint:

https://g8way.io/<TX_ID>
Enter fullscreen mode Exit fullscreen mode

If we take the ID from our example:

https://g8way.io/NscTg8uL5I12QSf8_WmTKxsiH4LTknOwjw9cIsfnVTg
Enter fullscreen mode Exit fullscreen mode




Summary

Monetizing your content is just a few tags away, thanks to the UDL. You simply tag your Arweave transactions and can be sure you have a solid legal standing to demand payments from content consumers.

Since the UDL is so flexible, it even helps you to manage other permissions, like for derivative work.

Arweave Community Hackathon

If you're excited about the UDL and want to build build on it right away, sign up for the Arweave Community Hackathon! You can win $25,000 in prize money and $10,000 dedicated to projects built with the UDL!

Top comments (5)

Collapse
 
derick1530 profile image
Derick Zihalirwa

Nice post

Collapse
 
kayis profile image
K

Hope it helps!

Collapse
 
derick1530 profile image
Derick Zihalirwa

Of course

Collapse
 
leondo profile image
Leon Do

and can be sure you have a solid legal standing to demand payments from content consumers.

Does this mean it requires a legal side? Can smartweave enforce?

And thank you for the article ☺️

Collapse
 
kayis profile image
K

I'd assume, you can enforce at least the automated payments in $AR or $U 🤔