Suppose I have an inheritance contract (xyz.sol) with three contracts A, B and C such that C is B, I am trying to compile using solc offline in node console. Upon compiling, I have three separate bytecodes and ABI interface generated. For a single contract alone ABI=..... [`:xyz'].interface used to give the ABI alone. Now because there are more ABI present in the output compiled code, it returns an error (undefined). Is it possible to get all the ABI interface together or separate by any indexing method?

1 Answer 1


I don't understand this statement:

Now because there are more ABI present in the output compiled code, it returns an error (undefined).

I'm not 100% sure "what" exactly returns the error. Depends on what you're doing, I suppose. You should probably only be concerned with the ABI for the contract you want to deploy.

There's an ABI for each contract and it's possible you want to deploy any of the contracts contained in your source. You'll find that B's functions are part of C's ABI.

Consider this even simpler example:

pragma solidity 0.4.18;

contract A {

    function aDo() public pure returns(bool success) {
        return true;

contract B is A {

    function bDo() public pure returns(bool success) {
        return true;


Notice that the ABI for B contains function aDo() because B is A.


The compiler is going to give you the ABI for A, but the thing is you don't really need it (or the bytecode for A) unless you plan to deploy A, and you probably don't want to.

In most use-cases, you would only want to deploy the main contract that has inherited the lessor components.

Hope it helps.

p.s. If using Truffle, they take/make the assumption that the source file name matches the name of the contract you will be interested in deploying (B in my example, C in yours), although the source and imports may load it up with many contracts that won't be deployed by themselves.

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.