HowTo run PoP Miner

From Veriblock Wiki
Revision as of 18:28, 26 April 2018 by TimStall (talk | contribs)
Jump to: navigation, search

See: Main_Page, PoP_Miner_CommandLine, PoP_Transaction_LifeCycle

Overview

Proof-of-Proof (PoP) mining is what ultimately endorses the VeriBlock blockchain using Bitcoin's OP_RETURN, and thereby allows an altchain to have Bitcoin-level security through VeriBlock. It is different than Proof-of-Work mining, which collects valid transactions into a block and adds that block to the blockchain.

Prerequisites

PoP Mining requires Bitcoin accessibility.

For Testnet, that means just running a testnet Bitcoin node.

See this Bitcoin page for background info: https://en.bitcoin.it/wiki/Running_Bitcoin

  1. Download Bitcoin Core https://bitcoin.org/en/download, run Bitcoin in testnet mode, and allow it to fully sync. This may take a while depending on your network connection.
  2. Run bitcoin TestNet by passing in the testnet parameter:
    1. Windows: bitcoin-qt.exe -testnet
    2. Linux: bitcoind -testnet
  3. Set up a rpc user and password in the bitcoin.conf file
  4. In Bitcoin Core, goto: Settings > Options > Main (tab) > Open Config File (button).
    1. HowTo PoP 1a.png
  5. specify the flags like below (server=1, rpcuser=your_username, rpcpassword=your_password), and save the file. Re-click the "Open Config File" to ensure the settings did indeed save (they should have)
  6. If prompted with "The configuration file is used to...", then click ok.

bitcoin.conf (a plaintext file) will open.

server=1
rpcuser=bitcoinrpc
rpcpassword=someTestNetPassword123

Get Bitcoin testnet coins from a faucet. Running PoP on VeriBlock testnet requires a small amount of testnet Bitcoin. You can find a list of popular Bitcoin testnet faucets here: https://en.bitcoin.it/wiki/Testnet#Faucets. Get a new Bitcoin testnet address from your running instance of Bitcoin, and then enter it into one of the Bitcoin testnet faucet sites to receive testnet Bitcoin coins.

Run the PoP Miner

Note: If you are having trouble running nodecore-pop on linux, you may need to make nodecore-pop executable: chmod a+x nodecore-pop

Run a local instance of NodeCore

Unzip nodecore-pop-*.zip In the bin folder, if Windows then run nodecore-pop.bat, if linux then run nodecore-pop You will be prompted for a series of questions. Below is sample inputs. Note that Bitcoin TestNet port is 18332 (not 18333).

One prompt will be for a "funded Bitcoin address." This can be retrieved by running "listunspent" from the built-in console. To get to the built-in consile, go to: Help > Debug > Console Tab:

HowTo PoP 4.png

At this point, you should have:

  • An instance of NodeCore running, such as one available at 127.0.0.1:10500
  • A Bitcoin testnet node, such as on available at 127.0.0.1:18332
  • That Bitcoin testnet node has an RPC username and password set up in its bitcoin.conf file
  • A funded Bitcoin address (first get testnet Bitcoin coins from a faucet, then run listunspent to get an address), such as "mwAY47kNhN2TY1nc23Y18aDi4botjpGzAy"

Please enter the VeriBlock NodeCore host [Default: 127.0.0.1](]):
 > 127.0.0.1
Please enter the VeriBlock NodeCore port [10500](Default:):
 > 10500
Please enter the Bitcoin RPC host [127.0.0.1](Default:):
 > 127.0.0.1
Please enter the Bitcoin RPC port [8332](Default:):
 > 18332
Please enter a funded Bitcoin address you would like to use for PoP:
 > mwAY47kNhN2TY1nc23Y18aDi4botjpGzAy
Please enter your Bitcoin RPC username:
 > bitcoinrpc
Please enter your Bitcoin RPC password:
 > someTestNetPassword123
How many BTC would you like to pay as a transaction fee for each PoP? (Suggested: 0.001)
 > 0.001

Note that after entering this info once, it will be saved to a ncpop.properties file for future reference. If you ever need to change these entries in the future, you can either delete ncpop.properties and restart nodecore-pop (where it will prompt you for new entries), or you can change the entires in the configuration file directly.

Because PoP Mining costs a small amount of BTC, you will be prompted for each transaction with something like: "Press enter to pay 0.001 BTC to perform a PoP! (q to quit)"

A Proof of Proof mining operation is a long running process. It involves retrieving a PoP signature from NodeCore, submitting a Bitcoin transaction, waiting for the Bitcoin transaction to be included in a block, and finally submitting that Bitcoin block information back to NodeCore. Until that final submission to NodeCore takes place, the mining operation is incomplete, and you will not be rewarded for your PoP mining efforts.

The console output updates with each new stage of the mining operation. Because it is possible to have multiple concurrent mining operations executing, each status update written to the console includes a "job identifier", that will look like [4826f210]. This job identifier can be used to correlate status messages for any given mining operation. By far, the longest single task in the mining operation is waiting for a Bitcoin transaction to be included in a mined Bitcoin block. It is very common and normal to see many status message written very rapidly as soon as you initiate a new operation and then for the miner to seemingly "pause" with the latest message reading:

2018-04-02 00:15:00.052 [4826f210] Mining operation current action: Waiting for transaction to be included in Bitcoin block

If a reasonable transaction fee was used to submit your Bitcoin transaction, it will eventually be included in a block, and the PoP miner will progress through the final stages of the operation. You will know an operation is complete when you see console output:

2018-04-02 00:18:27.315 [4826f210] Mining operation is now: Completed

At any point in the process, you may queue up another PoP mining operation by hitting the "ENTER" key. You also may quit the application at any time by pressing "q" followed by the "ENTER" key. The quit sequence waits for all in-progress mining operations to complete before actually shutting down the application. This is to ensure that your PoP transaction is submitted and you have every opportunity to be rewarded for the Bitcoin you've spent to begin the operation. You will see status updates written to the console as it's attempting to finalize running operations:

Waiting on operation '2a479b68' at action: Waiting for transaction to be included in Bitcoin block
Waiting on 1 operations to complete

Congrats, you have mined a PoP transaction!

View PoP on the bitcoin blockchain

Go back to your Bitcoin Core wallet, Transactions tab, and you will see PoP Transactions. Drill down on a transaction and you'll see a transaction ID.

HowTo PoP 2c.png

After a few minutes, this transaction ID should show up on Bitcoin testnet block explorers, such as http://testnet.coinsecrets.org.

Status: 0/unconfirmed, in memory pool
Date: 3/9/2018 14:33
Debit: 0.00000000 BTC
Transaction fee: -0.00100000 BTC
Net amount: -0.00100000 BTC
Transaction ID: 52bac8bad5c9d71f1adcf166c5ef5e651f269851b1816b61cb99ed62268f512b
Transaction total size: 283 bytes
Output index: 0

Drill down on the block explorer, and you will see the proof in the OP_RETURN. Ignore the first 4 characters (0x4c refers to the OP_PUSHDATA1 opcode, and 0x50 refers to 80 bytes [the size of our published data] being pushed onto the stack), look at the last 160 (80 bytes), and that is your pop publication on the BTC testnet!

OP_RETURN
4c5000000001000000f29717032fb910956d001e9ae5554540864b4c998cf7233ca3ff78109365086b0e7ad55c480ce9dd55fa6763275aa2eedc0319ca1c

https://www.blocktrail.com/tBTC/tx/52bac8bad5c9d71f1adcf166c5ef5e651f269851b1816b61cb99ed62268f512b

HowTo PoP 3.png