Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: kzv on October 01, 2016, 05:04:21 AM



Title: How to start mining in offline?
Post by: kzv on October 01, 2016, 05:04:21 AM
Hello,

I'm testing blockchain technology and want to understand how bitcoind is start mining?

I run bitcoind in offline machine with "bintcoind -daemon -gen" and i waiting for him to begin mining new blockchain statred from Genesis block...
I waited a long time, but it does not generate a new chain!

So i tried "bintcoind -daemon -regtest" but it does not generate a blockchain too!

Why is this happening?


Title: Re: How to start mining in offline?
Post by: 2112 on October 01, 2016, 05:28:40 AM
For the Bitcoin Core client to start mining it requires some minimal rudimentary peer to peer network. If I remember correctly the minimum is either 2 or 3 peers. You actually don't need the separate computers, the necessary peer to peer network can be created on a single computer by running multiple Bitcoin Core instances under multiple user accounts.

I don't remember the details, you'll have to experiment with starting multiple instances of Bitcoin Core with several flags: -connect=? , -port=? and -rpcport=? .

Edit: If I remember correctly such setup is not called "offline mining", it is called "testnet in a box", even if you aren't running testnet.

Also, research older versions of cgminer that still supported GPU mining of Bitcoin to use for your tests. GPU mining is much more power-efficient than CPU mining. With a mid-range laptop (couple of years ago, when GPU mining of Bitcoin was still a thing) you should be able to run all the required programs (multiple instances of Bitcoin Core and at least one instance of cgminer) on batteries and without spinning up the laptop's fan or having to suffer a hot laptop. Even if you work on a desktop and not on the laptop, the power savings and the fan noise reduction are really helpful for the developer.



Title: Re: How to start mining in offline?
Post by: kzv on October 01, 2016, 07:44:31 AM
I tried to start several bitcoind
Code:
#!/bin/bash
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16591 -datadir=$HOME/ForkTest/A/ -connect=localhost:17592 -pid=$HOME/ForkTest/A/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16592 -datadir=$HOME/ForkTest/B/ -connect=localhost:17593 -pid=$HOME/ForkTest/B/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16593 -datadir=$HOME/ForkTest/C/ -connect=localhost:17594 -pid=$HOME/ForkTest/C/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17594 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16594 -datadir=$HOME/ForkTest/D/ -connect=localhost:17591 -pid=$HOME/ForkTest/C/.pid -daemon -debug

but the blockchain still does not start mining (((


Title: Re: How to start mining in offline?
Post by: 2112 on October 01, 2016, 12:02:49 PM
Conceptually your ring of 4 peers looks correct and should be capable of mining. I don't know why it isn't working for you.

The only thing I can suggest is to search the net for the phase "testnet in a box". There are multiple pages describing exactly how they did it. Just retrace exactly their steps. I've done it multiple times, but my computers used for testing are in storage and I can't look at them now.


Title: Re: How to start mining in offline?
Post by: cr1776 on October 01, 2016, 12:41:50 PM
I tried to start several bitcoind
Code:
#!/bin/bash
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16591 -datadir=$HOME/ForkTest/A/ -connect=localhost:17592 -pid=$HOME/ForkTest/A/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16592 -datadir=$HOME/ForkTest/B/ -connect=localhost:17593 -pid=$HOME/ForkTest/B/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16593 -datadir=$HOME/ForkTest/C/ -connect=localhost:17594 -pid=$HOME/ForkTest/C/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17594 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16594 -datadir=$HOME/ForkTest/D/ -connect=localhost:17591 -pid=$HOME/ForkTest/C/.pid -daemon -debug

but the blockchain still does not start mining (((

Did you try the generate RPC call to mine a new block?  (setgenerate has been removed due to the internal miner being removed - see e.g. https://bitcoin.org/en/release/v0.13.0#removal-of-internal-miner )


Title: Re: How to start mining in offline?
Post by: cr1776 on October 01, 2016, 12:42:33 PM
since mining is a way to make small earning in the present time because mining is not more profitable work for mining hardware in the current time so i will suggest you to leave your idea of mining bitcoin . it is waste of time .

I guess you didn't bother to read the first message and just wanted to post in order to increase your ad campaign post count?  


Title: Re: How to start mining in offline?
Post by: kzv on October 02, 2016, 06:41:54 PM
I tried to start several bitcoind
Code:
#!/bin/bash
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17591 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16591 -datadir=$HOME/ForkTest/A/ -connect=localhost:17592 -pid=$HOME/ForkTest/A/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17592 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16592 -datadir=$HOME/ForkTest/B/ -connect=localhost:17593 -pid=$HOME/ForkTest/B/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17593 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16593 -datadir=$HOME/ForkTest/C/ -connect=localhost:17594 -pid=$HOME/ForkTest/C/.pid -daemon -debug
$HOME/bitcoin-0.13.0/src/bitcoind -regtest -server -listen -port=17594 -rpcuser=bitcoinrpc -rpcpassword=P -rpcport=16594 -datadir=$HOME/ForkTest/D/ -connect=localhost:17591 -pid=$HOME/ForkTest/C/.pid -daemon -debug

but the blockchain still does not start mining (((

Did you try the generate RPC call to mine a new block?  (setgenerate has been removed due to the internal miner being removed - see e.g. https://bitcoin.org/en/release/v0.13.0#removal-of-internal-miner )

Thank you very much!
I tried with version 0.12.0 and everything works as expected! :)


Title: Re: How to start mining in offline?
Post by: jonahmarieaton101 on October 07, 2016, 02:31:03 PM
Is it really possible to do mining in offline?


Title: Re: How to start mining in offline?
Post by: vino.gcs on October 19, 2016, 12:11:46 PM
Is it really possible to do mining in offline?

Yes. It is possible, by implementing a private network of peers. Atleast it is off from internet. And you will never find the actual block if you mine on private network. You can have fun with playing on how crypto currency works. :P


Title: Re: How to start mining in offline?
Post by: Decoded on October 21, 2016, 04:36:29 AM
Is it really possible to do mining in offline?

What OP is trying to do is not mining on the current chain offline, as this is impossible.

He wants to create his own blockchain offline. So it will be a network consisting of him and him only.