IERC Document
  • 📜IERC Protocol
    • Overview
    • Why use IERC 20?
    • Use Cases and Features
    • Roadmap
  • 🌠User's Guide
    • Explore IERC-20
    • How To Mine
    • How To Deploy
    • How To Transfer
    • Market
      • How To Buy
      • How To List
      • How To Bulk Buy
  • 🔁IERC Swap
    • How to IERC Swap
    • How to add Liquidity
    • Liquidity providers (LPs)
    • FAQ
  • 🔥New Features
    • PoW&DPoS
    • 🔨How to PoW&DPoS Mining
    • IERC PoW
      • Phrase I: PoW - Base
      • ⛏️How to Mine
      • Phase II: PoW - Advanced
      • 🤝How to Participate
    • IERC DPoS
      • 📒Staking Rules
      • 💦How to Stake
      • 🎁Rewards Program
    • Tokenomics
    • FAQ
  • 💻Devs
    • IERC-20
      • Deploy
      • Mint
      • Transfer
      • Freeze Sell
      • Proxy Transfer
      • Stake
      • Unstake
      • More
    • DINX EVM (beta)
      • RPC
      • Add Token
      • Explorer
      • API
  • 🤵Ambassador Program
  • ❓FAQ
Powered by GitBook
On this page
  • Calculation of virtual contract addresses
  • IERC20 Token Contract Mapping (eg.)
  • ERC-20 Standard Interface
  1. Devs
  2. DINX EVM (beta)

Add Token

PreviousRPCNextExplorer

Last updated 4 months ago

When DINX RPC is enabled, you can add your inscription assets to your asset list .

You can add assets manually by entering the token address in metamask

Also you can programmatically add

await window.ethereum.request({
 "method": "wallet_watchAsset",
 "params": {
  type: "ERC20",
  options: {
    address: "0x8ada557a6a1cdf21a0794ab3394e0ab745ca2259",
    symbol: "ETHI",
    decimals: 8,
    image: "https://app.ierc20.com/static/images/logos/ethi.png"
  }
},
});

Calculation of virtual contract addresses

All current and future protocol tokens can be calculated using DINX's virtual contract address calculation. The principle of the calculation is as follows

package main

import (
	"crypto/sha3"
	"encoding/hex"
	"fmt"
	"strings"
)

// Function to compute keccak256 hash of a string
func keccak256(input string) string {
	hasher := sha3.NewLegacyKeccak256()
	hasher.Write([]byte(input))
	hash := hasher.Sum(nil)
	return hex.EncodeToString(hash)
}

// Function to convert a hash to an Ethereum address
func hashToAddress(hash string) string {
	// Extract the last 20 bytes (40 hex characters)
	last20Bytes := hash[len(hash)-40:]
	return "0x" + strings.ToLower(last20Bytes)
}

func main() {
	// Define the input string
	inputString := "ierc:ethi"

	// Compute the keccak256 hash of the input string
	hash := keccak256(inputString)
	fmt.Println("Keccak256 Hash:", hash)

	// Extract the Ethereum address from the hash
	address := hashToAddress(hash)

	// Output the results
	fmt.Println("Ethereum Address (Lowercase):", address)
}

Currently Supported Protocols

Protocol
Support
Chain

IERC20

yes.

Ethereum

BRC20

Not for a while.

BTC,Requires wallet association

Facet

Not for a while.

Ethereum

Bnbs

Not for a while.

Bsc

Sols

Not for a while.

Solana,Requires wallet association

Pols

Not for a while.

Polygon

Avas

Not for a while.

Avalanche

IERC20 Token Contract Mapping (eg.)

Tick
Contract Address

ETHI

0x8ada557a6a1cdf21a0794ab3394e0ab745ca2259

ETHPI

0xfca7fdce880d3a328bd03e5c4271b195685c1eaa

Future support for more protocols can be derived from the virtual contract address calculations.

ERC-20 Standard Interface

Core Functions:

  1. totalSupply(): Returns the total number of tokens in existence.

  2. balanceOf(address account): Provides the token balance of a specific account.

  3. transfer(address recipient, uint256 amount): Transfers a specified amount of tokens from the caller's account to a recipient.

  4. approve(address spender, uint256 amount): Authorizes another account (the spender) to spend a certain amount of tokens on behalf of the caller.

  5. allowance(address owner, address spender): Returns the remaining number of tokens that the spender is permitted to spend on behalf of the owner.

  6. transferFrom(address sender, address recipient, uint256 amount): Facilitates the transfer of tokens from one account to another, utilizing the allowance mechanism.

Events:

  • Transfer(address indexed from, address indexed to, uint256 value): Emitted when tokens are transferred, including zero-value transfers.

  • Approval(address indexed owner, address indexed spender, uint256 value): Emitted when an account's allowance for a spender is set by a call to approve.

⚠️ Currently DINX RPC only supports read type operations, not write operations.

You can also try a one-click add at to add

💻
https://explorer.dinx.io