I've been making and deploying contracts and libraries, deploying libraries first and then using the binary output from e.g.

$ solc --bin-runtime test.sol --libraries TestLib:0xb78f86ea662866b3131f79a886c17884e793f5c4

and copying the contract output and sending in a geth transaction as data.

Is there a way to link contracts to existing/previously deployed libraries and deploy from within the geth console, so that I don't have to independently define the ABI and keep switching between tabs? If not, why not? And how do I use the ABI in this case?

1 Answer 1



All linking does is stick the library's address into another contract's bytecode. When you don't tell solc to link, it will put something like __SomeLib________ (with a lot more underlines) where every reference to the library is. All you need to do is replace that placeholder with the address of your deployed contract.

See my answer here for one way to do it.

  • Ah thanks, cool work around! I was just wondering if there was anything more like --libraries but I guess if it works, it works
    – bekah
    Nov 13, 2016 at 0:45

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.