2

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?

bekah
  • 1,099
  • 11
  • 17

1 Answers1

2

Yes.

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.

Matthew Schmidt
  • 7,290
  • 1
  • 24
  • 35
  • 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 '16 at 00:45