I have compiled my contracts with solc module for nodejs. These contracts import and use some libraries. But in the deployed bytecodes of the contracts, there are no placeholders for librairies used in the contract. I read solc compiler documentation and i does not understand why there are no placeholders for librairies in my bytecodes. Can someone help me ?

1 Answer 1


The functions you use must have been declared public or internal. In that case the compiler will add their bytecode in the resulting contract so there's no need to reference the library. OpenZeppelin's SafeMath is an example of such library.

library SafeMath {
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     * Counterpart to Solidity's `+` operator.
     * Requirements:
     * - Addition cannot overflow.
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;

If the functions were declared external the compiler will add the placeholder that should be resolved when linking with the library deployed address.

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.