EIPs Explained

ERC-5727 · Draft · ERC · 2022-09-28

ERC-5727: Semi-Fungible Soulbound Token

A soulbound token interface built on ERC-3525 slots, so non-transferable badges, credentials and point balances can be issued, revoked, verified and recovered in one framework.

What problem does it solve?

Soulbound tokens (SBTs) are meant to represent things that should not be sold: memberships, certificates, roles, reputation. Simple soulbound NFTs answer "is it transferable?" but not the lifecycle questions issuers actually face: who issued it, can it be revoked, does it expire, can a holder move it to a new wallet after losing a key, and how do you represent a score rather than a single badge?

ERC-5727 tries to cover all of that with one core interface and a set of optional extensions.

How it works

The storage model is borrowed from ERC-3525 (semi-fungible tokens): every token has an ID and a value, and belongs to a slot. A slot groups related tokens, for example "DAO membership" or "reputation points", so one collection can mix one-off badges and fungible-style balances.

The core IERC5727 interface extends ERC-3525, ERC-5192 (locked status), ERC-5484 (burn authorization) and ERC-4906 (metadata update events) and adds:

Function Purpose
issue(to, tokenId, slot, burnAuth, verifier, data) Issue a new SBT in a slot
issue(tokenId, amount, data) Add value (credit) to an existing token
revoke(tokenId, data) / revoke(tokenId, amount, data) Revoke a token or part of its value
verify(tokenId, data) Ask the token's verifier whether it is valid
issuerOf(tokenId), verifierOf(tokenId) Who issued it and who verifies it

Events Revoked and Verified record these actions.

Optional extensions:

  • Enumerable: list slots and per-slot balances of an owner.
  • Metadata: ERC-3525-style metadata for tokens, slots and the contract.
  • Governance: voters approve or reject issuance requests.
  • Delegate: grant an operator the right to issue in a specific slot.
  • Recovery: recover(owner, signature) moves all of an owner's SBTs to a new address using an EIP-712 signature.
  • Expirable: set an expiry and renewability per token.

Sample code

Reading an SBT's issuer and checking validity (ethers v6):

import { Contract, JsonRpcProvider } from "ethers";

const abi = [
  "function issuerOf(uint256 tokenId) view returns (address)",
  "function verifierOf(uint256 tokenId) view returns (address)",
  "function slotOf(uint256 tokenId) view returns (uint256)",
  "function locked(uint256 tokenId) view returns (bool)",
  "function verify(uint256 tokenId, bytes data) returns (bool)",
];

const provider = new JsonRpcProvider(process.env.RPC_URL);
const sbt = new Contract(process.env.SBT_ADDRESS!, abi, provider);

const tokenId = 1n;
console.log("issuer:", await sbt.issuerOf(tokenId));
console.log("slot:", await sbt.slotOf(tokenId));
console.log("locked:", await sbt.locked(tokenId));

// verify() is not a view function in the interface; use staticCall to read the result
const ok: boolean = await sbt.verify.staticCall(tokenId, "0x");
console.log("valid:", ok);

Things to know

  • Status: Draft. The interface may still change and should not be treated as a settled standard.
  • It is a large surface: a full implementation must also satisfy ERC-3525, ERC-5192, ERC-5484 and ERC-4906. Many projects only need ERC-5192.
  • The recovery extension is a double-edged sword: whoever controls the owner's key can sign a recovery and take every SBT. The spec recommends multi-signature recovery schemes.
  • Revocation and verification are controlled by issuers and verifiers, so a holder's credential is only as trustworthy as those parties.

#soulbound #sbt #identity #credentials #erc3525

Details

Authors
Austin Zhu (@AustinZhu), Terry Chen <[email protected]>
Status
Draft
Type
Standards Track / ERC
Created
2022-09-28
Requires

Machine-readable: Markdown · JSON