|
| 1 | +Stratum is a light-weight mining protocol. |
| 2 | + |
| 3 | +# CLI options for Stratum |
| 4 | + |
| 5 | + * `--no-stratum` |
| 6 | + > Do not run stratum. |
| 7 | + * `--stratum-port <PORT>` |
| 8 | + > Listen for stratum connections on PORT. [default: 8008] |
| 9 | +
|
| 10 | +# List of methods |
| 11 | + |
| 12 | + * [mining.subscribe](#mining.subscribe) |
| 13 | + * [mining.authorize](#mining.authorize) |
| 14 | + * [mining.notify](#mining.notify) |
| 15 | + * [mining.submit](#mining.submit) |
| 16 | + |
| 17 | +# Specification |
| 18 | + |
| 19 | +## mining.subscribe |
| 20 | + |
| 21 | +Used for subscribing mining jobs. |
| 22 | + |
| 23 | +Params: No parameters |
| 24 | + |
| 25 | +Return Type: No parameters |
| 26 | + |
| 27 | +Request Example |
| 28 | +``` |
| 29 | +{ |
| 30 | + "jsonrpc": "2.0", |
| 31 | + "id": 1, |
| 32 | + "method": "mining.subscribe", |
| 33 | + "params": [] |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +Response Example |
| 38 | +``` |
| 39 | +{ |
| 40 | + "jsonrpc": "2.0", |
| 41 | + "id": 1, |
| 42 | + "result": [], |
| 43 | + "error": null |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +## mining.authorize |
| 48 | + |
| 49 | +Used for authorizing miners. |
| 50 | + |
| 51 | +Params: |
| 52 | + 1. name: `string` |
| 53 | + 2. password: `string` |
| 54 | + |
| 55 | +Return Type: `bool` |
| 56 | + |
| 57 | +Request Example |
| 58 | +``` |
| 59 | +{ |
| 60 | + "jsonrpc": "2.0", |
| 61 | + "id":2, |
| 62 | + "method": "mining.authorize", |
| 63 | + "params": ["miner1", "password"] |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +Response Example |
| 68 | +``` |
| 69 | +{ |
| 70 | + "jsonrpc": "2.0", |
| 71 | + "id": 2, |
| 72 | + "result": true, |
| 73 | + "error": null |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## mining.notify |
| 78 | + |
| 79 | +Used for sending notifications regarding mining jobs. |
| 80 | + |
| 81 | +Params: `Work` |
| 82 | + |
| 83 | +Notification Example |
| 84 | +``` |
| 85 | +{ |
| 86 | + "jsonrpc": "2.0", |
| 87 | + "id": 3, |
| 88 | + "method": "mining.notify", |
| 89 | + "params": { |
| 90 | + "0x56642f04d519ae3262c7ba6facf1c5b11450ebaeb7955337cfbc45420d573077", |
| 91 | + "100" |
| 92 | + }, |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +## mining.submit |
| 97 | + |
| 98 | +Used for submitting a proof-of-work solution. |
| 99 | + |
| 100 | +Params: |
| 101 | + 1. powHash: `string` |
| 102 | + 2. seal: `string[]` |
| 103 | + |
| 104 | +Return Type: `bool` |
| 105 | + |
| 106 | +Request Example |
| 107 | +``` |
| 108 | +{ |
| 109 | + "jsonrpc": "2.0", |
| 110 | + "id": 4, |
| 111 | + "method": "mining.submit", |
| 112 | + "params": ["0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", ["0x56642f04d519ae3262c7ba6facf1c5b11450ebaeb7955337cfbc45420d573077"]], |
| 113 | +} |
| 114 | +``` |
| 115 | + |
| 116 | +Response Example |
| 117 | +``` |
| 118 | +{ |
| 119 | + "jsonrpc": "2.0", |
| 120 | + "id": 4, |
| 121 | + "result": true, |
| 122 | + "error": null |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +## Exception Handling (DRAFT) |
| 127 | +Stratum defines simple exception handling. Example of a rejected share looks like: |
| 128 | +``` |
| 129 | +{ |
| 130 | + "jsonrpc": "2.0", |
| 131 | + "id": 5, |
| 132 | + "result": null, |
| 133 | + "error": (21, "Job not found", null) |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +Where the error field is defined as (error_code, human_readable_message, traceback). Traceback may contain additional information about debugging errors. |
| 138 | +Proposed error codes for mining services are: |
| 139 | +* 20 - Other/Unknown |
| 140 | +* 21 - Job not found (=stale) |
| 141 | +* 22 - Duplicate share |
| 142 | +* 23 - Low target share |
| 143 | +* 24 - Unauthorized worker |
| 144 | +* 25 - Not subscribed |
0 commit comments