# TTR

The following arguments for the TTR transaction subgraph spiders can be set, including:

* **source**: a source address that can not exist with `file` argument.
* **file**: the source address `json` file, which cannot exist with `source` argument.
* **out**: the output directory, default is `./data`.
* **fields**: the output fields joined by `,` for each transaction, the default is `hash,from,to,value,timeStamp,blockNumber,tokenSymbol,contractAddress`, and other fields include `isError`, `input`, `nonce`, `blockHash`, `gas`, `gasPrice`, `gasUsed`, and `confirmations`.
* **types**: the transaction types joined by `,` that spider crawled, default is `external`, and the options including: `external`, `internal`, `erc20`, `erc721`.&#x20;
* **symbols**: the token symbols for tracing joined by `,` , the default will trace all token symbols. Especially, use `native` for tracing the native token such as ETH in Ethereum.
* **start\_blk**: the start block for collecting transactions, the default is `0`.
* **end\_blk**: the end block for collecting transactions, the default is `99999999`.
* **auto\_page**: whether to obtain all transactions of each node. The default is `False`, that is, obtain the first 10k transactions at most.
* **alpha**: the alpha for TTR strategy, default is `0.15`.
* **beta**: the beta for TTR strategy, default is `0.7`.
* **epsilon**: the epsilon for TTR strategy, default is `0.001`.

## Crawl from an address

The following command shows how to get the transaction subgraph of an address:

```shell
scrapy crawl txs.eth.ttr \
-a source=0xeb31973e0febf3e3d7058234a5ebbae1ab4b8c23 \
-a out=/path/to/output/data \
-a fields=hash,from,to,value,timeStamp,blockNumber,isError,input \
-a types=external,internal
-a alpha=0.1
-a beta=0.6
-a epsilon=0.0001
```

## Crawl from multiple addresses

The following command shows how to get the transaction subgraphs of two addresses:

```shell
scrapy crawl txs.eth.ttr -a file=/path/to/source/file.json 
```

Well, the input file `file.json` is formatted as follow:

```json
[
  {
    "source": "0xeb31973e0febf3e3d7058234a5ebbae1ab4b8c23",
    "types": "external,internal,erc20",
    "start_blk": 10933499,
    "out": "/path/to/output/data/0xeb3",
    "beta": 0.6,
    "epsilon": 0.0001
  },
  {
    "source": "0xc8a65fadf0e0ddaf421f28feab69bf6e2e589963",
    "types": "external,internal,erc20",
    "start_blk": 12990635,
    "out": "/path/to/output/data/0xc8a",
    "beta": 0.6,
    "epsilon": 0.0001
  }
]
```
