1

I tried to compile some smart contracts in truffle 3.0.2 (which works without problems in browser solidity and even older versions of truffle) and got compile errors. So I created a sample truffle project with

truffle init

and launched truffle compile:

$ truffle compile
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Error compiling:

Could not find expected contract or library in '/home/ubuntu-user/meta/contracts/MetaCoin.sol': contract or library 'MetaCoin' not found.
Compiliation failed. See above.

I suppose truffle init just was not updated for the new project structure. Trouble is, I do not know what that structure is supposed to be. I have read the documentation and upgrade guide, but it seems outdated and I was not able to get a clue about the problem. Does anyone have any idea, or maybe an idea for a tool that actually reduces complexity when dealing with smart contracts?

2
  • What you have in '/home/ubuntu-user/meta/contractsl' ?
    – underdog
    Feb 2, 2017 at 19:56
  • I have there what truffle init created, i.e. ConvertLib.sol, MetaCoin.sol, Migrations.sol
    – comodoro
    Feb 2, 2017 at 20:36

2 Answers 2

2

Can you upgrade Truffle to 3.0.5? The best way is to completely uninstall Truffle and then reinstall it.

The issue here is that the solidity compiler added breaking API changes between versions 0.4.8 and 0.4.9 -- a minor version change, a big no no. This invariably broke Truffle, and we had to scramble to fix it.

Please give the new version a try. It should fix your issue.

1
  • I will definitely give it a try. However, I decided also to famiiarilize myself with web3 more, so that at least I know what I am doing.
    – comodoro
    Feb 6, 2017 at 8:17
2

TL;DR update troufle to the newest verison or at least 3.0.4.

This is caused by solcjs breaking change in version 0.4.9. Truffle fixed the version at 0.4.8 in versions > 3.0.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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