Integrate Web3Auth with the Aleph Zero Blockchain in Web Applications
While using the Web3Auth Web SDK, you get a EIP1193
provider, similar to the Metamask Provider.
This provider can be used with libraries like
web3.js
,
ethers.js
etc. to make
Aleph Zero 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 examples to get you started.
Installation
- viem
- web3.js
- ethers.js
- npm
- yarn
- CDN
npm install --save web3
yarn add web3
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
- npm
- yarn
- CDN
npm install --save ethers
yarn add ethers
<script src="https://cdn.ethers.io/scripts/ethers-v4.min.js"></script>
- npm
- yarn
- CDN
npm install --save viem
yarn add viem
<script src="https://cdn.jsdelivr.net/npm/viem@2.9.32/_cjs/index.min.js"></script>
Chain Details for Aleph Zero
- Mainnet
- Testnet
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0xA1EF", // hex of 41455, Aleph Zero Mainnet
rpcTarget: "https://rpc.alephzero.raas.gelato.cloud",
displayName: "Aleph Zero Mainnet",
blockExplorerUrl: "https://evm-explorer.alephzero.org",
ticker: "AZERO",
tickerName: "Aleph Zero",
logo: "https://i.ibb.co/cYcFtr4/A0-mark-graphite.png",
};
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x7F7", // hex of 2039, Aleph Zero Testnet
rpcTarget: "https://rpc.alephzero-testnet.gelato.digital",
displayName: "Aleph Zero Testnet",
blockExplorerUrl: "https://evm-explorer-testnet.alephzero.org",
ticker: "tAZERO",
tickerName: "Aleph Zero Testnet",
logo: "https://i.ibb.co/cYcFtr4/A0-mark-graphite.png",
};