Create NEAR token

 



Let’s create a Fungible Token (FT) on the NEAR blockchain. FTs are exchangeable assets that are divisible and not unique, making them ideal for representing currencies or other interchangeable items. Here’s a step-by-step guide to defining and creating your own FT:

  1. Understand the Basics:

    • A fungible token is an asset that can be exchanged for another of the same kind. For example, if Benji has 1 Canadian dollar, it’s equivalent to Matt’s Canadian dollar. Both dollars are fungible.
    • Non-fungible tokens (NFTs), on the other hand, are unique and indivisible (like a specific house or car).
  2. Navigate to the Skeleton Contract:

    • Start by switching to the 1.skeleton folder in the NEAR repository. If you haven’t cloned the repository, refer to the Contract Architecture to get started.
    • You can find the finished code for this tutorial in the 2.defining-a-token folder.
  3. Define Metadata for Your Token:

    • Open the 1.skeleton/src/metadata.rs file. This is where you’ll define metadata for your fungible token.
    • Required fields:
      • spec: Set to ft-1.0.0.
      • name: Human-readable token name (e.g., “Wrapped NEAR” or “TEAM Tokens”).
      • symbol: Token abbreviation (e.g., wNEAR or gtNEAR).
      • decimals: Used in frontends to display significant digits.
    • Optional fields:
      • icon: Token image (must be a data URL).
      • reference: Link to supplementary JSON details stored off-chain.
      • reference_hash: Hash of the referenced JSON.
  4. Add Metadata to the Contract:

    • In the 1.skeleton/src/lib.rs file, add the following to the Contract struct:
      Rust
      pub struct Contract {
          // Other fields...
          metadata: TokenMetadata,
      }
      
    • Store the metadata on the contract under the metadata field.
  5. Compile and Deploy:

    • Compile your contract using the NEAR compiler (e.g., near-sdk-as for AssemblyScript).
    • Deploy your contract to the NEAR network using the NEAR Wallet or command-line interface.
  6. Test Your Token:

    • Verify that your fungible token works as expected. Test transfers, balances, and other functionalities.
  7. Document and Promote:

    • Create detailed documentation for your token, explaining how it works and its security features.
    • Share your token with the NEAR community through forums, social media, and development platforms.

Remember, creating a token involves technical steps, but with patience and persistence, you can build your own custom token on the NEAR blockchain! 🚀

For a more detailed tutorial, check out the Defining a Fungible Token tutorial.1


Useful links : 

  1. Defining a Fungible Token Tutorial:

    • This tutorial guides you through creating a complete FT smart contract from scratch that conforms with all the NEAR FT standards. Learn what a fungible token is and how to define one on the NEAR blockchain.
    • Defining a Fungible Token Tutorial1
  2. More NEAR Tutorials:

    • Explore other tutorials and examples related to NEAR development, including random numbers, DeFi, governance, and more.
    • NEAR Examples & Tutorials2
  3. NEAR Token Basics:

Feel free to explore these resources to dive deeper into creating your own custom token on the NEAR blockchain! 🚀

Post a Comment

0 Comments