直接贴代码,实现方式很简单
import Web3 from "web3";
const RPC_URL = "https://ropsten.infura.io/v3/2c2a9b9cfe2541809d2c6ff9db7202a0"
const web3 = new Web3(RPC_URL)
const end1 = '888888'
const end2 = '999999'
const end3 = '666666'
let account = ''
let wallet = web3.eth.accounts.create()
do {
wallet = web3.eth.accounts.create()
account = wallet.address
console.log('当前生成的钱包账号:', account);
if (account.endsWith(end1) || account.endsWith(end2) || account.endsWith(end3)) {
console.log('当前生成的钱包:', wallet);
}
} while (!account.endsWith(end1) && !account.endsWith(end2) && !account.endsWith(end3))