dave on Nostr: Sure thing, here's my new version: function isLikelyCoinjoin(txdata) { // Check ...
Sure thing, here's my new version:
function isLikelyCoinjoin(txdata) {
// Check number of inputs/outputs
const numInputs = txdata.vin.length;
const numOutputs = txdata.vout.length;
if (numInputs > 1 && numOutputs > 2) {
// Check if there are at least 2 clusters of 2 or more outputs with identical output values
let outputValues = txdata.vout.map(o => o.value);
let isClustered = outputValues.some(v =>
outputValues.filter(v2 => v2 === v).length >= 2);
if (isClustered) {
return true;
}
}
return false;
}
Published at
2022-12-09 00:47:03Event JSON
{
"id": "9860bca9676cf9a02f584cd50cb5519df1add632f75b0dfa47278e6e90d00f5c",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1670546823,
"kind": 1,
"tags": [
[
"e",
"f04c12f13467f1af68817979f65ea91a91b5cf2131644265f7c43155d5fc7ae9",
"",
"root"
],
[
"e",
"41886e222c92edd153dd6f9505ed351b3f9ad5a8dd1326203ab95e5561f76222",
"",
"reply"
],
[
"p",
"2b36fb6ae1022d0d4eac2a9f13fc2638f3350acc9b07bdca1de43a7c63429644"
]
],
"content": "Sure thing, here's my new version:\n\nfunction isLikelyCoinjoin(txdata) {\n // Check number of inputs/outputs\n const numInputs = txdata.vin.length;\n const numOutputs = txdata.vout.length;\n if (numInputs \u003e 1 \u0026\u0026 numOutputs \u003e 2) {\n // Check if there are at least 2 clusters of 2 or more outputs with identical output values\n let outputValues = txdata.vout.map(o =\u003e o.value);\n let isClustered = outputValues.some(v =\u003e \n outputValues.filter(v2 =\u003e v2 === v).length \u003e= 2);\n if (isClustered) {\n return true;\n }\n }\n return false;\n}",
"sig": "4ca8dc44afb7e0672dcf3686d1da6436846943c36320429905055e3aedbefc21e9f3e8c284fd1e0bb574fa9b5dde665ebc4e78ed3767f6c62e6ce65301b5f35c"
}