Monetize Your Content with the UDL
Tags: web3, arweave, crypto
Published: 2023-07-25 11:01:32

---
title: Monetize Your Content with the UDL
published: true
description: How to use the Universal Data License to monetize your content on Arweave
tags: web3, arweave, crypto
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5dm0zatgdmzxjp8nmivo.jpg
---

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](https://mirror.xyz/0x64eA438bd2784F2C52a9095Ec0F6158f847182d9/AjNBmiD4A4Sw-ouV9YtCO6RCq0uXXcGwVJMB5cdfbhE) (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!](https://dev.to/fllstck/the-universal-data-license-explained-2di)

## 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](https://specs.arweave.dev/#/view/A4LY2jdTKpIrJ9kkRfcpSg1ozm7L75jd32rwQdW1-x0) and [the UDL itself](https://g8way.io/yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8).

### 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:

```javascript
{
  name: "License", 
  value: "yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8"
}
```

When using [the Arweave SDK for JavaScript](https://www.npmjs.com/package/arweave), adding the "License" tag would look like this:

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

### 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:

```javascript
{ name: "License-Fee", value: "One-Time-5" }
```

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

```javascript
{ name: "License-Fee", value: "Monthly-1" }
```

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:

```javascript
{ name: "Currency", value: "AR" }
```

You can also require currencies outside the Arweave network:

```javascript
{ name: "Currency", value: "MATIC" }
```

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:

```javascript
{
  name: "Payment-Address", 
  value: "0xE754B87d6efB5Ec4d5D3Fa02c12907e89Edb7731" 
}
```

### 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.

```javascript
{ name: "Payment-Mode", value: "Random-Distribution" }
```

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.

```javascript
{ name: "Payment-Mode", value: "Global-Distribution" }
```

### 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:

```javascript
{ name: "Derivation", value: "Allowed-With-Credit" }
```

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

```javascript
{ name: "Derivation", value: "Allowed-With-License-Passthrough" }
```

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

```javascript
{ name: "Derivation", value: "Allowed-With-RevenueShare-25%" }
```

You can change the percentage of course.

## How to Upload UDL Licensed Content to Arweave?

[The Bundlr Network](https://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

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.

```javascript
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,
})
```

### 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:

```javascript
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
}
```

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](https://gql-guide.vercel.app/).

Popular endpoints are:

- https://g8way.io/graphql
- https://arweave.dev/graphql

To filter transacitions by UDL, use the following query:

```graphql
query {
  transactions(
    tags: [
      {
        name: "License"
        values: ["yRj4a5KMctX_uOmKWCFJIjmY8DeJcusVk6-HzLiM_t8"]
      }
    ]
  ) {
    edges {
      node {
        id
        tags {
          name
          value
        }
      }
    }
  }
}
```

The result will look something like this:

```json
{
  "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"
              }
            ]
          }
        },
        .
        . 
        .
      ]
    }
  }
}
```

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>

If we take the ID from our example:

    https://g8way.io/NscTg8uL5I12QSf8_WmTKxsiH4LTknOwjw9cIsfnVTg

## 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qjtew0g9rs5cnhcgpg1k.jpg)](https://arweavehub.com/#/hackathon)

**If you're excited about the UDL and want to build build on it right away, [sign up for the Arweave Community Hackathon!](https://arweavehub.com/#/hackathon) You can win $25,000 in prize money and $10,000 dedicated to projects built with the UDL!**