I want to find ethereum address and I have almost all the letters. The beginning of the wallet: 0xb6b2ceb624a6b667e67af1893b16706baec21 But how can I find remaining letters?
3 Answers
Code using web3.js 1.0-beta, which failed to find any accounts with positive balances:
const Web3 = require('web3');
const web3 = new Web3('https://mainnet.infura.io');
const start = '0xb6b2ceb624a6b667e67af1893b16706baec21';
async function main() {
for (var i = 0; i < 4096; i++) {
const end = web3.utils.padLeft(web3.utils.toHex(i).substring(2), 3);
const address = start + end;
const balance = parseInt(await web3.eth.getBalance(address), 10);
if (balance > 0) {
console.log(`${address} has a balance of ${balance} wei.`);
}
}
}
main();
You have 3 digits missing and all the possible combinaisons are valid address from 0xb6b2ceb624a6b667e67af1893b16706baec21000
(here) to 0xb6b2ceb624a6b667e67af1893b16706baec21fff
(here)
You have no choice than checking all the combinaisons: 16^3 = 4096
If you are sure that the address you are looking for has a positive balance, you can write an algorithm which will check for each possible combinaison the balance and extract only the address with positive balance.
For example:
const provider = new Web3.providers.HttpProvider("https://mainnet.infura.io/");
const web3 = new Web3(provider);
const alphabet = [0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f];
const input = "0xb6b2ceb624a6b667e67af1893b16706baec21";
for (x in alphabet) {
for (y in alphabet) {
for (z in alphabet) {
let address = input + x + y + z;
let balance = new BigNumber(web3.eth.getBalance(address));
if(balance.greaterThan(new BigNumber(0)) {
console.log(address + "=" + web3.fromWei(balance, "ether"));
}
}
}
}
-
I ran something similar and didn't find any accounts with positive balances. Commented Jan 24, 2019 at 9:36
You can write SQL query using LIKE syntax with wildcard character %.
SELECT *
FROM ethereum.transactions
WHERE TO_ADDRESS LIKE '0xb6b2ceb624a6b667e67af1893b16706baec21%'
See it in action on Flipside.