0%
Overview page background
HomeOverviewsSolana
What are semi-fungible tokens (SFTs)?

What are semi-fungible tokens (SFTs)?

Written by Pragat

Brady Werkheiser headshot

Reviewed by Brady Werkheiser

Published on January 26, 20235 min read

Semi-fungible tokens (SFTs) combine the characteristics of fungible tokens (FTs) and non-fungible tokens (NFTs), and are a comparatively recent innovation for the Solana blockchain. SFTs are currently being used in gaming and metaverse applications, and are expected to have many other uses in the future.

The idea of semi-fungible tokens were initially created on Ethereum with the ERC1155 multi-token standard, and now exist on Solana as SFTs. To grasp how SFTs function on Solana it’s necessary to understand the blockchain’s architecture, which divides logic and data into Data Accounts and Program Accounts, as well as Solana's Token Metadata program.

Semi-fungible tokens exhibit the qualities of fungible tokens and non-fungible tokens at different points in their lifecycle. Initially, SFTs function like fungible tokens and can be exchanged with identical tokens with no loss of value for either party. Once used, they lose their exchange value and gain the attributes of collectible non-fungible tokens.

SFTs are preferable to NFTs in certain contexts as they are more efficient, cost-effective, flexible, and involve improved transaction security.

Perhaps the most significant advantage of using SFTs over NFTs is that token transactions to incorrect addresses are reversible and refundable.

Unlike NFTs which must be transferred individually, SFTs support batch transfers. This means that multiple SFTs can be transferred in a single program call, saving time and significantly reducing transaction costs.

SFTs permit highly secure transfers by improving upon the existing standards for NFTs.

Currently, SFTs are primarily used in gaming and metaverse environments where on-chain activity can be attached to in-game assets. Let's look at two examples: managing many units of the same NFT, and recording gaming achievements.

Genopets is an NFT game on the Solana blockchain that utilizes both NFTs and SFTs. Players can buy a unique pet as an NFT, and the abundant resources they gather (e.g. wood, water, crystals, metal etc.) are available as SFTs.

SFTs are preferable for NFT gaming because they allow players to buy and sell multiple assets (e.g. 15 water crystals) in a single transaction. Fungible tokens can accommodate multiple assets in a single program (i.e. smart contract), meaning their transfer generates less congestion and lower transaction fees than standard NFTs, which are handled individually.

SFTs are also useful for recording game history. For example, an in-game weapon can be made as an SFT, and as the weapon is used it gains the characteristics of an NFT to become a new unique item because of it's recorded in-game history.

As the item changes hands over time, new history can be stored (e.g. how many times the weapon has been used, how many times it had been used to kill other players, etc.) like traditional weapon characteristics in web2 video games.

SFTs on Solana operate as a unique type of account to which metadata is attached to a token to represent characteristics in a game or metaverse environment. 

The functioning of SFTs on Solana is related to the blockchain’s unique architecture, specifically, the division of logic and data into two distinct components called programs and data accounts, and the Token Metadata program.

Unlike most blockchains, Solana divides logic and data into two distinct components called programs and accounts. Rather than storing data in variables like Solidity smart contracts, programs in Solana can interact with, and have the ability to mutate, external data stored in data accounts.

This unique structure makes programs in Solana highly performant by allowing programs to run in parallel while accessing several accounts. The separation between executable cope and data accounts makes the programs in Solana more modular, as they are not inherently bound to any individual data.

Solana accounts are arrays of bytes stored at a particular address. The address of an account can be defined as the public key of a cryptographic pair. To sign into an account, a program must also have access to the key pair’s private key. Some types of programs have the ability to mutate data in that account.

Newly created accounts are usually initialized by a program marked as the owner of the account. The program defines the structure of data allocated to the account and is also responsible for providing instructions to the account.

The types of accounts on Solana include:‍

  1. Mint Accounts - store the global information of a token

  2. Token Accounts - store the relationship between a user’s Wallet Account and a Mint Account.

Source: Metaplex Documentation
Source: Metaplex Documentation

PDAs are account addresses that are algorithmically derived from the public key of the program that owns the account they’re home to, rather than forming part of a cryptographic pair.

Accounts located at PDAs are designed to be controlled by the specific program their address is generated from. Because Program Derived Addresses are algorithmically generated from a program’s public key, it’s impossible for two different programs to generate the PDA.

PDAs have some important uses, such as allowing programs to sign Cross-Program Invocations and enabling the creation of multiple accounts within an address that can be derived deterministically.

The purpose of the Token Metadata program on Solana is to allow the addition of extra metadata to tokens because Mint Accounts are limited in the amount and types of data they can store. 

The Token Metadata program is part of the Metaplex protocol, which was initially developed to simplify the creation of NFTs on Solana. However, the program also works with SFTs.

A Mint Account stores only a few data attributes about a token, such as its current supply and authorities. Mint Accounts can’t hold other data that apps and marketplaces use. To overcome this limitation, the Token Metadata program offers a Metadata Account located at a PDA derived from the address of the Mint Account. The Metadata Account incorporates many valuable attributes, allowing regular on-chain tokens to be made into digital assets.

Metadata Account
Metadata Account

The JSON standard is a way to add data to tokens that is stored off-chain, in order to save on the fees involved in storing additional data on-chain. The URI attribute in Metadata Accounts links to an off-chain JSON file which stores useful information on tokens following a certain standard.

To ensure the JSON file cannot be updated, it can be stored using a permanent storage solution such as Arweave. Additionally, the Is Mutable attribute in the Metadata Account can be used to prevent the URI attribute, and other attributes, from being changed.

Off-Chain JSON Object
Off-Chain JSON Object

Token metadata is the way that SFTs on Solana become functional in games or metaverse environments as metadata-heavy objects, such as weapons.

A Semi-fungible Token in Solana consists of a Mint Account with two properties:

  1. It has a supply greater than or equal to 0, (e.g. more than 1 token is in circulation)

  2. It has no decimal places (e.g. whole integers only)

The addition of the Metadata Account keeps track of the fungibility of a token through its Token Standard attribute. The program automatically assigns this attribute, which cannot be updated manually. Additionally, The FungibleAsset attribute represents the token standard for SFTs. 

Token standard for SFTs
Token standard for SFTs

The Metadata Account also contains other important information that specifies the SFT as a particular in-game weapon, for example. This information includes the animation or logo which, under the JSON standard, can be stored off-chain using the URI attribute.

Example SFT metadata fields and their descriptions
Example SFT metadata fields and their descriptions
JSON example of Solana SFT metadata
JSON example of Solana SFT metadata

The hybrid nature of SFTs has opened up new possibilities for how tokens can be used to represent complex digital assets in a variety of environments in a cost-effective, highly functional manner.

Although gaming and metaverse use cases are the most popular uses for SFTs, they’re attracting a lot of attention because of their enhanced flexibility and the opportunity to reduce costs by storing data off-chain.

Overview cards background graphic
Desktop section background image

Build blockchain magic

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key