Ethers. js is a library that helps developers create decentralized applications, while Web3. js is a library that helps developers connect to the Ethereum network.

Internally within the SDK and when used with TransactionKit, it’s important that we use ether.js version 5.4.0. This is the current version that we support for such use cases.

For using it outside of TransactionKit it’s still recommended to use version 5 as it’s more stable.

npm i ethers@5

Demo dapps

Commonly we use ethers.js when creating demo or test dapps because it easily lets us create a new key based wallet on page load.

This is done with TransactionKit like this:

import { ethers } from "ethers";

const randomWallet = ethers.Wallet.createRandom();
const providerWallet = new ethers.Wallet(randomWallet.privateKey);

      provider={providerWallet} /* The random wallet we created above */
      <App />

You can find more information on working with ethers here.