# Test using MetaMask

In this article, we will show how to test smartBCH single-testing-node using MetaMask. We use Chrome browser as example but Firefox browser should work the same way.

Please note in the following example we assume you are using a [local single-node testnet](https://docs.smartbch.org/smartbch/archives/broken-reference). Instead, if you want to use a remote node to provide JSON-RPC, just replace "localhost" with the node's IP address.

## Start smartBCH single-testing-node

Please flow [this doc](https://docs.smartbch.org/smartbch/archives/broken-reference) to start smartBCH single testing node. When the testing node is started with default options, it will serve JSON-RPC on localhost:8485. You can use the following cmd to check that the node works well and to see the testing accounts:

```bash
$ curl -X POST --data '{"jsonrpc":"2.0", "method":"eth_accounts", "params":[],"id":1}' \
    -H "Content-Type: application/json" http://localhost:8545 | jq
```

The output looks like this:

```javascript
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "0x876367b14fe2c725ed4bfc4ace406ea53db58d0f",
    "0x8c1fe0ad5e59d72ffd064ff80e0c605530af8806",
    "0xa321e9ca672fb04b3c57160f93a40b70fb3f1d6b",
    "0xa6f8d15b18b2b93cbf7fae192184ccd9e03bfaf4",
    "0xb77f11af5206fdfd87011744ea1c0b3bf77ca4ec",
    "0xc38a47a2481bc692c2203e7e7e5e73c474bea43c",
    "0xd5fd2c57069d93b6ce3126275a288d21b8aa2e87",
    "0xdc7c3b6c76eed26bf224a9f1a300b79ce8bc68b2",
    "0xf995503a428d2deaeb53075dc0476affeee95f05",
    "0xfb2c39aafd37c6d17e16b73cc8601f77ed5586b9"
  ]
}
```

## Config MetaMask networks

Install MetaMask into your browser, create or import a wallet, and than add a network configuration:

![metamask-select-networks](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F0aad8c78e2612cc07e9b65285b4bded26b51f22f.png?generation=1619421244324157\&alt=media)

If you started smartBCH testing node on localhost:8545 for JSON-RPC, it happens that MetaMask has a preconfigured Network that matched this RPC URL:

![metamask-settings-networks-localhost-8584](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F437716da4af1131c8387e47c8804277c5a434bd1.png?generation=1619421244639653\&alt=media)

But the chain ID may not match, in that case, you can replace 1337 with your smartBCH chain ID (for example, for the smartBCH-T1 testnet, it's 0x2711). And it's better that you change Currency Symbol to BCH. You can also add a new Network configuration like this:

![metamask-settings-networks-new](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2Fc429a7cd3a0b13cffeb373709e4984186383cfa3.png?generation=1619421250251921\&alt=media)

## Create a new account

Create a new account in MetaMask, and let's name it smartBCH\_user1. This newly created account have no BCH (the native token of smartBCH) of cause:

![metamask-new-account](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F065823f0df2ad264571b092ce271dd3babbc78a0.png?generation=1619421249559119\&alt=media)

We can transfer 1 BCH to this account using cmd like this:

```bash
$ curl -X POST --data '{
  "jsonrpc": "2.0",
  "method": "eth_sendTransaction",
  "params":[{
    "from": "0xd5fd2c57069d93b6ce3126275a288d21b8aa2e87",
    "to": "0xc370743331B37d3C6D0Ee798B3918f6561Af2C92",
    "gasPrice": "0x0",
    "value": "0xDE0B6B3A7640000"
  }],
  "id":1}' -H "Content-Type: application/json" http://localhost:8545
```

The `from` address comes from output of `eth_accounts` RPC. The `to` address is copied from MetaMask by clicking the account name. The `value` is amount of BCH to send in HEX, and is amplified by 1018. Just like ETH, 1 BCH on smartBCH chain can be divided into 1018 units. The output looks like this:

```javascript
{"jsonrpc":"2.0","id":1,"result":"0x40f6c7d7e350f295d000520b1a820f4b22535524a7e71b279dff45b2c60ce2c8"}
```

Wait a second, and you can check that your account has received 1 BCH:

![metamask-new-account-1bch](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2Fe0efd8d05fcf76a63f679f86e7b7b972bbcb92f2.png?generation=1619421244872029\&alt=media)

## Transfer BCH using MetaMask

Let's create another new account and name it smartBCH\_user2:

![metamask-new-account2](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F7773870c786b390b8df5b9e97d7f6aae601e1c17.png?generation=1619421244765738\&alt=media)

We can transfer/send to smartBCH\_user2 some BCH from smartBCH\_user1:

![metamask-send-bch](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F51b5ae90a133d4781dd38cf512b80bcf36efe65e.png?generation=1619421251054476\&alt=media)

![metamask-send-confirm](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F22c95943e3ce9b77ddf43d834307abce54bf6a7a.png?generation=1619421250388498\&alt=media)

A few seconds later, the balance of smartBCH\_user1 and smartBCH\_user2 should be updated:

![metamask-send-result1](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2F8b028782910b5640404d7fdd2af7123d41ba050f.png?generation=1619421249688546\&alt=media)

![metamask-send-result2](https://3319495191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MWmt0o30W7ixggmDAgb%2Fsync%2Ffd54b8c260707e7381d00f22de930696d5a1af8f.png?generation=1619421251630975\&alt=media)

Congratulations! You just started smartBCH single-testing node and tested it with the most popular browser wallet MetaMask. If you are new to MetaMask, you can read it's help docs [here](https://metamask.zendesk.com/hc/en-us).
