Bitcoin Forum
May 04, 2024, 04:15:24 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ANN] [FREE] Fork balance checker in python  (Read 282 times)
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
April 25, 2018, 09:26:29 AM
Last edit: April 26, 2018, 11:25:23 AM by mocacinno
Merited by TryNinja (1), user0000001 (1)
 #1

I wasn't into claiming from forks, but lately so many of them have popped up, and some actually seem to be worth some "real" BTC, so i was searching for a tool that i could use to check if i controlled unspent outputs (had some balance) on multiple forks... I found a couple online ones, and a couple github projects, but none actually worked the way i liked, and some only checked for a limited amount of forks...

So, i decided to build my own fork balance checker in python Smiley
As usual, the project started out really small and easy, but i kept adding more and more forks and more and more functionality, so it has now grown into a big-ish script that should have been divided into modules... But hey, it's free and it's working Wink

https://github.com/mocacinno/mocacinnoforkchecker/
I've given credits to the users whose idears, code and research i used in the README.md

Requirements:
  • Linux
  • Python 2.7
  • pip
  • git

Installation instructions:
Code:
pip install argparse requests base58 urllib3 tqdm
git clone https://github.com/mocacinno/mocacinnoforkchecker/ balancechecker

you can read the README or give the --help parameter if you want to know which parameters to use...
Code:
python checker.py --help

Basically, only address OR addressfile are obligatory (the script needs to know which addresses to check on those forks).
ADDRESSFILE is just a newline seperated list of your addresses, only lines starting with "1", "3" or "bc" are used, so you can add newlines or lines starting with # for comments as much as you'd like

Todo:
  • Add the last forks in my list to the tool
  • use Beautifulsoup to parse the block explorers that don't publish an API
  • To a last sweep to be certain i didn't miss any coins/explorers
  • Maybe fetch the price from CMC and display it aswell
  • change the BTC block explorer... The one i used seems to be in maintenance mode for at least 24 hours
  • look into moneywagon (credit: btc_enigma)
  • look into accepting xpub (credit: btc_enigma)
  • add functionality to not parse dead forks

Warning: if you import your private key(s), xpub's or seed phrases in ANY unknown wallet you COULD lose your unspent outputs on all chains (including the BTC chain), unknown wallets might use a backdoor to send your keys to the wallet's author, he could use these keys to rob you and sign messages in your name!!!
Also, make sure the chains you claim on have implemented some sort of replay protection

I did not investigate all forks i used in my tool, some *might* be scam!!! use your own brain, i'm not responsible if you lose anything during the claim process!!!


█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
"This isn't the kind of software where we can leave so many unresolved bugs that we need a tracker for them." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
btc_enigma
Hero Member
*****
Offline Offline

Activity: 688
Merit: 565


View Profile
April 25, 2018, 09:32:18 AM
 #2

Very nice, I like this project. Further imporvements

- Use moneywagon to query APIs (Has multiexplorer support with failsafe)
- Allow xpub as argument... show balance of wallet across various forks

mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
April 25, 2018, 09:37:07 AM
 #3

Very nice, I like this project. Further imporvements

- Use moneywagon to query APIs (Has multiexplorer support with failsafe)
- Allow xpub as argument... show balance of wallet across various forks

moneywagon seems very interesting... I'll look into that one and see if i can implement it
xpub as an argument is also a good idear, however i'm a bit afraid of sending to much queries to the explorer's api's... Don't want them to blacklist any ip's Wink I'll try to find a workaround...

Thanks for the feedback Smiley

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
btc_enigma
Hero Member
*****
Offline Offline

Activity: 688
Merit: 565


View Profile
April 25, 2018, 09:43:13 AM
 #4

Very nice, I like this project. Further imporvements

- Use moneywagon to query APIs (Has multiexplorer support with failsafe)
- Allow xpub as argument... show balance of wallet across various forks

moneywagon seems very interesting... I'll look into that one and see if i can implement it
xpub as an argument is also a good idear, however i'm a bit afraid of sending to much queries to the explorer's api's... Don't want them to blacklist any ip's Wink I'll try to find a workaround...

Thanks for the feedback Smiley

Understand! If you use moneywagon , it randomizes the calls among the blockexplorers API so that you won't get blacklisted ! You can copy snippets from  the below code if you like
https://github.com/shivaenigma/btxfees/blob/master/main.py


user0000001
Sr. Member
****
Offline Offline

Activity: 938
Merit: 261


View Profile
April 25, 2018, 11:06:28 AM
 #5


I would like to see instructions for Windows. if this is certainly possible. thank you very much. very necessary thing
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
April 25, 2018, 11:14:24 AM
 #6


I would like to see instructions for Windows. if this is certainly possible. thank you very much. very necessary thing

It should be possible to run this script on windows, all you need is python 2.7 and pip... then you need to visit the github page, download the sourcecode, install the pip modules (as indicated in the OP) and run the script using the freshly installed python 2.7

Can't give you a complete walktrough tough since the only windows laptop i have is the one provided to me by my employer (can't install python on that one)

I have compiled v0.1 into a binary that will run on *nix boxes. If you find somebody trustable who knows how to compile python scripts on windows, you can always ask him/her if he/she is willing to compile the script so you can run the binary out of the box Smiley

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
MrCrank
Sr. Member
****
Offline Offline

Activity: 1336
Merit: 258



View Profile
April 25, 2018, 04:04:51 PM
 #7

Wow, very nice project.
I have not install yet but check soon.
I'm interesting because I learn Python now.
Thanks
NectarHQ
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
April 25, 2018, 04:51:51 PM
 #8

Good job! Its small projects like this that help push crypto forward and solve unique issues.
mocacinno (OP)
Legendary
*
Offline Offline

Activity: 3388
Merit: 4919


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
April 26, 2018, 12:08:30 PM
 #9

new version released...
Changelog
  • fixed many, many, many bugs
  • some code cleanup
  • improved outfile handling
  • extended the default timeout
  • added a filter to filter out dead forks and/or forks that need manual intervention
  • fetched the price from coinmarketcap if available
  • new BTC explorer used
  • added my tipjars  Grin

I ran two tests, the fist one is kind of private, i tested 300 of my addresses against all forks that had an active api:
Code:
python checker.py --addressfile ../myaddresslist.txt --timeout 1 --outfile outnewversion.log --maximumstatus 1
--addressfile ../myaddresslist.txt =>points to the ascii file containing ~300 addresses, seperated by a newline, comments and newlines added
--timeout 1 => wait 1 second between 2 queries
--outfile outnewversion.log => write all important information to this file
--maximumstatus 1 => only test chains that have an active api. If i had set this to 2, the script would have included chains that had an explorer without a public api. If i had set this to 3, the script would have also printed info about chains that didn't even have a blockchain explorer (dead, doa, dying, to new, unmaintained, bad dev, scam,...)

I'm unwilling to provide any feedback, exept that testing 300 addresses vs 15 chains took less than 2 hours  Grin

The second demo i ran on the addresses staked on the first 10 posts of this thread:
https://bitcointalk.org/index.php?topic=996318.4515

input file: testaddresses_bitcointalk.txt
Code:
1FLnpvdXL6ooBpFj2LHqZxQsrxn2voj5uv
123Get818NzrAiYRs28dJkga9FdHxmWBnE
1NDUXQuVVjcmmqDrdt4ZUyTkoXg8fjSZLV
13FwZeMsiigSpDLc9TLFUVQ8BhcKeGdvVM
1AGGxwgVT57gRcAcmRdRpmeWocAh1obtgh
133KGgCJQSToSByvwU5cDjhMuqmziLJ1Rm
1D2SEqdu5c52fq59VHp6u61sdjL2j2mmjf
1MZakirz92c76pK6BNy1NAEmbWYpDcP7mh
12AYZG9Qk7XssfLLWcf6KV3u9XVLgBNkuL
1redsY74u97ECVVKx7Gz9QWJWECUuzsrj     

command line:
Code:
python checker.py --addressfile testaddresses_bitcointalk.txt --timeout 1 --outfile demolog.txt --maximumstatus 1

Terminal looked like this while it was running:
Code:
forkchecker@node:~/mocacinnoforkchecker$ python checker.py --addressfile testaddresses_bitcointalk.txt --timeout 1 --outfile demolog.txt --maximumstatus 1
testing 10 addresses for unspent outputs
testing 15 chains for unspent outputs
  5%|####                                                                                | 7/150 [00:08<02:44,  1.15s/forks

Terminal after the script was done
Code:
forkchecker@node:~/mocacinnoforkchecker$ python checker.py --addressfile testaddresses_bitcointalk.txt --timeout 1 --outfile demolog.txt --maximumstatus 1
testing 10 addresses for unspent outputs
testing 15 chains for unspent outputs
100%|##################################################################################################################################################| 150/150 [03:43<00:00,  1.37s/forks]

failed tests (usually because the api was down, or because the address wasnt found on the explorer)
************
for some reason, address 1FLnpvdXL6ooBpFj2LHqZxQsrxn2voj5uv failed to be tested on BPA
--snip--
for some reason, address 1redsY74u97ECVVKx7Gz9QWJWECUuzsrj failed to be tested on CDY



**************************************************
* found unspent outputs on one or more chains!!! *
* claim at your own risk!                        *
**************************************************

successlist
***********
133KGgCJQSToSByvwU5cDjhMuqmziLJ1Rm has a balance of 0.015243 on BCH . Coinmarketcap says this balance of 0.015243BCH is worth $1335.99 per coin. In your case this comes down to 20.36449557USD
133KGgCJQSToSByvwU5cDjhMuqmziLJ1Rm has a balance of 0.015243 on BCHC . There is no linkt to coinmarketcap, so we can't find the price

-------------------------------------------------------------------------------------------
| once again, if you import your private key into ANY unknown/untrusted wallet,           |
| you risk losing your unspent outputs on all other chains!!!                             |
| proceed with caution                                                                    |
|*****************************************************************************************|
| at least make sure your wallets on the most important chains are empty before importing |
| their private keys into unknown wallets!!!                                              |
-------------------------------------------------------------------------------------------

if you like this project, consider some of the "free" coins you got from these forks to me ;)
BTC/BCH/BTX/B2X/...: 1MocACiWLM8bYn8pCrYjy6uHq4U3CkxLaa
BTG: GeeXaL3TKCjtdFS78oCrPsFBkEFt9fxuZF
if you would exchange all coins right now, you'd make a whopping $20.36449557

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!