Tuesday, July 1, 2025
No Result
View All Result
Coin Digest Daily
  • Home
  • Bitcoin
  • Crypto Updates
    • General
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • Metaverse
  • Web3
  • DeFi
  • Analysis
  • Scam Alert
  • Regulations
Marketcap
  • Home
  • Bitcoin
  • Crypto Updates
    • General
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • Metaverse
  • Web3
  • DeFi
  • Analysis
  • Scam Alert
  • Regulations
No Result
View All Result
Coin Digest Daily
No Result
View All Result

How to Mint an ERC-20 Token on Base with the Interchain Token Service in 5 Steps – Moralis for Developers | Enterprise-Grade Web3 APIs

29 September 2024
in Web3
Reading Time: 5 mins read
0 0
A A
0
Home Web3
Share on FacebookShare on Twitter


This step-by-step information will educate you how one can mint a multichain ERC-20 token on the Base community utilizing Axelar’s Interchain Token Service (ITS) and use the Moralis Token API to simply retrieve token balances.

Step 1: Stipulations

You’ll need:

Step 2: Arrange a brand new undertaking and required ABIs

On this step, you have to to create a brand new undertaking and arrange the required ABIs to work together with ITS and mint your ERC-20 token on the Base community.

Open your terminal and navigate to any listing of your alternative. Run the next instructions to create and provoke a undertaking:

mkdir mint-token && cd mint-token
npm init -y

Set up Hardhat and Moralis

Set up Hardhat and Moralis with the next instructions:

npm set up –save-dev [email protected] [email protected]
[email protected] @nomicfoundation/[email protected] moralis

Arrange undertaking ABIs

Subsequent, arrange the ABI for the Interchain Token Manufacturing unit as it will likely be wanted throughout deployment. Create a brand new file referred to as interchainTokenFactoryABI.json and add the Interchain Token Manufacturing unit ABI.

Create an .env file

To be sure to’re not by accident publishing your non-public key, create an .env file to retailer it in:

contact .env

Add your non-public key to .env

Export your non-public key and add it to the .env file you simply created:

PRIVATE_KEY= // Add your account non-public key right here

💡 If you’ll push this undertaking on GitHub, create a .gitignore file and embrace .env.

Step 3: Arrange the distant process name (RPC)

Subsequent, you’ll have to arrange the RPC. Navigate to the listing the place you put in Hardhat and run the next command:

npx hardhat init

Choose Create an empty hardhat.config.js along with your keyboard and hit enter:

888 888 888 888 888
888 888 888 888 888
888 888 888 888 888
8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
888 888 “88b 888P” d88″ 888 888 “88b “88b 888
888 888 .d888888 888 888 888 888 888 .d888888 888
888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
888 888 “Y888888 888 “Y88888 888 888 “Y888888 “Y888

👷 Welcome to Hardhat v2.18.1 👷‍

? What do you need to do? …
Create a JavaScript undertaking
Create a TypeScript undertaking
Create a TypeScript undertaking (with Viem)
❯ Create an empty hardhat.config.js
Stop

Subsequent, replace hardhat.config.js with the next code snippet:

/** @kind import(‘hardhat/config’).HardhatUserConfig */
require(“@nomicfoundation/hardhat-toolbox”);
require(“dotenv”).config({ path: “.env” });

const PRIVATE_KEY = course of.env.PRIVATE_KEY;

/** @kind import(‘hardhat/config’).HardhatUserConfig */
module.exports = {
solidity: “0.8.19”,
networks: {
base: {
url: “<https://base-sepolia-rpc.publicnode.com>”,
chainId: 84532,
accounts: [PRIVATE_KEY],
},
},
};

Hardhat runs by finding the closest hardhat.config.js from the present listing, sometimes discovered on the root of your undertaking. Even an empty hardhat.config.js permits Hardhat to operate, as your whole setup is housed on this file.

Step 4: Mint an ERC-20 token with ITS

Now that you simply’ve arrange a Base Sepolia testnet RPC, you’ll be able to mint a multichain ERC-20 token. For this tutorial, you’ll create a token utilizing the next data:


Title: My New Token



Image: MNT



Decimals: 18

Create a brand new file named script.js. Import the required dependencies:


Ethers.js



Moralis



The contract ABI



The InterchainTokenFactory contract tackle



Your token data

const hre = require(“hardhat”);
const crypto = require(“crypto”);
const Moralis = require(“moralis”).default;
const ethers = hre.ethers;

const interchainTokenFactoryContractABI = require(“./interchainTokenFactoryABI”);

const interchainTokenFactoryContractAddress =
“0x83a93500d23Fbc3e82B410aD07A6a9F7A0670D66”;

// Create a brand new token
const identify = “My New Tokenn”;
const image = “MNT”;
const decimals = 18;

// Intial token to be minted
const initialSupply = ethers.utils.parseEther(“1000”);

Create a mintToken() operate

Create a mintToken() operate for minting a brand new token on the Base Sepolia testnet:

//…

// Mint a brand new ERC-20 multichain token to the Base Sepolia testnet
attempt {
// Generate random salt
const salt = “0x” + crypto.randomBytes(32).toString(“hex”);

// Get a signer to signal the transaction
const [signer] = await ethers.getSigners();

// Create contract situations
const interchainTokenFactoryContract = await new ethers.Contract(
interchainTokenFactoryContractAddress,
interchainTokenFactoryContractABI,
signer
);

// Deploy the token
const deployTxData =
await interchainTokenFactoryContract.deployInterchainToken(
salt,
identify,
image,
decimals,
initialSupply,
signer.tackle
);

console.log(
`
Transaction Hash: ${deployTxData.hash},
salt: ${salt},
`
);
} catch (e) {
console.error(e);
}

Add a principal() operate

Add a principal() operate for executing script.js. It can deal with any errors that will come up:

//…

async operate principal() {
const functionName = course of.env.FUNCTION_NAME;
change (functionName) {
case “mintToken”:
await mintToken();
break;
default:
console.error(`Unknown operate: ${functionName}`);
course of.exitCode = 1;
return;
}
}

principal().catch((error) => {
console.error(error);
course of.exitCode = 1;
});

Run  script.js  to deploy your token to the Base Sepolia testnet

Run the script in your terminal to create and mint the token, specifying the Base Sepolia testnet:

FUNCTION_NAME=mintToken npx hardhat run script.js –network base

You must see one thing much like the next in your console:

Transaction Hash: 0x7695f2dd6e29240fc792d37fd6b86f402f2b5338e088e0ad4a448685e0ad565b,
salt: 0xef36cf55326c3fb9fb47c6d3828b8a4ea12fdfab31aae4bc3634bf7bbe04eb49,

Transaction: https://sepolia.basescan.org/tx/0x7695f2dd6e29240fc792d37fd6b86f402f2b5338e088e0ad4a448685e0ad565b Token: https://sepolia.basescan.org/token/0x274e53a526fa2543ce19f9c0334286b4724aa5e0

Step 5: Verify the minted token steadiness with the Moralis API

Now that you’ve efficiently minted your new token, it’s time to retrieve the steadiness.

Add the Moralis API key to .env

MORALIS_API_KEY= // Add you Moralis API key right here

Get your token steadiness

Add the next within the script.js file:

//…

const MORALIS_API_KEY = course of.env.MORALIS_API_KEY;

// Get person steadiness with the Moralis API
async operate getBalance() {
attempt {
console.log(“Getting steadiness…”);
await Moralis.begin({
apiKey: MORALIS_API_KEY,
});

const response = await Moralis.EvmApi.token.getWalletTokenBalances({
chain: “84532”, // Base Sepolia
tackle: “0x510e5EA32386B7C48C4DEEAC80e86859b5e2416C”, // Consumer tackle
});

console.log(response.uncooked);
} catch (e) {
console.error(e);
}
}

Replace principal() to get the token steadiness

Replace principal() to execute getBalance() :

//…

async operate principal() {
const functionName = course of.env.FUNCTION_NAME;
change (functionName) {
//…
case “getBalance”:
await getBalance();
break;
default:
//…
}
}

Run the script in your terminal to retrieve your token:

FUNCTION_NAME=getBalance node script.js 

You must see one thing much like the next in your console:

Getting steadiness…
[
{
token_address: ‘0x274e53a526fa2543ce19f9c0334286b4724aa5e0’,
symbol: ‘MNT’,
name: ‘My New Tokenn’,
logo: null,
thumbnail: null,
decimals: 18,
balance: ‘1000000000000000000000’,
possible_spam: false,
verified_contract: false,
total_supply: ‘1000000000000000000000’,
total_supply_formatted: ‘1000’,
percentage_relative_to_total_supply: 100
}
]

Abstract

The tutorial gives a step-by-step information on minting a multichain ERC-20 token on the Base Sepolia community utilizing Axelar’s Interchain Token Service (ITS). The method entails organising conditions, creating a brand new undertaking and ABIs, organising a distant process name (RPC), minting the ERC-20 token with ITS, and checking the minted token steadiness with the Moralis API.

References

Now that you know the way to mint a multichain token, try the next:



Source link

Tags: APIsBaseDevelopersEnterpriseGradeERC20InterchainMintMoralisServiceStepstokenWeb3
Previous Post

BitDegree, Dyor Team Up: Mission Explores Crypto Investing

Next Post

Cutting-Edge AI-Powered Engineering at Farnborough International Airshow 2024

Related Posts

Feds Charge Man With $1.7M Scheme to Convert Fake Checks Into Bitcoin – Decrypt
Web3

Feds Charge Man With $1.7M Scheme to Convert Fake Checks Into Bitcoin – Decrypt

1 July 2025
Metaplanet Adds $104M in BTC, Testing Limits of Bitcoin Treasury Plan – Decrypt
Web3

Metaplanet Adds $104M in BTC, Testing Limits of Bitcoin Treasury Plan – Decrypt

30 June 2025
Can China’s MiniMax-M1 AI Topple US Rivals? We Put It to the Test – Decrypt
Web3

Can China’s MiniMax-M1 AI Topple US Rivals? We Put It to the Test – Decrypt

29 June 2025
Trump Blames Biden for Banks Blocking Crypto: ‘There Is a Lot of Debanking’ – Decrypt
Web3

Trump Blames Biden for Banks Blocking Crypto: ‘There Is a Lot of Debanking’ – Decrypt

28 June 2025
Bitcoin ETFs Notch 13 Consecutive Days of Inflow—Why It Matters – Decrypt
Web3

Bitcoin ETFs Notch 13 Consecutive Days of Inflow—Why It Matters – Decrypt

27 June 2025
Meta and OpenAI Use of Copyrighted Books for Training AI Was Fair Use: Federal Judge – Decrypt
Web3

Meta and OpenAI Use of Copyrighted Books for Training AI Was Fair Use: Federal Judge – Decrypt

26 June 2025
Next Post
Cutting-Edge AI-Powered Engineering at Farnborough International Airshow 2024

Cutting-Edge AI-Powered Engineering at Farnborough International Airshow 2024

DeFi Technologies amplifies Bitcoin holdings, adds Solana to treasury

DeFi Technologies amplifies Bitcoin holdings, adds Solana to treasury

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Trending
  • Comments
  • Latest
Ethereum Reclaims $2,500 In Squeeze-Driven Rally – But Can It Hold?

Ethereum Reclaims $2,500 In Squeeze-Driven Rally – But Can It Hold?

28 June 2025
솔라나 레이어 2 코인 솔락시, 유니스왑 상장 출시… 지금 구매할 만한 유망 코인일까? | Bitcoinist.com

솔라나 레이어 2 코인 솔락시, 유니스왑 상장 출시… 지금 구매할 만한 유망 코인일까? | Bitcoinist.com

24 June 2025
$304M Raised, 20 Listings Locked – BlockDAG’s Plan Is Set, TAO and Pi Downtrend

$304M Raised, 20 Listings Locked – BlockDAG’s Plan Is Set, TAO and Pi Downtrend

16 June 2025
Why is Crypto Crashing? Dust Settles Over SOL and ETH After Musk Storm

Why is Crypto Crashing? Dust Settles Over SOL and ETH After Musk Storm

7 June 2025
Ethereum Price To Resume Downtrend? Market Expert Identifies Bearish Chart Setup | Bitcoinist.com

Ethereum Price To Resume Downtrend? Market Expert Identifies Bearish Chart Setup | Bitcoinist.com

23 June 2025
Altcoin Exchange Flows Dip Below $1.6B – History Points To Incoming Rally | Bitcoinist.com

Altcoin Exchange Flows Dip Below $1.6B – History Points To Incoming Rally | Bitcoinist.com

28 June 2025
The Blockchain Group Confirms Acquisition of 60 BTC, Total Holdings Reach 1,788 BTC – News Bytes Bitcoin News

The Blockchain Group Confirms Acquisition of 60 BTC, Total Holdings Reach 1,788 BTC – News Bytes Bitcoin News

1 July 2025
Robinhood Kickstarts US Stocks in Europe with Crypto: Will On-Chain Adoption Skyrocket?

Robinhood Kickstarts US Stocks in Europe with Crypto: Will On-Chain Adoption Skyrocket?

1 July 2025
Penis envy? 35-foot appendage at UK heritage site was almost covered up

Penis envy? 35-foot appendage at UK heritage site was almost covered up

1 July 2025
Feds Charge Man With $1.7M Scheme to Convert Fake Checks Into Bitcoin – Decrypt

Feds Charge Man With $1.7M Scheme to Convert Fake Checks Into Bitcoin – Decrypt

1 July 2025
Circle Proposed to Launch Federally Regulated Trust Bank

Circle Proposed to Launch Federally Regulated Trust Bank

1 July 2025
Supreme Court Rejects Crypto Privacy Case Against IRS

Supreme Court Rejects Crypto Privacy Case Against IRS

1 July 2025
Facebook Twitter Instagram Youtube RSS
Coin Digest Daily

Stay ahead in the world of cryptocurrencies with Coin Digest Daily. Your daily dose of insightful news, market trends, and expert analyses. Empowering you to make informed decisions in the ever-evolving blockchain space.

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • NFT
  • Regulations
  • Scam Alert
  • Web3

SITEMAP

  • About us
  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2024 Coin Digest Daily.
Coin Digest Daily is not responsible for the content of external sites.

No Result
View All Result
  • Home
  • Bitcoin
  • Crypto Updates
    • General
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • Metaverse
  • Web3
  • DeFi
  • Analysis
  • Scam Alert
  • Regulations

Copyright © 2024 Coin Digest Daily.
Coin Digest Daily is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
  • bitcoinBitcoin(BTC)$106,709.00-0.95%
  • ethereumEthereum(ETH)$2,443.99-0.96%
  • tetherTether(USDT)$1.000.01%
  • rippleXRP(XRP)$2.190.38%
  • binancecoinBNB(BNB)$651.53-0.45%
  • solanaSolana(SOL)$148.32-1.77%
  • usd-coinUSDC(USDC)$1.000.00%
  • tronTRON(TRX)$0.2785840.52%
  • dogecoinDogecoin(DOGE)$0.159727-3.03%
  • staked-etherLido Staked Ether(STETH)$2,444.40-0.95%