How to check about 10 million bitcoin addresses? A few years ago I deposited a specific amount of bitcoins into an address and wrote that address/private key down. I lost the last four characters of the address. I counted that each character can be 26 upper + 26 lower + 10 digits = 62 characters. So missing 4 characters means that my wallet can be an of 62*62*62*62 = 14,776,336 addresses. How can I programmatically check all those combinations? I will find all the addresses with the same bitcoins as I deposited and then check them one by one as I expect (hope) there to be less than 1,000 matching addresses. 

I've checked blockchain.info but they timed me out after a few requests, I checked blockonomics.co but they are expensive.
You don't need to check the whole 62*62*62*62 addresses online through API. That would be an insanely long journey, and you'll get blacklisted at any free service before finding what you seek, no doubt.

In your place I would:

1) download the daily balance snapshot from blockchair.com

2) either in Windows through Cygwin or in Linux shell, or in MacOS terminal type:

zcat blockchair_bitcoin_addresses_latest.tsv.gz|grep "the part of the address you remember"


Example, I took a random address from the list and removed last 4 digits:

root@ubuntu:~# time zcat blockchair_bitcoin_addresses_latest.tsv.gz |grep 1EpfyhhNnwF2Sv53PUzoJGRawiTVy
1EpfyhhNnwF2Sv53PUzoJGRawiTVybuMTz      1

real    0m9.479s
user    0m9.209s
sys     0m0.746s


I've run the command with time in front just for testing purposes, in order to demonstrate that it took less than 10 seconds to parse the list and find the matching address, and this is not a powerful PC. I don't even have SSD here, I bet if you have one it will be even faster.

Please note the number 1 after the address: this BTC address has indeed 1 satoshi.

If you are in doubt about capital letters in your address just add the -i option after grep so it will not run a case-sensitive search and will return the result even with wrong capitals in the search pattern; here I searched all Bitcoin addresses with non-zero balance containing my name despite any capitals, and it still took 10s:

root@ubuntu:~# time zcat blockchair_bitcoin_addresses_latest.tsv.gz |grep -i marco
3NPjX9BFc3hZdXeqjFqMNMARco2gfna9cR      1512000000
1HTsd6dR5qdKUTghRh8VdfDq3marcoVBdZ      4267964
1LCidVxbHzL4maRcoeaYZrevVVz3KTHnqb      3900000
1AF9enGasTBY1zxsMARCotYP9izc2v3Fzs      2028360
17kaMiiyDa11VGYMArCoZM8wD9enpWXc5K      1009417
1EoDrgLovufWp4BjC4iEqyhSHR2MaRcob1      1003055
14UEd1qtHwvWk3tWjkDsZfRXKUDx7mArCo      483996
1At868R9nWceRRpymarCopNhrywPUooDvE      431629
1Marco12CWtLWwAK9eKxqTZmeQgitBwAhg      200000
1marcoUFS2NyCtW7hH2AGxGVbJ9fpZkrR       184000
17Nw3Ed1vnUQpmzKty2MarcoCskKDZQmAp      167192
18odA7ipASdRFkf1gGAspQ8DQmArCoLrsU      99300
1MArcoSBgoNhnypXD7YhE4T9B7eUFSTLA3      26280
1marco52Uta2SKaLPeNiEczbrwCHnV7Jb       17100
1MaRCoEoSZXpupVVtCcs5chdEVwF78FQ9U      10000
1Kf9aZ21UQmrRBpXfMarcoQoj7VgV2e9H2      3660
1FT4mpGZS4Df8WzjWHhDDCezJJKksmARCo      3607
1MarcoStvKXXkeQJhwfcUdUP1NLnHB2bfr      1
1MArCovVsyQ54sRufEvjCrNCmUfgr3ZsvY      1
1MARcoseSo15DysRD9t2GoRm2aaHPKxgeh      1
1DemArcoSrb2D8RCSvsU7gPBvFbT3sdDL1      1
1MarConm2xEoBveieCcGGZvAvKZi6EHvzn      1
1DemArCozufYcpvVqxsXy3ttLh2iN5keHr      1
1MARCoNioFuSbuX7mgAifgBx8hsF8FVFu8      1

real    0m9.921s
user    0m10.829s
sys     0m0.656s


Relevant note: if you have not a premium API account on blockchair.com the list download (today over 700MB) is rate limited to 128KB/s. The DL takes around two hours but it is updated daily, and I find it's still a tremendous booster for all bulk balance lookups issues, unless you need balances to be real time. In this last case, look to a paid API as only solution.