0

I am trying to compile this contract (part of an online tutorial, not my contract). I'm running ethereumjs-testrpc (ganace precursor) on one terminal, then on another instantiate web3 object;

> Web3 = require('web3')
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

From there I get confirmation Im running on test network, I can call the dummy accounts, etc.

Then from there I believe I need to cast my .sol contract to a string object;

code = fs.readFileSync('voting.sol').toString()

And I get this: enter image description here

I'm assuming there's an error in my contract, can't figure out where..

1 Answer 1

1

It looks like geth.

The contract itself says it needs solc 0.4.21 or better. You must be running an earlier version of solc. Try $ solc --version.

If your compiler is reasonably recent, you might get away with changing that first line to be more permissive. It also depends on whether that contract contains any syntax that really is nearly new.

You could also update your compiler so it does support 0.4.21 or better.

Hope it helps.

2
  • Would you recommend using another tool to compile and / or test my contracts ? From what I understand truffle would have those functionalities right?
    – J.C
    Apr 5, 2018 at 8:21
  • I use truffle for quite a bit. Its compiler is currently at 0.4.19. Apr 5, 2018 at 14:26

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.