This repository contains source code underlying our empirical analysis of traceability in the Monero blockchain.
Reproducing the deducibility analysis involves the following steps:
- Export blockchain data from a fully synchronized Monero node
- Import the data into a Neo4j database using the Neo4j batch importer
- Create database indices and run the Sudoku algorithm
- Querying the database
This repository does not contain the simulation of the different mixin-sampling procedures. It can be found at kvnl33/monero-simulations instead.
- Install the Monero software, start the daemon and wait for the node to synchronize
- Install the requests python library:
pip install requests - Run the
monero-to-csv.pyscript (i.e.,python monero-to-csv.py)
- Download and/or install the Neo4j graph database v3.4.5
- You should now have a folder structure similar to this:
./csv/: the Monero blockchain export (CSV files)./csv-headers/: the CSV header files
- Use the following import script to use the
neo4j-importtool for a quick import (you'll need to modify the--into <DIRECTORY>directory to match the location of your Neo4j installation)
neo4j-import --into <DIRECTORY> --nodes:Block "csv-headers/blocks.csv,csv/blocks.csv" --relationships:PREV_BLOCK "csv-headers/blocks-rels.csv,csv/blocks-rels.csv" --nodes:Transaction "csv-headers/transactions.csv,csv/transactions.csv" --relationships:IN_BLOCK "csv-headers/tx-blocks.csv,csv/tx-blocks.csv" --nodes:Output "csv-headers/outputs.csv,csv/outputs.csv" --relationships:TX_OUTPUT "csv-headers/output-rels.csv,csv/output-rels.csv" --nodes:Input "csv-headers/inputs.csv,csv/inputs.csv" --relationships:TX_INPUT "csv-headers/input-rels.csv,csv/input-rels.csv" --relationships:REFERENCES "csv-headers/input-output-refs.csv,csv/input-output-refs.csv"
- Afterwards, you should see a message similar to the following:
IMPORT DONE in 5m 41s 347ms.
Imported:
45169429 nodes
84119631 relationships
109326559 properties
Peak memory usage: 1.51 GB
- Compile the Neo4j plugin in the
neo4j-pluginfolder:mvn package - Put the resulting
mixinsudoku.jarinto thepluginsfolder of your Neo4j installation - Download the APOC plugin and also put it into the
pluginsfolder - Allow unrestricted access by adding
dbms.security.procedures.unrestricted=mixinsudoku.*,apoc.*to your Neo4j config - Start the database
- Run the following cypher commands (through the web interface or the command line interface)
CALL mixinsudoku.schema(): creates all necessary indexes (you can check the status with:SCHEMA)CALL mixinsudoku.coinbase(): adds labels for coinbase transactions
- Run the mixin sudoku in two steps (run the second query only after the first one has finished):
CALL mixinsudoku.zeromixin(): labels all outputs spent by 0-mixin transactionsCALL mixinsudoku.sudoku(): iteratively labels further deducable outputs
- Run
CALL mixinsudoku.checkdb()as a sanity check at the end
- Install the following Python modules:
pip install jupyterpip install pandaspip install seabornpip install py2neo
- Launch the notebook server:
jupyter notebook & - Open Monero Analysis.ipynb in the notebook interface