Skip links

How-to create a Solana Meme Coin & NOT accidentally burn it

;TLDR

  • The Solana Meme Coin SLERF dev accidentally burned half of the token’s supply and all the SOL/SLERF LP tokens supposed to be distributed after the presale.
  • The fail was caused by an accidental click on a web tool
  • There’s no real need for using such tools, even without coding expertise.

[Development Article]

What you’ll find

In the first section, this article will guide you through a quick post-mortem analysis of the accidental massive burn of SLERF Meme Coins and the SOL/SLERF LP tokens.

Then, you’ll learn how to use the official Solana CLI tools to create, mint, edit, and transfer a new token. As a bonus, how to burn and close unwanted token accounts. A Solana Basics section provides an overview over core concepts to help you cover this article scope.

No coding skills are required, though some familiarity with the terminal is helpful.

Some context

In the past few weeks Solana meme coins, a type of cryptocurrency that typically has no utility beyond being a lighthearted joke, have taken center stage in the crypto world. Success cases like the Book of Meme (BOME), with a market capitalization that went from zero to 1.6 billion, empowered this tendency. Presales have become popular, allowing projects to raise significant amounts of money even before having a working product.

Following this trend, many “easy-to-use” web tools offer the possibility to create, edit and burn Solana tokens to anyone with limited or even no coding expertise, often charging a small amount of SOLs to get the job done. Unfortunately, sometimes conducting backdoor scams.

SLERF, the sloth-themed meme coin built on Solana that raised an impressive $10 million in SOL during its presale, was created and managed with those resources. Following the creator field on its metadata, we can see the watermark of the web tool used to issue the token.

The SLERF dev also created a SOL/SLERF LP pool on Raydium, providing liquidity with the total amount of SOL received during the presale and half of the token’s supply, getting 5,171,020 of LP tokens that were supposed to be distributed among its early supporters.

On March 18th 2024, the SLERF dev annonunced on X that he “fucked up”, by accidentally burning “the LP and the tokens that were set aside from the airdrop”. The massive fail occurred when he first tried to burn some worthless coins sent to the presale wallet using the web tool solana-tools with no success, and then tried again with sol-incinerator. Apparently, he also accidentally listed the wrong token accounts.

(As a side note, he was trying to retrieve the rent lamports from the unwanted token accounts associated with the presale wallet, which is normal practice on Solana. More on this in the Solana Basics section).

You can take a look at the transactions where these actions took place:

Paradoxically, it seems that the event pushed up the asset price, but since this article does not intend to provide investment advice, but rather technical advice, let’s get to work.

Solana Basics

This section is a heads up about Solana’s basic concepts. If you are experienced enough, please feel free to skip it.

  • Solana Tokens: Unlike Ethereum, where each token corresponds to a different Smart Contract, on Solana each token is an entity issued by a single program, called the SPL-TokenProgram (On Solana, Smart Contracts are called just programs). To create a token, you have to execute one of its functions, which results in the creation of a Mint.
  • Mint: A Mint represents the global state of a token. In a not-so-close analogy, you can think of it as a “money printer”. It contains essential information such as the supply, decimals, and mint and freeze authorities. These authorities are addresses (“users”) with specific roles: the power to create (or in Solana’s terminology, to mint) new tokens and, if necessary, the ability to freeze holding accounts as a security measure.
  • Token Accounts: Unlike Ethereum, where a single user address can be associated with token balances across different Smart Contracts, on Solana users need to have separate Token Accounts for each new token they want to receive. You can think of these accounts as “bags” for each different type of coin. Fortunately, there are mechanisms in place to associate token accounts with a user address, so from an end-user perspective, you don’t have to worry about this.
  • Rent: When creating any programming entity on Solana, such as Mints or Token Accounts, a small quantity of lamports is required as memory rent. Transaction fees include this cost. Once an entity is no longer needed, it can be closed to retrieve the rent lamports and free the memory. 

(By the way, every entity in Solana is called an account. Entity will be our preferred term throughout this tutorial, as it avoids confusions)

  • Token Decimals: In the context of blockchains, working with large integers is common for handling monetary values. Computationally, integers provide greater precision than decimal numbers. A Mint’s decimals field determines how many decimal places are used for representing fractional amounts of the token. (For example, 1 token with 9 decimals has an internal value of 1,000,000,000).
  • Token-2022: Recently a new token program called Token-2022 has been deployed. It natively adds, on demand, more functionality to Mints created with it, such as confidential transfers, transfer fees, metadata, and more. Before Token-2022, adding metadata to a token was a complicated process, so to ease the learning process, we will be using the new standard. 

The throwback is that DeXes are slowly evolving to be Token-2022 compatible, so not all of them will be immediately capable of displaying your Meme Coin image. Nevertheless, there are already Dexes working with these tokens, and Token-2022 is backwards compatible, so even if a DeX can’t process the metadata, it can list the token anyway.

  • Authority revoking: Token authorities, once set to None, are considered revoked. For instance, if a mint authority is revoked, there’s no way to issue new tokens. This practice is commonly employed when creating Meme Coins, serving as a means to instill confidence among supporters.

How To Create A Solana Meme Coin ⚒️

We will be working on the Solana Devnet environment, paying TX fees with fake SOL. Feel free to experiment.

Check every address twice before executing any command on a mainnet environment. Remember to NEVER share your private keys, since they control your assets.

Pre Requisites

Before Start

  1. Open a terminal (If on Windows, a WSL terminal)
  2. Create a new folder: $ mkdir memecoin
  3. Get into the project folder: $ cd memecoin
  4. Create a Wallet with: $ solana-keygen new

This will create a wallet at the default solana installation path ~/.config/solana/id.json (a.k.a “system wallet“). You’ll be using it to sign and pay transactions. 

Tip: When prompted for a passphrase, just press enter to skip, since we are working with disposable test accounts.

  1. Target your Chrome Phantom Wallet to Devnet:
    • Settings -> Developer Settings -> Testnet Mode On -> Choose `Solana Devnet`
  2. Log your system wallet private key. If the Solana CLI was installed at the default location, type: $ cat ~/.config/solana/id.json

Tip: Carefully copy the private key, including the brackets.

  1. Import your wallet on Phantom:
    • Add / Connect Wallet -> Import Private Key -> Paste your private key
    • Enter the account name and press create

Tip: If you see the error Bad Format when pasting your private key, try deleting the last char after pasting and typing ] again.

  1. Fund your wallet with Devnet fake SOL from a faucet:
    1. go to https://faucet.solana.com/
    2. Copy your system wallet address by clicking on the account name on the Phantom wallet extension.
    3. Target devnet, paste your address, and ask for 5 SOL.
    4. After a couple of seconds, you should be able to see the 5 fake SOL in your wallet.

At this point, you have your working environment up and running.

A Token Is Born ⭐

Tip: For every command of the Solana CLI, you can append `–help` or just `-h` to see the full list of available options.
You’ll get different outputs for `spl-token –help` or `spl-token create-token –help`. Feel free to experiment.

Token’s Metadata

Essentially, a Meme Coin is a regular token with an associated image. In Token-2022 Mints (The Token Program that we will use throughout this tutorial) provide a metadata field on the token itself which points to a .json file that in turn points to the image.

Mint metadata -> json file -> image

 

  1. Upload your Meme Coin image. You can use any public hosting service. (However, in a real mainnet scenario, we recommend using IPFS, which ensures that your asset image will always be accessible).

Tip: You can host your assets on your Google Drive account:

    1. Upload your file to your google drive account.
    2. Set the Share status to “Anyone with the link
    3. Transform the default share link using this tool
  1. Create the json file: $ touch metadata.json

Open your just created metadata.json file from your favorite text editor, and paste the following, filled with your data:

{
    "name": "<TOKEN_NAME>",
    "symbol": "<TOKEN_SYMBOL>",
    "image": "<TOKEN_IMAGE_URI>"
}

On the <TOKEN_IMAGE_URI> placeholder, paste your image URL

Tip: When replacing angle brackets placeholders such as <TOKEN_NAME>, data must be passed without the brackets (i.e., MyToken)

Tip: There are more available fields on the json metadata standard that you can use to fit your needs.

  1. Upload also your metadata.json file. Store the file URL, we will need it soon.

Mint, Token Account, Initial Supply, Revoke, Transfer

  1. Create a Mint:  $ spl-token create-token --enable-metadata --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb --url devnet
    • Notice that the transaction was automatically signed and paid by your system wallet.
    • TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb is the address of the Token-2022 program.
    • Defaults: decimals: 9, mint authority: system wallet, freeze authority: None, initial supply: 0.
    • –url devnet indicates to target Devnet.
  1. Display Mint Info: $ spl-token display <MINT_ADDRESS> -u d
    • -u d is the abbreviated form of –url devnet
  1.  Add the Token Metadata: $ spl-token initialize-metadata <MINT_ADDRESS> <TOKEN_NAME> <TOKEN_SYMBOL> <TOKEN_URI> -u d
    • For <TOKEN_URI>, you have to pass the URL from your uploaded metadata.json file.
  1. Create a Token Account: $ spl-token create-account <MINT_ADDRESS> -p TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb -u d
    • By default, the authority (ownership) of the Token Account is given to the system wallet.
  1. Display Token Account info: $ spl-token display <TOKEN_ACCOUNT_ADDRESS> -u d
  2.  Mint the initial supply: $ spl-token mint <MINT_ADDRESS> <AMOUNT> <RECIPIENT_ADDRESS> -u d
    • <RECIPIENT_ADDRESS> should be your just created Token Account.
    • Notice that you are able to mint tokens since you are the mint authority of the new token.
    • The amount should be passed without decimals (i.e. to 100 mint 100 tokens, which internally will be represented as 100,000,000,000)
    • Optionally, display both Mint and Token Account info again to take a look at the updated balances and supply.

Tip: At this point, you should be able to see the token in your phantom wallet, its image, and the updated balances.

Now, since we want to build trust upon our early supporters, let’s prevent any more tokens to be minted in the future.

  1.  Revoke mint authority: $ spl-token authorize <MINT_ADDRESS> --disable mint -u d
    • Optionally, try to mint some more tokens to check that the mint authority has successfully been revoked.

Let’s transfer some tokens, mimicking a token distribution event. To do so, we’ll need another system wallet, and its associated token account:

  1.  To create another filesystem wallet: $ solana-keygen new --outfile ./another-keypair.json
    • The command will create a .json file at the specified path.
  1. Grab the created keypair’s Pubkey: $ solana-keygen pubkey ./another-keypair.json
  2. Fund the new account with 1 SOL with the solana faucet
  3.  Transfer some amount: $ spl-token transfer <MINT_ADDRESS> <AMOUNT> <RECIPIENT> -u d --allow-unfunded-recipient --fund-recipient
    • For <RECIPIENT>, pass the pubkey of the account created on the previous step. spl-token transfer will automatically create an associated token account.
    • Notice that although the authority of the new token account is the keypair from another-keypair.json, the system wallet is paying the rent for the new entity, included in the cost of the transaction.

Bonus: Burn & Close a Token Account

Let’s suppose that the user that just received the tokens doesn’t really want them. So, it’s an opportunity to get those lamports from the unwanted token Token Account’s memory rent.

In order to close a token account, its balance must be zero. You can transfer all to somebody else or, like we are going to do, just burn the total.

  1.  Check the another-keypair wallet’s SOL balance: $ solana account <WALLET_ADDRESS> --lamports -u d
    • For <WALLET_ADDRESS> pass the another-keypair.json public key.
  1.  Burn: $ spl-token burn <TOKEN_ACCOUNT> <AMOUNT> -u d --owner ./another-keypair.json --fee-payer ~/.config/solana/id.json
    • For <AMOUNT>, pass the total balance of the token account you want to burn.
    • Notice that the transaction fees are paid by the system wallet, just to make it easy to see the retrieved lamports on the new account’s balance.
  1. Close the account: $ spl-token close --address <TOKEN_ACCOUNT> --owner ./another-keypair.json --fee-payer ~/.config/solana/id.json --recipient <WALLET_ADDRESS> -u d
  2. Repeat step 1 to check the wallet’s SOL balance again.

Tip: It is possible to burn several unwanted token accounts in bulk to avoid the base fee of each transaction. However we recommend not to do so, even with supposedly easy to use web tools. You don’t want the pain

Conclusions

As you have seen, the process of creating a Meme Coin, even for newcomers, shouldn’t be exposed to untrusted tools.

Once you feel comfortable, you can target the Solana mainnet-beta cluster to launch your Meme Coin. Naturally, you’ll need real SOL and a business plan (or at least a good meme!), but aside from transaction fees, you won’t be charged a dime, and your journey should be free from avoidable hiccups.