> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formless.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Song Smart Contract

> Create a Pay-For-Access (PFA) smart contract for a song on the blockchain

Create a PFA (Pay-For-Access) smart contract for a song on the blockchain. PFA stands for "Pay-For-Access". It represents a song that is available for sale on the SHARE protocol. Unlike NFTs where ownership of a collectible is transferred, PFA contracts grant users access to content while keeping ownership of the contract with the creator, similar to mechanical royalties.

## Song Contract Example

To create a song contract, set the `revenue_source.product.type` to `"pfa"` and include `pay_for_access_metadata`:

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "contracts_create",
    "params": {
        "type": "digital_property_with_revenue_share",
        "network": "base",
        "title": "Test Song",
        "description": "Test Song",
        "creator_name": "Test User",
        "revenue_source": {
            "product": {
                "type": "pfa",
                "pay_for_access_metadata": {
                    "json_rpc": "https://base-mainnet.g.alchemy.com/v2/uTDQJozcVtnDB8Rc7fvmf",
                    "network_id": 8453,
                    "grant_ttl_seconds": 2153088000,
                    "price_per_access_usd": 0.99,
                    "price_per_license_usd": 0,
                    "supports_licensing": true,
                    "use_usdc_as_currency": true,
                    "license_type": "UNLIMITED_LEASE_V1",
                    "preview": {
                        "name": "Test Song",
                        "description": "Test Song",
                        "image": "https://share-ddn.formless.xyz/content/test-song-artwork.png",
                        "attributes": {},
                        "title": "Test Song",
                        "artist": "Test User",
                        "asset_release_timestamp": 1798761600,
                        "type": "audio",
                        "audio": "https://share-ddn.formless.xyz/content/stackmatik-kamil-30s-preview.wav"
                    },
                    "grant": {
                        "name": "Test Song",
                        "description": "Test Song",
                        "image": "https://share-ddn.formless.xyz/content/test-song-artwork.png",
                        "attributes": {},
                        "title": "Test Song",
                        "artist": "Test User",
                        "type": "audio",
                        "asset_release_timestamp": 1798761600,
                        "audio": "https://share-ddn.formless.xyz/content/stackmatik-kamil.wav"
                    }
                },
                "product": {
                    "type": "pfa"
                }
            }
        },
        "revenue_share": {
            "recipients": {
                "share@formless.xyz": 100
            },
            "community_allocation_percent": 0,
            "community_split_count": 0,
            "distribution_unit": {
                "value": 0.99,
                "currency": "USD"
            }
        }
    }
}
```

### Response

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "1",
    "result": {
        "status": "success",
        "code": 200,
        "PFA": {
            "contract_address": "0x04EF0B1d4416E12094C8599C17E00512B99Db16A"
        }
    }
}
```

## PFA Metadata Parameters

### Pay-For-Access Metadata

* **`price_per_access_usd`**: The price users pay to access the full song (e.g., 0.99 for \$0.99).
* **`preview`**: Contains metadata for the free preview version of the song (typically a 30-second clip).
* **`grant`**: Contains metadata for the full version users receive after purchase.
* **`supports_licensing`**: Whether the song can be licensed for commercial use.
* **`license_type`**: Type of license (e.g., "UNLIMITED\_LEASE\_V1").

### Revenue Share

* **`recipients`**: A mapping of email addresses to percentage shares (must total 100).
* **`distribution_unit`**: The amount distributed per sale and the currency.
