What are semi-fungible tokens (SFTs)?
Written by Pragat
Reviewed by Brady Werkheiser
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.
How are SFTs different from fungible and non-fungible tokens?
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.
What are the main advantages of using SFTs instead of NFTs?
SFTs are preferable to NFTs in certain contexts as they are more efficient, cost-effective, flexible, and involve improved transaction security.
1. Reversible Transactions
Perhaps the most significant advantage of using SFTs over NFTs is that token transactions to incorrect addresses are reversible and refundable.
2. More Efficient and Cost-effective
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.
3. Improved Security
SFTs permit highly secure transfers by improving upon the existing standards for NFTs.
What are SFTs used for?
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.
1. Genopets SFT Example
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.
2. In-game Achievements Example
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.
How do SFTs work on Solana?
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.
What are programs and accounts on Solana?
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:
Mint Accounts - store the global information of a token
Token Accounts - store the relationship between a user’s Wallet Account and a Mint Account.
How are Program Derived Addresses (PDAs) different from other accounts on Solana?
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.
What is the Token Metadata program on Solana?
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.
What is the JSON standard?
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.
What is the relevance of the Token Metadata program to SFTs on Solana?
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:
It has a supply greater than or equal to 0, (e.g. more than 1 token is in circulation)
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.
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.
What are the implications of SFTs for the future of web3?
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.
Related overviews
Learn About Compressed NFTs and How They Work
Learn What an Associated Token Account Is, How it Works, and How to Create One
Learn About the Solana Account Model, the Different Account Types, and How They All Work Together