{"id":369,"date":"2020-09-29T22:07:12","date_gmt":"2020-09-29T22:07:12","guid":{"rendered":"http:\/\/bitcoinsv-io.bitproton.com\/?post_type=miner_document&p=369"},"modified":"2020-09-29T19:30:56","modified_gmt":"2020-09-29T19:30:56","slug":"miner-id","status":"publish","type":"miner_document","link":"https:\/\/bitcoinsv.io\/documentation\/miners\/installation\/miner-id\/","title":{"rendered":"Miner ID"},"content":{"rendered":"\n
The following instructions describe installing Miner ID using tools available in most mainstream Linux distributions. We assume you use a Bourne-like shell such as The BRFC (Bitcoin Request For Comment) specification can be found here<\/a>.<\/p>\n\n\n\n The open source code of the implementation can be found here<\/a>.<\/p>\n\n\n\n For support and general discussion of both standards and reference implementations please join the following telegram group<\/a>.<\/p>\n\n\n\n For development, you will only need Node.js (minimum 10.12.0) and a node global package, NPM, installed in your environment.<\/p>\n\n\n\n Just go on official Node.js website<\/a> and download the installer. Also, be sure to have You can install nodejs and npm easily with apt install, just run the following commands.<\/p>\n\n\n\n You can find more information about the installation on the official Node.js website<\/a> and the official NPM website<\/a>.<\/p>\n\n\n\n Create a config.json<\/a> and edit it with your settings:<\/p>\n\n\n\n To run API server:<\/p>\n\n\n\n To run CLI:<\/p>\n\n\n\n You can build the image yourself with your own modifications or own configurations.<\/p>\n\n\n\n You can also pull it from the public Docker Hub repository for Miner ID\u00a0here<\/a>.<\/p>\n\n\n\n Example Since Miner ID is essentially a service built around a private key (Miner ID) we are running the container with volumes in order to avoid the situation where the container falls over for some reason and the private key is lost. In the environment variables, we are specifying which network ( Once the docker container is running, you will need to setup and configure your Miner ID by generating a Miner ID private key as well as setting up your\u00a0Validity Check Transaction output (VCTx)<\/a>. You can do that using\u00a0 Then run the cli commands to setup and configure the above:<\/p>\n\n\n\n If you are running on Once your Miner ID service is setup and running, you will need to call its exposed API from your pool software to include Miner ID in your coinbase transactions. You will also need to call it from mAPI if you want to sign your mAPI responses. The Miner ID API is defined\u00a0here<\/a>\u00a0as well as below:<\/p>\n\n\n\n The REST API<\/strong> has 4 endpoints:<\/p>\n\n\n\n 1. returns<\/strong> Miner ID output (locking) script hex string for an bash<\/code>.<\/p>\n\n\n\n
Support<\/h2>\n\n\n\n
Build from source<\/h2>\n\n\n\n
Requirements<\/h3>\n\n\n\n
Node<\/h4>\n\n\n\n
git<\/code> available in your PATH,
npm<\/code> might need it (You can find git here<\/a>).<\/p>\n\n\n\n
```console\n$ sudo apt install nodejs\n$ sudo apt install npm\n```\n<\/pre>\n\n\n\n
Install<\/h3>\n\n\n\n
$ git clone https:\/\/github.com\/bitcoin-sv\/minerid-reference.git\n$ cd minerid-reference\n$ npm install\n<\/pre>\n\n\n\n
Configuration<\/h3>\n\n\n\n
port<\/code><\/li>
minerIdDataPath<\/code> which stores user’s miner IDs<\/li>
keystore<\/code> which stores miner ID private keys<\/li>
network<\/code> (mainnet=”livenet” | testnet=”testnet” | regtest=”regtest”)<\/li>
rpcHost<\/code><\/li>
rpcPort<\/code><\/li>
rpcUser<\/code><\/li>
rpcPassword<\/code><\/li><\/ul>\n\n\n\n
Running the project<\/h3>\n\n\n\n
$ npm start\n<\/pre>\n\n\n\n
$ npm run cli\n<\/pre>\n\n\n\n
Testing<\/h3>\n\n\n\n
$ npm test\n<\/pre>\n\n\n\n
Docker<\/h2>\n\n\n\n
Build Image<\/h3>\n\n\n\n
$ docker build . -t minerid_reference:1.1.1\n<\/pre>\n\n\n\n
Pull Image<\/h3>\n\n\n\n
$ docker pull bitcoinsv\/minerid:1.1.1\n<\/pre>\n\n\n\n
Run with Docker Compose<\/h3>\n\n\n\n
docker-compose<\/code> file:<\/p>\n\n\n\n
version: \"3.8\"\nservices:\n minerid:\n image: bitcoinsv\/minerid:1.1.1\n ports:\n - 9002:9002\n restart: always\n environment:\n NODE_CONFIG: '{\n \"bitcoin\": {\n \"rpcHost\":\"host.docker.internal\"\n },\n \"network\": \"regtest\"\n }'\n volumes:\n - minerid:\/root\/.keystore\n - minerid:\/root\/.minerid-client\nvolumes:\n minerid:\n external: false\n<\/pre>\n\n\n\n
livenet<\/code> (or mainnet),
testnet<\/code>, or
regtest<\/code>) and what Bitcoin node RPC parameters and credentials to use by passing them to
NODE_CONFIG<\/code>.<\/p>\n\n\n\n
Initial Setup<\/h3>\n\n\n\n
docker exec<\/code>:<\/p>\n\n\n\n
$ docker exec -it <CONTAINER> bash\n\nroot@2623e1f4ed4e:\/app#\n<\/pre>\n\n\n\n
root@2623e1f4ed4e:\/<\/strong>app# npm run cli --<\/strong> generateminerid --<\/strong>name testMiner\n<\/pre>\n\n\n\n
root@2623e1f4ed4e:\/<\/strong>app# npm run cli --<\/strong> generatevctx --<\/strong>name testMiner\n<\/pre>\n\n\n\n
livenet<\/code> (mainnet), follow the instructions to fund your VCTx.<\/p>\n\n\n\n
Using Miner ID API<\/h2>\n\n\n\n
Implementation<\/h3>\n\n\n\n
GET \/opreturn\/:alias\/:blockHeight([0-9]+)<\/code><\/p>\n\n\n\n
alias<\/code>: Miner ID alias
blockHeight<\/code>: block height which Miner ID document is created for\/at<\/p>\n\n\n\n
alias<\/code> Miner ID at height
blockHeight<\/code><\/p>\n\n\n\n
Example<\/h5>\n\n\n\n