Loop Network Docs
  • Welcome to Loop Network !
    • Tokenomics
    • Table of Comparison
  • Basic Knowledge
    • What is Blockchain ?
      • EVM Explained
      • Nodes
      • Smart Contract
    • Getting Started with Loop Network
      • Connect to Metamask
        • How to Connect with Metamask
  • Whitepaper 2.0
    • Genesis File
    • Consensus
    • Key Management
    • Contract Deployment
      • Truffle
      • Hardhat
    • LRC20 Token
  • Running Full Node
Powered by GitBook
On this page
  • Setup Web3
  • Connect to LOOP network
  • Set up account
  • Recover account
  • Full Example
  1. Whitepaper 2.0

Key Management

PreviousConsensusNextContract Deployment

Last updated 3 years ago

This article is a guide about key management strategy on client side of your Decentralised Application on Loop Network

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

Connect to LOOP network

    // mainnet 
     const web3 = new Web3('https://api.mainnetloop.com');
    // testnet
    const web3 = new Web3('https://api.testnetloop.com');

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 backup 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://https://api.mainnetloop.com');
    const loader = setupLoader({ provider: web3 }).web3;

    const account = web3.eth.accounts.create();
    console.log(account);
}
here