Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC-6239, which proposes using RDF to describe information about soulbound tokens (SBTs) based on ERC-5192 in greater detail.

This article translates, summarizes, and expands on the proposal below, as discussed in the original article published on December 31, 2023.

I have also written about various other ERCs.

Overview

The proposal introduces a way to create tokens that represent richer information on a blockchain. Specifically, it builds on two existing standards, ERC-721 and ERC-5192, to extend a particular type of token known as a soulbound token (SBT).

ERC-721 defines an interface for non-fungible tokens representing individually identifiable items or collectibles. ERC-5192 defines a minimal interface for identifying locked, non-transferable NFTs. Such tokens can represent items intended to remain bound to a particular account.

The key idea is to use RDF (Resource Description Framework) to describe information about tokens in subject-predicate-object form. This makes it possible to express various attributes of a token and the relationships between them more explicitly. For example, a statement could specify that a token represents a particular artwork.

RDF (Resource Description Framework)

RDF is a model for sharing and interpreting information on the web. It represents information as subject-predicate-object statements.

This format identifies the entity being described (the subject), its attribute or relationship (the predicate), and the corresponding value or related entity (the object).

Consider representing information about a library book using RDF. Suppose the book is Harry Potter and the Philosopher's Stone, written by J. K. Rowling and published in 1997. The information can be represented as follows.

text
主語: 「ハリー・ポッターと賢者の石」
述語: 「著者は」
目的語: 「J.K.ローリング」

主語: 「ハリー・ポッターと賢者の石」
述語: 「出版年は」
目的語: 「1997年」

Using RDF structures information about the book in a form that computers can interpret. The data can also be linked to information from other sources, such as libraries, bookstores, and online databases. This makes it easier to find other works by the same author or other books published in the same year.

RDF also provides a foundation for linking information across the web. It connects data from different websites and databases and helps identify new relationships. This supports richer queries and analysis, facilitating knowledge discovery and sharing.

With this approach, an SBT can represent more than an individual item. It can carry structured information about a person's background, roles, and experiences.

This is a step toward allowing people to share credentials, educational backgrounds, and employment histories through blockchain-based records. It also facilitates meaningful information exchange between different contracts and systems. The security and mutability of such records depend on their implementation.

For more on ERC-721, see the following article.

https://chaldene.net/erc721

For more on ERC-5192, see the following article.

[ERC-5192] Understanding Non-Transferable NFTs and SBTs

Motivation

Soulbound tokens (SBTs) are blockchain-based items that can represent people's commitments, capabilities, and affiliations.

Semantic SBTs build on ERC-721 and ERC-5192 to extend this concept. They use RDF (Resource Description Framework) to add subject-predicate-object statements to metadata, enabling more detailed representations of attributes and relationships between people and tokens.

An advantage of semantic SBTs is their ability to link data from multiple sources into a common model. This makes information from different sources easier to query and retrieve, potentially revealing new insights. Possible applications include visualizing social relationships on a blockchain, identifying trusted participants, and supporting fairer decision-making.

Achieving this requires a common data model for managing social metadata. The model is intended to record social relationships and attributes in a reliable, accessible form. Developing the SBT ecosystem also requires a decentralized approach to maintaining information associated with people's social identities.

Semantic SBTs address these requirements by recording social metadata, attestations, and permissions on a blockchain, creating a layer that connects social identity and data on Ethereum. This gives additional meaning to blockchain data and supports more meaningful interactions between participants.

Connectedness

Semantic SBTs help connect and interpret information and attributes associated with people and organizations. Using RDF's subject-predicate-object model, they record relationships between accounts, such as those belonging to individuals or organizations, and attributes such as skills and experience.

Representing information in this format makes it easier for computers to read and organize data automatically and discover new connections.

For example, semantic SBTs can describe a person's particular skills or participation in a project. Because this information is structured using RDF, applications can identify relationships and common attributes among individuals and organizations more readily, helping establish new opportunities for collaboration.

Semantic SBTs can therefore facilitate communication and cooperation by connecting information about people and organizations and making their relationships explicit.

Linked data

Semantic SBTs provide a way to organize blockchain data and make it easier to use. Specifically, they use RDF as a common representation for data about individuals and organizations.

This makes blockchain information easier to discover and link. It also facilitates information sharing across applications and services, reducing the cost and effort of integrating data.

For example, an application could use semantic SBTs to discover a person's skills and experience. Other applications could reuse that information to build networks or identify people whose qualifications match particular requirements.

Semantic SBTs aim to make blockchain data more accessible and usable. This increases the usefulness of information and can facilitate interaction and collaboration among individuals and organizations.

Social Identity

Semantic SBTs allow individuals to publish or provide evidence of information related to their identity without relying on a central intermediary. This gives individuals more direct control over how they disclose information.

Individual semantic SBTs may contain only fragments of a person's information, with those fragments connected through social relationships. Algorithms can use RDF triples to discover patterns and structures within communities.

For example, individuals and organizations could use the system to express and share their relationships and roles within communities. This could support more transparent and open social connections. Semantic SBTs can be particularly useful in social applications that derive value from connecting information across sources.

Specification

The following table describes the interfaces that a token must implement.

Interface Identifier Description
ERC165 0x01ffc9a7 A standard for determining which interfaces a contract supports.This allows applications to discover functionality automatically and check compatibility.
ERC721 0x80ac58cd The basic interface for unique, non-fungible tokens (NFTs).Each token has its own identifier and an associated owner.
ERC721Metadata 0x5b5e139f An extension that provides additional information about tokens.Metadata can include the token's name, description, and image URL.
ERC5192 0xb45a3c0e An interface for determining whether a token is locked.This enables non-transferable tokens, such as soulbound tokens, to be identified.

By implementing these interfaces, tokens can expose a range of functions and information for use across different platforms and applications. Following the standards helps developers and users understand and anticipate how tokens behave.

For more on ERC-165, see the following article.

[ERC-165] Checking Whether a Contract Supports a Particular Interface

RDF Statement

RDF (Resource Description Framework) statements can be expressed in several formats for sharing information on the web. The proposal selects six commonly used formats: nt (N-Triples), ttl (Turtle), rdf (RDF/XML), rj (RDF/JSON), nq (N-Quads), and trig (TriG).

The complete format of an RDF statement is as follows.

text
rdfStatements = {[format]}<statements>

In this notation, parts enclosed in {} are OPTIONAL, and those enclosed in <> are REQUIRED. This means that the format identifier may be omitted when writing a statement.

The available formats are as follows.

text
format: nt/ttl/rdf/rj/nq/trig

If no format is specified, statements use ttl (Turtle) by default. In other words, information is represented in Turtle unless a different format is explicitly selected.

The different RDF serialization formats have their own characteristics and use cases. Developers can choose the format that best suits their requirements.

nt (N-Triples)

nt (N-Triples) is a simple format for representing RDF (Resource Description Framework) data. The subject, predicate, and object are separated by whitespace, and each triple ends with a period.

The basic structure is as follows.

text
subject predicate object .

The subject is an IRIREF (an internationalized resource identifier used to identify a resource) or a BLANK_NODE_LABEL (a label identifying an anonymous resource).

The predicate is an IRIREF, and the object may be an IRIREF, a BLANK_NODE_LABEL, or a string literal represented by STRING_LITERAL_QUOTE.

Consider the following example.

text
<http://example.org/entity/user1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/entity/User> .
<http://example.org/entity/user1> <http://example.org/property/name> "Alice" .

These statements indicate that a particular user, user1, is of type User and has the name Alice.

The nt format is straightforward and well suited to expressing the basic components of RDF data explicitly.

ttl(Turtle)

ttl (Turtle) is an RDF serialization format that is easier to read and write than nt (N-Triples). It uses prefixes to abbreviate IRI references (IRIREF) and allows statements sharing the same subject or predicate to be combined without unnecessary repetition.

The keyword a can also represent <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>.

Consider the following Turtle example.

text
@prefix : <http://example.org/entity/> .
@prefix p: <http://example.org/property/> .

:user1 a :User;
       p:name ”Alice” .

First, @prefix assigns short aliases (prefixes) to frequently used IRIs. Here, <http://example.org/entity/> is assigned the prefix :, and <http://example.org/property/> is assigned the prefix p:.

The statements then specify that :user1 (referring to http://example.org/entity/user1) is of type :User (referring to http://example.org/entity/User) and has the name Alice.

Here, a is shorthand for rdf:type, and p:name is a property with the value "Alice".

The format provides a concise, intuitive representation that both humans and machines can interpret.

rdf(RDF/XML)

rdf (RDF/XML) represents RDF data using XML. It uses rdf:RDF as the top-level element and xmlns to define prefixes (namespaces).

A node (entity) can be described using rdf:Description, with the rdf:about attribute identifying the node. Properties of the node are nested within the description. IRI-valued properties use rdf:resource, while string values can be expressed directly as text.

The basic structure is as follows.

xml
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/ 02/22-rdf-syntax-ns#">

 <rdf:Description rdf:about="subject" >
  <predicate rdf:resource="object"/>
   <predicate >object</predicate>
 </rdf:Description>
</rdf:RDF>

Consider the following example.

xml
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/ 02/22-rdf-syntax-ns#"
           xmlns:p="http://example.org/property/">

 <rdf:Description rdf:about="http://example.org/entity/user1" >
   <rdf:type rdf:resource="http://example.org/entity/"/>
  <p:name >Alice</p:name>
 </rdf:Description>
</rdf:RDF>

This example specifies that user1 (http://example.org/entity/user1) is an entity of type User and has the name Alice.

The rdf:type property specifies the entity's type, and p:name specifies its name.

The rdf (RDF/XML) format uses standard XML syntax to provide a structured representation of RDF data.

rj(RDF/JSON)

rj (RDF/JSON) represents RDF data in JSON. Triples, consisting of a subject, predicate, and object, are represented using JSON objects.

The basic structure is as follows.

text
{"subject":{"predicate":[object]}}

Each subject serves as a unique key in the root object. Duplicate keys are not permitted. Similarly, a predicate appears as a single key under a particular subject, with its values represented together.

Consider the following example.

json
{
 "http://example.org/entity/user1": {
   "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
     "http://example.org/entity/User"
   ],
   "http://example.org/property/name": [
     "Alice"
   ]
 }
}

The example contains two predicates for the subject http://example.org/entity/user1.

One is http://www.w3.org/1999/02/22-rdf-syntax-ns#type, which identifies the entity's type, and the other is http://example.org/property/name, which specifies its name.

The type is http://example.org/entity/User, and the name is Alice.

The rj (RDF/JSON) format uses JSON's flexible, explicit structure to represent RDF data in a form that applications can parse.

nq(N-Quads)

nq (N-Quads) is an RDF serialization format based on nt (N-Triples). It adds a graph label that identifies the graph in an RDF dataset to which a triple belongs.

The graph label takes the form of an IRIREF (an internationalized resource identifier) or a BLANK_NODE_LABEL (a label identifying an anonymous resource).

The basic structure is as follows.

text
subject predicate object graphLabel.

Consider the following example.

text
<http://example.org/entity/user1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/entity/User> <http://example.org/graphs/example> .
<http://example.org/entity/user1> <http://example.org/property/name> "Alice" <http://example.org/graphs/example> .

The example contains two triples, each associated with the graph label <http://example.org/graphs/example>.

The first triple indicates that http://example.org/entity/user1 is of type http://example.org/entity/User. The second specifies that the same entity has the name Alice.

The nq (N-Quads) format allows RDF statements to be organized into particular graphs or contexts. This makes it possible to handle and manage data from multiple datasets or contexts efficiently.

trig(TriG)

trig (TriG) extends ttl (Turtle) by allowing graph labels that identify the graphs in an RDF dataset to which triples belong. Groups of triples are enclosed in curly braces {}.

Consider the following example.

text
@prefix : <http://example.org/entity/> .
@prefix p: <http://example.org/property/> .

<http://example.org/graphs/example>
  {
       :user1 a :User;
              p:name "Alice" .
   }

The example uses prefixes to abbreviate IRIs. Within the graph http://example.org/graphs/example, it defines two predicates for the subject :user1.

The first is a (shorthand for rdf:type), referring to the object :User. The second is p:name, with Alice as its object.

For contract events (CreateRDF, UpdateRDF, RemoveRDF) and the rdfOf method, rdfStatements uses the ttl format by default.

When using one of the other listed formats, a format identifier must be added to identify the serialization. The identifier begins with [ and ends with ]. For example, N-Triples rdfStatements must include the prefix [nt].

text
[nt]subject predicate object .

The trig (TriG) format extends the capabilities of ttl by supporting richer contexts for RDF data and providing greater flexibility in how data is managed and used.

Contract interface

javascript
/**
 * @title Semantic Soulbound Token
 * Note: the ERC-165 identifier for this interface is 0xfbafb698
 */
interface ISemanticSBT{
    /**
     * @dev This emits when minting a Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. 
     */
    event CreateRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev This emits when updating the RDF data of Semantic Soulbound Token. RDF data is a collection of RDF statements that are used to represent information about resources.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the semantic soulbound token. 
     */
    event UpdateRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev This emits when burning or revoking Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. 
     */
    event RemoveRDF (
        uint256 indexed tokenId,
        string  rdfStatements
    );
    /**
     * @dev Returns the RDF statements of the Semantic Soulbound Token. 
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @return rdfStatements The RDF statements for the Semantic Soulbound Token. 
     */
    function rdfOf(uint256 tokenId) external view returns (string memory rdfStatements);
}

The ISemanticRDFSchema interface is an optional extension to ERC-721 metadata that provides the URI of the RDF data schema.

javascript
interface ISemanticRDFSchema{
    /**
     * @notice Get the URI of schema for this contract.
     * @return The URI of the contract which point to a configuration profile.
     */
    function schemaURI() external view returns (string memory);
}

Methods

rdfOf (uint256 tokenId)

This method retrieves information about a semantic soulbound token (SBT) with a particular token ID.

The returned RDF data is a collection of RDF statements, each expressing information about a resource as a combination of a subject, predicate, and object. This model follows the W3C RDF standard, in which an RDF statement, also called a triple, represents a unit of information.

schemaURI()

This optional method retrieves the URI of a schema describing the structure of the RDF data.

An RDF schema extends the basic RDF vocabulary and provides vocabulary for modeling RDF data. The proposal recommends storing the schema on decentralized storage, such as Arweave or IPFS, and recording its URI in the contract. Applications can use this method to retrieve the URI.

These methods allow developers and users to retrieve detailed information about semantic SBTs and understand how that information is structured.

The rdfOf method provides data associated with an individual token, while schemaURI provides metadata describing the structure of that data. Together, they facilitate information retrieval and interpretation.

Events

CreateRDF

Emitted when new RDF data is created for a semantic soulbound token. The event notifies other parts of the system and users that the new data is available. The associated RDF statements, consisting of subjects, predicates, and objects, are supplied with the event.

UpdateRDF

Emitted when the RDF data of an existing semantic soulbound token is updated. The event notifies other components and users of the update so that they can respond accordingly. The updated RDF data is provided in subject-predicate-object form.

RemoveRDF

Emitted when RDF data associated with a semantic soulbound token is removed or invalidated. The event notifies other components and users of the removal so that they can respond accordingly. The relevant RDF data is supplied in subject-predicate-object form.

These events communicate information about the creation, modification, and removal of data associated with semantic soulbound tokens. This helps relevant systems and users respond to changes and process token-related operations consistently.

Additional considerations

RDF is a flexible, extensible data model for representing relationships using subjects, predicates, and objects. It incorporates concepts from semantic web standards and linked data and is commonly used to model graph data because of its flexibility and support for querying.

RDF facilitates the integration of graph data with different data sources on the web, enabling more comprehensive and interoperable models.

It supports detailed semantic descriptions by expressing information about terms, categories, properties, and relationships. Using standardized metadata formats and languages also provides a consistent way to describe semantic information, improving interoperability across systems and facilitating the construction of reliable semantic networks.

RDF-based semantic reasoning can help infer new relationships or connections between nodes in a social graph from existing data.

RDF statements can be expressed in several serialization formats. The EIP identifies six widely used formats: Turtle, N-Triples, RDF/XML, RDF/JSON, N-Quads, and TriG.

Each has different advantages and applications when representing, storing, and parsing RDF statements. Turtle is particularly popular because it is concise and human-readable.

The EIP uses Turtle as the default RDF serialization. It makes RDF statements easier to understand and maintain and can reduce storage requirements, making it well suited to representing complex RDF graphs.

Compatibility

The proposal is fully compatible with ERC-721 and ERC-5192.

Security

The proposal identifies no security considerations directly related to implementing this standard. Applications handling social identity data should still account for the privacy and security implications of their implementation.

Citation

Jessica Chang (@JessicaChg), "ERC-6239: Semantic Soulbound Tokens," Ethereum Improvement Proposals, no. 6239, December 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6239.

Final thoughts

This article covered ERC-6239, which proposes representing richer metadata for ERC-5192 soulbound tokens using RDF.

If you have questions, feel free to send me a direct message on Twitter.

Twitter @cardene777

I also publish content on other platforms.

https://chaldene.net/