The Content contract allows a user to publish content openly on the Relation Protocol. Users can share articles, pictures, videos, and more with it. Meanwhile, it is based on blockchain technology, so the content published is immutable and traceable.

With the PublicContent contract, users can publish and read their own contents. They can also comment and like the contents generated by other users.


The schema of a content to be published is saved to Arweave in the form of a ttl file. The transaction hash will serve as a schemaURI to be passed as a parameter when initializing the contract. The following is an example:


A schema consists of the following three parts:

  • The list of prefixes.

PREFIX p: <>
PREFIX rdf: <>
PREFIX xsd: <>
PREFIX rdfs: <>
  • Class

Soul is used to represent an address entity.

:Soul a rdfs:Class ;
    rdfs:label "Soul" ;
    rdfs:comment "A soul." .
  • Predicate

The predicate p:publicContent describes the content to be published.

p:publicContent a rdf:Property ;
    rdfs:label "publicContent" ;
    rdfs:comment "The public content." ;
    rdfs:domain :Soul ;
    rdfs:range xsd:string .

The contract

interface IContent is ISemanticSBT {
     * Post a content.
     * @param content  The content should be the hash on arweave. The actual encrypted content and authorization records are stored on arweave.
    function post(string memory content) external;
     * View the hash on arweave corresponding to the token.
     * @param tokenId
     * @return content 
    function contentOf(uint256 tokenId) external view returns (string memory);

The content uploaded to Arweave is structured as follows:

  "content": {
    "body": "${The body of content}",
    "title": "${The title of content}"

Full source code:

Last updated