Fungible Tokens

A guide to help you create your own fungible tokens

Creating a fungible token on Stacks can happen a few different ways — using no-code launchpads or writing your own Clarity smart contract. This guide helps you pick the best path for your goals and gives you the implementation details to ship confidently, whether you’re deploying with clicks or code.

Custom Development

For developers who want full control over their token implementation, here’s how to create a custom SIP-010 token on Stacks using Clarity. But before you deploy the token contract, you must have your token contract conform to the SIP-010 trait standard.

1

Define SIP-010 fungible token trait

chevron-rightWhat is SIP-010?hashtag

SIP-010arrow-up-right is the standard for defining fungible tokens on Stacks. Defining a common interface (known in Clarity as a "trait") allows different smart contracts, apps, and wallets to interoperate with fungible token contracts in a reusable way.

Below is an implementation of the SIP-010 trait standard for fungible tokens. You can use the existing minimal standard SIP-010 trait or extend it by adding in your own custom traits. But the requirements of the SIP-010 traits are necessary to have at the minimum.

All we are doing here is defining the function signatures for functions we'll need to implement in our token contract, which we can see a simple version of below.

2

Implement SIP-010 trait in token contract

Any token contract that wants to conform to the SIP-010 fungible token standard for Stacks needs to have this trait "implemented" in their token contract. See the below minimal token contract example of how this is done.

This is the Clarity code we need in order to create an fungible token, with one additional function, mint that allows us to actually create a new fungible tokens. This mint function is not needed to adhere to the trait.

The token contract example above is passing in an already deployed trait on mainnet into the impl-trait function. You can use this same deployed trait for your own token contract as well.

circle-check

No-code Platforms

Use community built no-code platforms that can quickly help you deploy tokens.

chevron-rightSTX.Cityhashtag

STX.CITYarrow-up-right is a one-click platform for launching tokens on Stacks. The platform is a comprehensive toolkit for memecoin creators, enabling them to grow their communities through features like AMM listing support (such as on Alexarrow-up-right, Velararrow-up-right, and Stackswaparrow-up-right), airdrops, token donations, and burn mechanisms.

Check out thisarrow-up-right blog post by the founder of STX.City for more information.

Best Practices

Here are some things to consider when creating your token and after your token is launched.

chevron-rightHow to format the token metadata?hashtag

Example token metadata taken from the sBTC token:

Check out the SIP-016arrow-up-right standard for how you should define the schema of your metadata.

chevron-rightHow would I properly update my token metadata?hashtag

If you plan on updating your token's metadata in the future, you should definitely implement a SIP-019arrow-up-right compliant token metadata update notification. Take a look at the example token contract above and you'll notice the set-token-uri function emits a SIP-019 compliant print event.

Hiro’s Token Metadata APIarrow-up-right watches for that specific print event (specifically the notification of "token-metadata-update") on the network and auto-updates the API’s database to reflect a change in the existing token’s metadata.

If your token contract did not implement this print event, you could use the helper contract below to invoke a function that'll emit the same print event notification. Just invoke the ft-metadata-update-notify function of this contract below:

SP1H6HY2ZPSFPZF6HBNADAYKQ2FJN75GHVV95YZQ.token-metadata-update-notifyarrow-up-right

Additional Resources

Last updated

Was this helpful?