Difference between revisions of "Altchain PoP Miner"
(63 intermediate revisions by 4 users not shown) | |||
Line 19: | Line 19: | ||
=== Configuration === | === Configuration === | ||
− | |||
− | |||
The application.conf file is composed by different configuration blocks: | The application.conf file is composed by different configuration blocks: | ||
{|class="wikitable" | {|class="wikitable" | ||
− | !colspan=" | + | !colspan="5"| miner |
|- | |- | ||
! Configuration Name | ! Configuration Name | ||
! Default Value | ! Default Value | ||
+ | ! Environment Variable | ||
! Description | ! Description | ||
! Example | ! Example | ||
|- | |- | ||
− | | | + | |network |
− | | | + | |testnet |
− | |The | + | |MINER_NETWORK |
− | |rowspan=" | + | |The network type, there are three options: mainnet, testnet and alphanet |
+ | |rowspan="8"| | ||
<pre> | <pre> | ||
miner { | miner { | ||
+ | network: testnet | ||
feePerByte: 1000 | feePerByte: 1000 | ||
maxFee: 10000000 | maxFee: 10000000 | ||
+ | # Uncomment if you have a local full node | ||
+ | #connectDirectlyTo: ["localhost"] | ||
+ | |||
+ | # Uncomment if you want the miner API to be bound to the internet | ||
+ | api.host: 127.0.0.1 | ||
+ | api.port: 8081 | ||
+ | |||
+ | # Uncomment if you want basic auth at the miner API | ||
+ | #api.auth.username: my-username | ||
+ | #api.auth.password: my-password | ||
} | } | ||
</pre> | </pre> | ||
+ | |- | ||
+ | |feePerByte | ||
+ | |1000 | ||
+ | |MINER_FEE_PER_BYTE | ||
+ | |The atomic units to pay per transaction byte | ||
|- | |- | ||
|maxFee | |maxFee | ||
|10000000 | |10000000 | ||
+ | |MINER_MAX_FEE | ||
|Maximum veriblock atomic units to pay as transaction fee | |Maximum veriblock atomic units to pay as transaction fee | ||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | |connectDirectlyTo | |
− | + | | | |
− | + | | | |
− | + | |The NodeCore IP if you have a full node | |
+ | |- | ||
+ | |api.host | ||
+ | |127.0.0.1 | ||
+ | |MINER_API_HOST | ||
+ | |The miner API host | ||
|- | |- | ||
− | | | + | |api.port |
− | | | + | |8081 |
− | | | + | |MINER_API_PORT |
− | | | + | |The miner API port |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | |api.auth.username |
− | | | + | | |
− | |The | + | |MINER_API_USERNAME |
+ | |The miner API auth username | ||
|- | |- | ||
− | | | + | |api.auth.password |
− | | | + | | |
− | |The | + | |MINER_API_PASSWORD |
+ | |The miner API auth password | ||
|} | |} | ||
You can add chains to the securityInheriting block, for example: | You can add chains to the securityInheriting block, for example: | ||
{|class="wikitable" | {|class="wikitable" | ||
− | !colspan=" | + | !colspan="5"| securityInheriting |
− | |||
− | |||
|- | |- | ||
+ | ! Parent Configuration | ||
! Configuration Name | ! Configuration Name | ||
! Example Value | ! Example Value | ||
Line 87: | Line 99: | ||
! Example | ! Example | ||
|- | |- | ||
− | | | + | |vbtc |
+ | |pluginKey | ||
|btc | |btc | ||
− | |The plugin | + | |The plugin to load |
− | |rowspan=" | + | |rowspan="10"| |
<pre> | <pre> | ||
securityInheriting { | securityInheriting { | ||
− | btc: { | + | vdoge: { |
− | + | // This can be set to [1,2,3,4] | |
− | id: | + | autoMineRounds: [4] |
− | name: "vBitcoin" | + | payoutAddress: "INSERT PAYOUT ADDRESS" |
− | host: "http://localhost: | + | pluginKey: btc |
− | username: | + | id: 100111103101 |
− | + | name: "vDogecoin" | |
+ | host: "http://localhost:44555" | ||
+ | // Uncomment if your daemon is auth protected | ||
+ | auth: { | ||
+ | username: "vdoge" | ||
+ | password: "BETATeSt!" | ||
+ | } | ||
+ | payoutInterval: 50 | ||
+ | extraConfig: { | ||
+ | daemonConnectionTimeout: 60000 | ||
+ | } | ||
+ | } | ||
+ | vbsv: { | ||
+ | // This can be set to [1,2,3,4] | ||
+ | autoMineRounds: [4] | ||
+ | payoutAddress: "INSERT PAYOUT ADDRESS" | ||
+ | pluginKey: btc | ||
+ | id: 98115118 | ||
+ | name: "vBitcoin-SV" | ||
+ | host: "http://localhost:9332" | ||
+ | // Uncomment if your vBTC daemon is auth protected | ||
+ | auth: { | ||
+ | username: "vbsv" | ||
+ | password: "BETATeSt!" | ||
+ | } | ||
+ | payoutInterval: 50 | ||
+ | extraConfig: { | ||
+ | daemonConnectionTimeout: 20000 | ||
+ | } | ||
} | } | ||
} | } | ||
</pre> | </pre> | ||
|- | |- | ||
+ | |vbtc | ||
|id | |id | ||
− | | | + | |3860170 |
|The chain id | |The chain id | ||
|- | |- | ||
+ | |vbtc | ||
|name | |name | ||
|vBitcoin | |vBitcoin | ||
|The chain name | |The chain name | ||
|- | |- | ||
+ | |vbtc | ||
|host | |host | ||
|http://localhost:10600/api | |http://localhost:10600/api | ||
|API url from the coin daemon | |API url from the coin daemon | ||
|- | |- | ||
+ | |vbtc | ||
+ | |payoutAddress | ||
+ | |payoutAddress | ||
+ | |Specify a payout address, if is not specified the first address from the publication data will be used as the payout address | ||
+ | |- | ||
+ | |vbtc | ||
+ | |keystonePeriod | ||
+ | |10 | ||
+ | |Specify the keystone period | ||
+ | |- | ||
+ | |vbtc | ||
+ | |autoMineRounds | ||
+ | |[1,2,3,4] | ||
+ | |Whether this chain is configured to automine the block at the given block height, it can be disabled by commenting the autoMineRounds config. | ||
+ | |- | ||
+ | |vbtc.auth | ||
|username | |username | ||
− | | | + | |rpcUsername |
− | |The username used on the daemon authentication (if any) | + | |The username used on the daemon authentication (if any), it can be disabled by commenting the whole auth config block. |
|- | |- | ||
+ | |vbtc.auth | ||
|password | |password | ||
− | | | + | |rpcPassword |
− | |The password used on the daemon authentication (if any) | + | |The password used on the daemon authentication (if any), it can be disabled by commenting the whole auth config block. |
+ | |- | ||
+ | |vbtc.extraConfig | ||
+ | |requestLogsPath | ||
+ | |./logs | ||
+ | |The verbose request logging path | ||
|} | |} | ||
Line 128: | Line 194: | ||
<pre> | <pre> | ||
miner { | miner { | ||
+ | network: testnet | ||
feePerByte: 1000 | feePerByte: 1000 | ||
maxFee: 10000000 | maxFee: 10000000 | ||
− | + | # Uncomment if you have a local full node | |
+ | #connectDirectlyTo: ["localhost"] | ||
+ | |||
+ | # Uncomment if you want the miner API to be bound to the internet | ||
+ | api.host: 127.0.0.1 | ||
+ | api.port: 8081 | ||
− | + | # Uncomment if you want basic auth at the miner API | |
− | + | #api.auth.username: my-username | |
− | + | #api.auth.password: my-password | |
− | |||
} | } | ||
securityInheriting { | securityInheriting { | ||
− | + | vdoge: { | |
− | + | // This can be set to [1,2,3,4] | |
− | id: | + | autoMineRounds: [4] |
− | name: " | + | payoutAddress: "INSERT PAYOUT ADDRESS" |
− | host: "http://localhost: | + | pluginKey: btc |
− | username: | + | id: 100111103101 |
− | + | name: "vDogecoin" | |
+ | host: "http://localhost:44555" | ||
+ | // Uncomment if your daemon is auth protected | ||
+ | auth: { | ||
+ | username: "vdoge" | ||
+ | password: "BETATeSt!" | ||
+ | } | ||
+ | payoutInterval: 50 | ||
+ | extraConfig: { | ||
+ | daemonConnectionTimeout: 60000 | ||
+ | } | ||
} | } | ||
− | + | vbsv: { | |
− | host: "http://localhost: | + | // This can be set to [1,2,3,4] |
− | + | autoMineRounds: [4] | |
+ | payoutAddress: "INSERT PAYOUT ADDRESS" | ||
+ | pluginKey: btc | ||
+ | id: 98115118 | ||
+ | name: "vBitcoin-SV" | ||
+ | host: "http://localhost:9332" | ||
+ | // Uncomment if your vBTC daemon is auth protected | ||
+ | auth: { | ||
+ | username: "vbsv" | ||
+ | password: "BETATeSt!" | ||
+ | } | ||
+ | payoutInterval: 50 | ||
+ | extraConfig: { | ||
+ | daemonConnectionTimeout: 20000 | ||
+ | } | ||
} | } | ||
} | } | ||
Line 157: | Line 252: | ||
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) | 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- | + | 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. | 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. | ||
Line 164: | Line 259: | ||
=== Docker === | === Docker === | ||
+ | With [https://hub.docker.com/r/veriblock/altchain-pop-miner APM Docker], the next environment variables are accessible: | ||
− | + | {|class="wikitable" | |
+ | |- | ||
+ | ! 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 | ||
+ | |- | ||
+ | |MINER_NETWORK | ||
+ | |testnet | ||
+ | |The network type, there are three options: mainnet, testnet and alphanet | ||
+ | |- | ||
+ | |MINER_API_HOST | ||
+ | |127.0.0.1 | ||
+ | |The miner API host | ||
+ | |- | ||
+ | |MINER_API_PORT | ||
+ | |8081 | ||
+ | |The miner API port | ||
+ | |- | ||
+ | |MINER_API_USERNAME | ||
+ | | | ||
+ | |The miner API auth username | ||
+ | |- | ||
+ | |MINER_API_PASSWORD | ||
+ | | | ||
+ | |The miner API auth password | ||
+ | |- | ||
+ | |CONFIG_FILE | ||
+ | |/data/application.conf | ||
+ | |The APM config file | ||
+ | |- | ||
+ | |APM_LOG_PATH | ||
+ | |/data/logs | ||
+ | |The folder for the APM logs | ||
+ | |- | ||
+ | |APM_LOG_LEVEL | ||
+ | | | ||
+ | |The APM logger level | ||
+ | |- | ||
+ | |APM_CONSOLE_LOG_LEVEL | ||
+ | | | ||
+ | |The APM console logger level | ||
+ | |- | ||
+ | |APM_ENABLE_JSON_LOG | ||
+ | |false | ||
+ | |Enable the APM JSON logs | ||
+ | |- | ||
+ | |} | ||
== Mining == | == Mining == | ||
Line 174: | Line 324: | ||
Once we start having more plugins ready, Every single APM instance will be able to perform mining operations on multiple different chains. | 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: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Action | ||
+ | ! Duration | ||
+ | ! Description | ||
+ | ! Comment | ||
+ | |- | ||
+ | | INITIAL | ||
+ | | N/A | ||
+ | | Initial state, to be started | ||
+ | | | ||
+ | |- | ||
+ | | INSTRUCTION | ||
+ | | ~10 Seconds | ||
+ | | Mining Instruction retrieved, Endorsement Transaction to be submitted | ||
+ | | | ||
+ | |- | ||
+ | | ENDORSEMENT_TRANSACTION | ||
+ | | ~10 Seconds | ||
+ | | Endorsement Transaction submitted and to be confirmed | ||
+ | | | ||
+ | |- | ||
+ | | ENDORSEMENT_TX_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 | ||
+ | | ~5 Seconds | ||
+ | | Block of Proof received, Endorsement Transaction to be proved | ||
+ | | | ||
+ | |- | ||
+ | | PROVEN | ||
+ | | ~5 Second | ||
+ | | Endorsement Transaction proven, building Context | ||
+ | | | ||
+ | |- | ||
+ | | SUBMITTED_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 | ||
+ | |- | ||
+ | | PAYOUT_DETECTED | ||
+ | | N/A | ||
+ | | Completed | ||
+ | | ALT reward payout has been detected in ALT coinbase transaction | ||
+ | |} | ||
== Shell == | == Shell == | ||
Line 183: | Line 384: | ||
! Description | ! Description | ||
|- | |- | ||
− | |help | + | |help <command (optional)> |
|Lists all the commands | |Lists all the commands | ||
|- | |- | ||
Line 191: | Line 392: | ||
|quit or exit | |quit or exit | ||
|Stops the application | |Stops the application | ||
+ | |- | ||
+ | |getdebuginfo | ||
+ | |Collect information about the application for troubleshooting | ||
|- | |- | ||
|listconfig | |listconfig | ||
Line 197: | Line 401: | ||
|setconfig <key> <value> | |setconfig <key> <value> | ||
|Sets a config value | |Sets a config value | ||
+ | |- | ||
+ | |getautomine <chain> | ||
+ | |Gets the current automine config | ||
+ | |- | ||
+ | |setautomine <chain> <round> <value> | ||
+ | |Sets the current automine config | ||
+ | |- | ||
+ | |getmaxfee | ||
+ | |Gets the current VBK max fee config | ||
+ | |- | ||
+ | |setmaxfee <value> | ||
+ | |Sets the current VBK max fee config | ||
+ | |- | ||
+ | |getfeeperbyte | ||
+ | |Gets the current VBK fee/Byte config | ||
+ | |- | ||
+ | |setfeeperbyte <value> | ||
+ | |Sets the current VBK fee/Byte config | ||
|- | |- | ||
|mine <chain> <block (optional)> | |mine <chain> <block (optional)> | ||
|Begins a proof of proof mining operation for the given chain | |Begins a proof of proof mining operation for the given chain | ||
|- | |- | ||
− | |listoperations | + | |listoperations <state> <limit> <offset> |
|Lists the currently running mining operations | |Lists the currently running mining operations | ||
|- | |- | ||
Line 207: | Line 429: | ||
|Supplies the details of the operation matching the given id | |Supplies the details of the operation matching the given id | ||
|- | |- | ||
− | | | + | |getoperationlogs <id> <level (optional)> |
− | | | + | |Gets the logs of the supplied operation |
+ | |- | ||
+ | |canceloperation <id> | ||
+ | |Cancels the operations | ||
+ | |- | ||
+ | |getaddress | ||
+ | |Gets the currently loaded VeriBlock address | ||
|- | |- | ||
|getbalance | |getbalance | ||
− | |Gets the coin balance for the VeriBlock address | + | |Gets the coin balance for the current VeriBlock address |
+ | |- | ||
+ | |withdrawvbktoaddress <address> <amount> | ||
+ | |Sends a VBK amount to a given address | ||
+ | |- | ||
+ | |dumpprivatekey <address> | ||
+ | |Gets private key for an address | ||
+ | |- | ||
+ | |importprivatekey <key> | ||
+ | |Imports the provided private key into APM | ||
+ | |- | ||
+ | |setdefaultaddress <address> | ||
+ | |Sets the default APM address | ||
+ | |- | ||
+ | |importwallet <locationPath> | ||
+ | |Imports a wallet file | ||
+ | |- | ||
+ | |backupwallet <targetPath> | ||
+ | |Creates a backup from the loaded wallet | ||
+ | |- | ||
+ | |submitcontext <chain> <blockHash (optional)> | ||
+ | |Submits a context block to the given altchain | ||
+ | |- | ||
+ | |submitvtbs <chain> | ||
+ | |Submits VTBs to the given altchain <chain> | ||
+ | |- | ||
+ | |handlecontextgap <chain> | ||
+ | |Checks if there's any context gap in the given altchain and submits VTBs to it if so | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | == API == | ||
+ | The APM miner API is accessible at http://localhost:8081/api (by default), those are the API endpoints that are accessible: | ||
+ | |||
+ | See sample: https://github.com/VeriBlock/samples/tree/master/apm | ||
+ | |||
+ | {|class="wikitable" | ||
+ | ! Method | ||
+ | ! Endpoint | ||
+ | ! Description | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/miner | ||
+ | |Get miner data | ||
+ | |- | ||
+ | |POST | ||
+ | |/api/miner/mine | ||
+ | |Start mining operation | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/miner/operations | ||
+ | |Get operations list | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/miner/operations/{id} | ||
+ | |Get operation details | ||
+ | |- | ||
+ | |POST | ||
+ | |/api/miner/operations/{id}/cancel | ||
+ | |Cancel an operation | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/miner/operations/{id}/logs | ||
+ | |Get the operation logs | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/miner/operations/{id}/workflow | ||
+ | |Get operation workflow | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/miner/configured-altchains | ||
+ | |Get configured altchains | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/debug | ||
+ | |Get debug information | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/config | ||
+ | |Get all configuration values | ||
+ | |- | ||
+ | |PUT | ||
+ | |/api/config | ||
+ | |Sets a new value for a config property (needs restart) | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/config/automine/{chain} | ||
+ | |Get the automine config | ||
+ | |- | ||
+ | |PUT | ||
+ | |/api/config/automine/{chain} | ||
+ | |Set the automine config | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/config/vbk-fee | ||
+ | |Gets the current VBK fee config | ||
+ | |- | ||
+ | |PUT | ||
+ | |/api/config/vbk-fee | ||
+ | |Sets the current VBK fee config | ||
+ | |- | ||
+ | |POST | ||
+ | |/api/quit | ||
+ | |Exists the application | ||
+ | |- | ||
+ | |POST | ||
+ | |/api/wallet/withdraw | ||
+ | |Withdraw VBKs to Address | ||
+ | |- | ||
+ | |GET | ||
+ | |/api/network | ||
+ | |Returns the Blockchain Network this APM is configured with | ||
+ | |- | ||
|} | |} | ||
+ | |||
+ | == User Interface == | ||
+ | |||
+ | APM comes with a web user interface accessible by default under http://localhost:8081/index.html. It is a Single-Page Application that uses a set of the API endpoints to communicate with the APM instance. | ||
+ | |||
+ | [[File:apm_gui_2.png|800px]] | ||
+ | |||
+ | == FAQ == | ||
+ | |||
+ | === How to pop multiple altchains from one APM === | ||
+ | |||
+ | * Ensure that all your alt daemons are properly configured, this means that each alt daemon should run at different ports (you can't bind two daemons at the same port). | ||
+ | * At the APM side, you should make the host configuration (inside the securityInheriting block) match with your alt daemon configuration. |
Latest revision as of 16:36, 25 August 2021
Altchain PoP Miner install and run instructions
Contents
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
- Download the latest NodeCore software suite from the VeriBlock Github repository and extract the contents of the package.
- Follow the instructions at NodeCore QuickStart to start a local instance of NodeCore.
For Altchain PoP mining to be successful, the local NodeCore instance must be fully synced with the VeriBlock network.
Configuration
The application.conf file is composed by different configuration blocks:
miner | ||||
---|---|---|---|---|
Configuration Name | Default Value | Environment Variable | Description | Example |
network | testnet | MINER_NETWORK | The network type, there are three options: mainnet, testnet and alphanet |
miner { network: testnet feePerByte: 1000 maxFee: 10000000 # Uncomment if you have a local full node #connectDirectlyTo: ["localhost"] # Uncomment if you want the miner API to be bound to the internet api.host: 127.0.0.1 api.port: 8081 # Uncomment if you want basic auth at the miner API #api.auth.username: my-username #api.auth.password: my-password } |
feePerByte | 1000 | MINER_FEE_PER_BYTE | The atomic units to pay per transaction byte | |
maxFee | 10000000 | MINER_MAX_FEE | Maximum veriblock atomic units to pay as transaction fee | |
connectDirectlyTo | The NodeCore IP if you have a full node | |||
api.host | 127.0.0.1 | MINER_API_HOST | The miner API host | |
api.port | 8081 | MINER_API_PORT | The miner API port | |
api.auth.username | MINER_API_USERNAME | The miner API auth username | ||
api.auth.password | MINER_API_PASSWORD | The miner API auth password |
You can add chains to the securityInheriting block, for example:
securityInheriting | ||||
---|---|---|---|---|
Parent Configuration | Configuration Name | Example Value | Description | Example |
vbtc | pluginKey | btc | The plugin to load |
securityInheriting { vdoge: { // This can be set to [1,2,3,4] autoMineRounds: [4] payoutAddress: "INSERT PAYOUT ADDRESS" pluginKey: btc id: 100111103101 name: "vDogecoin" host: "http://localhost:44555" // Uncomment if your daemon is auth protected auth: { username: "vdoge" password: "BETATeSt!" } payoutInterval: 50 extraConfig: { daemonConnectionTimeout: 60000 } } vbsv: { // This can be set to [1,2,3,4] autoMineRounds: [4] payoutAddress: "INSERT PAYOUT ADDRESS" pluginKey: btc id: 98115118 name: "vBitcoin-SV" host: "http://localhost:9332" // Uncomment if your vBTC daemon is auth protected auth: { username: "vbsv" password: "BETATeSt!" } payoutInterval: 50 extraConfig: { daemonConnectionTimeout: 20000 } } } |
vbtc | id | 3860170 | The chain id | |
vbtc | name | vBitcoin | The chain name | |
vbtc | host | http://localhost:10600/api | API url from the coin daemon | |
vbtc | payoutAddress | payoutAddress | Specify a payout address, if is not specified the first address from the publication data will be used as the payout address | |
vbtc | keystonePeriod | 10 | Specify the keystone period | |
vbtc | autoMineRounds | [1,2,3,4] | Whether this chain is configured to automine the block at the given block height, it can be disabled by commenting the autoMineRounds config. | |
vbtc.auth | username | rpcUsername | The username used on the daemon authentication (if any), it can be disabled by commenting the whole auth config block. | |
vbtc.auth | password | rpcPassword | The password used on the daemon authentication (if any), it can be disabled by commenting the whole auth config block. | |
vbtc.extraConfig | requestLogsPath | ./logs | The verbose request logging path |
Example of a full configuration file:
miner { network: testnet feePerByte: 1000 maxFee: 10000000 # Uncomment if you have a local full node #connectDirectlyTo: ["localhost"] # Uncomment if you want the miner API to be bound to the internet api.host: 127.0.0.1 api.port: 8081 # Uncomment if you want basic auth at the miner API #api.auth.username: my-username #api.auth.password: my-password } securityInheriting { vdoge: { // This can be set to [1,2,3,4] autoMineRounds: [4] payoutAddress: "INSERT PAYOUT ADDRESS" pluginKey: btc id: 100111103101 name: "vDogecoin" host: "http://localhost:44555" // Uncomment if your daemon is auth protected auth: { username: "vdoge" password: "BETATeSt!" } payoutInterval: 50 extraConfig: { daemonConnectionTimeout: 60000 } } vbsv: { // This can be set to [1,2,3,4] autoMineRounds: [4] payoutAddress: "INSERT PAYOUT ADDRESS" pluginKey: btc id: 98115118 name: "vBitcoin-SV" host: "http://localhost:9332" // Uncomment if your vBTC daemon is auth protected auth: { username: "vbsv" password: "BETATeSt!" } payoutInterval: 50 extraConfig: { daemonConnectionTimeout: 20000 } } }
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 |
MINER_NETWORK | testnet | The network type, there are three options: mainnet, testnet and alphanet |
MINER_API_HOST | 127.0.0.1 | The miner API host |
MINER_API_PORT | 8081 | The miner API port |
MINER_API_USERNAME | The miner API auth username | |
MINER_API_PASSWORD | The miner API auth password | |
CONFIG_FILE | /data/application.conf | The APM config file |
APM_LOG_PATH | /data/logs | The folder for the APM logs |
APM_LOG_LEVEL | The APM logger level | |
APM_CONSOLE_LOG_LEVEL | The APM console logger level | |
APM_ENABLE_JSON_LOG | false | Enable the APM JSON 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 | |
INSTRUCTION | ~10 Seconds | Mining Instruction retrieved, Endorsement Transaction to be submitted | |
ENDORSEMENT_TRANSACTION | ~10 Seconds | Endorsement Transaction submitted and to be confirmed | |
ENDORSEMENT_TX_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 | ~5 Seconds | Block of Proof received, Endorsement Transaction to be proved | |
PROVEN | ~5 Second | Endorsement Transaction proven, building Context | |
SUBMITTED_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 |
PAYOUT_DETECTED | N/A | Completed | ALT reward payout has been detected in ALT coinbase transaction |
Shell
The Altchain PoP miner provides several commands:
Command | Description |
---|---|
help <command (optional)> | Lists all the commands |
clear | Clears the screen |
quit or exit | Stops the application |
getdebuginfo | Collect information about the application for troubleshooting |
listconfig | Lists the current config values |
setconfig <key> <value> | Sets a config value |
getautomine <chain> | Gets the current automine config |
setautomine <chain> <round> <value> | Sets the current automine config |
getmaxfee | Gets the current VBK max fee config |
setmaxfee <value> | Sets the current VBK max fee config |
getfeeperbyte | Gets the current VBK fee/Byte config |
setfeeperbyte <value> | Sets the current VBK fee/Byte config |
mine <chain> <block (optional)> | Begins a proof of proof mining operation for the given chain |
listoperations <state> <limit> <offset> | Lists the currently running mining operations |
getoperation <id> | Supplies the details of the operation matching the given id |
getoperationlogs <id> <level (optional)> | Gets the logs of the supplied operation |
canceloperation <id> | Cancels the operations |
getaddress | Gets the currently loaded VeriBlock address |
getbalance | Gets the coin balance for the current VeriBlock address |
withdrawvbktoaddress <address> <amount> | Sends a VBK amount to a given address |
dumpprivatekey <address> | Gets private key for an address |
importprivatekey <key> | Imports the provided private key into APM |
setdefaultaddress <address> | Sets the default APM address |
importwallet <locationPath> | Imports a wallet file |
backupwallet <targetPath> | Creates a backup from the loaded wallet |
submitcontext <chain> <blockHash (optional)> | Submits a context block to the given altchain |
submitvtbs <chain> | Submits VTBs to the given altchain <chain> |
handlecontextgap <chain> | Checks if there's any context gap in the given altchain and submits VTBs to it if so |
API
The APM miner API is accessible at http://localhost:8081/api (by default), those are the API endpoints that are accessible:
See sample: https://github.com/VeriBlock/samples/tree/master/apm
Method | Endpoint | Description |
---|---|---|
GET | /api/miner | Get miner data |
POST | /api/miner/mine | Start mining operation |
GET | /api/miner/operations | Get operations list |
GET | /api/miner/operations/{id} | Get operation details |
POST | /api/miner/operations/{id}/cancel | Cancel an operation |
GET | /api/miner/operations/{id}/logs | Get the operation logs |
GET | /api/miner/operations/{id}/workflow | Get operation workflow |
GET | /api/miner/configured-altchains | Get configured altchains |
GET | /api/debug | Get debug information |
GET | /api/config | Get all configuration values |
PUT | /api/config | Sets a new value for a config property (needs restart) |
GET | /api/config/automine/{chain} | Get the automine config |
PUT | /api/config/automine/{chain} | Set the automine config |
GET | /api/config/vbk-fee | Gets the current VBK fee config |
PUT | /api/config/vbk-fee | Sets the current VBK fee config |
POST | /api/quit | Exists the application |
POST | /api/wallet/withdraw | Withdraw VBKs to Address |
GET | /api/network | Returns the Blockchain Network this APM is configured with |
User Interface
APM comes with a web user interface accessible by default under http://localhost:8081/index.html. It is a Single-Page Application that uses a set of the API endpoints to communicate with the APM instance.
FAQ
How to pop multiple altchains from one APM
- Ensure that all your alt daemons are properly configured, this means that each alt daemon should run at different ports (you can't bind two daemons at the same port).
- At the APM side, you should make the host configuration (inside the securityInheriting block) match with your alt daemon configuration.