From the docs:

// The Contract interface
let abi = [ ... ];

// Connect to the network
let provider = ethers.getDefaultProvider();

// The address from the above deployment example
let contractAddress = "...";

// We connect to the Contract using a Provider, so we will only
// have read-only access to the Contract
let contract = new ethers.Contract(contractAddress, abi, provider);

I understand how this works, but I'm curious if you need the ABI at all? In web3.js, you don't, thanks to the ability to pass a contract method as a string:

// in web3.js

1 Answer 1


As of v4 at least, the answer is yes, the contract ABI must be provided. Creating a contract with no ABI and no provider or signer:

let tokenContract = new ethers.Contract(tokenAddress);

Yields this error:

TypeError: Cannot read property 'forEach' of undefined

Creating a contract with just no provider or signer:

let tokenContract = new ethers.Contract(tokenAddress, erc20Abi);

Yields this other error:

Error: invalid signer or provider (arg="signerOrProvider", value=undefined, version=4.0.41)

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.