Skip to content

Program: Transaction Network Generator

hkanezashi edited this page Aug 22, 2019 · 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",  // Parameter directory
    "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 parameter files should be located at paramFiles/1K, and these file names are shown below.

  • accounts.csv: Account parameter file
  • alertPatterns.csv: Alert (fraud) transaction pattern parameter file
  • degree.csv: Degree distribution parameter file
  • transactionType.csv: Transaction distribution parameter file

The description of each file content is 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",
    "transactions": "transactions.csv",
    "accounts": "accounts.csv",
    "alert_members": "alert_members.csv"
  },
//...
}