Create the Transaction Graph
- Run the following query in the
psql
shell to write the edges file to disk.\COPY (SELECT keyimage_id, output_id FROM xmr_bigraph_edges) TO '/tmp/fork-ringct-edges-2530000.txt' WITH DELIMITER ' ';
- Each row in the
fork-ringct-edges-2530000.txt
file represents an edge. Thekeyimage_id
andoutput_id
values that represent the edge are index values from the respective PostgreSQL tables. These index values do not form a contiguous range and can have gaps. But the sparse graph representations we will use work better without gaps in the index ranges.- Copy the
fork-ringct-edges-2530000.txt
file to thescripts/monero
directory. - Compile the
create_csparse_edges.cpp
file located in thescripts/monero
directory. Run it with the block height as argument.
The output should look like the following.cd scripts/monero g++ -O2 create_csparse_edges.cpp ./a.out 2530000 fork-ringct
Reading edge file Finished reading edge file Number of key images: 40351733 Number of outputs: 45805316 Number of vertices: 86157049 Number of edges: 409132035 Creating keyimage index map Finished creating keyimage index map Creating output index map Finished creating output index map Adding edges to graph Finished adding edges to graph
- Three output files are created.
-
fork-ringct-csparse-edges-2530000.txt
The edges in this file are represented as pairs of indices starting from 0 followed by a 1. This is the CSparse format for representing sparse matrices. The 1 corresponds to the value of the matrix entry. In our case, we use this format to represent sparse bipartite graphs.
-
fork-ringct-index-keyimageid-map-2530000.txt
This file has pairs of indices and key image IDs per line. It is to translate the result of the transaction graph analysis back to the key image ID space.
-
fork-ringct-index-outputid-map-2530000.txt
This file has pairs of indices and output IDs per line. It is to translate the result of the transaction graph analysis back to the output ID space.
-
- Copy the