1

I'm compiling a contract with solc and I'm getting something like this (I replaced most of the hexadecimal digits with three dots to make it shorter):

608060405234801561001057600080fd5b5060008054600...152905173__whitelist.sol:AddressSet______________91637ab6b0b491604480830192...0029

The thing that seems to be causing troubles is __whitelist.sol:AddressSet______________ because when I deployed the contract in Ethereum, when I check the transaction, only the code up to that string is taken. Everything else is discarded.

When I deploy the contract using Remix, the binary looks good, without those strings in the middle.

Here is the command I'm using to compile the code:

solc --optimize --pretty-json --combined-json bin,abi whitelist.sol

Do I need to use a special flag to avoid that?

dgaviola
  • 175
  • 11
  • 1
    In your contract you are using a library, before you can deploy your contract you have to "link" the bytecode to the deployed address of the library. – Ismael May 15 '18 at 19:06

1 Answers1

1

As @Ismael pointed out in a comment the problem was that I was using a library and wasn't linking it. I get rid of the problem by using --libraries in solc:

solc --optimize --libraries "AddressSet:0x4025e920fb97ce003b361021534f0c0335254f65" --pretty-json --combined-json bin,abi whitelist.sol

That generated the correct binary code that can be deployed to Ethereum.

dgaviola
  • 175
  • 11