Difference between revisions of "Altchain PoP Miner"

From Veriblock Wiki
Jump to: navigation, search
Line 93: Line 93:
 
<pre>
 
<pre>
 
securityInheriting {
 
securityInheriting {
   btc: {
+
   vbtc: {
 +
    pluginKey: btc
 
     family: btc
 
     family: btc
 
     id: 3860170
 
     id: 3860170
 
     name: "vBitcoin"
 
     name: "vBitcoin"
 
     host: "http://localhost:18332"
 
     host: "http://localhost:18332"
     username: rpcUsername
+
     username: vbitcoin
     password: rpcPassword
+
     password: "....."
     payoutAddress: payoutAddress
+
     payoutAddress: "tb1q3az9yn9crk2zfgae2geuew8q58ftey7kexk5wy"
 
     autoMineRounds: [1,2,4]
 
     autoMineRounds: [1,2,4]
 
   }
 
   }

Revision as of 17:25, 1 May 2020

Altchain PoP Miner install and run instructions

Overview

The Proof-of-Proof (PoP) consensus protocol enables a security inheriting blockchain (any Altchain) to inherit the complete proof-of-work of a security providing blockchain (VeriBlock). For a deeper understanding of the PoP consensus protocol, please refer to the PoP White Paper.

A PoP miner serves as the communication and transactional bridge between the mined Altchain and the VeriBlock blockchain. As often as they wish, a PoP miner will take the most recent blockchain state data from the Altchain, along with an identification of the miner, and publish it to the VeriBlock blockchain via a PoP transaction with the embedded data. The PoP miner then waits for the transaction to be included in a VeriBlock block and also proven in the Bitcoin blockchain (through the process of VeriBlock PoP Mining).

PoP mining is a competitive endeavor in which miners compete to have their endorsement of the Altchain state included in the earliest possible VeriBlock block.

Getting Started

Download NodeCore

For Altchain PoP mining to be successful, the local NodeCore instance must be fully synced with the VeriBlock network.

Configuration

By default the application comes without a configuration file, in order to generate the configuration file you should run the application (see #Run)

The application.conf file is composed by different configuration blocks:

miner
Configuration Name Default Value Description Example
feePerByte 1000 The atomic units to pay per transaction byte
miner {
  feePerByte: 1000
  maxFee: 10000000
}
maxFee 10000000 Maximum veriblock atomic units to pay as transaction fee
nodecore
Configuration Name Default Value Description Example
network mainnet The network type, there are three options: mainnet, testnet and alphanet
nodecore {
  network: mainnet
  ip: 127.0.0.1
  port: 10500
}
ip 127.0.0.1 The NodeCore ip to which the miner will connect to
port 10500 The NodeCore port to which the miner will connect to

You can add chains to the securityInheriting block, for example:

securityInheriting
btc
Configuration Name Example Value Description Example
family btc The plugin family to load
securityInheriting {
  vbtc: {
    pluginKey: btc
    family: btc
    id: 3860170
    name: "vBitcoin"
    host: "http://localhost:18332"
    username: vbitcoin
    password: "....."
    payoutAddress: "tb1q3az9yn9crk2zfgae2geuew8q58ftey7kexk5wy"
    autoMineRounds: [1,2,4]
  }
}
id 3860170 The chain id
name vBitcoin The chain name
host http://localhost:10600/api API url from the coin daemon
username rpcUsername The username used on the daemon authentication (if any)
password rpcPassword The password used on the daemon authentication (if any)
payoutAddress payoutAddress Specify a payout address, if is not specified the first address from the publication data will be used as the payout address

Example of a full configuration file:

miner {
  feePerByte: 1000
  maxFee: 10000000
}

nodecore {
  network: mainnet
  ip: 127.0.0.1
  port: 10500
}

securityInheriting {
  btc: {
    family: btc
    id: 3860170
    name: "vBitcoin"
    host: "http://localhost:18332"
    username: rpcUsername
    password: rpcPassword
    payoutAddress: payoutAddress
    autoMineRounds: [1,2,3,4]
  }
  test: {
    host: "http://localhost:10600/api"
    autoMinePeriod: null
  }
}

Run

Inside the application's bin folder, you will have two scripts to run the application, veriblock-alt-pop (Linux and Mac) and veriblock-alt-pop.bat (Windows)

NOTE: If you are having trouble running nodecore-apm on Linux, you may need to make nodecore-apm executable: chmod a+x veriblock-alt-pop

On first execution of the application, a lightweight VeriBlock wallet will be created, in order to start mining you have to send VBK coin funds to this wallet.

The Altchain PoP miner communicates with NodeCore to maintain the internal wallet. A connection to a synchronized NodeCore is always required.

Docker

With APM Docker, the next environment variables are accessible:

Variable Name Example Value Description
MINER_FEE_PER_BYTE 1000 The atomic units to pay per transaction byte
MINER_MAX_FEE 10000000 Maximum veriblock atomic units to pay as transaction fee
NODECORE_NETWORK mainnet The network type, there are three options: mainnet, testnet and alphanet
NODECORE_IP localhost The NodeCore ip to which the miner will connect to
NODECORE_PORT 10500 The NodeCore port to which the miner will connect to
CONFIG_FILE /data/application.conf The APM config file
APM_LOG_PATH /data/logs The folder for the APM logs

Mining

Right now there are no real Altchains integrated with APM. However, we have created a virtual altchain for testing purposes

  • To begin a mining operation for the test alchain, type 'mine test' and press ENTER

Once we start having more plugins ready, Every single APM instance will be able to perform mining operations on multiple different chains.

Mining Lifecycle

The Altchain PoP Miner will do the next actions with the next order:

Action Duration Description Comment
INITIAL N/A Initial state, to be started
PUBLICATION_DATA ~1 Second Publication Data retrieved, Endorsement Transaction to be submitted
ENDORSEMENT_TRANSACTION ~1 Second Endorsement Transaction submitted to the VeriBlock blockchain, waiting to be confirmed
ENDORSEMENT_CONFIRMED ~30 Seconds (VeriBlock block time) Endorsement Transaction confirmed in VeriBlock blockchain, waiting for Block of Proof VeriBlock transaction containing ALT data can be seen on VBK Explorer
BLOCK_OF_PROOF ~1 Second Block of Proof received, Endorsement Transaction to be proved
TRANSACTION_PROVED ~1 Second Endorsement Transaction Proved, waiting for Keystone of Proof
KEYSTONE_OF_PROOF ~5 Minutes (Time for 0-20 VBK blocks, depending on publication height) Keystone of Proof received, waiting for VeriBlock Publications VeriBlock Keystone visible on VBK Explorer
VERIBLOCK_PUBLICATIONS 1 Second - 1.5 Hours (Bitcoin block time + VeriBlock block time) VeriBlock Publications received, waiting for submission response A Bitcoin transaction containing VBK data for the relevant VBK keystone can be seen on a BTC explorer, and a VBK PoP transaction containing that BTC transaction exists in the VeriBlock blockchain. VBK reward payout for VBK PoP miner will occur in a future coinbase transaction.
SUBMITED_POP_DATA Altchain block time VTB submitted, waiting for depth completion ALT PoP transaction can be seen in ALT mempool and later in an ALT block (at which point it will write out ATV, VTB[] to the Integration Library storage
COMPLETED N/A Completed ALT reward payout will occur in a future ALT coinbase transaction

Shell

The Altchain PoP miner provides several commands:

Command Description
help Lists all the commands
clear Clears the screen
quit or exit Stops the application
listconfig Lists the current config values
setconfig <key> <value> Sets a config value
mine <chain> <block (optional)> Begins a proof of proof mining operation for the given chain
listoperations Lists the currently running mining operations
getoperation <id> Supplies the details of the operation matching the given id
getoperationvtb <id> Supplies the VTB details of the operation matching the given id
getbalance Gets the coin balance for the VeriBlock address