Skip to main content
added 81 characters in body
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75

These blocks are mined by your client by using miner.start() tothe blocks are mined until your transaction got included in one of these blocks. To stop the operation tape miner.stop() even the log didn't give you the prompt. However, the best thing is using a script that mine only the pending transactions (you mine only few blocks until your transaction got mined).

such script will contain

var mining_threads = 1

    function checkWork() {
        if (eth.getBlock("pending").transactions.length > 0) {
            if (eth.mining) return;
            console.log("== Pending transactions! Mining...");
            miner.start(mining_threads);
        } else {
            miner.stop();
            console.log("== No transactions! Mining stopped.");
        }
    }
    console.log("checkWork() is defined");
    eth.filter("latest", function(err, block) { checkWork(); });
    eth.filter("pending", function(err, block) { checkWork(); });
    
    checkWork();

on geth use

 loadScript("C:/Users/Tera_pc/Desktop/demo/mine_pending.js")

These blocks are mined by your client by using miner.start() to stop the operation tape miner.stop() even the log didn't give you the prompt. However, the best thing is using a script that mine only the pending transactions (you mine only few blocks until your transaction got mined).

such script will contain

var mining_threads = 1

    function checkWork() {
        if (eth.getBlock("pending").transactions.length > 0) {
            if (eth.mining) return;
            console.log("== Pending transactions! Mining...");
            miner.start(mining_threads);
        } else {
            miner.stop();
            console.log("== No transactions! Mining stopped.");
        }
    }
    console.log("checkWork() is defined");
    eth.filter("latest", function(err, block) { checkWork(); });
    eth.filter("pending", function(err, block) { checkWork(); });
    
    checkWork();

on geth use

 loadScript("C:/Users/Tera_pc/Desktop/demo/mine_pending.js")

These blocks are mined by your client by using miner.start() the blocks are mined until your transaction got included in one of these blocks. To stop the operation tape miner.stop() even the log didn't give you the prompt. However, the best thing is using a script that mine only the pending transactions (you mine only few blocks until your transaction got mined).

such script will contain

var mining_threads = 1

    function checkWork() {
        if (eth.getBlock("pending").transactions.length > 0) {
            if (eth.mining) return;
            console.log("== Pending transactions! Mining...");
            miner.start(mining_threads);
        } else {
            miner.stop();
            console.log("== No transactions! Mining stopped.");
        }
    }
    console.log("checkWork() is defined");
    eth.filter("latest", function(err, block) { checkWork(); });
    eth.filter("pending", function(err, block) { checkWork(); });
    
    checkWork();

on geth use

 loadScript("C:/Users/Tera_pc/Desktop/demo/mine_pending.js")
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75

These blocks are mined by your client by using miner.start() to stop the operation tape miner.stop() even the log didn't give you the prompt. However, the best thing is using a script that mine only the pending transactions (you mine only few blocks until your transaction got mined).

such script will contain

var mining_threads = 1

    function checkWork() {
        if (eth.getBlock("pending").transactions.length > 0) {
            if (eth.mining) return;
            console.log("== Pending transactions! Mining...");
            miner.start(mining_threads);
        } else {
            miner.stop();
            console.log("== No transactions! Mining stopped.");
        }
    }
    console.log("checkWork() is defined");
    eth.filter("latest", function(err, block) { checkWork(); });
    eth.filter("pending", function(err, block) { checkWork(); });
    
    checkWork();

on geth use

 loadScript("C:/Users/Tera_pc/Desktop/demo/mine_pending.js")