Create Outputs Table
- There is a file called
create_outputs_table.sqlin thescripts/monerodirectory with the following contents.CREATE TABLE xmr_outputs ( address VARCHAR(64), id SERIAL PRIMARY KEY, amount BIGINT, index INTEGER, UNIQUE(amount, index) ) - Run the following command in the
scripts/monerodirectory to create thexmr_outputstable.psql -U postgres -h 127.0.0.1 -W -f create_outputs_table.sqlNOTE: Alternatively, you can create the
xmr_outputstable by running the script calledoutput_table_creation.shin thescripts/monerodirectory. You can run the commandsource output_table_creation.shand enter the Postgres user password when prompted. - Populate the
xmr_outputstable using the following steps.- Run the following commands to enter the
psqlshell.sudo su postgres psql - Run ONLY ONE of the following queries. These queries consider transactions upto block height 1541236. This block height was used by Yu et al in their FC 2019 paper.
- Run the following query to consider all outputs (RingCT and pre-RingCT).
INSERT INTO xmr_outputs(amount, index) SELECT ring_amount, UNNEST(ring_indices) FROM xmr_keyimages WHERE block_height <= 1541236 ON CONFLICT(amount, index) DO NOTHING; - To consider only RingCT outputs, run the following query. The difference from the previous query is the
AND ring_amount=0clause.INSERT INTO xmr_outputs(amount, index) SELECT ring_amount, UNNEST(ring_indices) FROM xmr_keyimages WHERE block_height <= 1541236 AND ring_amount=0 ON CONFLICT(amount, index) DO NOTHING;
- Run the following query to consider all outputs (RingCT and pre-RingCT).
NOTE: The point of creating the
xmr_outputstable is to generate a unique integer index for every output. Then any edge in the CryptoNote transaction graph can be represented as a pair of integers: the key image index and the output index. - Run the following commands to enter the