> For the complete documentation index, see [llms.txt](https://docs.ierc20.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ierc20.com/devs/dinx-evm-beta/add-token.md).

# Add Token

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

<div align="center" data-full-width="false"><figure><img src="/files/qAq99ZtVaICVGwwJIrSC" alt="" width="278"><figcaption></figcaption></figure></div>

Also you can programmatically add

```javascript
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"
  }
},
});
```

You can also try a one-click add at [`https://explorer.dinx.io`](https://explorer.dinx.io) to add

### 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

```go
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

<table><thead><tr><th>Protocol</th><th width="186">Support</th><th>Chain</th></tr></thead><tbody><tr><td>IERC20</td><td>yes.</td><td>Ethereum</td></tr><tr><td>BRC20</td><td>Not for a while.</td><td>BTC,Requires wallet association</td></tr><tr><td>Facet</td><td>Not for a while.</td><td>Ethereum</td></tr><tr><td>Bnbs</td><td>Not for a while.</td><td>Bsc</td></tr><tr><td>Sols</td><td>Not for a while.</td><td>Solana,Requires wallet association</td></tr><tr><td>Pols</td><td>Not for a while.</td><td>Polygon</td></tr><tr><td>Avas</td><td>Not for a while.</td><td>Avalanche</td></tr></tbody></table>

### IERC20 Token Contract Mapping (eg.)

<table><thead><tr><th width="246">Tick</th><th>Contract Address</th></tr></thead><tbody><tr><td>ETHI</td><td>0x8ada557a6a1cdf21a0794ab3394e0ab745ca2259</td></tr><tr><td>ETHPI</td><td>0xfca7fdce880d3a328bd03e5c4271b195685c1eaa</td></tr></tbody></table>

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.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ierc20.com/devs/dinx-evm-beta/add-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
