源码
https://github.com/chaincc/just_tools
const { ethers } = require("ethers"); function main() { newWallet() } main(); async function newWallet() { var privateKey = ethers.utils.randomBytes(32); var wallet = new ethers.Wallet(privateKey); let keyNumber = ethers.BigNumber.from(privateKey); if (keyNumber._hex.length != 66){ console.log("key length fail,请重新执行") return } console.log("账号地址: "+wallet.address); console.log("账号私钥: "+keyNumber._hex); }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279804.html