체인의정석

SBT와 관련된 표준 ERC 정리) ERC-6239: Semantic Soulbound Tokens 본문

블록체인/NFT & BRIDGE

SBT와 관련된 표준 ERC 정리) ERC-6239: Semantic Soulbound Tokens

체인의정석 2023. 9. 16. 18:02
728x90
반응형

ERC-6239는 이전에 살펴본  erc5192의 확장 표준이다.
https://eips.ethereum.org/EIPS/eip-5192

 

ERC-5192: Minimal Soulbound NFTs

Minimal interface for soulbinding EIP-721 NFTs

eips.ethereum.org

동기를 보면 RDF라는 프레임워크 트리플을 SBT의 메타데이터에 넣는 형태라고 합니다.

"이 제안은 소울바운드 토큰('SBT')의 메타데이터에 리소스 설명 프레임워크(RDF) 트리플을 도입하여 ERC-721과 ERC-5192를 확장합니다."

SBT의 경우 사실 신원 인증으로서 사용하려면 여러 메타데이터들이 들어가야 할 텐데 해당 메타데이터를 직접 SBT안에 넣을 때 사용하는 표준이다.

nt(N-Triples),ttl(Turtle),rdf(RDF/XML),rj(RDF/JSON),nq(N-Quads) and trig(TriG).

위와 같이 다양한 표준들에 따라서 데이터를 남기게 되는데 해당 데이터의 경우에는 W3C에서 지정한 표준에 따르는 내용이기 때문에 이 포스팅에서는 다루지 않도록 하겠다.

 

rdfStatements = {[format]}<statements>

In the following section, fragments surrounded by {} characters are OPTIONAL.

In the following section, fragments surrounded by <> characters are REQUIRED.

{} 안의 포멧은 옵션으로 넣고 <> 안의 statements는 필수적으로 넣어야 한다고 한다.

문서를 보아하니 statements안에는

nt(N-Triples),ttl(Turtle),rdf(RDF/XML),rj(RDF/JSON),nq(N-Quads) and trig(TriG).

이 6개의 포맷 중 하나를 선택해야 하는 것 같다.

 

해당 표준의 컨트렉트 인터페이스를 살펴보도록 하겠다.

/**
 * @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);
}

RDF에 대해서 변경하거나 추가하거나 삭제할 때 각각 토큰 아이디와 위에서 정의한 형태의 statement를 이벤트로 남기고 이에 대한 조회 함수인 rdfOf를 표준으로 지정하고 있다.

이를 SBT토큰에 대입해 보자면 생성이 되는 것은 mint가 해당이 될 것이고,

삭제가 되는것은 소각행위 일것이고

변경은 메타데이터의 변경이 여기에 포함된다. 만약 특정 조건에서의 전송이 있다면 해당 함수에서도 해당 이벤트를 같이 남기면 될 것 같다.

메타데이터에 기록하는 것이지만 기록, 삭제, 변경 등이 있을 때 마다 이벤트 로그로 남겨두어서 해당 메타데이터가 제대로 된 데이터인지를 체크할 수 있게 해두었으며 현재 rdfStatements를 조회 할 수 있게 해두었다. 

그리고 옵션 사항으로

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);
}

다음 함수가 있는데 해당 RDF의 schema가 담긴 URI를 원래 메타데이터 URI와 구분하여 따로 관리하는 식으로 구현해 두었다.

결론

해당 표준의 경우 SBT를 신원 인증용으로 쓰거나 뭔가 내용이 많이 기록되는 용도로 사용할 때 메타데이터의 표준을 지정해서 기록하기 위해서 사용하였다. 따라서 tokenURI도 따로 두고 정보를 적기 위한 규격도 6가지 종류로 넣어 두었다. 사실 기존의 메타데이터에 넣는 방식도 있겠지만 SBT가 일반적인 NFT와는 달리 예술작품이나 자산보다는 뭔가 증명하는 것에 많이 쓰이는 형태로 비즈니스적으로 풀어가는 케이스가 많기 때문에 여기에 대한 표준을 제시한 것으로 보인다.

 

참고로 해당 표준을 제안한 사람이 같이 보여준 예시 코드는 아래 링크에서 볼 수 있다.

https://github.com/JessicaChg/semanticSBT/blob/main/contracts/core/SemanticSBT.sol

https://ethereum-magicians.org/t/eip-6239-semantic-soulbound-tokens/12334

 

728x90
반응형
Comments