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

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

Open
beatrizsanchez opened this Issue Mar 17, 2017 · 95 comments

Comments

Projects
None yet
@beatrizsanchez

beatrizsanchez commented Mar 17, 2017

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 : 6d038e7

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
@fjl

This comment has been minimized.

Show comment
Hide comment
@fjl

fjl Mar 17, 2017

Contributor

Compiling via RPC has been removed in #3740 (see ethereum/EIPs#209 for why). We will bring it back under a different method name if there is sufficient user demand. You're the second person to complain about it within 2 days, so it looks like there is demand.

Contributor

fjl commented Mar 17, 2017

Compiling via RPC has been removed in #3740 (see ethereum/EIPs#209 for why). We will bring it back under a different method name if there is sufficient user demand. You're the second person to complain about it within 2 days, so it looks like there is demand.

@fjl fjl changed the title from "Method does not exist/is not available" eth.getCompilers(), in geth console to eth_compilers, eth_compileSolidity are gone in go-ethereum 1.6.0 Mar 17, 2017

@fjl

This comment has been minimized.

Show comment
Hide comment
@fjl

fjl Mar 17, 2017

Contributor

Leaving this open so other people can find this issue and raise their voice here.

Contributor

fjl commented Mar 17, 2017

Leaving this open so other people can find this issue and raise their voice here.

@beatrizsanchez

This comment has been minimized.

Show comment
Hide comment
@beatrizsanchez

beatrizsanchez Mar 17, 2017

@fjl, Thanks for the info. It would be convenient to have it on RPC but I have the issue as well on IPC, any idea why?

beatrizsanchez commented Mar 17, 2017

@fjl, Thanks for the info. It would be convenient to have it on RPC but I have the issue as well on IPC, any idea why?

@fjl

This comment has been minimized.

Show comment
Hide comment
@fjl

fjl Mar 17, 2017

Contributor

When I say RPC I mean the IPC endpoint too. The methods have been removed by the linked PR. There is no way to invoke solc through geth at this time.

Contributor

fjl commented Mar 17, 2017

When I say RPC I mean the IPC endpoint too. The methods have been removed by the linked PR. There is no way to invoke solc through geth at this time.

@hynese

This comment has been minimized.

Show comment
Hide comment
@hynese

hynese Mar 23, 2017

This feature is really useful. Can we please have the compilers available?

hynese commented Mar 23, 2017

This feature is really useful. Can we please have the compilers available?

@mavstronaut

This comment has been minimized.

Show comment
Hide comment
@mavstronaut

mavstronaut Mar 26, 2017

Eth.compile is a great feature!

mavstronaut commented Mar 26, 2017

Eth.compile is a great feature!

@islandBilly

This comment has been minimized.

Show comment
Hide comment
@islandBilly

islandBilly Mar 28, 2017

I too think eth.compile is a great feature, and it was an important part of my Dapp, so that people could generate a simple contract from a web form, compile and deploy it, all without knowledge of Solididty or the need to use Mist.

islandBilly commented Mar 28, 2017

I too think eth.compile is a great feature, and it was an important part of my Dapp, so that people could generate a simple contract from a web form, compile and deploy it, all without knowledge of Solididty or the need to use Mist.

@kunalbansal92

This comment has been minimized.

Show comment
Hide comment
@kunalbansal92

kunalbansal92 Apr 11, 2017

Updated my project due to this issue ethereum/solidity#1708, And now :/

kunalbansal92 commented Apr 11, 2017

Updated my project due to this issue ethereum/solidity#1708, And now :/

@vyorkin

This comment has been minimized.

Show comment
Hide comment
@vyorkin

vyorkin Apr 11, 2017

Also voting for bringing it back, otherwise at least we should update the official docs and tutorials to not confuse a newcomers (like me)

vyorkin commented Apr 11, 2017

Also voting for bringing it back, otherwise at least we should update the official docs and tutorials to not confuse a newcomers (like me)

@RomanKrakowiak

This comment has been minimized.

Show comment
Hide comment
@RomanKrakowiak

RomanKrakowiak Apr 11, 2017

Living exactly the same situation as the comment above from vyorkin. Newcomer, confused by outdated official tutorial.
also, please update the private network genesis block specifications in the official documentation please :p

RomanKrakowiak commented Apr 11, 2017

Living exactly the same situation as the comment above from vyorkin. Newcomer, confused by outdated official tutorial.
also, please update the private network genesis block specifications in the official documentation please :p

@michiels

This comment has been minimized.

Show comment
Hide comment
@michiels

michiels Apr 16, 2017

Either way, the docs/website should reflect the latest state I think :) On this page https://www.ethereum.org/greeter it still assumes you're using solc.

michiels commented Apr 16, 2017

Either way, the docs/website should reflect the latest state I think :) On this page https://www.ethereum.org/greeter it still assumes you're using solc.

@ropod7

This comment has been minimized.

Show comment
Hide comment
@ropod7

ropod7 Apr 17, 2017

eth_compileSolidity, or analogue should be available over RPC . Please.

ropod7 commented Apr 17, 2017

eth_compileSolidity, or analogue should be available over RPC . Please.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 17, 2017

If the old console command has to go, can we not just replace it with a similarly named function that calls a solidity compiler? It just seems sensible that it's there. Or at least, make a tutorial for writing and making solidity apps that people can follow.

I was trying to hard to learn how to use geth or ethereum or anything. All the introductions I can find use Solidity [1]. This system is hard enough to follow or install as it is without all the documentation leading us down dead ends after DAYS AND DAYS of trying to install compilers that apparently don't exist now. So how are we meant to make or deploy smart contracts? This crypto tool has amazing potential but the impossibility of learning how to use or interact with it is terrible.

I can run geth as a fast node on my windows 10 machine, and I have a command-line solc compiler on my MacBook. But I don't seem to be able to get both at once!

Windows10: For example chocolaty now doesn't work, despite tutorials telling me its by far the easiest way to get solc on Windows. If instead I run ">npm install -g solc" ([2]) it seems to work but then when I run ">solc" it just says it's not recognised as a command, program or batch file.
Running ">npm install solc" I get a series of warnings, starting with "npm WARN enoent ENOENT: no such file or directory, open 'LocalDir/package.json'".

MacBook: I think solc is working in Terminal, but without a tutorial I'm stuck with rookie errors in even compiling the "Hello World" of [1]. I describe this issue below.

[1] https://ethereum.org/greeter#getting-other-people-to-interact-with-your-code
[2] https://solidity.readthedocs.io/en/develop/installing-solidity.html


/* Rookie error with compiling my first solidity program. */
SolidityProjects$ cat helloWorld.sol
pragma solidity ^0.4.1

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

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

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

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

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

    /* main function */
    function greet() constant returns (string) {
        return greeting;
    }
}

SolidityProjects$ solc helloWorld.sol 
helloWorld.sol:8:5: Error: Expected import directive or contract definition.
    function mortal() { owner = msg.sender; }
    ^
SolidityProjects$ 

ghost commented Apr 17, 2017

If the old console command has to go, can we not just replace it with a similarly named function that calls a solidity compiler? It just seems sensible that it's there. Or at least, make a tutorial for writing and making solidity apps that people can follow.

I was trying to hard to learn how to use geth or ethereum or anything. All the introductions I can find use Solidity [1]. This system is hard enough to follow or install as it is without all the documentation leading us down dead ends after DAYS AND DAYS of trying to install compilers that apparently don't exist now. So how are we meant to make or deploy smart contracts? This crypto tool has amazing potential but the impossibility of learning how to use or interact with it is terrible.

I can run geth as a fast node on my windows 10 machine, and I have a command-line solc compiler on my MacBook. But I don't seem to be able to get both at once!

Windows10: For example chocolaty now doesn't work, despite tutorials telling me its by far the easiest way to get solc on Windows. If instead I run ">npm install -g solc" ([2]) it seems to work but then when I run ">solc" it just says it's not recognised as a command, program or batch file.
Running ">npm install solc" I get a series of warnings, starting with "npm WARN enoent ENOENT: no such file or directory, open 'LocalDir/package.json'".

MacBook: I think solc is working in Terminal, but without a tutorial I'm stuck with rookie errors in even compiling the "Hello World" of [1]. I describe this issue below.

[1] https://ethereum.org/greeter#getting-other-people-to-interact-with-your-code
[2] https://solidity.readthedocs.io/en/develop/installing-solidity.html


/* Rookie error with compiling my first solidity program. */
SolidityProjects$ cat helloWorld.sol
pragma solidity ^0.4.1

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

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

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

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

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

    /* main function */
    function greet() constant returns (string) {
        return greeting;
    }
}

SolidityProjects$ solc helloWorld.sol 
helloWorld.sol:8:5: Error: Expected import directive or contract definition.
    function mortal() { owner = msg.sender; }
    ^
SolidityProjects$ 

@alphaqiu

This comment has been minimized.

Show comment
Hide comment
@alphaqiu

alphaqiu Apr 19, 2017

Sorry, but how to adding my contract into the gethereum in version of geth 1.6.0?

Okey, web3.eth.contract([]).new() just still can be used.

alphaqiu commented Apr 19, 2017

Sorry, but how to adding my contract into the gethereum in version of geth 1.6.0?

Okey, web3.eth.contract([]).new() just still can be used.

@jw122

This comment has been minimized.

Show comment
Hide comment
@jw122

jw122 Apr 20, 2017

The greeter tutorial (and the token, crowdfunding ones) is not yet updated for the changes in 1.6.0.

It makes it harder for people who are trying to learn Ethereum to compile and run contracts. Please fix/advise

jw122 commented Apr 20, 2017

The greeter tutorial (and the token, crowdfunding ones) is not yet updated for the changes in 1.6.0.

It makes it harder for people who are trying to learn Ethereum to compile and run contracts. Please fix/advise

@KGutierrezTome

This comment has been minimized.

Show comment
Hide comment
@KGutierrezTome

KGutierrezTome Apr 20, 2017

Please bring back the old command line-compilers, they were very useful for testing

KGutierrezTome commented Apr 20, 2017

Please bring back the old command line-compilers, they were very useful for testing

@dkhatter

This comment has been minimized.

Show comment
Hide comment
@dkhatter

dkhatter Apr 24, 2017

I too think eth.compile is a great feature, please bring it back to the latest version.

dkhatter commented Apr 24, 2017

I too think eth.compile is a great feature, please bring it back to the latest version.

@temores

This comment has been minimized.

Show comment
Hide comment
@temores

temores Apr 25, 2017

many documents tutoriaIs, etc. point to command line compilers this change breaks them,I too spent DAYS trying to make this work. Please bring it back

temores commented Apr 25, 2017

many documents tutoriaIs, etc. point to command line compilers this change breaks them,I too spent DAYS trying to make this work. Please bring it back

@nakkapeddi

This comment has been minimized.

Show comment
Hide comment
@nakkapeddi

nakkapeddi Apr 26, 2017

Hi all,

Perhaps the following will help you.

To get a feeling of Solidity (not sure how up to date it is, but will give you an idea of syntax):
https://learnxinyminutes.com/docs/solidity/

In order to get the "Hello World" smart contract to work, you need to compile it with solc like so:
solc -o output --bin --ast --asm test.sol

where test.sol contains

pragma solidity ^0.4.1;
contract mortal {
    /* Define variable owner of the type address*/
        address owner;

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

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

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

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

                                                        /* main function */
                                                            function greet() constant returns (string) {
                                                                    return greeting;
                                                                        }
                                                                        }

"output" can be an arbitrary directory on your machine. For more info, go here:

http://solidity.readthedocs.io/en/develop/using-the-compiler.html

Ignore the formatting, as I copied it from @GregoryFenn; the solidity lexer ignores whitespace so it doesn't matter. This will compile your contract.

nakkapeddi commented Apr 26, 2017

Hi all,

Perhaps the following will help you.

To get a feeling of Solidity (not sure how up to date it is, but will give you an idea of syntax):
https://learnxinyminutes.com/docs/solidity/

In order to get the "Hello World" smart contract to work, you need to compile it with solc like so:
solc -o output --bin --ast --asm test.sol

where test.sol contains

pragma solidity ^0.4.1;
contract mortal {
    /* Define variable owner of the type address*/
        address owner;

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

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

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

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

                                                        /* main function */
                                                            function greet() constant returns (string) {
                                                                    return greeting;
                                                                        }
                                                                        }

"output" can be an arbitrary directory on your machine. For more info, go here:

http://solidity.readthedocs.io/en/develop/using-the-compiler.html

Ignore the formatting, as I copied it from @GregoryFenn; the solidity lexer ignores whitespace so it doesn't matter. This will compile your contract.

@k26dr

This comment has been minimized.

Show comment
Hide comment
@k26dr

k26dr May 2, 2017

I use eth.compile.solidity for a custom deploy script, it was very useful, please bring back.

k26dr commented May 2, 2017

I use eth.compile.solidity for a custom deploy script, it was very useful, please bring back.

@bl4ck5un

This comment has been minimized.

Show comment
Hide comment

bl4ck5un commented May 5, 2017

@Tectract

This comment has been minimized.

Show comment
Hide comment
@Tectract

Tectract May 24, 2017

We're having downstream issues now because of this. Can you put those functions back, please?

Tectract commented May 24, 2017

We're having downstream issues now because of this. Can you put those functions back, please?

@brobits

This comment has been minimized.

Show comment
Hide comment
@brobits

brobits May 25, 2017

Ethereum.org's own greeter example is out of date now, should update the docs to demonstrate the steps to compiling if these functions aren't restored

brobits commented May 25, 2017

Ethereum.org's own greeter example is out of date now, should update the docs to demonstrate the steps to compiling if these functions aren't restored

@Tectract

This comment has been minimized.

Show comment
Hide comment
@Tectract

Tectract May 25, 2017

This cost me two days of work to work-around. I don't understand why you guys would intentionally make it harder to compile smart-contracts. We're compiling client-side now...

Tectract commented May 25, 2017

This cost me two days of work to work-around. I don't understand why you guys would intentionally make it harder to compile smart-contracts. We're compiling client-side now...

@k26dr

This comment has been minimized.

Show comment
Hide comment
@k26dr

k26dr May 26, 2017

Since a lot of people are saying they're having a hard time finding a workaround. Here's a code snippet that will get you the same result without eth.compile.solidity

var fs = require('fs');
var exec = require('child_process').execSync;

exec(`solc --bin --abi --optimize -o bin contract.sol`);

var abi = fs.readFileSync('bin/contract.sol:Contract.abi');
var compiled = '0x' + fs.readFileSync("bin/Contract.bin");

Replace all instances of contract.sol with your source filename and all instances of Contract with the name of your contract.

k26dr commented May 26, 2017

Since a lot of people are saying they're having a hard time finding a workaround. Here's a code snippet that will get you the same result without eth.compile.solidity

var fs = require('fs');
var exec = require('child_process').execSync;

exec(`solc --bin --abi --optimize -o bin contract.sol`);

var abi = fs.readFileSync('bin/contract.sol:Contract.abi');
var compiled = '0x' + fs.readFileSync("bin/Contract.bin");

Replace all instances of contract.sol with your source filename and all instances of Contract with the name of your contract.

@Tectract

This comment has been minimized.

Show comment
Hide comment
@Tectract

Tectract May 26, 2017

This solution won't work under react, and it also requires you to have solc installed locally. It won't work with metamask against ethereum mainnet, either.

Here's my solution, see the full code at: www.github.com/tectract/ethdeployer

in the top-level .html file of my create-react-app:

    <script src="./browser-solc.min.js" type="text/javascript"></script>

and then in the code:

function loadWeb3() {
   let web3Injected = window.web3;
   if(typeof web3Injected !== 'undefined'){
     console.log("saw injected web3!");
     web3 = new Web3(web3Injected.currentProvider);
   } else {
     console.log("did not see web3 injected!");
     web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
     //console.debug(web3.eth.accounts);
   }
}

the above snippet detects either the local web3 object or switches to the metamask-provided web3 object, if that exists...

  var compiler;
  setupCompiler(){
    var outerThis = this;
    setTimeout(function(){
      // console.debug(window.BrowserSolc);
      window.BrowserSolc.getVersions(function(soljsonSources, soljsonReleases) {
        var compilerVersion = soljsonReleases[_.keys(soljsonReleases)[0]];
        console.log("Browser-solc compiler version : " + compilerVersion);
        window.BrowserSolc.loadVersion(compilerVersion, function(c) {
          compiler = c;
          outerThis.setState({statusMessage:"ready!"},function(){
            console.log("Solc Version Loaded: " + compilerVersion);
          });
        });
      });
    },1000);
  }

Note, I had to wait for the window.BrowserSolc object to load, which is the reason for the setTimeout there. note also I'm using the lodash lib as "_" here.

Cheers~

Tectract commented May 26, 2017

This solution won't work under react, and it also requires you to have solc installed locally. It won't work with metamask against ethereum mainnet, either.

Here's my solution, see the full code at: www.github.com/tectract/ethdeployer

in the top-level .html file of my create-react-app:

    <script src="./browser-solc.min.js" type="text/javascript"></script>

and then in the code:

function loadWeb3() {
   let web3Injected = window.web3;
   if(typeof web3Injected !== 'undefined'){
     console.log("saw injected web3!");
     web3 = new Web3(web3Injected.currentProvider);
   } else {
     console.log("did not see web3 injected!");
     web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
     //console.debug(web3.eth.accounts);
   }
}

the above snippet detects either the local web3 object or switches to the metamask-provided web3 object, if that exists...

  var compiler;
  setupCompiler(){
    var outerThis = this;
    setTimeout(function(){
      // console.debug(window.BrowserSolc);
      window.BrowserSolc.getVersions(function(soljsonSources, soljsonReleases) {
        var compilerVersion = soljsonReleases[_.keys(soljsonReleases)[0]];
        console.log("Browser-solc compiler version : " + compilerVersion);
        window.BrowserSolc.loadVersion(compilerVersion, function(c) {
          compiler = c;
          outerThis.setState({statusMessage:"ready!"},function(){
            console.log("Solc Version Loaded: " + compilerVersion);
          });
        });
      });
    },1000);
  }

Note, I had to wait for the window.BrowserSolc object to load, which is the reason for the setTimeout there. note also I'm using the lodash lib as "_" here.

Cheers~

@k26dr

This comment has been minimized.

Show comment
Hide comment
@k26dr

k26dr May 26, 2017

Correct, my script is for server-side compilation via Node, it will not work client side.

k26dr commented May 26, 2017

Correct, my script is for server-side compilation via Node, it will not work client side.

@educob

This comment has been minimized.

Show comment
Hide comment
@educob

educob Oct 26, 2017

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

educob commented Oct 26, 2017

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

@katopz

This comment has been minimized.

Show comment
Hide comment

katopz commented Oct 31, 2017

@trevorbroad

This comment has been minimized.

Show comment
Hide comment
@trevorbroad

trevorbroad Oct 31, 2017

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/

trevorbroad commented Oct 31, 2017

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

This comment has been minimized.

Show comment
Hide comment
@zachgoll

zachgoll Nov 2, 2017

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

zachgoll commented Nov 2, 2017

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

This comment has been minimized.

Show comment
Hide comment
@trevorbroad

trevorbroad Nov 3, 2017

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

trevorbroad commented Nov 3, 2017

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

@meoknu

This comment has been minimized.

Show comment
Hide comment
@meoknu

meoknu Nov 3, 2017

i demand for it

meoknu commented Nov 3, 2017

i demand for it

@magicliang

This comment has been minimized.

Show comment
Hide comment
@magicliang

magicliang Nov 7, 2017

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.

magicliang commented Nov 7, 2017

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

This comment has been minimized.

Show comment
Hide comment
@RoguePlanetoid

RoguePlanetoid Nov 8, 2017

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

RoguePlanetoid commented Nov 8, 2017

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

This comment has been minimized.

Show comment
Hide comment

zachgoll commented Nov 20, 2017

@temirov

This comment has been minimized.

Show comment
Hide comment
@temirov

temirov Dec 3, 2017

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

temirov commented Dec 3, 2017

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

@frewinchristopher

This comment has been minimized.

Show comment
Hide comment
@frewinchristopher

frewinchristopher Dec 4, 2017

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. 😂 Anyone get the reference?

frewinchristopher commented Dec 4, 2017

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. 😂 Anyone get the reference?
@nfrankel

This comment has been minimized.

Show comment
Hide comment
@nfrankel

nfrankel Dec 19, 2017

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

nfrankel commented Dec 19, 2017

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

@hamzadiaz

This comment has been minimized.

Show comment
Hide comment
@hamzadiaz

hamzadiaz Jan 12, 2018

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

hamzadiaz commented Jan 12, 2018

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

@adriadrop

This comment has been minimized.

Show comment
Hide comment
@adriadrop

adriadrop Mar 23, 2018

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.

adriadrop commented Mar 23, 2018

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

This comment has been minimized.

Show comment
Hide comment
@VoR0220

VoR0220 Mar 24, 2018

Contributor

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.

Contributor

VoR0220 commented Mar 24, 2018

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

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 24, 2018

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.

ghost commented Mar 24, 2018

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

This comment has been minimized.

Show comment
Hide comment
@Tectract

Tectract Mar 24, 2018

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 Mar 24, 2018

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

This comment has been minimized.

Show comment
Hide comment
@Tectract

Tectract Mar 24, 2018

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.

Tectract commented Mar 24, 2018

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

This comment has been minimized.

Show comment
Hide comment
@Gallaecio

Gallaecio Apr 13, 2018

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

Gallaecio commented Apr 13, 2018

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

This comment has been minimized.

Show comment
Hide comment
@avatar-lavventura

avatar-lavventura Apr 16, 2018

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

avatar-lavventura commented Apr 16, 2018

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

This comment has been minimized.

Show comment
Hide comment
@ibigbug

ibigbug Apr 25, 2018

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 :(

ibigbug commented Apr 25, 2018

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 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment