> For the complete documentation index, see [llms.txt](https://870167019.gitbook.io/blockchainspider/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://870167019.gitbook.io/blockchainspider/subgraph-spiders/overview.md).

# Overview

The transaction subgraph spiders aim at collecting the transactions related to the specific source addresses. BlockchainSpider gives the following strategies for sampling:

* **BFS**: Breath-First Search&#x20;
* **Poison**: A kind of taint analysis technology.
* **Haircut**: A kind of taint analysis technology
* **APPR**: the Approximate Personalized PageRank algorithm.
* **TTR**: the Transaction Tracing Rank algorithm.

The performance comparison of the above strategies is as follows:

![](https://2274903941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeTNqreKxjgijo5f3ctKZ%2Fuploads%2FHPiPF5szd3cYY7yLItMz%2FScreenshot%202022-02-09%20214320.png?alt=media\&token=b12c745a-4c87-4f41-a367-bacc1b143877)

## Chain Supports

The transaction subgraph spiders support to collect the transaction data of eth/bsc/polygon/heco until now.

* `txs.eth`: `eth` transaction subgraph spider.
* `txs.bsc`: `bsc` transaction subgraph spider.
* `txs.polygon`: `polygon` transaction subgraph spider.
* `txs.heco`: `heco` transaction subgraph spider.

The next sections will introduce more configurations about the transaction subgraph spiders through `txs.eth`.

## Design with Graph Expansion

In BlockchainSpider, all transaction subgraph spiders are implemented based on the framework of graph expansion, which has four core operations:

* **Expand**: collects all transactions related to a given address.
* **Push**: merges the collected transactions to the subgraph.
* **Rank**: computes the relevance of addresses in the subgraph to the source address.
* **Pop**: select an address for expanding.

The implementation of different strategies are as follows:

<table><thead><tr><th width="150">Strategy</th><th>Push &#x26; Rank</th><th>Pop &#x26; Expand</th></tr></thead><tbody><tr><td>BFS</td><td>Add expanded neighbors to a queue</td><td>Select a unexpanded node in the header of the queue for expanding</td></tr><tr><td>Poison</td><td>Add expanded out-degree neighbors to a queue</td><td>Select a unexpanded node in the header of the queue for expanding</td></tr><tr><td>Haircut</td><td>Allocated the pollution value of the expanded node to the neighbors according to the edge weight</td><td>Select a unexpanded node with the highest pollution for expanding</td></tr><tr><td>APPR</td><td>Use the local push procedure for extended neighbors</td><td>Select a node with the highest residual for expanding</td></tr><tr><td>TTR</td><td>Use the TTR local push procedure for extended neighbors</td><td>Select a node with the highest residual for expanding</td></tr></tbody></table>
