Skip to content

Commit

Permalink
lbry algo (stratum only)
Browse files Browse the repository at this point in the history
Signed-off-by: Tanguy Pruvot <[email protected]>
  • Loading branch information
tpruvot committed Jul 13, 2016
1 parent dbb9507 commit 5703a74
Show file tree
Hide file tree
Showing 15 changed files with 3,451 additions and 29 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ ccminer_SOURCES = elist.h miner.h compat.h \
sph/cubehash.c sph/echo.c sph/luffa.c sph/sha2.c sph/shavite.c sph/simd.c \
sph/hamsi.c sph/hamsi_helper.c sph/streebog.c \
sph/shabal.c sph/whirlpool.c sph/sha2big.c sph/haval.c \
sph/ripemd.c sph/sph_sha2.c \
lbry/lbry.cu lbry/cuda_ripemd160.cu lbry/cuda_sha256_lbry.cu lbry/cuda_sha512_lbry.cu \
qubit/qubit.cu qubit/qubit_luffa512.cu qubit/deep.cu qubit/luffa.cu \
x11/x11.cu x11/fresh.cu x11/cuda_x11_luffa512.cu x11/cuda_x11_cubehash512.cu \
x11/cuda_x11_shavite512.cu x11/cuda_x11_simd512.cu x11/cuda_x11_echo.cu \
Expand Down
8 changes: 6 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

ccMiner preview 1.8-dev (May 2016) "Pascal and x11evo algo"
ccMiner 1.8 Preview (July 2016) "CUDA 8, lbry and x11evo algos"
---------------------------------------------------------------

***************************************************************
Expand Down Expand Up @@ -28,20 +28,21 @@ Decred (Blake256 14-rounds - 180 bytes)
HeavyCoin & MjollnirCoin
FugueCoin
GroestlCoin & Myriad-Groestl
Lbry Credits
JackpotCoin
QuarkCoin family & AnimeCoin
TalkCoin
DarkCoin and other X11 coins
Chaincoin and Flaxscript (C11)
Saffroncoin blake (256 14-rounds)
BlakeCoin (256 8-rounds)
Midnight (BMW 256)
Qubit (Digibyte, ...)
Luffa (Joincoin)
Keccak (Maxcoin)
Pentablake (Blake 512 x5)
1Coin Triple S
Neoscrypt (FeatherCoin)
Revolver (X11evo)
Scrypt and Scrypt:N
Scrypt-Jane (Chacha)
Sibcoin (sib)
Expand Down Expand Up @@ -82,6 +83,7 @@ its command line interface and options.
heavy use to mine Heavycoin
jackpot use to mine Jackpotcoin
keccak use to mine Maxcoin
lbry use to mine LBRY Credits
luffa use to mine Joincoin
lyra2 use to mine Vertcoin
mjollnir use to mine Mjollnircoin
Expand Down Expand Up @@ -151,6 +153,7 @@ its command line interface and options.
--max-diff=N Only mine if net difficulty is less than specified value
--pstate=0 will force the Geforce 9xx to run in P0 P-State
--plimit=150W set the gpu power limit, allow multiple values for N cards
--tlimit=85 Set the gpu thermal limit (windows only)
--keep-clocks prevent reset clocks and/or power limit on exit
--show-diff display submitted block and net difficulty
-B, --background run the miner in the background
Expand Down Expand Up @@ -242,6 +245,7 @@ features.

July 2016 v1.8.0
Pascal support with cuda 8
lbry new multi sha / ripemd algo (LBC)
x11evo algo (XRE)
Lyra2v2, Neoscrypt and Decred improvements
Enhance windows NVAPI clock and power limits
Expand Down
2 changes: 2 additions & 0 deletions algos.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum sha_algos {
ALGO_HEAVY, /* Heavycoin hash */
ALGO_KECCAK,
ALGO_JACKPOT,
ALGO_LBRY,
ALGO_LUFFA,
ALGO_LYRA2,
ALGO_LYRA2v2,
Expand Down Expand Up @@ -67,6 +68,7 @@ static const char *algo_names[] = {
"heavy",
"keccak",
"jackpot",
"lbry",
"luffa",
"lyra2",
"lyra2v2",
Expand Down
25 changes: 24 additions & 1 deletion ccminer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ Options:\n\
heavy Heavycoin\n\
jackpot Jackpot\n\
keccak Keccak-256 (Maxcoin)\n\
lbry LBRY Credits (Sha/Ripemd)\n\
luffa Joincoin\n\
lyra2 LyraBar\n\
lyra2v2 VertCoin\n\
Expand Down Expand Up @@ -567,6 +568,7 @@ static void calc_network_diff(struct work *work)
// sample for diff 43.281 : 1c05ea29
// todo: endian reversed on longpoll could be zr5 specific...
uint32_t nbits = have_longpoll ? work->data[18] : swab32(work->data[18]);
if (opt_algo == ALGO_LBRY) nbits = swab32(work->data[26]);
if (opt_algo == ALGO_DECRED) nbits = work->data[29];
uint32_t bits = (nbits & 0xffffff);
int16_t shift = (swab32(nbits) & 0xff); // 0x1c = 28
Expand Down Expand Up @@ -837,6 +839,11 @@ static bool submit_upstream_work(CURL *curl, struct work *work)
le32enc(&nonce, work->data[19]);
be16enc(&nvote, *((uint16_t*)&work->data[20]));
break;
case ALGO_LBRY:
check_dups = true;
le32enc(&ntime, work->data[25]);
le32enc(&nonce, work->data[27]);
break;
case ALGO_ZR5:
check_dups = true;
be32enc(&ntime, work->data[17]);
Expand Down Expand Up @@ -1296,6 +1303,8 @@ bool get_work(struct thr_info *thr, struct work *work)
memset(work->data + 19, 0x00, 52);
if (opt_algo == ALGO_DECRED) {
memset(&work->data[35], 0x00, 52);
} else if (opt_algo == ALGO_LBRY) {
work->data[28] = 0x80000000;
} else {
work->data[20] = 0x80000000;
work->data[31] = 0x00000280;
Expand Down Expand Up @@ -1441,6 +1450,14 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
work->data[37] = (rand()*4) << 8; // random work data
sctx->job.height = work->data[32];
//applog_hex(work->data, 180);
} else if (opt_algo == ALGO_LBRY) {
for (i = 0; i < 8; i++)
work->data[9 + i] = be32dec((uint32_t *)merkle_root + i);
for (i = 0; i < 8; i++)
work->data[17 + i] = ((uint32_t*)sctx->job.claim)[i];
work->data[25] = le32dec(sctx->job.ntime);
work->data[26] = le32dec(sctx->job.nbits);
work->data[28] = 0x80000000;
} else {
for (i = 0; i < 8; i++)
work->data[9 + i] = be32dec((uint32_t *)merkle_root + i);
Expand Down Expand Up @@ -1498,6 +1515,7 @@ static bool stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
case ALGO_FRESH:
case ALGO_FUGUE256:
case ALGO_GROESTL:
case ALGO_LBRY:
case ALGO_LYRA2v2:
work_set_target(work, sctx->job.diff / (256.0 * opt_difficulty));
break;
Expand Down Expand Up @@ -1658,6 +1676,7 @@ static void *miner_thread(void *userdata)

// &work.data[19]
int wcmplen = (opt_algo == ALGO_DECRED) ? 140 : 76;
if (opt_algo == ALGO_LBRY) wcmplen = 108;
int wcmpoft = 0;
uint32_t *nonceptr = (uint32_t*) (((char*)work.data) + wcmplen);

Expand Down Expand Up @@ -1910,6 +1929,7 @@ static void *miner_thread(void *userdata)
minmax = 0x40000000U;
break;
case ALGO_KECCAK:
case ALGO_LBRY:
case ALGO_LUFFA:
case ALGO_SKEIN:
case ALGO_SKEIN2:
Expand Down Expand Up @@ -2035,6 +2055,9 @@ static void *miner_thread(void *userdata)
case ALGO_JACKPOT:
rc = scanhash_jackpot(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_LBRY:
rc = scanhash_lbry(thr_id, &work, max_nonce, &hashes_done);
break;
case ALGO_LUFFA:
rc = scanhash_luffa(thr_id, &work, max_nonce, &hashes_done);
break;
Expand Down Expand Up @@ -2130,7 +2153,7 @@ static void *miner_thread(void *userdata)

// todo: update all algos to use work->nonces
work.nonces[0] = nonceptr[0];
if (opt_algo != ALGO_DECRED && opt_algo != ALGO_BLAKE2S) {
if (opt_algo != ALGO_DECRED && opt_algo != ALGO_BLAKE2S && opt_algo != ALGO_LBRY) {
work.nonces[1] = nonceptr[2];
}

Expand Down
14 changes: 7 additions & 7 deletions ccminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<MaxRegCount>80</MaxRegCount>
<PtxAsOptionV>true</PtxAsOptionV>
<Keep>true</Keep>
<CodeGeneration>compute_50,sm_50</CodeGeneration>
<CodeGeneration>compute_61,sm_61;compute_52,sm_52</CodeGeneration>
<Include>$(NVTOOLSEXT_PATH)\include;..\..\..\Common\C99</Include>
<TargetMachinePlatform>64</TargetMachinePlatform>
</CudaCompile>
Expand Down Expand Up @@ -273,15 +273,11 @@
<ClCompile Include="sph\fugue.c" />
<ClCompile Include="sph\groestl.c" />
<ClCompile Include="sph\haval.c" />
<ClCompile Include="sph\haval_helper.c">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sph\jh.c" />
<ClCompile Include="sph\keccak.c" />
<ClCompile Include="sph\luffa.c" />
<ClCompile Include="sph\md_helper.c">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sph\ripemd.c" />
<ClCompile Include="sph\sph_sha2.c" />
<ClCompile Include="sph\sha2.c" />
<ClCompile Include="sph\sha2big.c" />
<ClCompile Include="sph\shabal.c" />
Expand Down Expand Up @@ -428,6 +424,10 @@
<MaxRegCount>92</MaxRegCount>
</CudaCompile>
<CudaCompile Include="Algo256\cuda_skein256.cu" />
<CudaCompile Include="lbry\cuda_ripemd160.cu" />
<CudaCompile Include="lbry\cuda_sha256_lbry.cu" />
<CudaCompile Include="lbry\cuda_sha512_lbry.cu" />
<CudaCompile Include="lbry\lbry.cu" />
<CudaCompile Include="pentablake.cu">
<MaxRegCount>80</MaxRegCount>
<AdditionalOptions Condition="'$(Configuration)'=='Release'">--ptxas-options="-dlcm=cg" %(AdditionalOptions)</AdditionalOptions>
Expand Down
25 changes: 20 additions & 5 deletions ccminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<Filter Include="Source Files\CUDA\lyra2">
<UniqueIdentifier>{1613763f-895c-4321-b58b-6f5849868956}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\CUDA\lbry">
<UniqueIdentifier>{3079ea1f-f768-455a-acd6-f517fac535b4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="compat\jansson\dump.c">
Expand Down Expand Up @@ -150,9 +153,6 @@
<ClCompile Include="sph\luffa.c">
<Filter>Source Files\sph</Filter>
</ClCompile>
<ClCompile Include="sph\md_helper.c">
<Filter>Source Files\sph</Filter>
</ClCompile>
<ClCompile Include="sph\sha2.c">
<Filter>Source Files\sph</Filter>
</ClCompile>
Expand Down Expand Up @@ -180,7 +180,10 @@
<ClCompile Include="sph\haval.c">
<Filter>Source Files\sph</Filter>
</ClCompile>
<ClCompile Include="sph\haval_helper.c">
<ClCompile Include="sph\ripemd.c">
<Filter>Source Files\sph</Filter>
</ClCompile>
<ClCompile Include="sph\sph_sha2.c">
<Filter>Source Files\sph</Filter>
</ClCompile>
<ClCompile Include="sph\sha2big.c">
Expand Down Expand Up @@ -721,6 +724,18 @@
<CudaCompile Include="Algo256\blake2s.cu">
<Filter>Source Files\CUDA\Algo256</Filter>
</CudaCompile>
<CudaCompile Include="lbry\cuda_sha256_lbry.cu">
<Filter>Source Files\CUDA\lbry</Filter>
</CudaCompile>
<CudaCompile Include="lbry\cuda_sha512_lbry.cu">
<Filter>Source Files\CUDA\lbry</Filter>
</CudaCompile>
<CudaCompile Include="lbry\cuda_ripemd160.cu">
<Filter>Source Files\CUDA\lbry</Filter>
</CudaCompile>
<CudaCompile Include="lbry\lbry.cu">
<Filter>Source Files\CUDA\lbry</Filter>
</CudaCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\ccminer.ico">
Expand All @@ -737,4 +752,4 @@
<Filter>Ressources</Filter>
</Text>
</ItemGroup>
</Project>
</Project>
Loading

0 comments on commit 5703a74

Please sign in to comment.