ether-camp / ethereum-harmony

DEPRECATED! Ethereum Independent Peer
GNU General Public License v3.0
254 stars 89 forks source link

how to run miner_start in web Terminal? #62

Closed lxiaodao closed 6 years ago

lxiaodao commented 6 years ago
  1. Cloned the code of ethereum-harmony 2.Run the system use command gradlew runMain -Dserver.port=9000 3.See the Terminal in the left menu tree. 4.In the Terminal,try the command.
    Ethereum
    node> miner_start 2
    JsonRpcServerError: method parameters invalid
    node> miner_start(2)
    Command not found

    could anybody give me some advice?

zilm13 commented 6 years ago

You don't need any params. Just miner_start. Here's the way I start it from RPC:

curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":67}' 
lxiaodao commented 6 years ago

zilm13,Thanks for your comment. I have started the miner.

lxiaodao commented 6 years ago

But how to add parameter recieved Account to miner_start?

zilm13 commented 6 years ago

@lxiaodao you should do it from config or pass params via command line. This is default options: https://github.com/ethereum/ethereumj/blob/develop/ethereumj-core/src/main/resources/ethereumj.conf#L282-L320 Just override what you want in custom config or pass it via command line by adding something like this -Dmine.coinbase=dd0f441d5262eae5af597bdcb3a40e50d4e1ed1c

lxiaodao commented 6 years ago

@zilm13 Thanks again,it is clear.

zilm13 commented 6 years ago

Btw I was wrong, we had methods in rpc and terminal but they were not documented. I've added it to the help (develop only for now): https://github.com/ether-camp/ethereum-harmony/commit/8655efb1e1f472ed9f1f1adb7f4f38b0878e8df0

lxiaodao commented 6 years ago

@zilm13 I see the document after you modify. I also find a issues maybe when run the command like this gradlew runClassic -Dserver.port=7000 -Dethereumj.conf.res=E:/business/classic.conf.The parameter -Dethereumj.conf.res is not effected. Only after I modify the build.gradle like below:

def bootRunWithNetworkConfig(String name, boolean includePresets) {
    def newArgs = []
    if (includePresets) {
        addJvmArgIfEmpty "database.dir", getDatabaseDir("database-" + name)
    // change by lxiaodao 201803014
    // "ethereumj.conf.res", "E:/business/classic.conf"
    def conf_name=name;
    if(name=='classic'){
           conf_name='E:/business/classic';
    }
        newArgs.addAll([
                '-Dethereumj.conf.res=' + conf_name + '.conf',
                '-Ddatabase.name=database-' + name,
                '-DnetworkProfile=' + name])
    }

    // set heap size configure in task
    if (!project.hasProperty('jvmArgs') || project.jvmArgs.indexOf('-Xmx') == -1) {
        println('Set default heap size for task ' + maxHeapSize)
        newArgs.add(maxHeapSize)
    } else {
        println('Using heap size from user input ' + project.jvmArgs)
    }

    bootRun.jvmArgs.addAll(newArgs)
    println 'Running Java with ' + bootRun.jvmArgs

    tasks.compileJava.execute()
    tasks.bootRun.execute()
}