Readercoin mining

Bitcoin 0.15, which Readercoin is based on, doesn't have an internal miner, so we will need to use a dedicated mining tool to mine our blocks. Among many, we will use Cpuminer (minerd), which is pretty simple to use and supports CPU mining for sha256 hashing.

To install it, you can get the binary file from GitHub: https://github.com/pooler/cpuminer/releases. Download the last release and extract the binary, you'll get a file called minerd.

Prior to running cpuminer, we need to generate new addresses in both instances using the following command:

readercoin-cli getnewaddress

Then, run the following command on one or both clients and provide the generated address as a value for the coinbase-addr option:

./minerd -o http://127.0.0.1:9332 -u user -p password -a sha256d --no-longpoll --no-getwork --no-stratum --coinbase-addr=your_address

Cpuminer will not start unless both nodes are connected and communicating with each other. Once working, you'll be able to see a series of log entries along with notifications declaring the receipt of new transactions (genesis transactions), each with 10 Readercoins:

If you're facing any mining problems while using cpuminer, you can use a more updated tool, such as cgminer or ccminer. In parallel, in another terminal, you can get detailed information about the progress of your blockchain using readercoin-cli Getinfo,which returns an object containing various state information. A more specific RPC method is getblockchaininfo, which provides you with various state information regarding blockchain processing, including the number of mined blocks, the last block hash, the chainwork, and the soft fork situation:

To get all the details about a specific block, you need to run readercoin-cli getblock <block hash>:

In the preceding screenshot, the genesis block has a 1 difficulty and 1e00ffff0 bits. We explained earlier that Bitcoin bits represent the target hash value in a special format.

Mining using a single node is called solo mining, which will be impossible to perform if the difficulty reaches a high level. In that situation, it's appropriate instead to build mining pools formed by multiple mining nodes, which share the work and rewards.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset