mirror of
https://github.com/Rucknium/misc-research.git
synced 2024-12-22 11:29:22 +00:00
Create analysis-monero-PR-8047-prevent-duplicate-outs.R
This commit is contained in:
parent
9ff4d51bed
commit
f98b994f67
1 changed files with 59 additions and 0 deletions
|
@ -0,0 +1,59 @@
|
||||||
|
# install.packages("RPostgreSQL")
|
||||||
|
# install.packages("data.table")
|
||||||
|
|
||||||
|
library(RPostgreSQL)
|
||||||
|
library(data.table)
|
||||||
|
|
||||||
|
dbDriver("PostgreSQL")
|
||||||
|
|
||||||
|
drv <- dbDriver("PostgreSQL")
|
||||||
|
|
||||||
|
dbname.arg <- ""
|
||||||
|
host.arg <- ""
|
||||||
|
port.arg <- # numeric
|
||||||
|
user.arg <- ""
|
||||||
|
password.arg <- ""
|
||||||
|
|
||||||
|
con <- dbConnect(drv, dbname = dbname.arg,
|
||||||
|
host = host.arg, port = port.arg,
|
||||||
|
user = user.arg, password = password.arg)
|
||||||
|
|
||||||
|
dbListTables(con)
|
||||||
|
|
||||||
|
|
||||||
|
xmr.tx <- dbGetQuery(con, "SELECT * FROM tx_input_list")
|
||||||
|
|
||||||
|
setDT(xmr.tx)
|
||||||
|
|
||||||
|
xmr.tx[, unique.tx := paste(vin_amount, amount_index, sep = "-")]
|
||||||
|
|
||||||
|
xmr.tx.collisions <- xmr.tx[, .(
|
||||||
|
collision.index = anyDuplicated(unique.tx),
|
||||||
|
n.inputs = uniqueN(vin_index)),
|
||||||
|
by = .(block_height, tx_index)]
|
||||||
|
|
||||||
|
setorder(xmr.tx.collisions, block_height, tx_index)
|
||||||
|
|
||||||
|
prop.table(table(xmr.tx.collisions$collision.index != 0))
|
||||||
|
|
||||||
|
|
||||||
|
xmr.tx.collisions[, block.interval := cut(block_height, 100)]
|
||||||
|
|
||||||
|
xmr.tx.collisions[, .(prop.collisions = 100 * mean(collision.index != 0)), by = .(block.interval)]
|
||||||
|
|
||||||
|
|
||||||
|
xmr.tx.collisions[n.inputs <= 2, .(prop.collisions = 100 * mean(collision.index != 0)), by = .(block.interval)]
|
||||||
|
|
||||||
|
prop.table(table(xmr.tx.collisions$collision.index[xmr.tx.collisions$n.inputs <= 2] != 0))
|
||||||
|
|
||||||
|
|
||||||
|
xmr.tx.collisions[n.inputs == 2, .(prop.collisions = 100 * mean(collision.index != 0)), by = .(block.interval)]
|
||||||
|
|
||||||
|
prop.table(table(xmr.tx.collisions$collision.index[xmr.tx.collisions$n.inputs == 2] != 0))
|
||||||
|
|
||||||
|
|
||||||
|
xmr.tx.collisions[n.inputs == 1, .(prop.collisions = 100 * mean(collision.index != 0)), by = .(block.interval)]
|
||||||
|
|
||||||
|
prop.table(table(xmr.tx.collisions$collision.index[xmr.tx.collisions$n.inputs == 1] != 0))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue