🔑
Key management
This article is a guideline on client key management strategies for FON smart chain decentralized applications
web3.js is a JavaScript library that allows our client applications to talk to the blockchain. We configure web3 to communicate via Metamask.
// mainnet
const web3 = new Web3('https://fsc-dataseed1.fonscan.io:443');
If the installation and instantiation of web3 was successful, the following should successfully return a random account:
const account = web3.eth.accounts.create();
If you backed up your account private key, you can use it to restore your account.
const account = web3.eth.accounts.privateKeyToAccount("$private-key")
const Web3 = require('web3');
async function main() {
const web3 = new Web3('https://fsc-dataseed1.fonscan.io:443');
const loader = setupLoader({ provider: web3 }).web3;
const account = web3.eth.accounts.create();
console.log(account);
}