Skip to content

Instantly share code, notes, and snippets.

@trepca
Created October 16, 2023 19:11
Show Gist options
  • Save trepca/e7b330c2ef8f4113a0efdf410fc42a87 to your computer and use it in GitHub Desktop.
Save trepca/e7b330c2ef8f4113a0efdf410fc42a87 to your computer and use it in GitHub Desktop.
Track down spend bundles that spent coin and it's descendants
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))
@trepca
Copy link
Author

trepca commented Oct 16, 2023

For example, to use to track prefarm 200k coin:
python track_coin_id.py 0x66ad46d67e14ae716b5cbaa086e0e63c24250d464e4b8be254f74ec74aacdd17

(you'll need a requests library)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment