> For the complete documentation index, see [llms.txt](https://calnix.gitbook.io/eth-dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnix.gitbook.io/eth-dev/deployment/interacting-with-external-contracts.md).

# Interacting with External Contracts

Say you want to interact with a deployed contract, but you don't have the published source code or interface to work with.

You can work with the ABI of the contract + address.

Assuming the ABI is not published, you can extract it from the website front-end:

* Dev Console -> Sources -> js bundles
* look through the js folder, the abi will be a long string in there somewhere

Once you extract the ABI:

Ensure the abi starts off in this manner: \[{....

![](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FJIVJDPmnlj1mIsdukxKp%2Fimage.png?alt=media\&token=007e391f-1d89-4269-8632-dd617d4ad9e6)

If it starts with abi =\[.. you can drop that bit.

{% hint style="info" %}
When you compile with brownie, compiled code is placed into `build` directory as a .json file. That 10.000 lines of code is not abi, abi is the first property of that json file.
{% endhint %}

### Loading the ABI into Brownie

```python
with open("./scripts/IdleGameAbi.json") as file:
    contract_abi = json.load(file)

# contract
contract_address = "0x82a85407BD612f52577909F4A58bfC6873f14DA8"
contract = Contract.from_abi("IdleGame", contract_address, contract_abi)

```

![](https://1628544884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTgomzlmn9NrxUY0OQ3cD%2Fuploads%2FMz5A1r8CXP7hqx0ZvRNd%2Fimage.png?alt=media\&token=37205ea1-886e-47ff-a544-1a2f39432423)

#### Some reference:

<https://ethereum.stackexchange.com/questions/114238/creating-a-contract-contrainer-with-brownie>
