ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.6k stars 20.16k forks source link

eth_compilers, eth_compileSolidity are gone in go-ethereum 1.6.0 #3793

Closed beatrizsanchez closed 6 years ago

beatrizsanchez commented 7 years ago

System information

Geth version: v1.6.0-unstable-6d038e76/linux/go1.7.3 OS & Version: Linux/Ubuntu 16.04.1 LTS (x86_64) Commit hash : 6d038e76

Expected behaviour

Running eth.getCompilers() in the geth console should return an array of compilers ['solidity'] that could even be empty ( [] )

Actual behaviour

The command returns Error: The method eth_getCompilers does not exist/is not available but I have started the node with --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" and I am able to run other eth commands. I was actually trying to execute the command via RPC with web3j and was getting an error then realized it didn't work in the console either.

> eth.compile
{
  lll: function(),
  serpent: function(),
  solidity: function()
}

Steps to reproduce the behaviour

  1. Attach the console to a running node with -ipc enabled
  2. Run eth.getCompilers()
  3. If no compilers are installed you should get [], not an error message
ucfyao commented 7 years ago

oh,my god 。I see a lot of tutorials using this!The official docs and tutorials!!!

juniway commented 7 years ago

Please update the wiki documents

Tectract commented 7 years ago

EthDeployer updated to ignore (sometimes erroneous) warning messages from solc. Working again:

https://www.enledger.io/EthDeployer/

See: https://github.com/ethereum/solidity/issues/2525#issuecomment-314742767

2cool4games commented 7 years ago

@Tectract I upgraded the Geth version, and I'm still having problems with Metamask. It's doing the same thing as before. I am trying to take pictures of the "Developer Console", on the actual Metamask window, and the Create Smart Contract Page.

I am going to try to update truffle too. I don't know if that will help or not. I'm not entirely sure.

Thanks for all the help Tectract!

Sebastian

Tectract commented 7 years ago

Sounds like a metamask problem, I suggest you start a ticket here: https://github.com/MetaMask/metamask-plugin/issues

This thread is for the issue of solc not being included in the ethereum node ;)

Akki9326 commented 7 years ago

Not able to compile solidity code. any work around, please. I am trying with this method. web3.eth.compile.solidity(source)

The method eth_compileSolidity does not exist/is not available

Tectract commented 7 years ago

See here for working client-side code for solc compilation:

https://github.com/Tectract/EthDeployer/blob/master/src/Deploy.js

Remi-Tuy commented 7 years ago

I have still not found any viable solution... This is a joke, how can they disable a function that so many people use ....

Tectract commented 7 years ago

Did you look at the links I posted?

snissn commented 7 years ago

FYI i get this error in the ethereum wallet when trying to a deploy a contract through the wallet (https://wallet.ethereum.org/deploy-contract)

hdiedrich commented 7 years ago

Thanks @k26dr - I think the "contract.sol:" in the fs.readFileSync path should go.

Wouldn't that work with solcjs? That's way faster to install.

k26dr commented 7 years ago

@hdiedrich The way the solc compiler operates on Linux, that's what works for me. I already had solc installed so I used that method. I haven't looked into solcjs

andyl commented 7 years ago

so this tutorial has been broken for FIVE MONTHS ?? can it be ??

Tectract commented 7 years ago

You should start a ticket about fixing the tutorial, maybe. This one is about getting the compiling back into Geth, or figuring out workarounds for people. See my tutorial linked above. It still works.

mikemilano commented 7 years ago

More human hours wasted here. I agree, if it can't be fixed, fix the tutorial or add an a warning that it's outdated at least.

trevorbroad commented 7 years ago

The tutorial has a workaround listed under "USING THE ONLINE COMPILER"

It's definitely not as slick as I imagine the compile function was, but it will get you through the tutorial

n0-m4d commented 7 years ago

a working tutorial is essential!

Tectract commented 7 years ago

For the time being, please see how I compile solidity code CLIENT-SIDE, using web3 and browser-solc, here:

https://blockgeeks.com/guides/how-to-learn-solidity/

Until they resolve the issue of solc not being included in Geth, browser-solc is the way to go.

spawn66336 commented 7 years ago

Because geth deprecated the command-line compiler interface after version 1.6, I was puzzled for a long time.I wrote a simple tutorial to describe how to compile and deploy a contract after geth1.6. Hope this tutorial will help you. Depoly contract on the private chain

zioalex commented 7 years ago

Please update the HelloWorld documentation to reflect how it is today.

pranoygn commented 7 years ago

As of now you can use the following command which generated .abi and .bin files which can be loaded using loadScript() locally

solc -o . --bin --abi

tRosJan commented 7 years ago

I am still trying to understand why this was removed. The least you could do is update all documents to reflect changes. Thanks

carlosotgz commented 7 years ago

Add 1 hour to the pile of wasted human hours!

mingard commented 7 years ago

+1

educob commented 7 years ago

This is a nightmare. Nothing works. Every solution I try fails. Thanks ethereum people for that crap docu and stupid changes.

katopz commented 7 years ago

So this is why https://github.com/ethereum/web3.js/blob/develop/example/contract.html#L20 not work am I right?

trevorbroad commented 7 years ago

Anyone having difficulty compiling their code, download the Ethereum Wallet. In the Contracts tab, in the Deploy New Contract feature there's a function to compile your contract before uploading it to the Blockchain.

https://ethereum.org/

zachgoll commented 7 years ago

7 months later and still no eth.compile.solidity() function nor an update on the tutorial. Shame. screen shot 2017-11-02 at 4 59 22 pm

trevorbroad commented 7 years ago

@zachgoll I commented above, use the compiler in Ethereum Wallet

meoknu commented 7 years ago

i demand for it

magicliang commented 7 years ago

I haven't read through all along this thread, but, I have to say that, the SDKs of Java/.Net CLR, always provide compiler with runtime together. I thought it is practical standard for programming runtime. And a lot of document is out-of-date, if you remove this important feature, can you just push an update of doc at the same time? This is like a distributed transaction failure causing inconsistency.

RoguePlanetoid commented 7 years ago

Seems odd to remove something that the tutorials depend on, what is the work around for this, to get started with a contract have to start somewhere, if can't get a Hello World example to work because of this it makes it hard to get going

zachgoll commented 6 years ago

WORKAROUND: https://www.youtube.com/watch?v=cRg2m2A2NGM

temirov commented 6 years ago

Anyone knows where is the source code of this page: https://www.ethereum.org/greeter and who can fix the glaring error? cc: @vbuterin

princefishthrower commented 6 years ago

Working update as of 4th December 2017:

Alright everyone... let's calm down... languages like C++ (and respective communities) have been around for decades, Solidity has been around for years... the newest version at that, for just months. Plus, the Ethereum Foundation team, which is probably in charge of changes like this, is literally 3 people. Sheesh, give 'em a break.

With that said, all you need for the greeter example to compile is the solc command line tool:

npm install -g solc

Then, you can use the command line tool from solc to compile to binary:

***NOTE: on the command line, the command is solcjs NOT solc!!!

solcjs --bin --abi --optimize -o bin hello_world.sol

(I named my solidity file hello_world.sol)

And pit pat piffy wing wong wang just like that1, you've got your compiled binaries and contract ABIs in the folder bin/:

hello_world_sol_greeter.bin
hello_world_sol_greeter.abi
hello_world_sol_mortal.bin
hello_world_sol_mortal.abi

BONUS: to get perfect linting for the code (the original example will compile just fine, but with warnings), add public to the top two functions and the last function, and pragma on the first line. The final code then looks like this:

pragma solidity ^0.4.19;

contract mortal {
  /* Define variable owner of the type address */
  address owner;

  /* This function is executed at initilization and sets the owner of the contract */
  function mortal() public { owner = msg.sender; }

  /* Function to recover the funds on the contract */
  function kill() public { if (msg.sender == owner) selfdestruct(owner); }
}

contract greeter is mortal {
  /* Define variable gretting of the type string */
  string greeting;

  /* This runs when the contract is executed */
  function greeter(string _greeting) public {
    greeting = _greeting;
  }

  /* Main function */
  function greet() public constant returns (string) {
    return greeting;
  }
}
  1. :joy: Anyone get the reference?
nfrankel commented 6 years ago

Note that the official site still documents the method, though.

hamzadiaz commented 6 years ago

Please bring back the feature, it's very useful for any kind of projects

n00b21337 commented 6 years ago

Internet is full of examples with eth_compileSolidity used in compile function, so now every newbie trying to learn from examples on the web is failing. Some people just think its all about the code and can't think outside the box, it's not about the code but its about the people so whoever orchestrated this change has failed. You should first find out how people are using something you are about to change and how much are they using it and then carefully plan how to change it and also inform people where change is about to happen to change the code. This is not a way how to treat an open source project of this importance or maybe people o charge think it is but I think it just sucks for community.

VoR0220 commented 6 years ago

These are from the days when the compiler was coupled to the RPC layer...which imho is a big no no. But we had a big EIP discussion about this...someone feel free to take up the charge on the EIP.

ghost commented 6 years ago

I'm giving up entirely on Ethereum. It was a nice idea but it's become just another cryptocurrency like bitcoin and wasted its chance to be a great distrubuted computing language due to infuriating barriers to entry. I'm a moderaderly good python, C++ and C# programmer and have a PhD in Cyber Security, but for the life of me I can't get to grips with this ruddy software. Come back when you've got a working and accessible API to write and deploy DAPPs, add funds, check balances and search and use other DAPPs.

Tectract commented 6 years ago

please see how I compile solidity code CLIENT-SIDE, using web3 and browser-solc, here:

https://blockgeeks.com/guides/how-to-learn-solidity/

relevant source code is here:

https://github.com/Tectract/EthDeployer/blob/master/src/Deploy.js

This should be the standard until solc is added back into GETH, if ever, imho. My article was recently translated to Chinese too :)

Tectract commented 6 years ago

If you just need to compile and deploy a contract, you can use the tool I wrote, running here:

https://www.enledger.io/EthDeployer/

Using Metamask and Chrome. It's not flawless, but I did recently updated it to handle deployment of ERC20 contracts.

Gallaecio commented 6 years ago

If the method is not supposed to exist, it should probably not be mentioned at https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial

avatar-lavventura commented 6 years ago

Is this normal:

> eth.getCompilers()
Error: The method eth_getCompilers does not exist/is not available
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1
ibigbug commented 6 years ago

If the method is not supposed to exist, it should probably not be mentioned at https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial

And probably the official doc: https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity ? a little bit frastrated :(

karalabe commented 6 years ago

https://github.com/ethereum/EIPs/issues/209