How to link library in browser-solidity? While creating a contract using library, solidity compiler requires to link the contract with the library. But there is no options in the browser to provide it. Contract is not created as it has lib's placeholders in bytecode similar to _______LibName_________

enter image description here


1 Answer 1


Browser-solidity is able to import library code from GitHub (importing from Swarm is on the way). E.g. you can write:

pragma solidity ^0.4.0;

import "github.com/ethereum/dapp-bin/library/stringUtils.sol";

contract test {
    function foo() returns (bool){
        string memory a = "hello";
        string memory b = "world";
        return StringUtils.equal(a, b);

When you press Create button, two contracts will be created on the blockchain: one for the library code and another one for the contract. Library address will be linked into the test contract automatically.

Please note, that you need to drop blob/<branch name> from URL.

Original URL:

URL to import (without https:// and blob/master/):

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