> For the complete documentation index, see [llms.txt](https://docs.jediswap.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jediswap.xyz/for-developers/jediswap-v1/smart-contract-integration/pair-addresses.md).

# Pair Addresses

## **get\_pair**

The best way to get the address for a pair is to call [get\_pair](/for-developers/jediswap-v1/smart-contract-reference/factory.md#get_pair) on the [Factory](/for-developers/jediswap-v1/smart-contract-reference/factory.md). If the pair exists, this function will return its address else 0

* The "canonical" way to determine whether or not a pair exists.
* Requires an on-chain lookup.

## **Off-Chain**

Python Example:

```python
from starkware.starknet.core.os.contract_address.contract_address import calculate_contract_address_from_hash
from starkware.cairo.lang.vm.crypto import pedersen_hash


def get_create2_address(token0: int, token1: int, class_hash: int) -> int:

    salt = pedersen_hash(token0, token1)

    constructor_calldata = [token0,
                            token1]

    create2_pair_address = calculate_contract_address_from_hash(
        salt=salt, class_hash=class_hash, deployer_address=factory, constructor_calldata=constructor_calldata)

    return create2_pair_address
```

* token0 must be strictly less than token1 by sort order.
* Can be computed offline.
* Requires the ability to perform pedersen\_hash.
