Royalty-Splitting Smart Contract
What it does:
Automatically splits revenue or royalties from digital content, NFT sales, streaming, or creator collaborations among multiple stakeholders on-chain.
Why it matters:
Eliminates disputes, ensures fair compensation for creators, collaborators, and platforms, and makes payments transparent, instant, and auditable.
How it works:
-
Content or NFT creators define stakeholders (co-creators, platforms, managers) and their percentage shares
-
Revenue from sales, streaming, or digital content usage is sent to the contract
-
Smart contract calculates each stakeholder’s share based on predefined percentages
-
Funds are distributed automatically to all stakeholders instantly
-
Distribution history is immutable and publicly auditable on-chain
-
Allows updates to stakeholder shares or adding new collaborators with proper authorization
-
Can integrate with NFT marketplaces, streaming platforms, or content licensing contracts for automated payouts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title MediaRoyaltySplitter
* @author Nam
* @notice Splits revenue and royalties among creators, collaborators, and platforms
*/
contract MediaRoyaltySplitter {
address public admin;
struct Stakeholder {
address payable account;
uint256 share; // basis points (1% = 100)
}
Stakeholder[] public stakeholders;
uint256 public totalShares; // max 10000 (100%)
// -------------------- EVENTS --------------------
event StakeholderAdded(address indexed account, uint256 share);
event StakeholderUpdated(address indexed account, uint256 oldShare, uint256 newShare);
event RevenueReceived(address indexed from, uint256 amount);
event RevenueDistributed(uint256 amount);
// -------------------- MODIFIERS --------------------
modifier onlyAdmin() {
require(msg.sender == admin, "Not admin");
_;
}
// -------------------- CONSTRUCTOR --------------------
constructor() {
admin = msg.sender;
}
// -------------------- STAKEHOLDER MANAGEMENT --------------------
function addStakeholder(address payable _account, uint256 _share) external onlyAdmin {
require(_account != address(0), "Invalid account");
require(_share > 0, "Share must be >0");
require(totalShares + _share <= 10000, "Exceeds 100%");
stakeholders.push(Stakeholder({account: _account, share: _share}));
totalShares += _share;
emit StakeholderAdded(_account, _share);
}
function updateStakeholder(uint256 index, uint256 newShare) external onlyAdmin {
require(index < stakeholders.length, "Invalid index");
uint256 oldShare = stakeholders[index].share;
totalShares = totalShares - oldShare + newShare;
require(totalShares 0, "No stakeholders");
for (uint256 i = 0; i < stakeholders.length; i++) {
uint256 payment = (amount * stakeholders[i].share) / 10000;
stakeholders[i].account.transfer(payment);
}
emit RevenueDistributed(amount);
}
}