Last active
February 7, 2018 13:08
-
-
Save ottosch/ffbbe4902e17764e4f0ae5c13e56ad62 to your computer and use it in GitHub Desktop.
A script to help using ymgve's fbtcclaimer.py script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This script is meant to be used with fbtcclaimer: https://github.com/ymgve/bitcoin_fork_claimer/blob/master/fbtcclaimer.py | |
# The outputs of this script are the inputs to the other script. | |
# Python 2.x is required | |
import urllib2, json | |
block = 501225 | |
# You can either insert your FBTC address below or find/replace after running the script | |
addr_fbtc = "YOUR_FBTC_ADDRESS" | |
# Insert your BTC addresses below, one per line | |
addresses = """ | |
1HTmbaeSZn7faPjxcSeEHJoxgBGMxJYYem | |
1FQ3eFGW4Kek7vFEFqb5e5U9FnH7vzn3xW | |
""" | |
addr_list = addresses.strip().split("\n") | |
valid = [] | |
addresses_with_btc = {} | |
for addr in addr_list: | |
a = urllib2.urlopen("https://blockchain.info/rawaddr/" + addr).read() | |
txs = json.loads(a)["txs"] | |
total_btc = 0 | |
txs_before_fork = [tx for tx in txs if tx.has_key("block_height") and tx["block_height"] <= block] | |
valid_txs = txs_before_fork[:] | |
for txid in valid_txs[:]: | |
for tx in txs_before_fork: | |
for input_tx in tx["inputs"]: | |
if input_tx["prev_out"]["tx_index"] == txid["tx_index"] and input_tx["prev_out"]["addr"] == addr: | |
try: | |
valid_txs.remove(txid) | |
except ValueError: | |
pass # Was probably removed before. Skipping. | |
for tx in valid_txs: | |
for tx_out in tx["out"]: | |
if addr == tx_out["addr"]: | |
total_btc += tx_out["value"] | |
break | |
if total_btc >= 1: | |
addresses_with_btc[addr] = total_btc | |
for addr, btcs in addresses_with_btc.viewitems(): | |
print " python fbtcclaimer.py " + ("PRIV_KEY_OF_" + addr) + " " + addr + " " + addr_fbtc + " " + str(btcs) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment