EVM compatible networks

How to integrate with D'CENT wallet for dapps on EVM compatible networks.

D'CENT mobile app's in-app browser injects window.ethereum as a provider. If your dapp is based on EVM compatible network, you can interact with D'CENT wallet through window.ethereum provider.

Supported Networks

The following is the D'CENT in-app browser's supported network list which can use window.ethereum provider. Additional networks (https://chainid.network/) will be added to this list in the future.

Chain ID

Network

1

Ethereum Mainnet

3

Ethereum Testnet Ropsten

4

Ethereum Testnet Rinkeby

5

Ethereum Testnet Goerli

42

Ethereum Testnet Kovan

56

Binance Smart Chain Mainnet

97

Binance Smart Chain Testnet

137

Polygon (previously Matic) Mainnet

80001

Polygon Testnet Mumbai

30

RSK Mainnet

31

RSK Testnet

14

Flare Network

16

Flare Testnet Coston

19

Songbird Mainnet

128

HECO Chain Mainnet

100

Gnosis Chain (prev. xDai Chain) Mainnet

250

Fantom Mainnet Opera

50

XinFin Network Mainnet

42220

Celo Mainnet

321

KCC Mainnet

43114

Avalanche C-Chain Mainnet

42161

Arbitrum

421611

Arbitrum Testnet Rinkeby

288

BOBA L2

66

OEC

10

Optimism Mainnet

11

Metadium Mainnit

12

Metadium Testnet

246

EWC (Energy Web Token) Mainnet

1666600000

Harmony Mainnet

1666700000

Harmony Testnet

2017

Orbit Chain Mainnet

25

Cronos Chain

8217

Klaytn (EVM) Mainnet

7518

MEVerse

8453

BASE

84531

BASE Goerli (Testnet)

11155111

Etherum Sepolia (Testnet)

255

Kroma

2358

Kroma Sepolia (Testnet)

592

Astar (EVM)

How to Switch the Network

By clicking the "network" icon on the right top corner of "discovery" tab, you can switch the blockchain network for dapp browser.

For more details, please see D'CENT user guide.

If your dapp is already integrated with MetaMask

D'CENT wallet's provider uses EIP-1193 & EIP-1102 interface.

MetaMask also uses the same provider interface (not exactly the same, but almost the same). This means if your dapp is already integrated with MetaMask, it's very easy to integrate with D'CENT wallet.

For your reference, you can also find the MetaMask's developer guide in the link below.

How to detect in-app browser

In order to check if your dapp running on EVM networks is supported by the dapp-browser, you need to check whether window.ethereum is defined.

if (typeof window.ethereum !== 'undefined') {
    console.log("It's in-app browser");
}

How to check D'CENT provider

Most of dapp browsers for EVM networks use the same interface window.ethereum. You can check whether the dapp browser is D'CENT wallet's in-app browser with the following code.

if (window.ethereum.isDcentWallet === true) {
    console.log("It's D'CENT wallet's in-app browser")
}

Connect to Wallet

You can use the following code in order to connect to D'CENT wallet's account.

ethereum.request({ method: 'eth_requestAccounts' })

You can also use the old style code.

ethereum.enable()

Wallet Connection UI

If the connection to wallet is requested, you can see the popup like below.

Get the current network

To get the current network ID, you can use the following code.

ethereum.request({ method: 'net_version' })

You can also use the old style code.

ethereum.networkVersion

Get the current account's address

To get the address of the current account, you can use the following code.

ethereum.request({ method: 'eth_accounts' })

Send Transaction

By using ethereum.request method to call eth_sendTransaction, you can send the transaction. The following is the example code to show how to send the transaction.

const transactionParameters = {
  nonce: '0x00', // ignored
  gasPrice: '0x9184e72a000', // customizable by user
  gas: '0x76c0', // customizable by user
  to: '0x0000000000000000000000000000000000000000',
  from: '0xb60e8dd61c5d32be8058bb8eb970870f07233154', // current account's address
  value: '0x9184e72a',
  data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675',
};

const txHash = await ethereum.request({
  method: 'eth_sendTransaction',
  params: [transactionParameters],
});

Last updated