On-Chain interaction
RPC
curl -s -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://localhost:8545SDK
const Web3 = require('web3')
async function getChainId() {
const web3 = new Web3('https://')
let chainId = await web3.eth.getChainId()
console.log(`chain id: ${chainId}`)
return chainId
}const Web3Accounts = require('web3-eth-accounts')
let account = new Web3Accounts().create()
//do not do this on prd env
console.log(`account generated. address: ${account.address}, private key: ${account.privateKey}`)Last updated