BDM_LoadBlockchainFile()
topBlock = TheBDM.getTopBlockHeight()
trackaddr = dict({'pirateat40 GPUMAX':['1PSf86KnLuzM7Ris5kDhTEZwooR3p2iyfV'],
'Armory Client Developer':['1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX']})
addratstart = 0
for item in trackaddr.itervalues():
addratstart += len(item)
addratend = 0
iterations = 0
while addratstart != addratend:
iterations += 1
addratstart = 0
for item in trackaddr.itervalues():
addratstart += len(item)
for h in xrange(0, topBlock+1):
if h%5000 == 0:
print '\tScanned %d blocks' % h
header = TheBDM.getHeaderByHeight(h)
txList = header.getTxRefPtrList()
for txref in txList:
tx = txref.getTxCopy()
foundaddr = False
addressowner = ''
for nin in range(tx.getNumTxIn()):
txin = tx.getTxIn(nin)
try:
senderAddr20 = TheBDM.getSenderAddr20(txin)
address = hash160_to_addrStr(senderAddr20)
#print address
for owner in trackaddr.keys():
if address in trackaddr[owner]:
foundaddr = True
addressowner = owner
print "FOUND TRANSACTION! At block " + str (h) + ' owned by ' + addressowner
break
except:
pass
if foundaddr is True:
for nin in range(tx.getNumTxIn()):
txin = tx.getTxIn(nin)
try:
senderAddr20 = TheBDM.getSenderAddr20(txin)
address = hash160_to_addrStr(senderAddr20)
trackaddr[addressowner].append(address)
except:
pass
trackaddr[addressowner] = list(set(trackaddr[addressowner]))
addratend = 0
for item in trackaddr.itervalues():
addratend += len(item)
print trackaddr
print "Went through the blockchain %d times!" % iterations
print "Found %d addresses in total" % addratend
for owner in trackaddr.keys():
print owner + ' has ' + str(len(trackaddr[owner])) + ' addresses'
The pirate address comes from https://bitcointalksearch.org/topic/m.980130 btw. and the donation address was public anyways and one of the first ones I randomly found while looking for an address.
It's easy now to enter more "name:address" relationships and search for all of them, though it might get weird if you try to give 2 different names to the same cluster of addresses I fear... I proabably need a list of names as well for each entity there. Also I haven't tested very tough cookies (GLBSE, MtGox(!)) so I don't know if it scales well. For tracking smaller/medium sized wallets it should be enough though.