Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rucknium/cd7b3b9ed73cba83a985731fba512ad1 to your computer and use it in GitHub Desktop.
Save Rucknium/cd7b3b9ed73cba83a985731fba512ad1 to your computer and use it in GitHub Desktop.
Simple Simulated Monero Black Marble/Flooding Attack
set.seed(314)
black.marble.proportion <- 0.9
ring.size <- 16
outputs <- sample(c(TRUE, FALSE), 1000000, replace = TRUE,
prob = c(1 - black.marble.proportion, black.marble.proportion))
sampled.decoys <- matrix(sample(outputs, (ring.size - 1) * 100000, replace = TRUE), ncol = ring.size - 1)
sampled.rings <- cbind(sampled.decoys, rep(TRUE, 100000))
summary(rowSums(sampled.rings))
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.000 2.000 2.000 2.495 3.000 9.000
black.marble.proportion <- 0.9
ring.size <- 11
outputs <- sample(c(TRUE, FALSE), 1000000, replace = TRUE,
prob = c(1 - black.marble.proportion, black.marble.proportion))
sampled.decoys <- matrix(sample(outputs, (ring.size - 1) * 100000, replace = TRUE), ncol = ring.size - 1)
sampled.rings <- cbind(sampled.decoys, rep(TRUE, 100000))
summary(rowSums(sampled.rings))
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.000 1.000 2.000 1.995 3.000 8.000
black.marble.proportion <- 0.8
ring.size <- 16
outputs <- sample(c(TRUE, FALSE), 1000000, replace = TRUE,
prob = c(1 - black.marble.proportion, black.marble.proportion))
sampled.decoys <- matrix(sample(outputs, (ring.size - 1) * 100000, replace = TRUE), ncol = ring.size - 1)
sampled.rings <- cbind(sampled.decoys, rep(TRUE, 100000))
summary(rowSums(sampled.rings))
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1 3 4 4 5 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment