Content Ownership
Manage ownership of digital content and assets
This contract allows you to create a content registry and users can create content that is stored in the registry.
It facilitates on-chain record of content (i.e. file on IPFS) ownership and transfer. While one cannot prefer others from obtaining a copy of the content, the app owner of the contract can serve the single source of truth of who owns the content. With the blockchain trace and record in place, it provides a trustless way to verify the ownership of the content and facilitates further application logics such as royalties, licensing, etc.
Install package
First you can to install the @meshsdk/contracts
package:
Initialize the contract
To initialize the contract, we need to initialize a provider, MeshTxBuilder
and MeshContentOwnershipContract
.
Both on-chain and off-chain codes are open-source and available on Mesh Github Repository.
Mint One Time Minting Policy
This is the first transaction you need to setup the contract.
This transaction mints the one-time minting policy (a NFT) for the contract.
It will be attached with the datum which serves as the single source of truth for the contract oracle.
Note: You must save the paramUtxo
for future transactions.
This transaction mints the one-time minting policy (a NFT) for the contract.
Connect wallet to run this demo
Setup Oracle Utxo
This transaction send the NFT to a oracle contract locking the datum, which serves as the single source of truth for the contract oracle with data integrity.
This is the second transaction you need to setup the contract.
Note: You must provide the paramUtxo
from the mintOneTimeMintingPolicy
transaction.
This transaction send the NFT to a oracle contract locking the datum.
Connect wallet to run this demo
Send Ref-Script Onchain
This are the next transactions you need to setup the contract. You need to run once for each script, and you would likely have to run one after the previous one is confirmed.
This transaction sends the reference scripts to the blockchain for later transactions, boosting efficiency and avoid exceeding 16kb of transaction size limits enforced by protocol parameter.
Note: You must provide the paramUtxo
from the mintOneTimeMintingPolicy
transaction.
Note: You must save txHash (after signed and submitted) forContentRegistry
, ContentRefToken
, OwnershipRegistry
,OwnershipRefToken
transactions for future transactions.
This transaction sends the reference scripts to the blockchain for later transactions.
Connect wallet to run this demo
Create Content Registry
This is the next transaction you need to setup the contract after completing all the `sendRefScriptOnchain` transactions.
This transaction creates one content registry. Each registry should comes in pair with one ownership registry and each pair of registry serves around 50 records of content ownership. The application can be scaled indefinitely according to the number of parallelization needed and volumes of content expected to be managed.
Note: You must provide the paramUtxo
from the mintOneTimeMintingPolicy
transaction.
Note: You must provide the txHash forContentRegistry
, ContentRefToken
, OwnershipRegistry
,OwnershipRefToken
transactions.
This transaction creates one content registry
Connect wallet to run this demo
Create Ownership Registry
This is the last transaction you need to setup the contract after completing all the `sendRefScriptOnchain` transactions.
This transaction creates one content registry. Each registry should comes in pair with one content registry and each pair of registry serves around 50 records of content ownership. The application can be scaled indefinitely according to the number of parallelization needed and volumes of content expected to be managed.
Note: You must provide the paramUtxo
from the mintOneTimeMintingPolicy
transaction.
Note: You must provide the txHash forContentRegistry
, ContentRefToken
, OwnershipRegistry
,OwnershipRefToken
transactions.
This transaction creates one content registry
Connect wallet to run this demo
Get Oracle Data
Getting the oracle data is essential to fetch the current state of the registry.
To facilitate this process, you must provide the paramUtxo
that contains the output index and transaction hash of the NFT minting policy.
The getOracleData()
function will return the current oracle data.
For example:
Fetch the current oracle data
Connect wallet to run this demo
Mint User Token
This transaction mints a token that users can use to create content.
Note that you can actually use any tokens for createContent()
, this mintUserToken()
function is just helpful if you want to mint a token specifically for this purpose.
Note that you signTx with true
to mint the token to enable partial signing.
Mint a token that users can use to create content
Connect wallet to run this demo
Create Content
This transaction creates a content attached to the registry reference by a token. You can use any token for ownerAssetHex
and the contentHashHex
is a string to identify the content.
Note: You must provide the paramUtxo
from the mintOneTimeMintingPolicy
transaction.
Note: You must provide the txHash forContentRegistry
, ContentRefToken
, OwnershipRegistry
,OwnershipRefToken
transactions.
For users to create a content attached to the registry reference by a token
Connect wallet to run this demo
Get Content
This transaction fetches the content data from the registry.
Fetch the current oracle data
Connect wallet to run this demo