# EVM-Compatible Networks

Using Ethers.js or Web3.js with the Wepin Provider allows you to interact with EVM-compatible blockchain networks.&#x20;

## Supported Networks

<table><thead><tr><th width="172.33333333333331">Chain ID</th><th>Network Name</th><th>Network Variable</th></tr></thead><tbody><tr><td>1</td><td>Ethereum Mainnet</td><td>ethereum</td></tr><tr><td>5</td><td>Ethereum Goerli Testnet</td><td>evmeth-goerli</td></tr><tr><td>11155111</td><td>Ethereum Sepolia Testnet</td><td>evmeth-sepolia</td></tr><tr><td>19</td><td>Songbird Canary Network</td><td>evmsongbird</td></tr><tr><td>137</td><td>Polygon Mainnet</td><td>evmpolygon</td></tr><tr><td>80002</td><td>Polygon Amoy</td><td>evmpolygon-amoy</td></tr><tr><td>1001</td><td>Klaytn Testnet</td><td>klaytn-testnet</td></tr><tr><td>8217</td><td>Klaytn Mainnet</td><td>klaytn</td></tr><tr><td>2731</td><td>TimeNetwork Testnet</td><td>evmtimenetwork-testnet</td></tr></tbody></table>

##

## Installation

First, import <mark style="color:blue;">`@wepin/widget-sdk`</mark> and <mark style="color:blue;">`@wepin/provider`</mark> into your peoject.

```jsx
// You must import the widget-sdk first.
import '@wepin/widget-sdk'
import '@wepin/provider'
```

## Initialize Web3.js

First, initialize <mark style="color:blue;">`Wepin`</mark>, then obtain the provider to initialize web3.js.

```jsx
// Import the web3.js first.
import Web3 from 'web3';

const appId = 'app_id_eg12sf3491azgs520' // Test App ID
const appKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key
const attributes = {
	type: 'show'
}
// Initialize Wepin
await Wepin.init(appId, appKey, attributes)
// Obtain the provider from the initialized Wepin.
const provider = Wepin.getProvider({ network: 'ethereum' });

// Initialize web3 using the Wepin provider.
const web3 = new Web3(provider) 
```

## Methods

### Get Accounts

Through the initialized <mark style="color:blue;">`web3`</mark>, you can retrieve account information.

```jsx
const accounts = await web3.eth.getAccounts()
```

### Get Balance

Using the account information, you can query the balance.

```jsx
const balance = await web3.eth.getBalance(accounts[0])
```

You can refer to the link below to query not only the balance but also fee information, block number, etc.

{% embed url="<https://web3js-kr.readthedocs.io/ko/latest/getting-started.html>" %}

### Send Transaction

You can send transactions.

```jsx
const accounts = await web3.eth.getAccounts()
const tx = {
    from: accounts[0],
    gasPrice: "2000000000",
    gas: "21000",
    to: '0x11f4d0A3c1......13F7E19D048276DAe',
    value: "10000000000000000",
}
const response = await web3.eth.sendTransaction(tx)
```

### Contract Call

You can perform contract calls.

```jsx
const callObject = {
	to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', //contract address
	data: '0xc6888fa10000000000000000000000000000000000000000000000000000000000000003'
}
const response = await web3.eth.call(callObject)
```

For more details on the Ethereum-compatible network provider, please refer to the link below.

{% embed url="<https://eips.ethereum.org/EIPS/eip-1193>" %}


---

# Agent Instructions: 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:

```
GET https://docs.wepin.io/en/deprecated/web-javascript-sdk/provider/evm-compatible-networks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
