Commit 9202cb9e authored by Wallet Guy's avatar Wallet Guy
Browse files

improve json output

parent e9d8e0ee
......@@ -31,12 +31,11 @@ def display_results(mat_lnk, nb_cmbn, inputs, outputs, fees, intrafees, efficien
efficiency= wallet efficiency for this transaction (expressed as a percentage)
'''
report = {}
print('\nInputs = ' + str(inputs))
report["inputs"] = str(inputs)
report["inputs"] = inputs
print('\nOutputs = ' + str(outputs))
report["outputs"] = str(outputs)
report["outputs"] = outputs
print('\nFees = %i satoshis' % fees)
report["fees"] = fees
......@@ -83,7 +82,7 @@ def display_results(mat_lnk, nb_cmbn, inputs, outputs, fees, intrafees, efficien
if nb_cmbn != 0:
print('\nLinkability Matrix (probabilities) :')
print(mat_lnk / nb_cmbn)
report["linkability_matrix"]["probabilities"] = str(mat_lnk / nb_cmbn)
report["linkability_matrix"]["probabilities"] = (mat_lnk / nb_cmbn).tolist()
else:
print('\nLinkability Matrix (#combinations with link) :')
print(mat_lnk)
......@@ -96,15 +95,15 @@ def display_results(mat_lnk, nb_cmbn, inputs, outputs, fees, intrafees, efficien
for j in range(0, len(inputs)):
if (mat_lnk[i,j] == nb_cmbn) and mat_lnk[i,j] != 0 :
print('%s & %s are deterministically linked' % (inputs[j], outputs[i]))
links.append(('%s & %s are deterministically linked' % (inputs[j], outputs[i])))
links.append({"link": (inputs[j], outputs[i]) })
dlCount += 1
report["deterministic_links"] = links
# deterministic link ratio:
# deterministic link ratio:
nbLinks = len(outputs) * len(inputs)
ratioDL = dlCount / nbLinks
# nRatioDL = 1.0 - ratioDL
# nRatioDL = 1.0 - ratioDL
print('\nDeterministic link ratio = %f%%' % (ratioDL * 100))
report["deterministic_link_ratio"] = '%f%%' % (ratioDL * 100)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment