Development

Create Wallet

Key Management

This article is a guide for your client key management strategy for decentralized applications on the XT smart chain

Set Web3

web3.js is a javascript library that allows our client application to talk to the blockchain. We configure web3 to communicate through Metamask.

web3.js [Document] (https://web3js.readthedocs.io/en/v1.2.2/getting-started.html#adding-web3-js)

Connect to XSC network

    
      

// testnet

const web3 = new Web3('https://testnet1.xtvip.top');

Set up account

If the installation and instantiation of web3 are successful, the following should successfully return a random account:

    
      

const account = web3.eth.accounts.create();

Restore Account

If you backed up the private key of your account, you can use it to restore your account.

    
      

const account = web3.eth.accounts.privateKeyToAccount('$private-key')

Complete Example

    
      

const Web3 = require('web3');

async function main() {

  const web3 = new Web3('https://testnet1.xtvip.top');

  const loader = setupLoader({ provider: web3 }).web3;

  const account = web3.eth.accounts.create();

  console.log(account);

}

Previous

RPC

Next

Environment & Configuration