pages/index.json

1 line
97 KiB
JSON
Raw Normal View History

2024-04-02 17:22:46 -04:00
[{"content":"I wanted to create an SPL token and after looking online I couldn\u0026rsquo;t find an updated guide. I mainly just found Keyglowmax (SCAM). So I thought I would learn and share. There are much easier ways to create these tokens but they cost $ and spending more $ than needed is no fun. They also have you connect your wallet which is enough of a worry. This guide costs as little SOL as possible as everything is transacted directly on-chain. Everything is done from the CLI.\nThis guide just covers the basics, the tools used are way more powerful than what I use them for, this is just creating a basic token with no taxes or memos or anything complex, but these tools do support those options. If you are interested in doing more I would read the proper documentation.\nhttps://docs.solanalabs.com/cli/install https://metaboss.rs/overview.html https://spl.solana.com/token NetworkChuck has a video from late 2021 on doing this, but some commands are a bit outdated, and Solana updated their entire metadata process in 2022.\nI am using an Ubuntu 22.04 VM with 60GB storage to run these commands.\nStarting balance: 0.079975 SOL Ending balance: 0.05731652 SOL Total SOL cost: 0.02265848 SOL ($4.22 on 3/15/2024) Installing Solana Tools First we need to download Solana tools to our system:\nsh -c \u0026#34;$(curl -sSfL https://release.solana.com/stable/install)\u0026#34; then run the export path command that is given to you:\nexport PATH=\u0026#34;/home/mafyuh/.local/share/solana/install/active_release/bin:$PATH\u0026#34; Restart your terminal session.\nCreating Wallet We will create a new SOL wallet to fund our token. To do this run:\nsolana-keygen new --derivation-path \u0026#34;m/44\u0026#39;/501\u0026#39;/0\u0026#39;/0\u0026#39;\u0026#34; --force --no-bip39-passphrase Credit to u/nel0_angel0 on finding the \u0026ndash;derivation-path flag\nI would backup your recovery seed phrase and take note of the public address. I would fund this wallet with some SOL as well at this time. It\u0026rsquo;s best to restore this private key in your wallet on PC/phone. (Phantom, Solflare, etc)\nKeep note of the keypair directory for later step.\nCheck your SOL balance with:\nsolana balance Install Rust We need Rust in order to create the token, to install Rust run:\ncurl --proto \u0026#39;=https\u0026#39; --tlsv1.2 -sSf https://sh.rustup.rs | sh Press enter for default installation. Once completed, restart your session again.\nThen we need to install some needed packages:\nsudo apt install libudev-dev llvm libclang-dev libssl-dev pkg-config build-essential protobuf-compiler -y Install spl-token-cli Now using Rust we are gonna install Solana\u0026rsquo;s CLI tools, this will take a few minutes.\ncargo install spl-token-cli Create Token Creating a new token is simple, make sure your wallet is funded with SOL and just run:\nspl-token create-token Your token\u0026rsquo;s address will be printed on screen. You will use this address in pretty much all the rest of the steps so keep handy.\nNote this creates a 9 decimal token, with no extensions, if you want to change this and add complexity to the token check out this\nIf you want to create a token with different that 9 decimals use:\nspl-token create-token --decimals \u0026lt;# of decimals\u0026gt; For a list of all things you can do run:\nspl-token create-token --help Now we need to create a token account for this token:\nspl-token create-account \u0026lt;TOKEN_ADDRESS\u0026gt; Example:\nspl-token create-account 7njsg9BA1xvXX9DNpe5fERHK4zb7MbCHKZ6zsx5k3adr If you get errors like:\n\u0026ldquo;unable to confirm transaction. This can happen in situations such as transaction expiration and insufficient fee-payer funds\u0026rdquo;\nYou just need to retry a few times, it will eventually go thru but sometimes takes 3-4 runs.\nMinting Tokens Now that you have a token and an account for the token, you can actually mint some tokens. To do this run:\nspl-token mint \u0026lt;TOKEN_ADDRESS\u0026gt; \u0026lt;# of tokens\u0026gt; \u0026lt;ACCOUNT_ADDRESS\u0026gt; Example:\nspl-token mint 7njsg9BA1xvXX9DNpe