Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solidity can't find contract name since 4.9, gets <stdin> instead #1708

Closed
GitDoggo opened this issue Feb 17, 2017 · 4 comments
Closed

Solidity can't find contract name since 4.9, gets <stdin> instead #1708

GitDoggo opened this issue Feb 17, 2017 · 4 comments
Labels
waiting for more input Issues waiting for more input by the reporter

Comments

@GitDoggo
Copy link

I have Solc 4.6 on my machine and everything works. When I call compiledContract = web3.eth.compile.solidity(sourceCode);, the first attribute of compiledContract is my contract name:

{
  SampleContract: {
    code: "...",
   info: {...},
   ...
  }
}

But on another machine that has 4.9, compiledContract looks like this:

{
  <stdin>:SampleContract: {
    code: "...",
    info: {...},
    ...
   }
 }

And I cannot compiledContract.<stdin>:SampleContrat of course, in Geth I get invalid token argument. Why did <stdin> appear?

What could cause that? How do I revert to 4.6 manually? (With command line)

@chriseth
Copy link
Contributor

Sorry for the hassle, this change was needed to allow unambiguous contract names for larger projects. You can access the contract using compiledContract['<stdin>:SampleContract'] but I would recommend not to use eth_compile at all and instead use solc.js directly.

@GitDoggo
Copy link
Author

Thanks for replying. I'm not familiar with solc.js, can it be used in Geth?

@chriseth
Copy link
Contributor

No, it can be used directly from javascript, please see https://github.com/ethereum/solc-js and don't hesitate to ask in http://gitter.im/ethereum/solidity

@chriseth
Copy link
Contributor

chriseth commented Jul 3, 2017

Closing due to inactivity.

@chriseth chriseth closed this as completed Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for more input Issues waiting for more input by the reporter
Projects
None yet
Development

No branches or pull requests

2 participants