> For the complete documentation index, see [llms.txt](/llms.txt).

# Integrate Embedded Wallets with the Flare Blockchain in Node

While using the Web3Auth Node SDK, you get a Ethers Signer on successful authentication. This signer can be used with libraries like [ethers.js](https://docs.ethers.io/v5/getting-started/) etc. to make [Flare](https://ethereum.org/) blockchain calls like getting the user's `account`, fetching `balance`, `sign transaction`, `send transaction`, `read` from and `write` to the smart contract, etc. We have highlighted a few here to get you started.

## Chain details for Flare[​](#chain-details-for-flare "Direct link to Chain details for Flare")

- Mainnet
- Coston2 Testnet

- **Chain ID:** 0xE
- **Public RPC URL:** `https://flare-api.flare.network/ext/C/rpc`
- **Display Name:** Flare Mainnet
- **Block Explorer Link:** `https://flare-explorer.flare.network`
- **Ticker:** FLR
- **Ticker Name:** Flare

- **Chain ID:** 0x72
- **Public RPC URL:** `https://coston2-api.flare.network/ext/C/rpc`
- **Display Name:** Flare Coston2 Testnet
- **Block Explorer Link:** `https://coston2-explorer.flare.network`
- **Ticker:** C2FLR
- **Ticker Name:** Coston2 Flare

## Installation[​](#installation "Direct link to Installation")

To interact with the blockchain, you can use either the [viem](https://viem.sh/) or [ethers.js](https://docs.ethers.io/v5/getting-started/) library with Web3Auth.

- ethers.js
- viem

- npm
- Yarn
- pnpm
- Bun

```
npm install --save ethers

```

```
yarn add ethers

```

```
pnpm add ethers

```

```
bun add ethers

```

- npm
- Yarn
- pnpm
- Bun

```
npm install --save viem

```

```
yarn add viem

```

```
pnpm add viem

```

```
bun add viem

```

## Initialize[​](#initialize "Direct link to Initialize")

```
const { Web3Auth } = require('@web3auth/node-sdk')

const web3auth = new Web3Auth({
  clientId: 'YOUR_WEB3AUTH_CLIENT_ID', // Pass your Web3Auth Client ID, ideally using an environment variable
  web3AuthNetwork: 'sapphire_mainnet', // or 'sapphire_devnet'
})

await web3auth.init()

const result = await web3auth.connect({
  authConnectionId: 'YOUR_AUTH_CONNECTION_ID', // Your custom authentication connection name
  idToken: 'USER_ID_TOKEN', // JWT token from your auth system
})

```

## Get account[​](#get-account "Direct link to Get account")

```
// Get user's Ethereum public address
const address = result.signer.getAddress()
console.log('\x1b[33m%s\x1b[0m', 'Accounts:', address)

```

## Get balance[​](#get-balance "Direct link to Get balance")

```
const address = await result.signer.getAddress()
const balance = ethers.formatEther(
  await result.signer.provider.getBalance(address) // Balance is in wei
)
console.log('\x1b[33m%s\x1b[0m', 'Balance:', balance, 'ETH')

```

## Sign a message[​](#sign-a-message "Direct link to Sign a message")

```
const signature = await result.signer.signMessage(message)
console.log('\x1b[33m%s\x1b[0m', 'Signed Message:', signature)

```
