Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Possible maker taker roles in ba29e.. JM tx
#!/usr/bin/env python3
""" This represents a brief check of mainnet transaction:
ba29e5c66bc0ce15a0228d47514f1de2a5737f2eb185c30589bfd4a735d78c1f
in particular, assuming the four inputs identified below as "known_ins",
i.e. there is an assumption they are co-owned by one entity, this identifies
possible combinations of the other inputs, with this set of inputs,
that matches the change output according to taker/maker role, applying a sudoku.
Note that the output of this script will of course depend quite a lot on choices
of tolerance range for the unknown quantity: total cjfee paid to makers,
if known actor is taker, and cjfee received, if known actor is a maker.
cjfees are larger here because (a) fees were higher in the past and (b) this
is at the extreme high end of the Joinmarket size range (103BTC), which always
commanded a higher fee.
"""
from itertools import combinations, chain, product
tx_ba29e_known_ins = [2182936558, 1862740183, 4194728493, 1582736672]
# note, order doesn't matter for this analysis (so, sorry, indices don't
# match the tx):
tx_ba29e_ins = [8218332780, 885123602, 700594746, 444822530, 415162658,
637783779, 1853323808, 4118367119, 1655285641, 1645196525,
770681347, 430302893, 539315618, 4836707433, 615644003,
4468047462, 1635293132, 350475728, 263731883, 892892067]
fee = 572433
cjout = 10346322211
tx_ba29e_change_outs = [1106627892, 255759472, 2341091663, 110886356]
known_sum = sum(tx_ba29e_known_ins)
def power_set(l):
iil = range(len(l))
return list(chain.from_iterable(combinations(iil, r) for r in range(len(iil)+1)))
for co in tx_ba29e_change_outs:
for x in power_set(tx_ba29e_ins):
sumx = sum([tx_ba29e_ins[i] for i in x])
# if taker, then (known inputs + chosen set) = cjout + fee + cjfeetotal + change out
# so, (chosen inputs + known set) - cjout - given changeout -fee = cjfeetotal
# and, the RHS is the unknown, we assume it's between zero and the 'fee' (bitcoin network fee).
expected_cjfee = known_sum + sumx - cjout - co - fee
# a simple "how much was received/spent" value:
delta = known_sum + sumx - cjout - co
if expected_cjfee >= 0 and expected_cjfee <= fee:
print("found a possible set, where known actor is the taker: ", x, [tx_ba29e_ins[i] for i in x])
print("vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:")
print(known_sum, sumx, cjout, co, delta, fee, expected_cjfee)
# if maker, then we assume no bitcoin network fee is paid, and the cjfee field is negative:
# (chosen inputs + known set) - cjout - given changeout < 0, but up to some limit (not huge negative).
# Note that 0.01% of the cjout is around 1 million sats for this VERY large coinjoin, so here we are being
# conservative by choosing a 1M value (as i recall most large makers used relfee option in the past).
expected_cjfee += fee
if expected_cjfee < 0 and expected_cjfee > - 1000000:
print("found a possible set, where known actor is maker: ", x, [tx_ba29e_ins[i] for i in x])
print("vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:")
print(known_sum, sumx, cjout, co, delta, fee, expected_cjfee)
waxwing@here~/testjminstall/joinmarket-clientserver$ python ba29eanal.py
('found a possible set, where known actor is the taker: ', (3, 4, 10), [444822530, 415162658, 770681347])
vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:
(9823141906, 1630666535, 10346322211, 1106627892, 858338, 572433, 285905)
('found a possible set, where known actor is maker: ', (4, 9, 12, 18), [415162658, 1645196525, 539315618, 263731883])
vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:
(9823141906, 2863406684, 10346322211, 2341091663, -865284, 572433, -865284)
('found a possible set, where known actor is the taker: ', (14, 16, 17, 18), [615644003, 1635293132, 350475728, 263731883])
vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:
(9823141906, 2865144746, 10346322211, 2341091663, 872778, 572433, 300345)
('found a possible set, where known actor is the taker: ', (3, 5, 12, 17, 19), [444822530, 637783779, 539315618, 350475728, 892892067])
vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:
(9823141906, 2865289722, 10346322211, 2341091663, 1017754, 572433, 445321)
('found a possible set, where known actor is maker: ', (3, 4, 10, 11, 12, 18), [444822530, 415162658, 770681347, 430302893, 539315618, 263731883])
vars: known_sum, sumx, cjout, changeout, DELTA, fee, expected_cjfee:
(9823141906, 2864016929, 10346322211, 2341091663, -255039, 572433, -255039)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.