{"id":4541,"date":"2020-09-29T22:07:12","date_gmt":"2020-09-29T22:07:12","guid":{"rendered":"https:\/\/stag.bitcoinsv.io\/?post_type=miner_document&p=4541"},"modified":"2020-10-05T14:53:55","modified_gmt":"2020-10-05T13:53:55","slug":"miner-id","status":"publish","type":"miner_document","link":"https:\/\/bitcoinsv.io\/zh\/documentation\/miners\/installation\/miner-id\/","title":{"rendered":"Miner ID"},"content":{"rendered":"\n
\u4ee5\u4e0b\u7684\u6307\u5f15\u662f\u4ecb\u7ecd\u5728\u4e3b\u6d41\u7684Linux\u7cfb\u7edf\u4e0b\u5b89\u88c5Miner ID\u53ef\u4f7f\u7528\u7684\u5de5\u5177\uff0c\u524d\u63d0\u5047\u8bbe\u662f\u4f60\u4f7f\u7528\u7740\u7c7b\u4f3cBourne shell\u7684shell\uff0c\u6bd4\u5982 \u5728\u6b64\u4e86\u89e3Miner ID\u7684BRFC<\/a>\uff08\u6bd4\u7279\u5e01\u6ce8\u91ca\u8bf7\u6c42\uff09\u3002<\/p>\n\n\n\n \u5728\u6b64\u4e86\u89e3Miner ID\u53c2\u8003\u5b9e\u73b0\u7684\u5f00\u6e90\u4ee3\u7801<\/a>\u3002<\/p>\n\n\n\n \u6280\u672f\u652f\u6301<\/strong><\/p>\n\n\n\n \u6b32\u83b7\u5f97\u6280\u672f\u652f\u6301\u3001\u53c2\u4e0e\u8ba8\u8bba\u6280\u672f\u6807\u51c6\u548c\u53c2\u8003\u5b9e\u73b0\u7684\uff0c\u8bf7\u52a0\u5165\u4ee5\u4e0btelegram\u7fa4\u7ec4<\/a>\u3002<\/p>\n\n\n\n \u4ece\u6e90\u4ee3\u7801\u5f00\u59cb\u6784\u5efa<\/strong><\/strong><\/p>\n\n\n\n \u8981\u6c42<\/strong><\/p>\n\n\n\n \u5bf9\u4e8e\u5f00\u53d1\uff0c\u4f60\u53ea\u9700\u8981\u5728\u672c\u5730\u4e2d\u5b89\u88c5Node.js\uff08\u6700\u4f4e10.12.0\u7248\u672c\uff09\u548c\u8282\u70b9\u5168\u5c40\u8f6f\u4ef6\u5305NPM\u3002<\/p>\n\n\n\n \u8282\u70b9<\/em><\/strong><\/p>\n\n\n\n \u524d\u5f80 Node.js\u5b98\u7f51<\/a>\u4e0b\u8f7d\u5b89\u88c5\u5305\u3002\u53e6\u5916\uff0c\u8bf7\u786e\u4fddgit\u5728\u4f60\u7684PATH\u4e2d\u53ef\u7528\uff0c \u4f60\u53ef\u4ee5\u4f7f\u7528apt install\u8f7b\u677e\u5b89\u88c5nodejs\u548cnpm\uff0c\u53ea\u9700\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n \u4f60\u53ef\u4ee5\u5728Node.js\u5b98\u7f51<\/a>\u548cNPM\u5b98\u7f51<\/a>\u627e\u5230\u66f4\u591a\u5173\u4e8e\u5b89\u88c5\u7684\u4fe1\u606f\u3002<\/p>\n\n\n\n \u5b89\u88c5<\/strong><\/p>\n\n\n\n \u914d\u7f6e<\/strong><\/p>\n\n\n\n \u6253\u5f00config.json<\/a> \u5e76\u6839\u636e\u4f60\u7684\u8bbe\u7f6e\u7f16\u8f91\u5b83\uff1a<\/p>\n\n\n\n \u8fd0\u884c\u9879\u76ee<\/p>\n\n\n\n \u8fd0\u884cAPI\u670d\u52a1\u5668\uff1a<\/p>\n\n\n\n \u8fd0\u884cCLI\uff1a<\/p>\n\n\n\n \u6d4b\u8bd5<\/p>\n\n\n\n \u4f60\u53ef\u4ee5\u4f7f\u7528\u81ea\u5df1\u7684\u66f4\u6539\u914d\u7f6e\u6765\u81ea\u884cbuild image\u3002<\/p>\n\n\n\n \u4f60\u8fd8\u53ef\u4ee5\u4eceMiner ID\u7684\u516c\u5171Docker Hub\u5e93<\/a>\u4e2d\u63d0\u53d6image\u3002<\/p>\n\n\n\n \u4f7f\u7528Docker Compose\u8fd0\u884c<\/p>\n\n\n\n \u7531\u4e8eMiner ID\u672c\u8d28\u4e0a\u662f\u56f4\u7ed5\u4e00\u4e2a\u79c1\u94a5\uff08Miner ID\uff09\u6784\u5efa\u7684\u670d\u52a1\uff0c\u56e0\u6b64\u6211\u4eec\u4f7f\u7528\u6570\u636e\u5377\u6765\u8fd0\u884c\u5bb9\u5668\uff0c\u4ee5\u907f\u514d\u5bb9\u5668\u7531\u4e8e\u67d0\u79cd\u539f\u56e0\u5931\u7075\u53ca\u79c1\u94a5\u4e22\u5931\u7684\u60c5\u51b5\u3002\u5728\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u5c06\u5176\u4f20\u9012\u7ed9 \u521d\u59cb\u8bbe\u7f6e<\/strong><\/p>\n\n\n\n \u4e00\u65e6docker\u5bb9\u5668\u5f00\u59cb\u8fd0\u884c\uff0c\u4f60\u5c31\u9700\u8981\u751f\u6210\u4e00\u4e2aMiner ID\u79c1\u94a5\uff0c\u5e76\u4e14\u8bbe\u7f6eValidity Check Transaction output (VCTx)<\/a>\uff0c\u6765\u8bbe\u7f6e\u548c\u914d\u7f6e\u4f60\u7684Miner ID\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 \u63a5\u4e0b\u6765\u8fd0\u884ccli\u547d\u4ee4\uff0c\u6765\u5bf9\u4e0a\u9762\u8fdb\u884c\u8bbe\u7f6e\u548c\u914d\u7f6e\uff1a<\/p>\n\n\n\n \u5982\u679c\u4f60\u6b63\u5728 \u4f7f\u7528<\/strong>Miner ID API<\/strong><\/p>\n\n\n\n \u4e00\u65e6\u4f60\u5df2\u7ecf\u8bbe\u7f6e\u597d\u5e76\u5f00\u59cb\u8fd0\u884cMiner ID\u670d\u52a1\uff0c\u4f60\u5c06\u9700\u8981\u4ece\u77ff\u6c60\u8f6f\u4ef6\u8c03\u7528Miner ID\u7684\u516c\u5f00API\uff0c\u4ece\u800c\u5c06Miner ID\u5305\u542b\u5728coinbase\u4ea4\u6613\u4e2d\u3002\u5982\u679c\u8981\u5bf9mAPI\u54cd\u5e94\u8fdb\u884c\u7b7e\u540d\uff0c\u4f60\u8fd8\u9700\u8981\u4ecemAPI\u8c03\u7528Miner ID\u3002Miner ID API\u7684\u5b9a\u4e49\u5982\u4e0b\uff0c\u4e5f\u53ef\u4ee5\u70b9\u51fb\u8fd9\u91cc<\/a>\u67e5\u770b:<\/p>\n\n\n\n \u5b9e\u65bd<\/strong><\/p>\n\n\n\n REST API\u6709\u56db\u4e2a\u7aef\u70b9\uff1a<\/strong><\/p>\n\n\n\n 1\u3001 block height which Miner ID document is created for\/at<\/p>\n\n\n\n \u8fd4\u56de<\/strong>\u9ad8\u5ea6\u4e3a \u793a\u4f8b<\/strong><\/p>\n\n\n\n 2\u3001 \u6b63\u6587\uff1a<\/p>\n\n\n\n \u8fd4\u56de<\/strong>\u5305\u542bMiner ID\u8f93\u51fa\u7684\u65b0\u7248coinbase2<\/p>\n\n\n\n \u8bf7\u6ce8\u610f\uff1acoinbase\u4ea4\u6613\u5728stratum\u534f\u8bae<\/a>\u4e2d\u88ab\u5206\u6210\u5982\u4e0b\uff1a<\/p>\n\n\n\nbash<\/code>\u3002<\/p>\n\n\n\n
npm<\/code>\u53ef\u80fd\u4f1a\u9700\u8981\u5b83\uff08\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc<\/a>\u627e\u5230git\uff09\u3002<\/p>\n\n\n\n
```console\n$ sudo apt install nodejs\n$ sudo apt install npm\n```<\/pre>\n\n\n\n
$ git clone https:\/\/github.com\/bitcoin-sv\/minerid-reference.git\n$ cd minerid-reference\n$ npm install<\/pre>\n\n\n\n
port<\/code><\/li>
minerIdDataPath<\/code> \uff0c\u5b83\u7528\u4e8e\u5b58\u50a8\u7528\u6237\u7684Miner ID<\/li>
keystore<\/code> \u5b83\u7528\u4e8e\u5b58\u50a8Miner ID\u79c1\u94a5<\/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
$ npm start<\/pre>\n\n\n\n
$ npm run cli<\/pre>\n\n\n\n
$ npm test<\/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<\/pre>\n\n\n\n
Pull Image<\/h3>\n\n\n\n
$ docker pull bitcoinsv\/minerid:1.1.1<\/pre>\n\n\n\n
docker-compose<\/code> \u6587\u4ef6\u793a\u4f8b\uff1a<\/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<\/pre>\n\n\n\n
NODE_CONFIG<\/code>\u6765\u6307\u5b9a\u8981\u4f7f\u7528\u54ea\u4e2a\u7f51\u7edc\uff08
livenet<\/code>\uff08\u6216mainnet\uff09\u3001
testnet<\/code>\u6216
regtest<\/code>\uff09\uff0c\u4ee5\u53ca\u8981\u4f7f\u7528\u54ea\u4e9b\u6bd4\u7279\u5e01\u8282\u70b9RPC\u53c2\u6570\u548c\u51ed\u8bc1\u3002<\/p>\n\n\n\n
docker exec<\/code>\uff1a<\/p>\n\n\n\n
$ docker exec -it <CONTAINER> bash\nroot@2623e1f4ed4e:\/app#<\/pre>\n\n\n\n
root@2623e1f4ed4e:\/<\/strong>app# npm run cli --<\/strong> generateminerid --<\/strong>name testMiner<\/pre>\n\n\n\n
root@2623e1f4ed4e:\/<\/strong>app# npm run cli --<\/strong> generatevctx --<\/strong>name testMiner<\/pre>\n\n\n\n
livenet<\/code>\uff08\u4e3b\u7f51\uff09\u4e0a\u8fd0\u884c\uff0c\u8bf7\u6309\u7167\u6307\u793a\u4e3a\u4f60\u7684VCT\u4f9b\u5e94\u8d44\u91d1\u3002<\/p>\n\n\n\n
GET \/opreturn\/:alias\/:blockHeight([0-9]+)<\/code><\/p>\n\n\n\n
Alias<\/code>\uff1aMiner ID\u7684\u522b\u540d
blockHeight<\/code>\uff1aMiner ID\u6587\u6863\u521b\u5efa\u65f6\u7684\u533a\u5757\u9ad8\u5ea6<\/p>\n\n\n\n
blockHeight<\/code>\u3001\u522b\u540d\u4e3a
alias<\/code>\u7684Miner ID\u8f93\u51fa\uff08\u9501\u5b9a\uff09\u811a\u672c\uff0c\u4e3a\u5341\u516d\u8fdb\u5236\u5b57\u7b26\u4e32<\/p>\n\n\n\n
POST \/coinbase2<\/code><\/p>\n\n\n\n
{ \n \"blockHeight\": number,\n \"alias\": string,\n \"coinbase2\": string,\n \"jobData\": {\n \"miningCandidate\": {},\n \"getInfo\": {},\n \"feeSpec\": {}\n }\n}<\/pre>\n\n\n\n
\u5b57\u6bb5<\/strong><\/strong><\/td> \u529f\u80fd<\/strong><\/strong><\/td><\/tr><\/thead> blockHeight<\/code><\/td>
coinbase\u4ea4\u6613\u6240\u5728\u7684\u533a\u5757\u9ad8\u5ea6<\/td><\/tr> alias<\/code><\/td>
Miner ID\u7684\u522b\u540d<\/td><\/tr> coinbase2<\/code><\/td>
coinbase ( coinb2<\/code>) \u7684\u7b2c\u4e8c\u90e8\u5206\uff0c\u8be6\u89c1stratum protocol<\/a><\/td><\/tr>
jobData<\/code><\/td>
\u6316\u77ff\u884c\u4e3a\u7684\u7279\u5b9a\u6570\u636e\u5c06\u901a\u8fc7\u6269\u5c55\u7684\u65b9\u5f0f\u6dfb\u52a0\u5230Miner ID coinbase\u6587\u6863\u4e2d<\/td><\/tr> miningCandidate<\/code><\/td>
BitCoin RPC getminingcandidate<\/code>\u54cd\u5e94<\/td><\/tr>
getInfo<\/code><\/td>
BitCoin RPC getinfo<\/code> \u54cd\u5e94<\/td><\/tr>
feeSpec<\/code><\/td>
mAPI\u9ed8\u8ba4 fees<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n