Production-grade guide to soulbound token patterns covering architecture patterns, implementation strategies, testing approaches, and operational best practices for enterprise engineering teams.
Soulbound tokens (SBTs) are non-transferable, persistent, and verifiable credentials issued to a specific account or "soul" on a blockchain. They represent achievements, memberships, roles, or qualifications that are permanently tied to an entity—be it a person, organization, or service. SBT patterns emerge when these tokens are structured, composed, and managed with intention across decentralized applications, enabling trust, identity, and composability in Web3.
To issue an SBT, a sender writes a new token to the blockchain with a fixed recipient and a schema identifier. The recipient cannot transfer the token, and it is immutable once issued.
The token is typically represented as an ERC-721 or ERC-1155 asset, with the transferable flag set to false and the tokenId derived from a unique combination of recipient, schema, and timestamp.
// In Solidity, issuing an SBT
function issueSoulboundToken(
address recipient,
uint256 schemaId,
bytes calldata metadata,
string memory uri
) external returns (uint256 tokenId) {
require(recipient != address(0), "Recipient cannot be zero address");
require(schemaId > 0, "Schema ID must be non-zero");
// Generate unique token ID based on recipient and schema
tokenId = uint256(keccak256(abi.encodePacked(recipient, schemaId, block.timestamp)));
// Mint token with non-transferable flag
_mint(recipient, tokenId, 1, metadata);
_setTokenURI(tokenId, uri);
// Record issuance in a log
emit SBTIssued(recipient, schemaId, tokenId, block.timestamp);
return tokenId;
}
The metadata field is typically a JSON object that includes name, description, image, issuedBy, and validFrom. The uri field points to a JSON file on IPFS or a decentralized storage system.
A soul is a set of SBTs that collectively represent an entity’s history, reputation, and credentials. The primary way to compose SBTs is through aggregation.
A soul’s identity is built by combining SBTs from multiple issuers. The pattern uses a soul registry contract that tracks which SBTs a soul owns and provides a canonical view of the soul.
interface ISoulRegistry {
function getSBTs(address soul) external view returns (uint256[] memory tokens);
function addSBT(address soul, uint256 tokenId) external;
function hasSBT(address soul, uint256 tokenId) external view returns (bool);
}
The addSBT function is used to link an SBT to a soul. It is idempotent: calling it multiple times on the same soul and tokenId results in no change.
The soul can be queried via a soul resolver service, which fetches all SBTs and their metadata, and computes a soul score based on criteria like:
A typical soul resolver query uses a GraphQL endpoint:
query GetSoulProfile($soul: Address!) {
soul(soul: $soul) {
id
totalSBTs
activeSchemas
recentSBTs(limit: 10) {
tokenId
schemaId
issuedAt
metadata
uri
}
score
verifiedBy
}
}
SBTs are used to verify eligibility in off-chain systems. The standard pattern is proof-of-soul.
An off-chain service checks that a soul holds a specific set of SBTs. This is done by verifying the soul's SBT proof—a Merkle tree root of all SBTs, or a list of tokenIds with their schemaIds, issuedAt, and metadata.
A common verification flow uses JSON Web Tokens (JWTs) signed by a trusted verifier.
{
"iss": "https://verifier.example.com",
"sub": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3",
"aud": "https://app.example.com",
"exp": 1704067200,
"iat": 1704063600,
"soul": {
"soul": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3",
"sbts": [
{
"tokenId": 123456789,
"schemaId": 1,
"issuedAt": 1672531200,
"metadata": {
"name": "Contributor",
"description": "Active contributor to the Open Source Project",
"image": "https://ipfs.example.com/QmXyZ123456789"
}
}
],
"proof": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3"
},
"signature": "0x456789abcdef..."
}
The proof field is a Merkle proof that confirms the inclusion of specific SBTs in the soul’s full set. The verifier checks the Merkle root against the proof and validates the JWT signature.
If the proof fails, the service logs an error:
Error: SBT proof verification failed
- Root hash mismatch: expected 0x1a2b3c... but got 0x4d5e6f...
- Missing SBT: tokenId 123456789 not found in Merkle tree
- Schema mismatch: expected schemaId 1, but found 2
SBTs are not static. They can carry metadata and state that evolve over time. The pattern uses schema versioning and metadata updates.
Each SBT schema is versioned. The schemaId is a composite of schemaName and version.
For example:
schemaId = 1 → {"name": "University Degree", "version": "1.0"}schemaId = 2 → {"name": "University Degree", "version": "1.1"}When a new version of a schema is released, existing SBTs remain valid but can be updated.
An update pattern involves:
metadata object to IPFS.uri of the SBT via a setURI transaction.SBTUpdated event.event SBTUpdated(
uint256 indexed tokenId,
string oldUri,
string newUri,
uint256 updatedAt
);
Clients can poll for updates using a getSBTUpdates endpoint:
GET /api/sbt-updates?since=1672531200
Response:
[
{
"tokenId": 123456789,
"schemaId": 1,
"oldUri": "https://ipfs.example.com/QmXyZ123456789",
"newUri": "https://ipfs.example.com/QmAbCdEfGhIjKlMnOpQrStUvWxYz123456",
"updatedAt": 1704063600,
"updatedBy": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3"
}
]
A common failure occurs when setURI is called but the new metadata is not available on the expected IPFS node. The service returns 404 on uri resolution:
Error: Failed to resolve SBT metadata
- URI: https://ipfs.example.com/QmAbCdEfGhIjKlMnOpQrStUvWxYz123456
- Error: IPFS node returned 404 for /QmAbCdEfGhIjKlMnOpQrStUvWxYz123456
- Fallback: using metadata from old URI
SBTs are composable across systems. The SBT marketplace pattern enables discovery and reuse.
A marketplace exposes a list of SBTs with their schemaId, issuer, metadata, and price. The standard query is:
GET /api/sbts?schemaId=1&issuer=0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3
Response:
[
{
"tokenId": 123456789,
"schemaId": 1,
"issuer": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3",
"recipient": "0x9876543210987654321098765432109876543210987654321098765432109876",
"issuedAt": 1672531200,
"metadata": {
"name": "Computer Science Degree",
"degree": "Bachelor of Science",
"university": "MIT",
"year": 2022
},
"uri": "https://ipfs.example.com/QmAbCdEfGhIjKlMnOpQrStUvWxYz123456"
}
]
Applications can filter SBTs by schemaId and recipient. The schemaId is a standard identifier across systems.
A failure occurs when schemaId is misaligned. For example, a schemaId of 1 in one system refers to University Degree v1.0, but in another system, it refers to University Degree v1.1. The mismatch results in:
Error: Schema mismatch
- Expected schemaId: 1 (University Degree v1.0)
- Found schemaId: 1 (University Degree v1.1)
- Metadata fields missing: expected "university", but received "institution"
SBT lifecycle is managed via event-driven patterns. The most common is SBT issuance via event stream.
A service listens to a blockchain event stream (e.g., from a node via WebSocket or a Kafka cluster) and triggers SBT issuance on specific conditions.
For example:
{
"event": "NewMemberJoined",
"timestamp": 1704063600,
"data": {
"member": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3",
"team": "core",
"joinedAt": "2023-10-25T12:00:00Z"
}
}
On receiving this event, the service issues an SBT with schemaId = 2 ("Team Membership") and recipient = member.
The service logs:
SBT issued: tokenId=234567890, schemaId=2, recipient=0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3
A common failure is event deduplication. If the same event is processed twice (e.g., due to network delay), the service may issue duplicate SBTs.
To prevent this, the system uses a deduplication index in a database:
CREATE TABLE sbt_events (
event_id TEXT PRIMARY KEY,
processed_at TIMESTAMP,
token_id BIGINT,
schema_id INT,
recipient BYTEA
);
Before issuing an SBT, the service checks if the event_id has already been processed. If so, it skips the issuance.
When an event is not deduplicated, the system logs:
Warning: Duplicate SBT issuance
- Event ID: "NewMemberJoined-123456"
- Already processed at: 2023-10-25T12:00:01Z
- Existing SBT: tokenId=234567890
- Skipping new issuance
Smart contracts use SBTs as a condition for access or state changes.
A common pattern is proof of soul for access control.
A contract checks that a caller holds at least one SBT from a set of required schemas.
function requireSoulMembership(address soul, uint256[] memory requiredSchemas) public view {
for (uint256 i = 0; i < requiredSchemas.length; i++) {
uint256 schemaId = requiredSchemas[i];
bool hasSchema = hasSBT(soul, schemaId);
require(hasSchema, "Missing required SBT schema");
}
}
The function can be called via a transaction. If the call fails, the error is:
Error: Access denied: missing required SBT
- Required schemas: [1, 2, 3]
- Missing: schemaId 2
- Caller: 0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3
The pattern is especially sensitive to schema versioning. A contract expecting schemaId 1 may fail when the SBT is actually schemaId 10, indicating a mismatched schema.
A sharp edge is schema mapping: the contract must maintain a schemaIdMap that maps schemaName to schemaId. If this mapping is outdated, the contract may reject valid SBTs.
The metadata schema for SBTs is standardized but flexible.
The base metadata is a JSON object with the following keys:
name (string): Human-readable name of the SBT.description (string): Long-form description.image (string): URL to an image.issuedBy (string): Identifier of the issuer.validFrom (integer): Unix timestamp of when the SBT becomes valid.validUntil (integer): Unix timestamp of when the SBT expires.properties (object): Additional structured data.Example:
{
"name": "Full Stack Developer",
"description": "Certified in full stack development with experience in React, Node, and blockchain.",
"image": "https://ipfs.example.com/QmXyZ123456789",
"issuedBy": "https://example.com/issuers/devcert",
"validFrom": 1672531200,
"validUntil": 1872531200,
"properties": {
"skills": ["React", "Node.js", "Solidity", "IPFS"],
"certificationLevel": "Advanced",
"examScore": 92.5
}
}
The properties field is used to enable queryability and filtering. Applications can build indexes on properties to enable fast searches across SBTs.
A failure mode occurs when properties are nested but not indexed. Queries like:
SELECT * FROM sbts WHERE properties->>'skills' ? 'Solidity';
fail silently when the properties column is a json type but not indexed.
This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy