mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
lyra2z (v3) xzc at block 20500
disable the public explorer for now + dyn payee note: xzc coinbase value is already without dev fees warning: this wallet rpc is very slow and seems to slow down the backend (use it at your risks)
This commit is contained in:
parent
e78d933300
commit
0bed2e0465
16 changed files with 432 additions and 16 deletions
1
rc.local
1
rc.local
|
@ -42,6 +42,7 @@ screen -dmS myr-gr $STRATUM_DIR/run.sh myr-gr
|
|||
screen -dmS lbry $STRATUM_DIR/run.sh lbry
|
||||
screen -dmS lyra2 $STRATUM_DIR/run.sh lyra2
|
||||
screen -dmS lyra2v2 $STRATUM_DIR/run.sh lyra2v2
|
||||
screen -dmS zero $STRATUM_DIR/run.sh lyra2z
|
||||
|
||||
screen -dmS blakecoin $STRATUM_DIR/run.sh blakecoin # blake 8
|
||||
screen -dmS blake $STRATUM_DIR/run.sh blake
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
*
|
||||
* @return 0 if the key is generated correctly; -1 if there is an error (usually due to lack of memory for allocation)
|
||||
*/
|
||||
int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int16_t nRows, const int16_t nCols)
|
||||
int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int64_t nRows, const int16_t nCols)
|
||||
{
|
||||
//============================= Basic variables ============================//
|
||||
int64_t row = 2; //index of row to be processed
|
||||
|
@ -164,10 +164,10 @@ int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *sa
|
|||
|
||||
//Checks if all rows in the window where visited.
|
||||
if (rowa == 0) {
|
||||
step = window + gap; //changes the step: approximately doubles its value
|
||||
window *= 2; //doubles the size of the re-visitation window
|
||||
gap = -gap; //inverts the modifier to the step
|
||||
}
|
||||
step = window + gap; //changes the step: approximately doubles its value
|
||||
window *= 2; //doubles the size of the re-visitation window
|
||||
gap = -gap; //inverts the modifier to the step
|
||||
}
|
||||
|
||||
} while (row < nRows);
|
||||
//==========================================================================/
|
||||
|
|
|
@ -37,6 +37,6 @@ typedef unsigned char byte;
|
|||
#define BLOCK_LEN_BYTES (BLOCK_LEN_INT64 * 8) //Block length, in bytes
|
||||
#endif
|
||||
|
||||
int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int16_t nRows, const int16_t nCols);
|
||||
int LYRA2(void *K, int64_t kLen, const void *pwd, int32_t pwdlen, const void *salt, int32_t saltlen, int64_t timeCost, const int64_t nRows, const int16_t nCols);
|
||||
|
||||
#endif /* LYRA2_H_ */
|
||||
|
|
250
stratum/algos/Lyra2z.c
Executable file
250
stratum/algos/Lyra2z.c
Executable file
|
@ -0,0 +1,250 @@
|
|||
/**
|
||||
* Implementation of the Lyra2 Password Hashing Scheme (PHS).
|
||||
*
|
||||
* Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014.
|
||||
*
|
||||
* This software is hereby placed in the public domain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "Lyra2.h"
|
||||
#include "Sponge.h"
|
||||
|
||||
static __thread uint64_t *wholeMatrix = NULL;
|
||||
static __thread uint64_t **memMatrix = NULL;
|
||||
static __thread uint64_t curRows = 0;
|
||||
|
||||
/**
|
||||
* Executes Lyra2 based on the G function from Blake2b. This version supports salts and passwords
|
||||
* whose combined length is smaller than the size of the memory matrix, (i.e., (nRows x nCols x b) bits,
|
||||
* where "b" is the underlying sponge's bitrate). In this implementation, the "basil" is composed by all
|
||||
* integer parameters (treated as type "unsigned int") in the order they are provided, plus the value
|
||||
* of nCols, (i.e., basil = kLen || pwdlen || saltlen || timeCost || nRows || nCols).
|
||||
*
|
||||
* @param K The derived key to be output by the algorithm
|
||||
* @param kLen Desired key length
|
||||
* @param pwd User password
|
||||
* @param pwdlen Password length
|
||||
* @param salt Salt
|
||||
* @param saltlen Salt length
|
||||
* @param timeCost Parameter to determine the processing time (T)
|
||||
* @param nRows Number or rows of the memory matrix (R)
|
||||
* @param nCols Number of columns of the memory matrix (C)
|
||||
*
|
||||
* @return 0 if the key is generated correctly; -1 if there is an error (usually due to lack of memory for allocation)
|
||||
*/
|
||||
int LYRA2z(void *K, uint64_t kLen, const void *pwd, uint64_t pwdlen, const void *salt, uint64_t saltlen, uint64_t timeCost, uint64_t nRows, uint64_t nCols) {
|
||||
|
||||
//============================= Basic variables ============================//
|
||||
int64_t row = 2; //index of row to be processed
|
||||
int64_t prev = 1; //index of prev (last row ever computed/modified)
|
||||
int64_t rowa = 0; //index of row* (a previous row, deterministically picked during Setup and randomly picked while Wandering)
|
||||
int64_t tau; //Time Loop iterator
|
||||
int64_t step = 1; //Visitation step (used during Setup and Wandering phases)
|
||||
int64_t window = 2; //Visitation window (used to define which rows can be revisited during Setup)
|
||||
int64_t gap = 1; //Modifier to the step, assuming the values 1 or -1
|
||||
int64_t i; //auxiliary iteration counter
|
||||
//==========================================================================/
|
||||
|
||||
//========== Initializing the Memory Matrix and pointers to it =============//
|
||||
//Tries to allocate enough space for the whole memory matrix
|
||||
|
||||
|
||||
const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * nCols;
|
||||
const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8;
|
||||
|
||||
|
||||
uint64_t *ptrWord = wholeMatrix;
|
||||
|
||||
if (!wholeMatrix || !memMatrix) {
|
||||
curRows = nRows + 32;
|
||||
i = (int64_t) ((int64_t) curRows * (int64_t) ROW_LEN_BYTES);
|
||||
wholeMatrix = (uint64_t*) malloc(i);
|
||||
if (wholeMatrix == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Allocates pointers to each row of the matrix
|
||||
memMatrix = malloc(sizeof(uint64_t*) * curRows);
|
||||
if (memMatrix == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Places the pointers in the correct positions
|
||||
ptrWord = wholeMatrix;
|
||||
for (i = 0; i < curRows; i++) {
|
||||
memMatrix[i] = ptrWord;
|
||||
ptrWord += ROW_LEN_INT64;
|
||||
}
|
||||
} else {
|
||||
if (nRows > curRows) {
|
||||
free(memMatrix); memMatrix = NULL;
|
||||
free(wholeMatrix); wholeMatrix = NULL;
|
||||
return -2;
|
||||
}
|
||||
memset(wholeMatrix, 0, nRows * ROW_LEN_BYTES);
|
||||
}
|
||||
/*
|
||||
i = (int64_t) ((int64_t) nRows * (int64_t) ROW_LEN_BYTES);
|
||||
uint64_t *wholeMatrix = malloc(i);
|
||||
if (wholeMatrix == NULL) {
|
||||
return -1;
|
||||
}
|
||||
memset(wholeMatrix, 0, i);
|
||||
|
||||
//Allocates pointers to each row of the matrix
|
||||
uint64_t **memMatrix = malloc(nRows * sizeof (uint64_t*));
|
||||
if (memMatrix == NULL) {
|
||||
return -1;
|
||||
}
|
||||
//Places the pointers in the correct positions
|
||||
uint64_t *ptrWord = wholeMatrix;
|
||||
for (i = 0; i < nRows; i++) {
|
||||
memMatrix[i] = ptrWord;
|
||||
ptrWord += ROW_LEN_INT64;
|
||||
}
|
||||
*/
|
||||
//==========================================================================/
|
||||
|
||||
//============= Getting the password + salt + basil padded with 10*1 ===============//
|
||||
//OBS.:The memory matrix will temporarily hold the password: not for saving memory,
|
||||
//but this ensures that the password copied locally will be overwritten as soon as possible
|
||||
|
||||
//First, we clean enough blocks for the password, salt, basil and padding
|
||||
uint64_t nBlocksInput = ((saltlen + pwdlen + 6 * sizeof (uint64_t)) / BLOCK_LEN_BLAKE2_SAFE_BYTES) + 1;
|
||||
byte *ptrByte = (byte*) wholeMatrix;
|
||||
memset(ptrByte, 0, nBlocksInput * BLOCK_LEN_BLAKE2_SAFE_BYTES);
|
||||
|
||||
//Prepends the password
|
||||
memcpy(ptrByte, pwd, pwdlen);
|
||||
ptrByte += pwdlen;
|
||||
|
||||
//Concatenates the salt
|
||||
memcpy(ptrByte, salt, saltlen);
|
||||
ptrByte += saltlen;
|
||||
|
||||
//Concatenates the basil: every integer passed as parameter, in the order they are provided by the interface
|
||||
memcpy(ptrByte, &kLen, sizeof (uint64_t));
|
||||
ptrByte += sizeof (uint64_t);
|
||||
memcpy(ptrByte, &pwdlen, sizeof (uint64_t));
|
||||
ptrByte += sizeof (uint64_t);
|
||||
memcpy(ptrByte, &saltlen, sizeof (uint64_t));
|
||||
ptrByte += sizeof (uint64_t);
|
||||
memcpy(ptrByte, &timeCost, sizeof (uint64_t));
|
||||
ptrByte += sizeof (uint64_t);
|
||||
memcpy(ptrByte, &nRows, sizeof (uint64_t));
|
||||
ptrByte += sizeof (uint64_t);
|
||||
memcpy(ptrByte, &nCols, sizeof (uint64_t));
|
||||
ptrByte += sizeof (uint64_t);
|
||||
|
||||
//Now comes the padding
|
||||
*ptrByte = 0x80; //first byte of padding: right after the password
|
||||
ptrByte = (byte*) wholeMatrix; //resets the pointer to the start of the memory matrix
|
||||
ptrByte += nBlocksInput * BLOCK_LEN_BLAKE2_SAFE_BYTES - 1; //sets the pointer to the correct position: end of incomplete block
|
||||
*ptrByte ^= 0x01; //last byte of padding: at the end of the last incomplete block
|
||||
//==========================================================================/
|
||||
|
||||
//======================= Initializing the Sponge State ====================//
|
||||
//Sponge state: 16 uint64_t, BLOCK_LEN_INT64 words of them for the bitrate (b) and the remainder for the capacity (c)
|
||||
uint64_t *state = malloc(16 * sizeof (uint64_t));
|
||||
if (state == NULL) {
|
||||
return -1;
|
||||
}
|
||||
initState(state);
|
||||
//==========================================================================/
|
||||
|
||||
//================================ Setup Phase =============================//
|
||||
//Absorbing salt, password and basil: this is the only place in which the block length is hard-coded to 512 bits
|
||||
ptrWord = wholeMatrix;
|
||||
for (i = 0; i < nBlocksInput; i++) {
|
||||
absorbBlockBlake2Safe(state, ptrWord); //absorbs each block of pad(pwd || salt || basil)
|
||||
ptrWord += BLOCK_LEN_BLAKE2_SAFE_INT64; //goes to next block of pad(pwd || salt || basil)
|
||||
}
|
||||
|
||||
//Initializes M[0] and M[1]
|
||||
reducedSqueezeRow0(state, memMatrix[0], nCols); //The locally copied password is most likely overwritten here
|
||||
reducedDuplexRow1(state, memMatrix[0], memMatrix[1], nCols);
|
||||
|
||||
do {
|
||||
//M[row] = rand; //M[row*] = M[row*] XOR rotW(rand)
|
||||
reducedDuplexRowSetup(state, memMatrix[prev], memMatrix[rowa], memMatrix[row], nCols);
|
||||
|
||||
|
||||
//updates the value of row* (deterministically picked during Setup))
|
||||
rowa = (rowa + step) & (window - 1);
|
||||
//update prev: it now points to the last row ever computed
|
||||
prev = row;
|
||||
//updates row: goes to the next row to be computed
|
||||
row++;
|
||||
|
||||
//Checks if all rows in the window where visited.
|
||||
if (rowa == 0) {
|
||||
step = window + gap; //changes the step: approximately doubles its value
|
||||
window *= 2; //doubles the size of the re-visitation window
|
||||
gap = -gap; //inverts the modifier to the step
|
||||
}
|
||||
|
||||
} while (row < nRows);
|
||||
//==========================================================================/
|
||||
|
||||
//============================ Wandering Phase =============================//
|
||||
row = 0; //Resets the visitation to the first row of the memory matrix
|
||||
for (tau = 1; tau <= timeCost; tau++) {
|
||||
//Step is approximately half the number of all rows of the memory matrix for an odd tau; otherwise, it is -1
|
||||
step = (tau % 2 == 0) ? -1 : nRows / 2 - 1;
|
||||
do {
|
||||
//Selects a pseudorandom index row*
|
||||
//------------------------------------------------------------------------------------------
|
||||
//rowa = ((unsigned int)state[0]) & (nRows-1); //(USE THIS IF nRows IS A POWER OF 2)
|
||||
rowa = ((uint64_t) (state[0])) % nRows; //(USE THIS FOR THE "GENERIC" CASE)
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
//Performs a reduced-round duplexing operation over M[row*] XOR M[prev], updating both M[row*] and M[row]
|
||||
reducedDuplexRow(state, memMatrix[prev], memMatrix[rowa], memMatrix[row], nCols);
|
||||
|
||||
//update prev: it now points to the last row ever computed
|
||||
prev = row;
|
||||
|
||||
//updates row: goes to the next row to be computed
|
||||
//------------------------------------------------------------------------------------------
|
||||
//row = (row + step) & (nRows-1); //(USE THIS IF nRows IS A POWER OF 2)
|
||||
row = (row + step) % nRows; //(USE THIS FOR THE "GENERIC" CASE)
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
} while (row != 0);
|
||||
}
|
||||
//==========================================================================/
|
||||
|
||||
//============================ Wrap-up Phase ===============================//
|
||||
//Absorbs the last block of the memory matrix
|
||||
absorbBlock(state, memMatrix[rowa]);
|
||||
|
||||
//Squeezes the key
|
||||
squeeze(state, K, kLen);
|
||||
//==========================================================================/
|
||||
|
||||
//========================= Freeing the memory =============================//
|
||||
//free(memMatrix);
|
||||
//free(wholeMatrix);
|
||||
|
||||
//Wiping out the sponge's internal state before freeing it
|
||||
memset(state, 0, 16 * sizeof (uint64_t));
|
||||
free(state);
|
||||
//==========================================================================/
|
||||
|
||||
return 0;
|
||||
}
|
51
stratum/algos/Lyra2z.h
Executable file
51
stratum/algos/Lyra2z.h
Executable file
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* Header file for the Lyra2 Password Hashing Scheme (PHS).
|
||||
*
|
||||
* Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014.
|
||||
*
|
||||
* This software is hereby placed in the public domain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef LYRA2z_H_
|
||||
#define LYRA2z_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
//Block length required so Blake2's Initialization Vector (IV) is not overwritten (THIS SHOULD NOT BE MODIFIED)
|
||||
#define BLOCK_LEN_BLAKE2_SAFE_INT64 8 //512 bits (=64 bytes, =8 uint64_t)
|
||||
#define BLOCK_LEN_BLAKE2_SAFE_BYTES (BLOCK_LEN_BLAKE2_SAFE_INT64 * 8) //same as above, in bytes
|
||||
|
||||
|
||||
#ifdef BLOCK_LEN_BITS
|
||||
#define BLOCK_LEN_INT64 (BLOCK_LEN_BITS/64) //Block length: 768 bits (=96 bytes, =12 uint64_t)
|
||||
#define BLOCK_LEN_BYTES (BLOCK_LEN_BITS/8) //Block length, in bytes
|
||||
#else //default block lenght: 768 bits
|
||||
#define BLOCK_LEN_INT64 12 //Block length: 768 bits (=96 bytes, =12 uint64_t)
|
||||
#define BLOCK_LEN_BYTES (BLOCK_LEN_INT64 * 8) //Block length, in bytes
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int LYRA2z(void *K, uint64_t kLen, const void *pwd, uint64_t pwdlen, const void *salt, uint64_t saltlen, uint64_t timeCost, uint64_t nRows, uint64_t nCols);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* LYRA2z_H_ */
|
39
stratum/algos/lyra2z.c
Normal file
39
stratum/algos/lyra2z.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Lyra2z.h"
|
||||
|
||||
#include <sha3/sph_blake.h>
|
||||
|
||||
#define _ALIGN(x) __attribute__ ((aligned(x)))
|
||||
|
||||
extern uint64_t lyra2z_height;
|
||||
|
||||
void lyra2z_hash(const char* input, char* output, uint32_t len)
|
||||
{
|
||||
uint32_t _ALIGN(64) hashB[8], hash[8];
|
||||
sph_blake256_context ctx_blake;
|
||||
/*
|
||||
uint64_t height = lyra2z_height;
|
||||
// initial implementation was pure lyra2 (no blake)
|
||||
|
||||
if (height < 100) {
|
||||
fprintf(stderr, "submit error, height=%u, len=%u\n", (uint32_t) height, len);
|
||||
memset(hash, 0xff, 32);
|
||||
return;
|
||||
}
|
||||
LYRA2z((void*)hash, 32, (void*)input, len, (void*)input, len, 2, height, 256);
|
||||
*/
|
||||
sph_blake256_set_rounds(14);
|
||||
|
||||
sph_blake256_init(&ctx_blake);
|
||||
sph_blake256(&ctx_blake, input, len);
|
||||
sph_blake256_close(&ctx_blake, hashB);
|
||||
|
||||
LYRA2z(hash, 32, hashB, 32, hashB, 32, 8, 8, 8);
|
||||
|
||||
memcpy(output, hash, 32);
|
||||
}
|
||||
|
16
stratum/algos/lyra2z.h
Normal file
16
stratum/algos/lyra2z.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef LYRA2Z_H
|
||||
#define LYRA2Z_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void lyra2z_hash(const char* input, char* output, uint32_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -8,7 +8,8 @@ CXXFLAGS = -O2 -I.. -march=native
|
|||
CFLAGS= $(CXXFLAGS) -std=gnu99
|
||||
LDFLAGS=-O2 -lgmp
|
||||
|
||||
SOURCES=lyra2re.c lyra2v2.c Lyra2.c Sponge.c blake.c scrypt.c c11.c x11.c x13.c sha256.c keccak.c \
|
||||
SOURCES=lyra2re.c lyra2v2.c Lyra2.c lyra2z.c Lyra2z.c Sponge.c \
|
||||
blake.c scrypt.c c11.c x11.c x13.c sha256.c keccak.c \
|
||||
x14.c x15.c x17.c nist5.c fresh.c quark.c neoscrypt.c scryptn.c qubit.c skein.c groestl.c \
|
||||
xevan.c \
|
||||
skein2.c zr5.c bmw.c luffa.c pentablake.c whirlpool.c whirlpoolx.c blakecoin.c \
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "stratum.h"
|
||||
|
||||
uint64_t lyra2z_height = 0;
|
||||
|
||||
//#define MERKLE_DEBUGLOG
|
||||
//#define HASH_DEBUGLOG_
|
||||
//#define DONTSUBMIT
|
||||
|
@ -445,6 +447,10 @@ bool client_submit(YAAMP_CLIENT *client, json_value *json_params)
|
|||
else
|
||||
build_submit_values(&submitvalues, templ, client->extranonce1, extranonce2, ntime, nonce);
|
||||
|
||||
if (templ->height && !strcmp(g_current_algo->name,"lyra2z")) {
|
||||
lyra2z_height = templ->height;
|
||||
}
|
||||
|
||||
// minimum hash diff begins with 0000, for all...
|
||||
uint8_t pfx = submitvalues.hash_bin[30] | submitvalues.hash_bin[31];
|
||||
if(pfx) {
|
||||
|
|
|
@ -105,6 +105,33 @@ void coinbase_create(YAAMP_COIND *coind, YAAMP_JOB_TEMPLATE *templ, json_value *
|
|||
if (strlen(coind->charity_address) == 0)
|
||||
sprintf(coind->charity_address, "BCDrF1hWdKTmrjXXVFTezPjKBmGigmaXg5");
|
||||
}
|
||||
else if(strcmp(coind->symbol, "XZC") == 0) {
|
||||
char script_payee[1024];
|
||||
if (coind->charity_percent <= 0)
|
||||
coind->charity_percent = 25; // wrong coinbase 40 instead of 40 + 10 = 50
|
||||
|
||||
json_int_t charity_amount = (available * coind->charity_percent) / 100;
|
||||
|
||||
if (strlen(coind->charity_address) == 0)
|
||||
sprintf(coind->charity_address, "aHu897ivzmeFuLNB6956X6gyGeVNHUBRgD");
|
||||
|
||||
strcat(templ->coinb2, "02");
|
||||
job_pack_tx(coind, templ->coinb2, available, NULL);
|
||||
base58_decode("aCAgTPgtYcA4EysU4UKC86EQd5cTtHtCcr", script_payee);
|
||||
job_pack_tx(coind, templ->coinb2, charity_amount/5, script_payee);
|
||||
base58_decode(coind->charity_address, script_payee); // may change
|
||||
job_pack_tx(coind, templ->coinb2, charity_amount/5, script_payee);
|
||||
base58_decode("aQ18FBVFtnueucZKeVg4srhmzbpAeb1KoN", script_payee);
|
||||
job_pack_tx(coind, templ->coinb2, charity_amount/5, script_payee);
|
||||
base58_decode("a1HwTdCmQV3NspP2QqCGpehoFpi8NY4Zg3", script_payee);
|
||||
job_pack_tx(coind, templ->coinb2, charity_amount/5, script_payee);
|
||||
base58_decode("a1kCCGddf5pMXSipLVD9hBG2MGGVNaJ15U", script_payee);
|
||||
job_pack_tx(coind, templ->coinb2, charity_amount/5, script_payee);
|
||||
strcat(templ->coinb2, "00000000"); // locktime
|
||||
|
||||
coind->reward = (double)available/100000000*coind->reward_mul;
|
||||
return;
|
||||
}
|
||||
else if(strcmp("DCR", coind->rpcencoding) == 0) {
|
||||
coind->reward_mul = 6; // coinbase value is wrong, reward_mul should be 6
|
||||
coind->charity_percent = 0;
|
||||
|
|
16
stratum/config.sample/lyra2z.conf
Normal file
16
stratum/config.sample/lyra2z.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
[TCP]
|
||||
server = yaamp.com
|
||||
port = 4553
|
||||
password = tu8tu5
|
||||
|
||||
[SQL]
|
||||
host = yaampdb
|
||||
database = yaamp
|
||||
username = root
|
||||
password = patofpaq
|
||||
|
||||
[STRATUM]
|
||||
algo = lyra2
|
||||
difficulty = 1
|
||||
max_ttf = 40000
|
||||
|
|
@ -106,6 +106,7 @@ YAAMP_ALGO g_algos[] =
|
|||
|
||||
{"lyra2", lyra2re_hash, 0x80, 0, 0},
|
||||
{"lyra2v2", lyra2v2_hash, 0x100, 0, 0},
|
||||
{"lyra2z", lyra2z_hash, 0x100, 0, 0},
|
||||
|
||||
{"blake", blake_hash, 1, 0 },
|
||||
{"blakecoin", blakecoin_hash, 1 /*0x100*/, 0, sha256_hash_hex },
|
||||
|
|
|
@ -142,6 +142,7 @@ void sha256_double_hash_hex(const char *input, char *output, unsigned int len);
|
|||
#include "algos/neoscrypt.h"
|
||||
#include "algos/lyra2re.h"
|
||||
#include "algos/lyra2v2.h"
|
||||
#include "algos/lyra2z.h"
|
||||
#include "algos/blake.h"
|
||||
#include "algos/blakecoin.h"
|
||||
#include "algos/blake2.h"
|
||||
|
|
|
@ -131,19 +131,19 @@ function BackendCoinsUpdate()
|
|||
if($coin->symbol == 'TAC' && isset($template['_V2']))
|
||||
$coin->charity_amount = $template['_V2']/100000000;
|
||||
|
||||
if(isset($template['payee_amount']) && $coin->symbol != 'LIMX')
|
||||
{
|
||||
if(isset($template['payee_amount']) && $coin->symbol != 'LIMX') {
|
||||
$coin->charity_amount = $template['payee_amount']/100000000;
|
||||
$coin->reward -= $coin->charity_amount;
|
||||
|
||||
// debuglog("$coin->symbol $coin->charity_amount $coin->reward");
|
||||
}
|
||||
|
||||
else if(!empty($coin->charity_address))
|
||||
{
|
||||
if($coin->charity_amount)
|
||||
; //$coin->reward -= $coin->charity_amount;
|
||||
else
|
||||
else if($coin->symbol == 'XZC') {
|
||||
// coinbasevalue here is the amount available for miners, not the full block amount
|
||||
$coin->reward = arraySafeVal($template,'coinbasevalue')/100000000 * $coin->reward_mul;
|
||||
$coin->charity_amount = $coin->reward * $coin->charity_percent / 100;
|
||||
}
|
||||
|
||||
else if(!empty($coin->charity_address)) {
|
||||
if(!$coin->charity_amount)
|
||||
$coin->reward -= $coin->reward * $coin->charity_percent / 100;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ function yaamp_get_algos()
|
|||
'luffa',
|
||||
'lyra2',
|
||||
'lyra2v2',
|
||||
'lyra2z',
|
||||
'neoscrypt',
|
||||
'nist5',
|
||||
'penta',
|
||||
|
@ -132,6 +133,7 @@ function getAlgoColors($algo)
|
|||
'qubit' => '#d0a0f0',
|
||||
'lyra2' => '#80a0f0',
|
||||
'lyra2v2' => '#80c0f0',
|
||||
'lyra2z' => '#80b0f0',
|
||||
'sib' => '#a0a0c0',
|
||||
'skein' => '#80a0a0',
|
||||
'skein2' => '#c8a060',
|
||||
|
@ -173,6 +175,7 @@ function getAlgoPort($algo)
|
|||
'scryptn' => 4333,
|
||||
'lyra2' => 4433,
|
||||
'lyra2v2' => 4533,
|
||||
'lyra2z' => 4553,
|
||||
'jha' => 4633,
|
||||
'qubit' => 4733,
|
||||
'zr5' => 4833,
|
||||
|
|
|
@ -58,6 +58,10 @@ class ExplorerController extends CommonController
|
|||
$id = getiparam('id');
|
||||
$coin = getdbo('db_coins', $id);
|
||||
|
||||
// todo: coin explorer option
|
||||
if ($coin && $coin->symbol == 'XZC' && !$this->admin)
|
||||
return;
|
||||
|
||||
$height = getiparam('height');
|
||||
if($coin && intval($height)>0)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue