Key Management
This article is a guide about key management strategy on the client side of your Decentralized Application on BAS

Setup Web3

web3.js is a javascript library that allows our client-side application to talk to the blockchain. We configure Web3 to communicate via Metamask.
web3.js doc is hereโ€‹

Connect to BAS ARIES network

// testnet
const web3 = new Web3('https://bas-aries-public.nodereal.io');

Set up account

If the installation and instantiation of Web3 was successful, the following should successfully return a random account:
const account = web3.eth.accounts.create();

Recover account

If you have backed up the private key of your account, you can use it to restore your account.
const account = web3.eth.accounts.privateKeyToAccount("$private-key")

Full Example

const Web3 = require('web3');
async function main() {
โ€‹
const web3 = new Web3('https://bas-aries-public.nodereal.io');
const loader = setupLoader({ provider: web3 }).web3;
โ€‹
const account = web3.eth.accounts.create();
console.log(account);
}
Copy link
On this page
Setup Web3
Connect to BAS ARIES network
Set up account
Recover account
Full Example