[{"data":1,"prerenderedAt":615},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fcore-tech\u002Fbeam-mining-protocol-api-(stratum)":3,"docs-surround-\u002Fdocs\u002Fcore-tech\u002Fbeam-mining-protocol-api-(stratum)":604},{"id":4,"title":5,"body":6,"description":595,"extension":596,"image":597,"meta":598,"navTitle":597,"navigation":599,"path":600,"seo":601,"stem":602,"__hash__":603},"docs\u002Fdocs\u002Fcore-tech\u002FBeam-mining-protocol-API-(Stratum).md","Beam mining protocol API (draft)",{"type":7,"value":8,"toc":584},"minimark",[9,13,30,34,37,48,51,54,60,66,71,76,79,85,168,172,175,181,191,262,266,270,273,279,293,298,365,369,372,376,418,422,431,434,500,503,566,569,577,580],[10,11,5],"h1",{"id":12},"beam-mining-protocol-api-draft",[14,15,16,17,21,22,25,26,29],"p",{},"The protocol is based on JSON RPC and uses ",[18,19,20],"em",{},"Long Polling"," to have a conversation between ",[18,23,24],{},"Miner"," and ",[18,27,28],{},"Node",". It describes only mining behavior without payouts at the moment.",[10,31,33],{"id":32},"regulating-miner-jobs-generation","Regulating miner jobs generation",[14,35,36],{},"The Node would generate a new miner job when a block is received (i.e. blockchain state changes), and in addition each time a new transaction appears in the transaction pool (in fluff phase). Generating miner jobs too often has negative impact on the miner (mostly due to increased traffic). To mitigate this impact, we have the following Node configuration parameter:",[38,39,40],"ul",{},[41,42,43,47],"li",{},[44,45,46],"code",{},"miner_job_latency"," - the minimum latency (in milliseconds) for miner job regeneration. Default is 1000 (1 second).",[14,49,50],{},"This parameter regulates max frequency for miner job regeneration due to incoming transactions. The bigger the latency is - the less often would the Node generate miner jobs. It has no effect on a situation when a block is received, in this case the new job is created immediately.",[14,52,53],{},"In the past we observed a situation where mining pools diluted the miner jobs artificially, by just ignoring some of the jobs generated by the Node. It was probably done to save network traffic, considering the fees collected from the new transactions are negligible.",[14,55,56,57,59],{},"We encourage miners to stop doing this. To regulate the miner jobs generation frequency it's better to use the ",[44,58,46],{}," parameter. This way more packed blocks are mined, giving miners an edge in fees, and less confirmation time for the users.\nIn addition this is essential for the new High-Frequency transaction infrastructure, which gives significant fees for the miners, as well as ultimate user experience.",[14,61,62,63,65],{},"Note also that switching miner jobs often has no effect on hashpower (i.e. it's not wasted). The switch is performed when it has no cost on the mining.\nSo, the only reason to reduce the miner job frequency is the traffic consideration, and the best way to tune it is via ",[44,64,46],{}," parameter. Either way, the job generated by the Node should not be discarded.",[67,68,70],"h2",{"id":69},"miner-to-node","Miner to Node",[72,73,75],"h3",{"id":74},"login","Login",[14,77,78],{},"Miner subscribes to the node to receive jobs.",[14,80,81,84],{},[44,82,83],{},"api_key"," - miner registration key.",[86,87,92],"pre",{"className":88,"code":89,"language":90,"meta":91,"style":91},"language-json shiki shiki-themes github-dark","{\n    \"method\" : \"login\", \n    \"api_key\": \"skjdb7343636gucgjdjgd\",\n    \"id\":\"login\",\n    \"jsonrpc\":\"2.0\" \n}\n","json","",[44,93,94,103,120,135,148,162],{"__ignoreMap":91},[95,96,99],"span",{"class":97,"line":98},"line",1,[95,100,102],{"class":101},"s95oV","{\n",[95,104,106,110,113,117],{"class":97,"line":105},2,[95,107,109],{"class":108},"sDLfK","    \"method\"",[95,111,112],{"class":101}," : ",[95,114,116],{"class":115},"sU2Wk","\"login\"",[95,118,119],{"class":101},", \n",[95,121,123,126,129,132],{"class":97,"line":122},3,[95,124,125],{"class":108},"    \"api_key\"",[95,127,128],{"class":101},": ",[95,130,131],{"class":115},"\"skjdb7343636gucgjdjgd\"",[95,133,134],{"class":101},",\n",[95,136,138,141,144,146],{"class":97,"line":137},4,[95,139,140],{"class":108},"    \"id\"",[95,142,143],{"class":101},":",[95,145,116],{"class":115},[95,147,134],{"class":101},[95,149,151,154,156,159],{"class":97,"line":150},5,[95,152,153],{"class":108},"    \"jsonrpc\"",[95,155,143],{"class":101},[95,157,158],{"class":115},"\"2.0\"",[95,160,161],{"class":101}," \n",[95,163,165],{"class":97,"line":164},6,[95,166,167],{"class":101},"}\n",[72,169,171],{"id":170},"solution","Solution",[14,173,174],{},"Miner sends a solution to the node.",[14,176,177,180],{},[44,178,179],{},"nonce"," - matched nonce for given solution.",[14,182,183,186,187,190],{},[44,184,185],{},"output"," - ",[18,188,189],{},"Equhash"," solition for current difficulty.",[86,192,194],{"className":88,"code":193,"language":90,"meta":91,"style":91},"{\n\"id\":\"212\",\n\"jsonrpc\":\"2.0\",\n\"method\":\"solution\",\n\"nonce\":\"0bb11009afc29dbe\",\n\"output\":\"a32a1e04ca447f895cfdd8fd1f96fe2ebdd8cd8f77e9c3010ca7231d5da5d0b0cee7ee857981389070eec196bfb4bd15439ef27dd370c4c763bdbad66d066f7cb2f06318e1a0c68c9f5aa8fe8112c479d9a227759d0f864136f265e9ffd3b276b9ba2243\"\n}\n",[44,195,196,200,212,223,235,247,257],{"__ignoreMap":91},[95,197,198],{"class":97,"line":98},[95,199,102],{"class":101},[95,201,202,205,207,210],{"class":97,"line":105},[95,203,204],{"class":108},"\"id\"",[95,206,143],{"class":101},[95,208,209],{"class":115},"\"212\"",[95,211,134],{"class":101},[95,213,214,217,219,221],{"class":97,"line":122},[95,215,216],{"class":108},"\"jsonrpc\"",[95,218,143],{"class":101},[95,220,158],{"class":115},[95,222,134],{"class":101},[95,224,225,228,230,233],{"class":97,"line":137},[95,226,227],{"class":108},"\"method\"",[95,229,143],{"class":101},[95,231,232],{"class":115},"\"solution\"",[95,234,134],{"class":101},[95,236,237,240,242,245],{"class":97,"line":150},[95,238,239],{"class":108},"\"nonce\"",[95,241,143],{"class":101},[95,243,244],{"class":115},"\"0bb11009afc29dbe\"",[95,246,134],{"class":101},[95,248,249,252,254],{"class":97,"line":164},[95,250,251],{"class":108},"\"output\"",[95,253,143],{"class":101},[95,255,256],{"class":115},"\"a32a1e04ca447f895cfdd8fd1f96fe2ebdd8cd8f77e9c3010ca7231d5da5d0b0cee7ee857981389070eec196bfb4bd15439ef27dd370c4c763bdbad66d066f7cb2f06318e1a0c68c9f5aa8fe8112c479d9a227759d0f864136f265e9ffd3b276b9ba2243\"\n",[95,258,260],{"class":97,"line":259},7,[95,261,167],{"class":101},[67,263,265],{"id":264},"node-to-miner","Node to Miner",[72,267,269],{"id":268},"job","Job",[14,271,272],{},"Miner will send new job automatically to connected miners.",[14,274,275,278],{},[44,276,277],{},"id"," - is a job index",[14,280,281,284,285,288,289,292],{},[44,282,283],{},"input"," - block header data hash (with current ",[18,286,287],{},"difficulty",") as an input parameter for ",[18,290,291],{},"Equihash",".",[14,294,295,297],{},[44,296,287],{}," - current chain difficulty.",[86,299,301],{"className":88,"code":300,"language":90,"meta":91,"style":91},"{ \n\"difficulty\":3441671469,\n\"id\":\"212\",\n\"input\":\"636b90cc38bc7a347f074d9ca97c3a2158330f6844f8f52075a38a15ab483223\",\n\"jsonrpc\":\"2.0\",\n\"method\":\"job\"\n}\n",[44,302,303,308,320,330,342,352,361],{"__ignoreMap":91},[95,304,305],{"class":97,"line":98},[95,306,307],{"class":101},"{ \n",[95,309,310,313,315,318],{"class":97,"line":105},[95,311,312],{"class":108},"\"difficulty\"",[95,314,143],{"class":101},[95,316,317],{"class":108},"3441671469",[95,319,134],{"class":101},[95,321,322,324,326,328],{"class":97,"line":122},[95,323,204],{"class":108},[95,325,143],{"class":101},[95,327,209],{"class":115},[95,329,134],{"class":101},[95,331,332,335,337,340],{"class":97,"line":137},[95,333,334],{"class":108},"\"input\"",[95,336,143],{"class":101},[95,338,339],{"class":115},"\"636b90cc38bc7a347f074d9ca97c3a2158330f6844f8f52075a38a15ab483223\"",[95,341,134],{"class":101},[95,343,344,346,348,350],{"class":97,"line":150},[95,345,216],{"class":108},[95,347,143],{"class":101},[95,349,158],{"class":115},[95,351,134],{"class":101},[95,353,354,356,358],{"class":97,"line":164},[95,355,227],{"class":108},[95,357,143],{"class":101},[95,359,360],{"class":115},"\"job\"\n",[95,362,363],{"class":97,"line":259},[95,364,167],{"class":101},[72,366,368],{"id":367},"cancel","Cancel",[14,370,371],{},"Miner will send a notification to cancel job with a given id",[14,373,374,278],{},[44,375,277],{},[86,377,379],{"className":88,"code":378,"language":90,"meta":91,"style":91},"{ \n\"id\":\"212\",\n\"jsonrpc\":\"2.0\",\n\"method\":\"cancel\"\n}\n",[44,380,381,385,395,405,414],{"__ignoreMap":91},[95,382,383],{"class":97,"line":98},[95,384,307],{"class":101},[95,386,387,389,391,393],{"class":97,"line":105},[95,388,204],{"class":108},[95,390,143],{"class":101},[95,392,209],{"class":115},[95,394,134],{"class":101},[95,396,397,399,401,403],{"class":97,"line":122},[95,398,216],{"class":108},[95,400,143],{"class":101},[95,402,158],{"class":115},[95,404,134],{"class":101},[95,406,407,409,411],{"class":97,"line":137},[95,408,227],{"class":108},[95,410,143],{"class":101},[95,412,413],{"class":115},"\"cancel\"\n",[95,415,416],{"class":97,"line":150},[95,417,167],{"class":101},[72,419,421],{"id":420},"result","Result",[14,423,424,425,427,428,430],{},"This is what server will return to ",[44,426,74],{}," or ",[44,429,170],{}," requests, identified by id string of message has been sent from the miner to the node.",[14,432,433],{},"Example 1 (login failed):",[86,435,437],{"className":88,"code":436,"language":90,"meta":91,"style":91},"{\n    \"code\":-32003,\n    \"description\":\"Login failed\",\n    \"id\":\"login\",\n    \"jsonrpc\":\"2.0\",\n    \"method\":\"result\"\n}\n",[44,438,439,443,455,467,477,487,496],{"__ignoreMap":91},[95,440,441],{"class":97,"line":98},[95,442,102],{"class":101},[95,444,445,448,450,453],{"class":97,"line":105},[95,446,447],{"class":108},"    \"code\"",[95,449,143],{"class":101},[95,451,452],{"class":108},"-32003",[95,454,134],{"class":101},[95,456,457,460,462,465],{"class":97,"line":122},[95,458,459],{"class":108},"    \"description\"",[95,461,143],{"class":101},[95,463,464],{"class":115},"\"Login failed\"",[95,466,134],{"class":101},[95,468,469,471,473,475],{"class":97,"line":137},[95,470,140],{"class":108},[95,472,143],{"class":101},[95,474,116],{"class":115},[95,476,134],{"class":101},[95,478,479,481,483,485],{"class":97,"line":150},[95,480,153],{"class":108},[95,482,143],{"class":101},[95,484,158],{"class":115},[95,486,134],{"class":101},[95,488,489,491,493],{"class":97,"line":164},[95,490,109],{"class":108},[95,492,143],{"class":101},[95,494,495],{"class":115},"\"result\"\n",[95,497,498],{"class":97,"line":259},[95,499,167],{"class":101},[14,501,502],{},"Example 2 (solution accepted):",[86,504,506],{"className":88,"code":505,"language":90,"meta":91,"style":91},"{\n    \"code\":1,\n    \"description\":\"accepted\",\n    \"id\":\"212\",\n    \"jsonrpc\":\"2.0\",\n    \"method\":\"result\"\n}\n",[44,507,508,512,523,534,544,554,562],{"__ignoreMap":91},[95,509,510],{"class":97,"line":98},[95,511,102],{"class":101},[95,513,514,516,518,521],{"class":97,"line":105},[95,515,447],{"class":108},[95,517,143],{"class":101},[95,519,520],{"class":108},"1",[95,522,134],{"class":101},[95,524,525,527,529,532],{"class":97,"line":122},[95,526,459],{"class":108},[95,528,143],{"class":101},[95,530,531],{"class":115},"\"accepted\"",[95,533,134],{"class":101},[95,535,536,538,540,542],{"class":97,"line":137},[95,537,140],{"class":108},[95,539,143],{"class":101},[95,541,209],{"class":115},[95,543,134],{"class":101},[95,545,546,548,550,552],{"class":97,"line":150},[95,547,153],{"class":108},[95,549,143],{"class":101},[95,551,158],{"class":115},[95,553,134],{"class":101},[95,555,556,558,560],{"class":97,"line":164},[95,557,109],{"class":108},[95,559,143],{"class":101},[95,561,495],{"class":115},[95,563,564],{"class":97,"line":259},[95,565,167],{"class":101},[14,567,568],{},"Example 3: (reply with nonce prefix)",[86,570,575],{"className":571,"code":573,"language":574},[572],"language-text","{\n    \"code\":0,\n    \"description\":\"Login successful\",\n    \"id\":\"login\",\n    \"jsonrpc\":\"2.0\",\n    \"nonceprefix\":\"ab4e3a\",\n    \"method\":\"result\"\n}\n","text",[44,576,573],{"__ignoreMap":91},[14,578,579],{},"Note: \"nonceprefix\" is an optional component.\nIf \"nonceprefix\" is given the first bytes of the used nonce must match the given pattern. Allowed is a prefix from 0 to 6 bytes. If \"nonceprefix\" is not given the miner may use the full nonce range.",[581,582,583],"style",{},"html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":91,"searchDepth":105,"depth":105,"links":585},[586,590],{"id":69,"depth":105,"text":70,"children":587},[588,589],{"id":74,"depth":122,"text":75},{"id":170,"depth":122,"text":171},{"id":264,"depth":105,"text":265,"children":591},[592,593,594],{"id":268,"depth":122,"text":269},{"id":367,"depth":122,"text":368},{"id":420,"depth":122,"text":421},"The protocol is based on JSON RPC and uses Long Polling to have a conversation between Miner and Node. It describes only mining behavior without payouts at the moment.","md",null,{},true,"\u002Fdocs\u002Fcore-tech\u002Fbeam-mining-protocol-api-(stratum)",{"title":5,"description":595},"docs\u002Fcore-tech\u002FBeam-mining-protocol-API-(Stratum)","aIXKjURfa3TXSZzJO-YFzjV0_Pz75qGMOEZ3ZGe1CF0",[605,610],{"title":606,"path":607,"stem":608,"description":609,"children":-1},"Beam Web Wallet Starter Kit working draft","\u002Fdocs\u002Fcore-tech\u002Fbeam-web-wallet-starter-kit","docs\u002Fcore-tech\u002FBeam-Web-Wallet-Starter-Kit","Web wallet starter allows you easily integrate Beam with your service, create a bunch of wallets and manage them... (TODO)",{"title":611,"path":612,"stem":613,"description":614,"children":-1},"Beam News Channels","\u002Fdocs\u002Fcore-tech\u002Fbeam-news-channels","docs\u002Fcore-tech\u002FBeam-news-channels","Beam able to provide actual news and exchange rates to wallet users.\nThis implemented using signed messages of different types transmitted over the Bulletin Board System (BBS).\nSuch messages make possible for instance to notify wallet user with popup on new wallet application version release.\nEach message is broadcasted over the network to wallet applications.\nBroadcasted messages has to be signed with apropriate key to verify publisher. Wallet applications have publisher key to check if messages are valid.",1783006062272]