# BlockchainDocumentLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/blockchain/BlockchainDocumentLoader)

Load elements from a blockchain smart contract.

See supported blockchains here: https://python.langchain.com/v0.2/api_reference/community/document_loaders/langchain_community.document_loaders.blockchain.BlockchainType.html

If no BlockchainType is specified, the default is Ethereum mainnet.

The Loader uses the Alchemy API to interact with the blockchain.
ALCHEMY_API_KEY environment variable must be set to use this loader.

The API returns 100 NFTs per request and can be paginated using the
startToken parameter.

If get_all_tokens is set to True, the loader will get all tokens
on the contract.  Note that for contracts with a large number of tokens,
this may take a long time (e.g. 10k tokens is 100 requests).
Default value is false for this reason.

The max_execution_time (sec) can be set to limit the execution time
of the loader.

## Signature

```python
BlockchainDocumentLoader(
    self,
    contract_address: str,
    blockchainType: BlockchainType = BlockchainType.ETH_MAINNET,
    api_key: str = 'docs-demo',
    startToken: str = '',
    get_all_tokens: bool = False,
    max_execution_time: Optional[int] = None,
)
```

## Description

**Future versions of this loader can:**

- Support additional Alchemy APIs (e.g. getTransactions, etc.)
- Support additional blockchain APIs (e.g. Infura, Opensea, etc.)

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `contract_address` | `str` | Yes | The address of the smart contract. |
| `blockchainType` | `BlockchainType` | No | The blockchain type. (default: `BlockchainType.ETH_MAINNET`) |
| `api_key` | `str` | No | The Alchemy API key. (default: `'docs-demo'`) |
| `startToken` | `str` | No | The start token for pagination. (default: `''`) |
| `get_all_tokens` | `bool` | No | Whether to get all tokens on the contract. (default: `False`) |
| `max_execution_time` | `Optional[int]` | No | The maximum execution time (sec). (default: `None`) |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    contract_address: str,
    blockchainType: BlockchainType = BlockchainType.ETH_MAINNET,
    api_key: str = 'docs-demo',
    startToken: str = '',
    get_all_tokens: bool = False,
    max_execution_time: Optional[int] = None,
)
```

| Name | Type |
|------|------|
| `contract_address` | `str` |
| `blockchainType` | `BlockchainType` |
| `api_key` | `str` |
| `startToken` | `str` |
| `get_all_tokens` | `bool` |
| `max_execution_time` | `Optional[int]` |


## Properties

- `contract_address`
- `blockchainType`
- `api_key`
- `startToken`
- `get_all_tokens`
- `max_execution_time`

## Methods

- [`load()`](https://reference.langchain.com/python/langchain-community/document_loaders/blockchain/BlockchainDocumentLoader/load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_loaders/blockchain.py#L37)