Skip to content

Program: Transaction Network Generator

hkanezashi edited this page Feb 28, 2020 · 11 revisions

Transaction network generator is a Python script to generate a network topology for the simulator.

Requirements

  • Python package
    • NetworkX 1.11 (2.x will not work)
    • NumPy

Input files

The transaction network generator script uses four parameter CSV files.

  • Account list
  • Alert list
  • Degree sequence of transaction network
  • Transaction type and frequency

Here is an example of the "input" section in the configuration file conf.json.

{
//...
  "input": {
    "directory": "paramFiles/1K",  // Relative path to the directory where parameter files are stored
    "schema": "schema.json",  // Configuration file of output CSV schema
    "accounts": "accounts.csv",  // Account list parameter file
    "alert_patterns": "alertPatterns.csv",  // Alert list parameter file
    "degree": "degree.csv",  // Degree sequence parameter file
    "transaction_type": "transactionType.csv",  // Transaction type list file
    "is_aggregated_accounts": true  // Whether the account list represents aggregated (true) or raw (false) accounts
  },
//...
}

In this case, all following parameter files should be located at paramFiles/1K.

  • accounts.csv: Account parameter file
  • alertPatterns.csv: Alert (SAR) transaction pattern parameter file
  • degree.csv: Degree distribution parameter file
  • transactionType.csv: Transaction distribution parameter file
  • schema.json: Schema definition file (JSON format)

The descriptions of these file contents are here.

How to run

cd /path/to/AMLSim
python3 scripts/transaction_graph_generator.py conf.json

The argument of this script is the configuration file path. It outputs all result files such as account list CSV to temporal directory. The temporal directory and file names are defined at the "temporal" section in the configuration file.

{
//...
  "temporal": {
    "directory": "tmp",  // Top directory of temporal data. All temporal files are stored under a directory with the same name as the simulation name.
    "transactions": "transactions.csv",
    "accounts": "accounts.csv",
    "alert_members": "alert_members.csv"
  },
//...
}

In this example, it outputs the temporal transaction file at tmp/transactions.csv.