├── NEWS ├── autogen.sh ├── html ├── BTC.png ├── index.php ├── maintenance.txt.dis ├── red.png ├── worker.php ├── BTC20.png ├── address.php ├── green.png ├── BTCSym.png ├── favicon.ico └── orange.png ├── Makefile.am ├── pool ├── index.html ├── page_index.php ├── page_help.php ├── page_pblocks.php ├── worker.php ├── address.php ├── param.php ├── page_allwork.php ├── page_ips.php ├── page_userinfo.php ├── page_mpayouts.php ├── page_ckp.php ├── page_api.php ├── page_payments.php ├── prime.php ├── page_stats.php ├── page_psperf.php ├── page_workmgt.php ├── page_shifts.php ├── page_userset.php ├── page_payout.php ├── page_reset.php ├── page_percent.php ├── page_usperf.php ├── page_luck.php ├── page_events.php ├── socket.php ├── email.php ├── page_addrmgt.php └── page_settings.php ├── ChangeLog ├── AUTHORS ├── ckpassthrough.conf ├── src ├── jansson-2.10 │ ├── jansson.pc.in │ ├── Makefile.am │ ├── src │ │ ├── Makefile.am │ │ ├── utf.h │ │ ├── strbuffer.h │ │ ├── jansson_config.h.in │ │ ├── jansson.def │ │ ├── error.c │ │ ├── memory.c │ │ ├── strbuffer.c │ │ ├── strconv.c │ │ ├── jansson_private.h │ │ ├── utf.c │ │ └── hashtable.h │ ├── LICENSE │ ├── android │ │ └── jansson_config.h │ ├── README.rst │ ├── configure.ac │ ├── test-driver │ └── jansson_private_config.h.in ├── connector.h ├── relog.sh ├── bitcoin.h ├── generator.h ├── Makefile.am ├── notifier.c ├── sha256_code_release │ └── open_software_license.txt ├── ckdb.php ├── sha2.h ├── stratifier.h ├── cmd.sh └── ktree.h ├── m4 └── .gitignore ├── ckredirector.conf ├── ckproxy.conf ├── .gitignore ├── sql ├── v1.0.7-v1.0.8.sql ├── v1.0.1-v1.0.2.sql ├── v0.6-v0.7.sql ├── v1.0.3-v1.0.4.sql ├── v0.9.3-v0.9.4.sql ├── initid.sh ├── v1.0.5-v1.0.6.sql ├── v0.9.1-v0.9.2.sql ├── v1.0.4-v1.0.5.sql ├── reloadstatus.sql ├── v0.7-v0.8.sql ├── v1.0.0-v1.0.1.sql ├── v1.0.2-v1.0.3.sql ├── v0.9.5-v0.9.6.sql ├── v0.9.4-v0.9.5.sql ├── tables.sql ├── v0.8-v0.9.sql ├── v0.9-v0.9.1.sql ├── tabdump.sh ├── v1.0.6-v1.0.7.sql ├── bs.sql ├── v0.9.2-v0.9.3.sql └── v0.9.6-v1.0.0.sql ├── cknode.conf ├── ckpool.conf └── configure.ac /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | autoreconf --force --install -I m4 3 | -------------------------------------------------------------------------------- /html/BTC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ctubio/ckpool/HEAD/html/BTC.png -------------------------------------------------------------------------------- /html/index.php: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /html/maintenance.txt.dis: -------------------------------------------------------------------------------- 1 |
| # | '; 12 | $pg .= 'Group | '; 13 | $pg .= 'IP | '; 14 | $pg .= 'Name | '; 15 | $pg .= 'Is? | '; 16 | $pg .= 'Lifetime | '; 17 | $pg .= 'Left | '; 18 | $pg .= 'Log | '; 19 | $pg .= 'Desc | '; 20 | $pg .= 'UTC | '; 21 | $pg .= "
| $j | "; 37 | $pg .= ''.$ans['group:'.$i].' | '; 38 | $pg .= ''.$ans['ip:'.$i].' | '; 39 | $pg .= ''.$ans['eventname:'.$i].' | '; 40 | $pg .= ''.$ans['is_event:'.$i].' | '; 41 | $pg .= ''.$ans['lifetime:'.$i].' | '; 42 | $exp = $ans['lifetime:'.$i]; 43 | if ($exp == 0) 44 | $dxp = '∞'; 45 | else 46 | { 47 | $exp += $ans['createdate:'.$i]; 48 | if ($exp <= $now) 49 | $dxp = 'Exp'; 50 | else 51 | { 52 | $exp -= $now; 53 | $dxp = $exp . 's'; 54 | } 55 | } 56 | $pg .= ''.$dxp.' | '; 57 | $pg .= ''.$ans['log:'.$i].' | '; 58 | $pg .= ''.$ans['description:'.$i].' | '; 59 | $pg .= ''.gmdate('j/M H:i:s',$ans['createdate:'.$i]).' | '; 60 | $pg .= "
| User | '; 26 | $pg .= 'Blocks | '; 27 | if ($sall) 28 | { 29 | $pg .= 'Diff | '; 30 | $pg .= 'Avg | '; 31 | } 32 | $pg .= "
| $un | "; 66 | $pg .= "$bl | "; 67 | if ($sall) 68 | { 69 | $diffacc = $all[$i]['diffacc']; 70 | $pg .= ''.difffmt($diffacc).' | '; 71 | if ($bl == 0) 72 | $bl = 1; 73 | $pg .= ''.difffmt($diffacc/$bl).' | '; 74 | } 75 | $pg .= "
| Block | '; 17 | $pg .= 'Block UTC | '; 18 | $pg .= 'Miner Reward | '; 19 | $pg .= 'N Diff | '; 20 | $pg .= 'N Range | '; 21 | $pg .= 'Pool N Avg | '; 22 | $pg .= 'Your % | '; 23 | $pg .= 'Your N Diff | '; 24 | $pg .= 'Your N Avg | '; 25 | $pg .= 'Your BTC | '; 26 | $pg .= "
| '.$ans['height:'.$i].' | '; 41 | $pg .= ''.gmdate('j/M H:i',$ans['blockcreatedate:'.$i]).' | '; 42 | $pg .= ''.btcfmt($ans['minerreward:'.$i]).' | '; 43 | $diffused = $ans['diffused:'.$i]; 44 | $pg .= ''.difffmt($diffused).' | '; 45 | $elapsed = $ans['elapsed:'.$i]; 46 | $pg .= ''.howmanyhrs($elapsed).' | '; 47 | $phr = $diffused * pow(2,32) / $elapsed; 48 | $pg .= ''.siprefmt($phr).'Hs | '; 49 | $diffacc = $ans['diffacc:'.$i]; 50 | $ypct = $diffacc * 100 / $diffused; 51 | $pg .= ''.number_format($ypct, 2).'% | '; 52 | $pg .= ''.difffmt($diffacc).' | '; 53 | $hr = $diffacc * pow(2,32) / $elapsed; 54 | $pg .= ''.dsprate($hr).' | '; 55 | $amount = $ans['amount:'.$i]; 56 | $totamt += $amount; 57 | $pg .= ''.btcfmt($amount).' | '; 58 | $pg .= "
| Total: | '; 70 | $pg .= ''; 71 | $pg .= ' | '.btcfmt($totamt).' | '; 72 | $pg .= "|||||||
| Name:<$r id=srtname data-sf=s0> | "; 34 | $pg .= 'Initial | '; 35 | $pg .= "<$r id=srtalloc data-sf=r2>:Alloc | "; 36 | $pg .= "<$r id=srtstore data-sf=r3>:In Store | "; 37 | $pg .= "<$r id=srtram data-sf=r4>:RAM | "; 38 | $pg .= "<$r id=srtram2 data-sf=r5>:RAM2 | "; 39 | $pg .= "<$r id=srtcull data-sf=r6>:Cull | "; 40 | $pg .= "<$r id=srtlim data-sf=r7>:Limit | "; 41 | $pg .= "
| ".$ans['name:'.$i].' | '; 55 | $pg .= ''.stnum($ans['initial:'.$i]).' | '; 56 | $pg .= "".stnum($ans['allocated:'.$i]).' | '; 57 | $pg .= "".stnum($ans['instore:'.$i]).' | '; 58 | $pg .= "".stnum($ans['ram:'.$i]).' | '; 59 | $pg .= "".stnum($ans['ram2:'.$i]).' | '; 60 | $pg .= "".stnum($ans['cull:'.$i]).' | '; 61 | $pg .= "".stnum($ans['cull_limit:'.$i]).' | '; 62 | $pg .= "
| Block | '; 33 | $pg .= 'Address | '; 34 | $pg .= 'Status | '; 35 | $pg .= 'BTC | '; 36 | $pg .= ''; 37 | $pg .= " |
| '.$all[$i]['height'].' | '; 62 | $pg .= ''.$all[$i]['payaddress'].' | '; 63 | $pg .= ''; 64 | $amount = $all[$i]['amount']; 65 | if ($amount < '10000') 66 | { 67 | $dust = '*'; 68 | $hasdust = true; 69 | } 70 | else 71 | $dust = ' '; 72 | $pg .= ' | '.btcfmt($amount).' | '; 73 | $pg .= "$dust | "; 74 | $pg .= "
| '; 80 | $pg .= '* '; 81 | $pg .= 'Dust payments are not automatically sent out'; 82 | $pg .= ' | ||||
| Pool Hashrate: $dsp | "; 70 | $pg .= "5m: $dsp5m | "; 71 | $pg .= "1hr: $dsp1hr | "; 72 | $pg .= "24hr: $dsp24hr | "; 73 | $pg .= '
| Username | '; 81 | $pg .= 'Hash Rate 5m | '; 82 | $pg .= "
| '.htmlspecialchars($all[$i]['username']).' | '; 106 | $uhr = $all[$i]['u_hashrate5m']; 107 | if ($uhr == '?') 108 | $dsp = '?GHs'; 109 | else 110 | $dsp = dsprate($uhr); 111 | $pg .= "$dsp | "; 112 | $pg .= "
| Worker Name | '; 29 | $pg .= 'Minimum Diff | '; 30 | $pg .= '
| '; 48 | $pg .= ""; 49 | $pg .= $wn.' | '; 50 | 51 | $md = intval($ans['difficultydefault:'.$i]); 52 | $pg .= ''; 53 | $pg .= ""; 54 | $pg .= ""; 55 | $pg .= " | "; 56 | 57 | $pg .= "
| *';
63 | $pg .= ' A value of 0, less than the pool minimum, '; 64 | $pg .= 'or less than the pool calculated value for you, '; 65 | $pg .= 'will use the pool calculated value | |
| '; 12 | $pg .= ""; 13 | $pg .= 'mini header | |||||||||
|
|
30 |
31 | What payout method does the pool use? 32 | We use PPL${n1}S (Pay Per Last $n1 Shares) 33 | PPL${n1}S means that when a block is found, the block reward is shared among the last $n1 shares that miners sent to the pool, up to when the block was found. 34 | The $n1 value the pool uses is $t times the network difficulty when the block is found - '$n'. 35 | 36 | How much of each block does the pool reward? 37 | Transaction fees are included in the miner reward. 38 | Pool fee is 0.9% of the total. 39 | 40 | PPL${n1}S acts like the reward 'ramps up' when you first start mining. What actually happens? 41 | The $n means it takes that long to reward your shares. 42 | The ramp isn't missing rewards, it's delaying them to reduce variance. 43 | Each share is rewarded in all the blocks found in the $n after the share. 44 | That's simply how it reduces variance. Each share's reward is averaged out over the $n after it. 45 | The pool hash rate $hr which means the $n 'ramp' is roughly $hrt. 46 | 47 | Continue reading below for more detail about how it works: 48 | 49 | How do the PPL${n1}S payments work? 50 | The $n means the pool rewards $t times the expected number of shares, each time a block is found. 51 | So each share will be paid approximately $ot of it's expected value, in each block it gets a reward, 52 | but each share is also expected, on average, to be rewarded $t times in blocks found after the share is submitted to the pool. 53 | i.e. if pool luck was always 100% then each share is expected to be rewarded $t times. 54 | If pool luck is better than 100%, then the average share reward will be better than $t times. 55 | If pool luck is lower than 100%, then the average share reward will be less than $t times. 56 | 57 | What's a shift? 58 | When your miner sends shares to the pool, the shares are not stored individually, but rather summarised into shifts. 59 | Shifts are ~50min or less in length. 60 | Aproximately every 30s, the pool generates new work and sends that to all the miners. 61 | The pool also sends new work every time a block is found on the Bitcoin network. 62 | A shift summarises all the shares submitted to the pool for 100 work changes. 63 | However, when we find pool blocks, the current shift ends at the work in which the block was found 64 | and a new shift starts. 65 | A ckpool restart will also end the current shift and start a new shift. 66 | A network difficulty change will also end the current shift and start a new shift. 67 | 68 | So, what's the $n value? 69 | The current Bitcoin network value for $n1d is $nv and thus $n is $nvx 70 | Bitcoin adjusts the $n1d value every 2016 blocks, which is about every 2 weeks. 71 | When a block is found, the reward process counts back shifts until the total share difficulty included is $n. 72 | Since shares are summarised into shifts, it will include the full shift at the end of the range counting backwards, 73 | so it usually will be a bit more than $n. 74 | 75 | When are payments sent out? 76 | The block 'Status' must first reach '$bc' on the Blocks page, and then is flagged as '$bm', before the reward is distributed. 77 | The block reward is sent out manually soon after that. 78 | 79 | |
';
8 |
9 | $pg .= 'Password Reset'; 10 | if ($error !== null) 11 | $pg .= "$error - please try again "; 12 | $pg .= makeForm('reset'); 13 | $pg .= " 14 |
| ||||||||||||
| # | '; 26 | $pg .= 'Name | '; 27 | $pg .= 'Value | '; 28 | $pg .= "
| $i | "; 44 | $pg .= "$name | "; 45 | $pg .= ''.$ans[$name].' | '; 46 | $pg .= "
| # | '; 66 | $pg .= 'Name | '; 67 | foreach ($flds as $row => $nam) 68 | $pg .= "$nam | "; 69 | $pg .= "
| $i | "; 92 | $pg .= "$name | "; 93 | foreach ($flds as $fld => $nam) 94 | $pg .= ''.$ans[$name.'_'.$fld].' | '; 95 | $pg .= "
| # | '; 109 | $pg .= 'List | '; 110 | $pg .= 'ID | '; 111 | $pg .= 'IDName | '; 112 | $pg .= 'User | '; 113 | $pg .= 'IP | '; 114 | $pg .= 'IPc | '; 115 | $pg .= 'Hash | '; 116 | $pg .= 'UTC | '; 117 | $pg .= "
| $j | "; 133 | $pg .= ''.$ans['list:'.$i].' | '; 134 | $pg .= ''.$ans['id:'.$i].' | '; 135 | $pg .= ''.$ans['idname:'.$i].' | '; 136 | $pg .= ''.$ans['user:'.$i].' | '; 137 | $pg .= ''.isans($ans, 'ip:'.$i).' | '; 138 | $pg .= ''.isans($ans, 'ipc:'.$i).' | '; 139 | $pg .= ''.isans($ans, 'hash:'.$i).' | '; 140 | $pg .= ''.gmdate('j/M H:i:s',$ans['createdate:'.$i]).' | '; 141 | $pg .= "
| # | '; 155 | $pg .= 'Key | '; 156 | $pg .= 'ID | '; 157 | $pg .= 'IDName | '; 158 | $pg .= 'Hour UTC | '; 159 | $pg .= 'Count | '; 160 | $pg .= "
| $j | "; 176 | $pg .= ''.$ans['key:'.$i].' | '; 177 | $pg .= ''.$ans['id:'.$i].' | '; 178 | $pg .= ''.$ans['idname:'.$i].' | '; 179 | $pg .= ''.gmdate('j/M H:i:s',$ans['hour:'.$i]*3600).' | '; 180 | $co = ''; 181 | for ($k = 0; $k < 60; $k++) 182 | { 183 | if ($k < 10) 184 | $min = '0' . $k; 185 | else 186 | $min = $k; 187 | if (isset($ans["min$min:$i"])) 188 | { 189 | if ($co != '') 190 | $co .= ' '; 191 | $co .= "$min=".$ans["min$min:$i"]; 192 | } 193 | } 194 | $pg .= "$co | "; 195 | $pg .= "
| # | '; 16 | $pg .= 'Address | '; 17 | $pg .= 'ID | '; 18 | $pg .= 'Ratio | '; 19 | $pg .= '% | '; 20 | $pg .= '|
| '; 25 | $pg .= ' | '; 26 | $pg .= ""; 27 | $pg .= ' | '; 28 | $pg .= ''; 29 | $pg .= ""; 30 | $pg .= ' | '; 31 | $pg .= ''; 32 | $pg .= ""; 33 | $pg .= ' | '; 34 | $pg .= ''; 35 | $pg .= "0.00%"; 36 | $pg .= ' | '; 37 | $pg .= "|
| '.($i+1).' | '; 62 | $pg .= ''; 63 | $pg .= ""; 64 | $pg .= ' | '; 65 | $nam = htmlspecialchars($ans['payname:'.$i]); 66 | $pg .= ''; 67 | $pg .= ""; 68 | $pg .= ' | '; 69 | $ratio = intval($ans['ratio:'.$i]); 70 | $pg .= ''; 71 | $pg .= ""; 72 | $pg .= ' | '; 73 | $pg .= ''; 74 | $pg .= "%"; 75 | $pg .= ' | '; 76 | $pg .= "|
| "; 86 | $pg .= ""; 87 | $pg .= " | limit $limit | ||||
| '; 97 | $pg .= ' | Password: | '; 98 | $pg .= ''; 99 | $pg .= ' | |||
| '; 107 | $pg .= ' | *2nd Authentication: | '; 108 | $pg .= ''; 109 | $pg .= ' | '; 110 | $pg .= '|||
| ';
113 | $pg .= "*Leave blank if you haven't enabled it "; 114 | $pg .= 'You must enter your password to save changes '; 115 | $pg .= 'A ratio of 0, will remove the address from the payouts | |||||
| ||||||||||||||
| ||||||||||||||
| ||||||||||||||