Having the .abi file and the address of a Smart Contract. Can I somehow retrieve the smart contract object instance?

I know for the web3.js we could do something like:

var inst = eth.contract(abi).at(address))

But this doesn't work for the web3py. I am new to this syntax. How can I solve this?

2 Answers 2


You can do:

contract = web3.eth.contract(abi=abi,address=address)

See the official documentation here.


Calling web3.eth.contract in web3.py uses the following syntax:

from web3 import Web3

w3 = Web3()

# modify these values
abi = {}
address = "0x00..."

contract = w3.eth.contract(address=address, abi=abi)

The returned value is a Contract object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.