Created
October 16, 2023 19:11
-
-
Save trepca/e7b330c2ef8f4113a0efdf410fc42a87 to your computer and use it in GitHub Desktop.
Track down spend bundles that spent coin and it's descendants
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
import requests | |
import sys | |
import json | |
coin_ids = [sys.argv[1]] | |
transactions = [] | |
cache = {} | |
while coin_ids: | |
additions = [] | |
for coin_id in coin_ids: | |
coin_txs = requests.post( | |
"https://api.mojonode.com/get_transactions_for_coin", json={"name": coin_id} | |
) | |
tx_id = coin_txs.json()["coin_transactions"]["removed_by"] | |
if tx_id and tx_id not in cache: | |
tx_req = requests.post( | |
"https://api.mojonode.com/get_tx_by_name", json={"name": tx_id} | |
) | |
tx = tx_req.json()["transaction"] | |
additions.extend(tx["additions"]) | |
transactions.append(tx) | |
cache[tx_id] = True | |
coin_ids = additions | |
print(json.dumps(transactions, indent=4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example, to use to track prefarm 200k coin:
python track_coin_id.py 0x66ad46d67e14ae716b5cbaa086e0e63c24250d464e4b8be254f74ec74aacdd17
(you'll need a requests library)