How to generate accounts and send transactions
This guide explains how GetBlock users can connect to blockchain nodes to create accounts and send transactions.
Creating accounts
const Web3 = require('web3');
//Set up the provider (replace ACCESS-TOKEN with your actual token)
const web3 = new Web3('https://go.getblock.io/<ACCESS-TOKEN>/');// Generate new address and private key
const accountTo = web3.eth.accounts.create();
console.log('Generated account:', accountTo);// Restore account from private key
const privateKey = process.env['privateKey'];
const accountFrom = web3.eth.accounts.privateKeyToAccount(privateKey);Sending transactions
Last updated
Was this helpful?